mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
show random maps
This commit is contained in:
@@ -566,17 +566,20 @@ void CGameState::initNewGame(const IMapService * mapService, bool allowSavingRan
|
||||
{
|
||||
try
|
||||
{
|
||||
auto path = VCMIDirs::get().userCachePath() / "RandomMaps";
|
||||
auto path = VCMIDirs::get().userDataPath() / "Maps" / "RandomMaps";
|
||||
boost::filesystem::create_directories(path);
|
||||
|
||||
std::shared_ptr<CMapGenOptions> options = scenarioOps->mapGenOptions;
|
||||
|
||||
const std::string templateName = options->getMapTemplate()->getName();
|
||||
const ui32 seed = scenarioOps->seedToBeUsed;
|
||||
const std::string dt = vstd::getDateTimeISO8601Basic(std::time(0));
|
||||
|
||||
const std::string fileName = boost::str(boost::format("%s_%d.vmap") % templateName % seed );
|
||||
const std::string fileName = boost::str(boost::format("%s_%s_%d.vmap") % dt % templateName % seed );
|
||||
const auto fullPath = path / fileName;
|
||||
|
||||
randomMap->name.appendRawString(boost::str(boost::format(" %s") % dt));
|
||||
|
||||
mapService->saveMap(randomMap, fullPath);
|
||||
|
||||
logGlobal->info("Random map has been saved to:");
|
||||
|
||||
Reference in New Issue
Block a user