mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +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:
@@ -248,7 +248,8 @@ int main(int argc, char** argv)
|
|||||||
("loadserverip",po::value<std::string>(),"IP for loaded game server")
|
("loadserverip",po::value<std::string>(),"IP for loaded game server")
|
||||||
("loadserverport",po::value<std::string>(),"port 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")
|
("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)
|
if(argc > 1)
|
||||||
{
|
{
|
||||||
@@ -313,6 +314,7 @@ int main(int argc, char** argv)
|
|||||||
testingSettings["enabled"].Bool() = true;
|
testingSettings["enabled"].Bool() = true;
|
||||||
testingSettings["port"].String() = vm["testingport"].as<std::string>();
|
testingSettings["port"].String() = vm["testingport"].as<std::string>();
|
||||||
testingSettings["prefix"].String() = vm["testingfileprefix"].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
|
// Initialize logging based on settings
|
||||||
|
@@ -178,7 +178,7 @@ void CPlayerInterface::yourTurn()
|
|||||||
}
|
}
|
||||||
firstCall = 0;
|
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));
|
LOCPLINT->cb->save("Saves/" + prefix + "Autosave_" + boost::lexical_cast<std::string>(autosaveCount++ + 1));
|
||||||
autosaveCount %= 5;
|
autosaveCount %= 5;
|
||||||
|
Reference in New Issue
Block a user