eliminated a whole bunch of gcc warnings

This commit is contained in:
Bill Meltsner
2010-02-09 13:21:25 -05:00
parent 3ebcee1e17
commit 73aba4bdd4
11 changed files with 242 additions and 230 deletions
+71 -67
View File
@@ -41,31 +41,33 @@ namespace sdl
if(!Event::getConstant(str, msg.type))
return false;
switch(msg.type)
{
case Event::TYPE_KEY_PRESSED:
if(!Event::getConstant(luaL_checkstring(L, 2), msg.keyboard.k))
return false;
msg.keyboard.u = (unsigned short)luaL_optint(L, 3, 0);
return true;
case Event::TYPE_KEY_RELEASED:
if(!Event::getConstant(luaL_checkstring(L, 2), msg.keyboard.k))
return false;
return true;
case Event::TYPE_MOUSE_PRESSED:
case Event::TYPE_MOUSE_RELEASED:
if(!Event::getConstant(luaL_checkstring(L, 2), msg.mouse.b))
return false;
msg.mouse.x = luaL_checkint(L, 3);
msg.mouse.y = luaL_checkint(L, 4);
return true;
case Event::TYPE_JOYSTICK_PRESSED:
case Event::TYPE_JOYSTICK_RELEASED:
msg.joystick.index = luaL_checkint(L, 2);
msg.joystick.button = luaL_checkint(L, 3);
return true;
case Event::TYPE_QUIT:
return true;
switch(msg.type)
{
case Event::TYPE_KEY_PRESSED:
if(!Event::getConstant(luaL_checkstring(L, 2), msg.keyboard.k))
return false;
msg.keyboard.u = (unsigned short)luaL_optint(L, 3, 0);
return true;
case Event::TYPE_KEY_RELEASED:
if(!Event::getConstant(luaL_checkstring(L, 2), msg.keyboard.k))
return false;
return true;
case Event::TYPE_MOUSE_PRESSED:
case Event::TYPE_MOUSE_RELEASED:
if(!Event::getConstant(luaL_checkstring(L, 2), msg.mouse.b))
return false;
msg.mouse.x = luaL_checkint(L, 3);
msg.mouse.y = luaL_checkint(L, 4);
return true;
case Event::TYPE_JOYSTICK_PRESSED:
case Event::TYPE_JOYSTICK_RELEASED:
msg.joystick.index = luaL_checkint(L, 2);
msg.joystick.button = luaL_checkint(L, 3);
return true;
case Event::TYPE_QUIT:
return true;
default:
return false;
}
return false;
@@ -80,52 +82,54 @@ namespace sdl
lua_pushstring(L, str);
switch(msg.type)
{
case Event::TYPE_KEY_PRESSED:
if(!Event::getConstant(msg.keyboard.k, str))
return 0;
lua_pushstring(L, str);
lua_pushinteger(L, msg.keyboard.u);
return 3;
case Event::TYPE_KEY_RELEASED:
if(!Event::getConstant(msg.keyboard.k, str))
return 0;
lua_pushstring(L, str);
return 2;
case Event::TYPE_MOUSE_PRESSED:
case Event::TYPE_MOUSE_RELEASED:
if(!Event::getConstant(msg.mouse.b, str))
return 0;
lua_pushinteger(L, msg.mouse.x);
lua_pushinteger(L, msg.mouse.y);
lua_pushstring(L, str);
return 4;
case Event::TYPE_JOYSTICK_PRESSED:
case Event::TYPE_JOYSTICK_RELEASED:
lua_pushinteger(L, msg.joystick.index);
lua_pushinteger(L, msg.joystick.button);
return 3;
case Event::TYPE_QUIT:
return 1;
switch(msg.type)
{
case Event::TYPE_KEY_PRESSED:
if(!Event::getConstant(msg.keyboard.k, str))
return 0;
lua_pushstring(L, str);
lua_pushinteger(L, msg.keyboard.u);
return 3;
case Event::TYPE_KEY_RELEASED:
if(!Event::getConstant(msg.keyboard.k, str))
return 0;
lua_pushstring(L, str);
return 2;
case Event::TYPE_MOUSE_PRESSED:
case Event::TYPE_MOUSE_RELEASED:
if(!Event::getConstant(msg.mouse.b, str))
return 0;
lua_pushinteger(L, msg.mouse.x);
lua_pushinteger(L, msg.mouse.y);
lua_pushstring(L, str);
return 4;
case Event::TYPE_JOYSTICK_PRESSED:
case Event::TYPE_JOYSTICK_RELEASED:
lua_pushinteger(L, msg.joystick.index);
lua_pushinteger(L, msg.joystick.button);
return 3;
case Event::TYPE_QUIT:
return 1;
default:
return 0;
}
return 0;
}
static int poll_i(lua_State * L)
{
static Event::Message m;
while(instance->poll(m))
{
static int poll_i(lua_State * L)
{
static Event::Message m;
while(instance->poll(m))
{
int args = push_message(L, m);
if(args > 0)
return args;
}
// No pending events.
return 0;
return 0;
}
int w_pump(lua_State * L)
@@ -190,13 +194,13 @@ namespace sdl
}
}
WrappedModule w;
w.module = instance;
w.name = "event";
w.flags = MODULE_T;
w.functions = functions;
w.types = 0;
WrappedModule w;
w.module = instance;
w.name = "event";
w.flags = MODULE_T;
w.functions = functions;
w.types = 0;
return luax_register_module(L, w);
}