From d06c13fb365a08055fd603a28facdf7a047017a0 Mon Sep 17 00:00:00 2001 From: cosmosninja Date: Sat, 29 Sep 2007 19:08:35 +0000 Subject: [PATCH] Fixed bug #1799454 (help menu bug), and a minor coding style improvements related to it. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1269 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/gui/help_menu.cpp | 2 +- src/gui/help_menu.hpp | 2 +- src/gui/race_gui.cpp | 2 +- src/player.hpp | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/help_menu.cpp b/src/gui/help_menu.cpp index 8b86168e6..def39b6d0 100644 --- a/src/gui/help_menu.cpp +++ b/src/gui/help_menu.cpp @@ -190,7 +190,7 @@ get stuck or fall too far, use the rescue button to get back on track."), const int LABEL_ID = widgetSet->varray(HS3); widgetSet -> filler(HS3); - for(int i = KC_LEFT; i <= KC_LAST; i++) + for(int i = KC_FIRST; i <= KC_LAST; i++) { // *sigh* widget set stores only pointer to strings, so // to make sure that all key-strings are permanent, they diff --git a/src/gui/help_menu.hpp b/src/gui/help_menu.hpp index a3e784cd6..3d2e482e3 100644 --- a/src/gui/help_menu.hpp +++ b/src/gui/help_menu.hpp @@ -30,7 +30,7 @@ class ssgContext; class HelpMenu: public BaseGUI { private: - std::string m_all_keys[KC_FIRE+1]; + std::string m_all_keys[KC_LAST+1]; ssgContext* m_context; ssgTransform* m_box; diff --git a/src/gui/race_gui.cpp b/src/gui/race_gui.cpp index fd8fab296..8032e7c34 100644 --- a/src/gui/race_gui.cpp +++ b/src/gui/race_gui.cpp @@ -103,7 +103,7 @@ void RaceGUI::UpdateKeyboardMappings() { PlayerKart* kart = world->getPlayerKart(i); - for(int ka=(int) KC_LEFT;ka< (int) KC_LAST+1;ka++) + for(int ka=(int)KC_FIRST; ka < (int)KC_LAST+1; ka++) putEntry(kart, (KartActions) ka); } diff --git a/src/player.hpp b/src/player.hpp index 93bb02f10..dd52ec62f 100644 --- a/src/player.hpp +++ b/src/player.hpp @@ -36,9 +36,8 @@ typedef struct } Input; -// Some part (e.g. gui/PlayerControls) depend on KC_LEFT being the first -// entry, and KC_FIRE being the last - so any action added should be -// added in between those two values. +//When adding any action at the beginning or at the end, remember to update +//the KC_FIRST and/or KC_LAST constants. enum KartActions { KC_LEFT, KC_RIGHT, KC_ACCEL, @@ -48,7 +47,8 @@ enum KartActions { KC_LEFT, KC_RESCUE, KC_FIRE, KC_LOOK_BACK }; -#define KC_LAST (KC_LOOK_BACK) +const int KC_FIRST = KC_LEFT; +const int KC_LAST = KC_LOOK_BACK; extern const char *sKartAction2String[KC_LAST+1]; /*class for managing player name and control configuration*/