From 63815d3b52a5111c4121f6c161fdabfe44f5fd00 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 26 Aug 2013 02:47:06 -0300 Subject: [PATCH] Changed Cursor:getType to only return one value --- src/modules/mouse/wrap_Cursor.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/modules/mouse/wrap_Cursor.cpp b/src/modules/mouse/wrap_Cursor.cpp index 520a32e0b..45fb4bdcf 100644 --- a/src/modules/mouse/wrap_Cursor.cpp +++ b/src/modules/mouse/wrap_Cursor.cpp @@ -32,22 +32,20 @@ int w_getType(lua_State *L) mouse::Cursor *cursor = luax_checktype(L, 1, "Cursor", MOUSE_CURSOR_T); Cursor::CursorType ctype = cursor->getType(); - const char *ctypestr; + const char *typestr = 0; - if (!mouse::Cursor::getConstant(ctype, ctypestr)) - return luaL_error(L, "Unknown cursor type."); - - lua_pushstring(L, ctypestr); - - Cursor::SystemCursor systype = cursor->getSystemType(); - const char *systypestr; - - if (mouse::Cursor::getConstant(systype, systypestr)) + if (ctype == Cursor::CURSORTYPE_IMAGE) + mouse::Cursor::getConstant(ctype, typestr); + else if (ctype == Cursor::CURSORTYPE_SYSTEM) { - lua_pushstring(L, systypestr); - return 2; + Cursor::SystemCursor systype = cursor->getSystemType(); + mouse::Cursor::getConstant(systype, typestr); } + if (!typestr) + return luaL_error(L, "Unknown cursor type."); + + lua_pushstring(L, typestr); return 1; };