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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user