Commits

Alex Szpakowski  committed 6518572

Changed Cursor:getType to only return one value

  • Participants
  • Parent commits c7aa61a

Comments (0)

Files changed (1)

File src/modules/mouse/wrap_Cursor.cpp

 	mouse::Cursor *cursor = luax_checktype<mouse::Cursor>(L, 1, "Cursor", MOUSE_CURSOR_T);
 
 	Cursor::CursorType ctype = cursor->getType();
-	const char *ctypestr;
+	const char *typestr = 0;
 
-	if (!mouse::Cursor::getConstant(ctype, ctypestr))
+	if (ctype == Cursor::CURSORTYPE_IMAGE)
+		mouse::Cursor::getConstant(ctype, typestr);
+	else if (ctype == Cursor::CURSORTYPE_SYSTEM)
+	{
+		Cursor::SystemCursor systype = cursor->getSystemType();
+		mouse::Cursor::getConstant(systype, typestr);
+	}
+
+	if (!typestr)
 		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))
-	{
-		lua_pushstring(L, systypestr);
-		return 2;
-	}
-
+	lua_pushstring(L, typestr);
 	return 1;
 };