diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 03c804be9..cc2425939 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -2872,6 +2872,10 @@ int glestMain(int argc, char** argv) { printf("Disabled reading from console [%s]\n",headless_command.c_str()); disableheadless_console = true; } + else if(headless_command == "lan") { + printf("Forcing local LAN mode [%s]\n",headless_command.c_str()); + GlobalStaticFlags::setFlag(gsft_lan_mode); + } } } } diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index b18b8a318..93cba544a 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -391,13 +391,13 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, // } checkBoxPublishServer.registerGraphicComponent(containerName,"checkBoxPublishServer"); checkBoxPublishServer.init(50, networkPos); - if(this->headlessServerMode == true || - (openNetworkSlots == true && parentMenuState != pLanGame)) { + + checkBoxPublishServer.setValue(false); + if((this->headlessServerMode == true || + (openNetworkSlots == true && parentMenuState != pLanGame)) && + GlobalStaticFlags::isFlagSet(gsft_lan_mode) == false) { checkBoxPublishServer.setValue(true); } - else { - checkBoxPublishServer.setValue(false); - } labelGameNameLabel.registerGraphicComponent(containerName,"labelGameNameLabel"); labelGameNameLabel.init(50, networkHeadPos-2*labelOffset-3,100); @@ -2542,7 +2542,8 @@ void MenuStateCustomGame::update() { if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start(); if(this->headlessServerMode == true || hasOneNetworkSlotOpen == true) { - if(this->headlessServerMode == true) { + if(this->headlessServerMode == true && + GlobalStaticFlags::isFlagSet(gsft_lan_mode) == false) { checkBoxPublishServer.setValue(true); } listBoxFallbackCpuMultiplier.setEditable(true); diff --git a/source/shared_lib/include/platform/sdl/platform_main.h b/source/shared_lib/include/platform/sdl/platform_main.h index bb96df3c8..78c094045 100644 --- a/source/shared_lib/include/platform/sdl/platform_main.h +++ b/source/shared_lib/include/platform/sdl/platform_main.h @@ -214,6 +214,8 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) { printf("\n \t has no more connected players."); printf("\n \t\tvps - which does NOT read commands from the"); printf("\n \t local console (for some vps's)."); + printf("\n \t\tlan - which does not broadcast the hosting server"); + printf("\n \t to the masterserver (for local LAN games)."); printf("\n%s\tCheck the current status of a headless server.",GAME_ARGS[GAME_ARG_MASTERSERVER_STATUS]); diff --git a/source/shared_lib/include/util/util.h b/source/shared_lib/include/util/util.h index 192fa1355..0c8c78a41 100644 --- a/source/shared_lib/include/util/util.h +++ b/source/shared_lib/include/util/util.h @@ -28,6 +28,15 @@ using namespace Shared::Platform; namespace Shared { namespace Util { +enum GlobalStaticFlagTypes { + gsft_none = 0x00, + gsft_lan_mode = 0x01, + //gsft_xx = 0x02 + //gsft__xx = 0x04, + //gsft__xx = 0x08, + //gsft__xx = 0x10, +}; + class GlobalStaticFlags { public: static bool getIsNonGraphicalModeEnabled() { @@ -38,8 +47,15 @@ public: isNonGraphicalMode = value; } + static void setFlags(uint64 flagsValue) { flags = flagsValue; } + static uint64 getFlags() { return flags; } + + static void setFlag(GlobalStaticFlagTypes flag) { flags |= flag; } + static bool isFlagSet(GlobalStaticFlagTypes flag) { return (flags & flag) == flag; } + protected: static bool isNonGraphicalMode; + static uint64 flags; }; class SystemFlags diff --git a/source/shared_lib/sources/util/util.cpp b/source/shared_lib/sources/util/util.cpp index ca06b0dc3..b476a46e8 100644 --- a/source/shared_lib/sources/util/util.cpp +++ b/source/shared_lib/sources/util/util.cpp @@ -46,6 +46,8 @@ using namespace Shared::Util; namespace Shared{ namespace Util{ bool GlobalStaticFlags::isNonGraphicalMode = false; +uint64 GlobalStaticFlags::flags = gsft_none; + // Init statics std::map *SystemFlags::debugLogFileList = NULL; int SystemFlags::lockFile = -1;