- headless server now supports lan option

This commit is contained in:
Mark Vejvoda 2012-11-09 21:50:01 +00:00
parent 8793b3400b
commit e3a7aedd5c
5 changed files with 31 additions and 6 deletions

View File

@ -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);
}
}
}
}

View File

@ -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);

View File

@ -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]);

View File

@ -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

View File

@ -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::DebugType,SystemFlags::SystemFlagsType> *SystemFlags::debugLogFileList = NULL;
int SystemFlags::lockFile = -1;