diff --git a/projects/mtg/include/OptionItem.h b/projects/mtg/include/OptionItem.h index ab822bc00..a90fcf199 100644 --- a/projects/mtg/include/OptionItem.h +++ b/projects/mtg/include/OptionItem.h @@ -239,6 +239,15 @@ class WDecoEnum : public WGuiDeco { EnumDefinition * edef; }; +class WDecoCheat: public WGuiDeco { + public: + WDecoCheat(WGuiBase * _it); + virtual bool Visible(); + virtual void Reload(); +protected: + bool bVisible; +}; + class WGuiButton: public WGuiDeco{ public: WGuiButton( WGuiBase* _it, int _controller, int _control, JGuiListener * jgl); diff --git a/projects/mtg/src/GameStateMenu.cpp b/projects/mtg/src/GameStateMenu.cpp index 4e9b0178b..296cbed64 100644 --- a/projects/mtg/src/GameStateMenu.cpp +++ b/projects/mtg/src/GameStateMenu.cpp @@ -152,9 +152,9 @@ void GameStateMenu::Start(){ //How many cards total ? PlayerData * playerdata = NEW PlayerData(mParent->collection); if(playerdata && !options[Options::ACTIVE_PROFILE].isDefault()) - sprintf(nbcardsStr, "%s: %i cards (%i)", options[Options::ACTIVE_PROFILE].str.c_str(), playerdata->collection->totalCards(), mParent->collection->totalCards()); + sprintf(nbcardsStr, _("%s: %i cards (%i)").c_str(), options[Options::ACTIVE_PROFILE].str.c_str(), playerdata->collection->totalCards(), mParent->collection->totalCards()); else - sprintf(nbcardsStr, "Database: %i cards", mParent->collection->totalCards()); + sprintf(nbcardsStr, _("Database: %i cards").c_str(), mParent->collection->totalCards()); SAFE_DELETE(playerdata); @@ -312,9 +312,9 @@ void GameStateMenu::Update(float dt) //List active profile and database size. PlayerData * playerdata = NEW PlayerData(mParent->collection); if(playerdata && !options[Options::ACTIVE_PROFILE].isDefault()) - sprintf(nbcardsStr, "%s: %i cards (%i)", options[Options::ACTIVE_PROFILE].str.c_str(), playerdata->collection->totalCards(), mParent->collection->totalCards()); + sprintf(nbcardsStr, _("%s: %i cards (%i)").c_str(), options[Options::ACTIVE_PROFILE].str.c_str(), playerdata->collection->totalCards(), mParent->collection->totalCards()); else - sprintf(nbcardsStr, "Database: %i cards", mParent->collection->totalCards()); + sprintf(nbcardsStr, _("Database: %i cards").c_str(), mParent->collection->totalCards()); SAFE_DELETE(playerdata); resetDirectory(); //All major things have been loaded, resize the cache to use it as efficiently as possible diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index ab1aec470..d94f7d4c9 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -36,8 +36,8 @@ void GameStateOptions::Start() optionsList->Add(NEW OptionInteger(Options::OSD, "Display InGame extra information")); if (options[Options::DIFFICULTY_MODE_UNLOCKED].number) optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::DIFFICULTY,"Difficulty",3,1,0),OptionDifficulty::getInstance())); - if(options[Options::ACTIVE_PROFILE].str == SECRET_PROFILE) - optionsList->Add(NEW OptionInteger(Options::CHEATMODE, "Enable cheat mode")); + + optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable cheat mode"))); optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDS, "Seconds to pause for an Interrupt", 20, 1)); optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYSPELLS, "Interrupt my spells")); optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYABILITIES, "Interrupt my abilities")); diff --git a/projects/mtg/src/OptionItem.cpp b/projects/mtg/src/OptionItem.cpp index a2c61757c..07b78ea5c 100644 --- a/projects/mtg/src/OptionItem.cpp +++ b/projects/mtg/src/OptionItem.cpp @@ -774,7 +774,18 @@ void WDecoEnum::Render() } WDecoEnum::WDecoEnum(WGuiBase * _it, EnumDefinition *_edef) : WGuiDeco(_it) {edef = _edef;} - +//WDecoCheat +WDecoCheat::WDecoCheat(WGuiBase * _it): WGuiDeco(_it){ + bVisible = (options[Options::ACTIVE_PROFILE].str == SECRET_PROFILE); +} +void WDecoCheat::Reload(){ + bVisible = (options[Options::ACTIVE_PROFILE].str == SECRET_PROFILE); +} +bool WDecoCheat::Visible(){ + if(bVisible && it && it->Visible()) + return true; + return false; +} //WDecoConfirm WDecoConfirm::WDecoConfirm(JGuiListener * _listener, WGuiBase * _it): WGuiDeco(_it){