Put constans into extra namespace as kBackToMainMenuID...

collides with itself. GameStateAwards::kBackToMainMenuID and
GameStateOptions::kBackToMainMenuID define those with different
values.
This commit is contained in:
Tobias Loose
2013-11-23 16:18:45 +01:00
parent 1e8fc81aa3
commit 9f0b70d1c9
2 changed files with 13 additions and 14 deletions
+8 -9
View File
@@ -7,13 +7,12 @@
#include "SimplePad.h"
#include "Translate.h"
namespace
namespace GameStateOptionsConstants
{
const int kSaveAndBackToMainMenuID = 1;
const int kBackToMainMenuID = 2;
const int kNewProfileID = 4;
const int kReloadID = 5;
}
GameStateOptions::GameStateOptions(GameApp* parent) :
@@ -78,7 +77,7 @@ void GameStateOptions::Start()
optionsList->Add(NEW WGuiSplit(cPrf, cThm));
optionsList->Add(cStyle);
optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, kNewProfileID, this));
optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, GameStateOptionsConstants::kNewProfileID, this));
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable Cheat Mode")));
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::OPTIMIZE_HAND, "Optimize Starting Hand")));
@@ -118,8 +117,8 @@ void GameStateOptions::Start()
optionsTabs->Add(optionsList);
optionsMenu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), -102, this, Fonts::MAIN_FONT, 50, 170);
optionsMenu->Add(kBackToMainMenuID, "Back to Main Menu");
optionsMenu->Add(kSaveAndBackToMainMenuID, "Save And Exit");
optionsMenu->Add(GameStateOptionsConstants::kBackToMainMenuID, "Back to Main Menu");
optionsMenu->Add(GameStateOptionsConstants::kSaveAndBackToMainMenuID, "Save And Exit");
optionsMenu->Add(kCancelMenuID, "Cancel");
optionsTabs->Entering(JGE_BTN_NONE);
@@ -285,21 +284,21 @@ void GameStateOptions::ButtonPressed(int controllerId, int controlId)
if (controllerId == -102)
switch (controlId)
{
case kSaveAndBackToMainMenuID:
case GameStateOptionsConstants::kSaveAndBackToMainMenuID:
mState = SAVE;
break;
//Set Audio volume
case kBackToMainMenuID:
case GameStateOptionsConstants::kBackToMainMenuID:
mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU);
break;
case kCancelMenuID:
mState = SHOW_OPTIONS;
break;
case kNewProfileID:
case GameStateOptionsConstants::kNewProfileID:
options.keypadStart("", &newProfile);
options.keypadTitle("New Profile");
break;
case kReloadID:
case GameStateOptionsConstants::kReloadID:
mReload = true;
break;
}