diff --git a/data/glest_game b/data/glest_game index f22554bcf..0ebb6df94 160000 --- a/data/glest_game +++ b/data/glest_game @@ -1 +1 @@ -Subproject commit f22554bcfa828545a8996e8f08a49c9f96848283 +Subproject commit 0ebb6df9491841a83a872d2a95291e6ee6f17750 diff --git a/source/glest_game/facilities/game_util.cpp b/source/glest_game/facilities/game_util.cpp index 5e1e585f5..3d8f7dd55 100644 --- a/source/glest_game/facilities/game_util.cpp +++ b/source/glest_game/facilities/game_util.cpp @@ -214,7 +214,7 @@ string getAboutString1(int i) { case 0: return "MegaGlest " + glestVersionString + " (" + "Shared Library " + sharedLibVersionString + ")"; case 1: return GIT_Rev; case 2: return "Copyright 2001-2010 The Glest Team"; - case 3: return "Copyright 2010-2015 The MegaGlest Team"; + case 3: return "Copyright 2010-2016 The MegaGlest Team"; } return ""; } diff --git a/source/glest_game/global/config.cpp b/source/glest_game/global/config.cpp index ea36da140..71b741409 100644 --- a/source/glest_game/global/config.cpp +++ b/source/glest_game/global/config.cpp @@ -113,6 +113,7 @@ Config::Config() { fileNameParameter.first = ""; fileNameParameter.second = ""; custom_path_parameter = ""; + serverTitle = ""; } bool Config::tryCustomPath(std::pair &type, std::pair &file, string custom_path) { diff --git a/source/glest_game/global/config.h b/source/glest_game/global/config.h index 21dea25e3..db4a89de2 100644 --- a/source/glest_game/global/config.h +++ b/source/glest_game/global/config.h @@ -52,6 +52,7 @@ private: std::pair fileName; std::pair fileLoaded; string custom_path_parameter; + string serverTitle; static map configList; @@ -118,6 +119,9 @@ public: string toString(); + string getServerTitle() {return serverTitle;} + void setServerTitle(string name) {serverTitle=name;} + static string getCustomRuntimeProperty(string key) { return customRuntimeProperties[key]; } static void setCustomRuntimeProperty(string key, string value) { customRuntimeProperties[key] = value; } diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 2bc41c4d2..862a4fabc 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -4107,6 +4107,29 @@ int glestMain(int argc, char** argv) { } } + if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_SERVER_TITLE]) == true) { + int foundParamIndIndex = -1; + hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_SERVER_TITLE]) + string("="),&foundParamIndIndex); + if(foundParamIndIndex < 0) { + hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_SERVER_TITLE]),&foundParamIndIndex); + } + string paramValue = argv[foundParamIndIndex]; + vector paramPartTokens; + Tokenize(paramValue,paramPartTokens,"="); + if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) { + Config &config = Config::getInstance(); + string serverTitle = paramPartTokens[1]; + printf("Forcing serverTitle[%s]\n",serverTitle.c_str()); + + config.setServerTitle(serverTitle); + } + else { + printf("\nInvalid missing server title specified on commandline [%s] value [%s]\n\n",argv[foundParamIndIndex],(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL)); + + return 1; + } + } + PlatformExceptionHandler::application_binary= executable_path(argv[0],true); mg_app_name = GameConstants::application_name; mailStringSupport = mailString; diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 64eaadd5a..eb2e69350 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -461,12 +461,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, labelGameName.init(20+checkBoxPublishServer.getW()+5, networkPos,200); labelGameName.setFont(CoreData::getInstance().getMenuFontBig()); labelGameName.setFont3D(CoreData::getInstance().getMenuFontBig3D()); - if(this->headlessServerMode == false) { - labelGameName.setText(defaultPlayerName+"'s game"); - } - else { - labelGameName.setText("headless ("+defaultPlayerName+")"); - } + labelGameName.setText(createGameName()); labelGameName.setEditable(true); labelGameName.setMaxEditWidth(20); labelGameName.setMaxEditRenderWidth(200); @@ -735,6 +730,22 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, } } +string MenuStateCustomGame::createGameName(string controllingPlayer){ + Config &config = Config::getInstance(); + if(config.getServerTitle()!="" && controllingPlayer == ""){ + return config.getServerTitle(); + } + else if (this->headlessServerMode == true) { + if (controllingPlayer != "") { + return controllingPlayer + " controls"; + } else { + return "Headless (" + defaultPlayerName + ")"; + } + } else { + return defaultPlayerName+"'s game"; + } +} + void MenuStateCustomGame::reloadUI() { Lang &lang= Lang::getInstance(); Config &config = Config::getInstance(); @@ -809,12 +820,8 @@ void MenuStateCustomGame::reloadUI() { labelGameName.setFont(CoreData::getInstance().getMenuFontBig()); labelGameName.setFont3D(CoreData::getInstance().getMenuFontBig3D()); - if(this->headlessServerMode == false) { - labelGameName.setText(defaultPlayerName+"'s game"); - } - else { - labelGameName.setText("headless ("+defaultPlayerName+")"); - } + + labelGameName.setText(createGameName()); labelNetworkPauseGameForLaggedClients.setText(lang.getString("NetworkPauseGameForLaggedClients")); @@ -3854,7 +3861,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force clientConnectedTime = serverInterface->getSlot(i,true)->getConnectedTime(); gameSettings->setMasterserver_admin(serverInterface->getSlot(i,true)->getSessionKey()); gameSettings->setMasterserver_admin_faction_index(serverInterface->getSlot(i,true)->getPlayerIndex()); - labelGameName.setText(serverInterface->getSlot(i,true)->getName()+" controls"); + labelGameName.setText(createGameName(serverInterface->getSlot(i,true)->getName())); //printf("slot = %d, admin key [%d] slot connected time[" MG_SIZE_T_SPECIFIER "] clientConnectedTime [" MG_SIZE_T_SPECIFIER "]\n",i,gameSettings->getMasterserver_admin(),serverInterface->getSlot(i)->getConnectedTime(),clientConnectedTime); } if(serverInterface->getSlot(i,true)->getSessionKey() == gameSettings->getMasterserver_admin()){ @@ -3878,7 +3885,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force clientConnectedTime = serverInterface->getSlot(i,true)->getConnectedTime(); gameSettings->setMasterserver_admin(serverInterface->getSlot(i,true)->getSessionKey()); gameSettings->setMasterserver_admin_faction_index(serverInterface->getSlot(i,true)->getPlayerIndex()); - labelGameName.setText(serverInterface->getSlot(i,true)->getName()+" controls"); + labelGameName.setText(createGameName(serverInterface->getSlot(i,true)->getName())); //printf("slot = %d, admin key [%d] slot connected time[" MG_SIZE_T_SPECIFIER "] clientConnectedTime [" MG_SIZE_T_SPECIFIER "]\n",i,gameSettings->getMasterserver_admin(),serverInterface->getSlot(i)->getConnectedTime(),clientConnectedTime); } if(serverInterface->getSlot(i,true)->getSessionKey() == gameSettings->getMasterserver_admin()){ @@ -3890,7 +3897,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force if(masterserver_admin_found == false) { - labelGameName.setText("Headless: "+defaultPlayerName); + labelGameName.setText(createGameName()); } } diff --git a/source/glest_game/menu/menu_state_custom_game.h b/source/glest_game/menu/menu_state_custom_game.h index c6cd6241c..bcc1ff2e2 100644 --- a/source/glest_game/menu/menu_state_custom_game.h +++ b/source/glest_game/menu/menu_state_custom_game.h @@ -292,6 +292,7 @@ private: ServerInterface *& serverInterface, int startIndex, int endIndex, bool onlyNetworkUnassigned); + string createGameName(string controllingPlayer=""); void reloadUI(); void loadScenarioInfo(string file, ScenarioInfo *scenarioInfo); void processScenario(); diff --git a/source/glest_map_editor/main.cpp b/source/glest_map_editor/main.cpp index 6264697df..a046ebc0e 100644 --- a/source/glest_map_editor/main.cpp +++ b/source/glest_map_editor/main.cpp @@ -1151,7 +1151,7 @@ void MainWindow::onMenuHideWater(wxCommandEvent &event) { void MainWindow::onMenuViewAbout(wxCommandEvent &event) { MsgDialog( this, - wxT("Glest Map Editor - Copyright 2004 The Glest Team\n(with improvements by others, 2010)."), + wxT("\n Glest Map Editor\n Copyright 2004-2010 The Glest Team\n Copyright 2010-2016 The MegaGlest Team \n"), wxT("About")).ShowModal(); } diff --git a/source/shared_lib/include/platform/sdl/platform_main.h b/source/shared_lib/include/platform/sdl/platform_main.h index edf1ba93b..a1fa4d125 100644 --- a/source/shared_lib/include/platform/sdl/platform_main.h +++ b/source/shared_lib/include/platform/sdl/platform_main.h @@ -33,6 +33,7 @@ const char *GAME_ARGS[] = { "--starthost", "--headless-server-mode", "--headless-server-status", + "--server-title", "--use-ports", "--load-scenario", @@ -113,6 +114,7 @@ enum GAME_ARG_TYPE { GAME_ARG_SERVER, GAME_ARG_MASTERSERVER_MODE, GAME_ARG_MASTERSERVER_STATUS, + GAME_ARG_SERVER_TITLE, GAME_ARG_USE_PORTS, GAME_ARG_LOADSCENARIO, @@ -235,7 +237,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) { printf("\n%s\tCheck the current status of a headless server.",GAME_ARGS[GAME_ARG_MASTERSERVER_STATUS]); - printf("\n%s=x,y,z\t\t\tForce hosted games to listen internally on port",GAME_ARGS[GAME_ARG_USE_PORTS]); + printf("\n%s=x,y,z\t\tForce hosted games to listen internally on port",GAME_ARGS[GAME_ARG_USE_PORTS]); printf("\n\t\t\t\tx, externally on port y and game status on port z."); printf("\n \t\tWhere x is the internal port # on the local"); printf("\n \t\t machine to listen for connects"); @@ -247,6 +249,8 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) { printf("\n \t\t*NOTE: If enabled the FTP Server port #'s will"); printf("\n \t\t be set to x+1 to x+9"); + printf("\n%s=x\t\tSet server title.",GAME_ARGS[GAME_ARG_SERVER_TITLE]); + printf("\n%s=x\t\tAuto load a scenario by scenario name.",GAME_ARGS[GAME_ARG_LOADSCENARIO]); printf("\n%s=x\t\t\tAuto load a mod by mod pathname.",GAME_ARGS[GAME_ARG_MOD]); diff --git a/source/tools/convert_faction_xml2html/convert_faction_xml2html.pl b/source/tools/convert_faction_xml2html/convert_faction_xml2html.pl index 70449b1b9..74ae9f94b 100755 --- a/source/tools/convert_faction_xml2html/convert_faction_xml2html.pl +++ b/source/tools/convert_faction_xml2html/convert_faction_xml2html.pl @@ -170,8 +170,9 @@ $me =~ s/^.+\///; our $footer=$cfg->val( 'style', 'footer'); our $map_legend = $cfg->val('style', 'map_legend'); -$footer =~ s/VAR_CREATED_BY/$me<\/A><\/I>, version: $version<\/I>, using config-file: $cfg_file<\/I>, on: $now_string<\/I> /; - +#$footer =~ s/VAR_CREATED_BY/$me<\/A><\/I>, version: $version<\/I>, using config-file: $cfg_file<\/I>, on: $now_string<\/I> /; +# ^ timestamp should be in the one common footer +$footer =~ s/VAR_CREATED_BY/$me<\/A><\/I>, version: $version<\/I>, using config-file: $cfg_file<\/I>/; our $level_hp = $cfg->val('all', 'level_hp'); our $level_ep = $cfg->val('all', 'level_ep');