From ebcadc13f01c7b163f9380929b216f1ba3c0842e Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Sat, 11 Dec 2010 00:20:31 +0000 Subject: [PATCH] Constants for easy/normal/ultra/mega default multipliers Multiplier example for scenarios Version number is only shown with build date and so on for dev versions --- source/glest_game/game/game_constants.h | 6 ++++++ source/glest_game/menu/menu_state_custom_game.cpp | 10 +++++----- source/glest_game/menu/menu_state_root.cpp | 14 ++++++++++---- source/glest_game/menu/menu_state_scenario.cpp | 8 ++++---- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/source/glest_game/game/game_constants.h b/source/glest_game/game/game_constants.h index 12f98ff9..aa6be93c 100644 --- a/source/glest_game/game/game_constants.h +++ b/source/glest_game/game/game_constants.h @@ -113,6 +113,12 @@ public: static const char *path_logs_CacheLookupKey; static const char *application_name; + + static const float normalMultiplier= 1.0f; + static const float easyMultiplier= 0.8f; + static const float ultraMultiplier= 3.0f; + static const float megaMultiplier= 4.0f; + }; enum PathType { diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 100a4886..b52fe4cb 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -927,26 +927,26 @@ void MenuStateCustomGame::updateAllResourceMultiplier() { void MenuStateCustomGame::updateResourceMultiplier(const int index) { ControlType ct= static_cast(listBoxControls[index].getSelectedItemIndex()); if(ct == ctHuman || ct == ctNetwork || ct == ctClosed) { - listBoxRMultiplier[index].setSelectedItemIndex(5); + listBoxRMultiplier[index].setSelectedItemIndex((GameConstants::normalMultiplier-0.5f)*10); listBoxRMultiplier[index].setEnabled(false); } else if(ct == ctCpuEasy || ct == ctNetworkCpuEasy) { - listBoxRMultiplier[index].setSelectedItemIndex(3); + listBoxRMultiplier[index].setSelectedItemIndex((GameConstants::easyMultiplier-0.5f)*10); listBoxRMultiplier[index].setEnabled(true); } else if(ct == ctCpu || ct == ctNetworkCpu) { - listBoxRMultiplier[index].setSelectedItemIndex(5); + listBoxRMultiplier[index].setSelectedItemIndex((GameConstants::normalMultiplier-0.5f)*10); listBoxRMultiplier[index].setEnabled(true); } else if(ct == ctCpuUltra || ct == ctNetworkCpuUltra) { - listBoxRMultiplier[index].setSelectedItemIndex(25); + listBoxRMultiplier[index].setSelectedItemIndex((GameConstants::ultraMultiplier-0.5f)*10); listBoxRMultiplier[index].setEnabled(true); } else if(ct == ctCpuMega || ct == ctNetworkCpuMega) { - listBoxRMultiplier[index].setSelectedItemIndex(35); + listBoxRMultiplier[index].setSelectedItemIndex((GameConstants::megaMultiplier-0.5f)*10); listBoxRMultiplier[index].setEnabled(true); } listBoxRMultiplier[index].setEditable(listBoxRMultiplier[index].getEnabled()); diff --git a/source/glest_game/menu/menu_state_root.cpp b/source/glest_game/menu/menu_state_root.cpp index c3903f91..28db799e 100644 --- a/source/glest_game/menu/menu_state_root.cpp +++ b/source/glest_game/menu/menu_state_root.cpp @@ -58,8 +58,6 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu): i-=40; buttonExit.registerGraphicComponent(containerName,"buttonExit"); buttonExit.init(425, i, 150); - labelVersion.registerGraphicComponent(containerName,"labelVersion"); - labelVersion.init(405, 420); buttonNewGame.setText(lang.get("NewGame")); buttonJoinGame.setText(lang.get("JoinGame")); @@ -67,8 +65,16 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu): buttonOptions.setText(lang.get("Options")); buttonAbout.setText(lang.get("About")); buttonExit.setText(lang.get("Exit")); - labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]"); - + + labelVersion.registerGraphicComponent(containerName,"labelVersion"); + if(EndsWith(glestVersionString, "-dev") == false){ + labelVersion.init(525, 420); + labelVersion.setText(glestVersionString); + } + else { + labelVersion.init(405, 420); + labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]"); + } //mesage box mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox"); mainMessageBox.init(lang.get("Yes"), lang.get("No")); diff --git a/source/glest_game/menu/menu_state_scenario.cpp b/source/glest_game/menu/menu_state_scenario.cpp index 94e67c85..5ad86546 100644 --- a/source/glest_game/menu/menu_state_scenario.cpp +++ b/source/glest_game/menu/menu_state_scenario.cpp @@ -215,18 +215,18 @@ void MenuStateScenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo } else {// if no multiplier exists use defaults - scenarioInfo->resourceMultipliers[i]=1.0f; + scenarioInfo->resourceMultipliers[i]=GameConstants::normalMultiplier; if(factionControl==ctCpuEasy) { - scenarioInfo->resourceMultipliers[i]=0.8f; + scenarioInfo->resourceMultipliers[i]=GameConstants::easyMultiplier; } if(factionControl==ctCpuUltra) { - scenarioInfo->resourceMultipliers[i]=2.0f; + scenarioInfo->resourceMultipliers[i]=GameConstants::ultraMultiplier; } else if(factionControl==ctCpuMega) { - scenarioInfo->resourceMultipliers[i]=3.5f; + scenarioInfo->resourceMultipliers[i]=GameConstants::megaMultiplier; } }