1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-24 03:47:18 +02:00

New command line option for testing: testingsavefrequency

Saving is slowest part of VCMI and for testing purposes like benchmarking it's helpful to create saves less often.
When --testingsavefrequency=N is specified client going to save only once in N days.

Option only active if other testing options are specified too.
This commit is contained in:
Arseniy Shestakov 2016-09-22 03:43:30 +03:00
parent dba58e5eb1
commit 9963b9e02b
2 changed files with 4 additions and 2 deletions

View File

@ -248,7 +248,8 @@ int main(int argc, char** argv)
("loadserverip",po::value<std::string>(),"IP for loaded game server")
("loadserverport",po::value<std::string>(),"port for loaded game server")
("testingport",po::value<std::string>(),"port for testing, override specified in config file")
("testingfileprefix",po::value<std::string>(),"prefix for auto save files");
("testingfileprefix",po::value<std::string>(),"prefix for auto save files")
("testingsavefrequency",po::value<int>(),"how often auto save should be created");
if(argc > 1)
{
@ -313,6 +314,7 @@ int main(int argc, char** argv)
testingSettings["enabled"].Bool() = true;
testingSettings["port"].String() = vm["testingport"].as<std::string>();
testingSettings["prefix"].String() = vm["testingfileprefix"].as<std::string>();
testingSettings["savefrequency"].Float() = vm.count("testingsavefrequency") ? vm["testingsavefrequency"].as<int>() : 1;
}
// Initialize logging based on settings

View File

@ -178,7 +178,7 @@ void CPlayerInterface::yourTurn()
}
firstCall = 0;
}
else
else if(settings["testing"].isNull() || cb->getDate() % static_cast<int>(settings["testing"]["savefrequency"].Float()) == 0)
{
LOCPLINT->cb->save("Saves/" + prefix + "Autosave_" + boost::lexical_cast<std::string>(autosaveCount++ + 1));
autosaveCount %= 5;