1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Client: add command line options to simplify multi-instance testing

Use these when you need to run multiple instances of VCMI simultaneously.
--testingport is port used to start server. Override port number from configuration files.
--testingfileprefix is prefix for auto save filenames.
Both options has to be set in order to work.
This commit is contained in:
ArseniyShestakov
2015-12-13 22:14:37 +03:00
parent 8ebdbd048b
commit 1ec7d14637
3 changed files with 62 additions and 25 deletions

View File

@@ -157,24 +157,30 @@ void CPlayerInterface::yourTurn()
GH.curInt = this;
adventureInt->selection = nullptr;
std::string prefix = "";
if(settings["testing"]["enabled"].Bool())
{
prefix = settings["testing"]["prefix"].String();
}
if(firstCall)
{
if(howManyPeople == 1)
adventureInt->setPlayer(playerID);
autosaveCount = getLastIndex("Autosave_");
autosaveCount = getLastIndex(prefix + "Autosave_");
if(firstCall > 0) //new game, not loaded
{
int index = getLastIndex("Newgame_Autosave_");
int index = getLastIndex(prefix + "Newgame_");
index %= SAVES_COUNT;
cb->save("Saves/Newgame_Autosave_" + boost::lexical_cast<std::string>(index + 1));
cb->save("Saves/" + prefix + "Newgame_Autosave_" + boost::lexical_cast<std::string>(index + 1));
}
firstCall = 0;
}
else
{
LOCPLINT->cb->save("Saves/Autosave_" + boost::lexical_cast<std::string>(autosaveCount++ + 1));
LOCPLINT->cb->save("Saves/" + prefix + "Autosave_" + boost::lexical_cast<std::string>(autosaveCount++ + 1));
autosaveCount %= 5;
}