1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-24 00:36:29 +02:00

Added GameSettings to gamestate, potentially allowing to define game

settings per map (or in random map template)
This commit is contained in:
Ivan Savenko
2024-08-31 11:00:36 +00:00
parent 6179521364
commit 8225eb454e
68 changed files with 432 additions and 293 deletions

View File

@@ -14,6 +14,7 @@
#include "../VCMI_Lib.h"
#include "../CCreatureHandler.h"
#include "../CHeroHandler.h"
#include "../GameSettings.h"
#include "../RiverHandler.h"
#include "../RoadHandler.h"
#include "../TerrainHandler.h"
@@ -208,6 +209,9 @@ CMap::CMap(IGameCallback * cb)
allowedAbilities = VLC->skillh->getDefaultAllowed();
allowedArtifact = VLC->arth->getDefaultAllowed();
allowedSpells = VLC->spellh->getDefaultAllowed();
gameSettings = std::make_unique<GameSettings>();
gameSettings->loadBase(VLC->settingsHandler->getFullConfig());
}
CMap::~CMap()
@@ -781,4 +785,15 @@ void CMap::reindexObjects()
}
}
const IGameSettings & CMap::getSettings() const
{
return *gameSettings;
}
void CMap::overrideGameSetting(EGameSettings option, const JsonNode & input)
{
return gameSettings->addOverride(option, input);
}
VCMI_LIB_NAMESPACE_END