From e6b473b7522c331cb8d2c62e8a2d05e0840800db Mon Sep 17 00:00:00 2001 From: Michal Zima Date: Mon, 7 Jun 2010 20:35:00 +0200 Subject: [PATCH] [BUGFIX] Player uses other gun than he expects --- src/client/control.c | 3 --- src/screen/world.c | 12 ++++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/client/control.c b/src/client/control.c index 8075692..bfc2428 100644 --- a/src/client/control.c +++ b/src/client/control.c @@ -60,12 +60,9 @@ int control_get_key_route(control_t *my_control) int control_get_key_action(control_t *my_control) { Uint8 *map; - SDLKey ret_key; assert(my_control != NULL); - ret_key = CONTROL_NONE; - map = SDL_GetKeyState(NULL); if (map[my_control->key[CONTROL_SHOT]] == SDL_PRESSED) { diff --git a/src/screen/world.c b/src/screen/world.c index b1043a1..3d3214b 100644 --- a/src/screen/world.c +++ b/src/screen/world.c @@ -243,12 +243,16 @@ static void control_keyboard(tux_t *tux, control_t *control) switch (control_get_key_action(control)) { case CONTROL_SHOT: - netAction(tux, TUX_SHOT); - tux_action(tux, TUX_SHOT); + if (tux->isCanShot == TRUE) { + netAction(tux, TUX_SHOT); + tux_action(tux, TUX_SHOT); + } break; case CONTROL_SWITCH: - netAction(tux, TUX_SWITCH_GUN); - tux_action(tux, TUX_SWITCH_GUN); + if (tux->isCanSwitchGun == TRUE) { + netAction(tux, TUX_SWITCH_GUN); + tux_action(tux, TUX_SWITCH_GUN); + } break; } } -- 2.11.4.GIT