- some bugfixes for headless mode:

- don't render anything
  - disable sounds in headless mode
(still need to add code to see if we can avoid loading models and graphics to make memory usage much smaller)
This commit is contained in:
Mark Vejvoda 2011-09-25 23:57:42 +00:00
parent 64d1e696b0
commit 9cd6355733
4 changed files with 14 additions and 5 deletions

View File

@ -37,6 +37,7 @@ const int Logger::logLineCount= 15;
// ===================== PUBLIC ========================
Logger::Logger() {
masterserverMode = false;
string logs_path = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey);
if(logs_path != "") {
fileName= logs_path + "log.txt";
@ -76,7 +77,7 @@ void Logger::add(const string str, bool renderScreen, const string statusText)
this->current= str;
this->statusText = statusText;
if(renderScreen == true) {
if(renderScreen == true && masterserverMode == false) {
renderLoadingScreen();
}
}

View File

@ -51,6 +51,8 @@ private:
bool cancelSelected;
GraphicButton buttonCancel;
bool masterserverMode;
private:
Logger();
~Logger();
@ -58,6 +60,8 @@ private:
public:
static Logger & getInstance();
void setMasterserverMode(bool value) { masterserverMode = value; }
void setFile(const string &fileName) {this->fileName= fileName;}
void setState(const string &state) {this->state= state;}
void setSubtitle(const string &subtitle) {this->subtitle= subtitle;}

View File

@ -1012,7 +1012,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
printf("\n%s\t\tAutomatically starts a game with the last game settings you played.",GAME_ARGS[GAME_ARG_AUTOSTART_LASTGAME]);
printf("\n%s=x\t\t\tAuto connects to a network server at IP or hostname x",GAME_ARGS[GAME_ARG_CLIENT]);
printf("\n%s\t\t\tAuto creates a network server.",GAME_ARGS[GAME_ARG_SERVER]);
printf("\n%s\t\t\tRuns as a masterserver.",GAME_ARGS[GAME_ARG_MASTERSERVER_MODE]);
printf("\n%s\t\t\tRun as a headless server.",GAME_ARGS[GAME_ARG_MASTERSERVER_MODE]);
printf("\n%s=x\t\tAuto loads the specified scenario by scenario name.",GAME_ARGS[GAME_ARG_LOADSCENARIO]);
printf("\n%s=x\t\tAuto Preview the specified map by map name.",GAME_ARGS[GAME_ARG_PREVIEW_MAP]);
printf("\n%s\t\t\tdisplays the version string of this program.",GAME_ARGS[GAME_ARG_VERSION]);
@ -2529,8 +2529,12 @@ int glestMain(int argc, char** argv) {
}
createDirectoryPaths(tempDataPath);
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_DISABLE_SOUND]) == true) {
if( hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_DISABLE_SOUND]) == true ||
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
config.setString("FactorySound","None");
if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
Logger::getInstance().setMasterserverMode(true);
}
}
bool enableATIHacks = config.getBool("EnableATIHacks","false");

View File

@ -1389,8 +1389,8 @@ void MenuStateCustomGame::mouseMove(int x, int y, const MouseState *ms){
}
bool MenuStateCustomGame::isMasterserverMode() const {
//return (this->masterserverMode == true && this->masterserverModeMinimalResources == true);
return false;
return (this->masterserverMode == true && this->masterserverModeMinimalResources == true);
//return false;
}
void MenuStateCustomGame::render() {