1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-03 00:46:55 +02:00

IdentifierStorage is now separate handler in VLC

This commit is contained in:
Ivan Savenko
2023-08-25 22:36:00 +03:00
parent c8a6cd74cc
commit 7e27ac7073
8 changed files with 34 additions and 55 deletions

@ -41,25 +41,8 @@ static JsonNode loadModSettings(const std::string & path)
CModHandler::CModHandler()
: content(std::make_shared<CContentHandler>())
, identifiers(std::make_unique<CIdentifierStorage>())
, coreMod(std::make_unique<CModInfo>())
{
//TODO: moddable spell schools
for (auto i = 0; i < GameConstants::DEFAULT_SCHOOLS; ++i)
identifiers->registerObject(ModScope::scopeBuiltin(), "spellSchool", SpellConfig::SCHOOL[i].jsonName, SpellConfig::SCHOOL[i].id);
identifiers->registerObject(ModScope::scopeBuiltin(), "spellSchool", "any", SpellSchool(ESpellSchool::ANY));
for (int i = 0; i < GameConstants::RESOURCE_QUANTITY; ++i)
{
identifiers->registerObject(ModScope::scopeBuiltin(), "resource", GameConstants::RESOURCE_NAMES[i], i);
}
for(int i=0; i<GameConstants::PRIMARY_SKILLS; ++i)
{
identifiers->registerObject(ModScope::scopeBuiltin(), "primSkill", NPrimarySkill::names[i], i);
identifiers->registerObject(ModScope::scopeBuiltin(), "primarySkill", NPrimarySkill::names[i], i);
}
}
CModHandler::~CModHandler() = default;
@ -462,7 +445,7 @@ void CModHandler::load()
logMod->info("\tLoading mod data: %d ms", timer.getDiff());
VLC->creh->loadCrExpMod();
identifiers->finalize();
VLC->identifiersHandler->finalize();
logMod->info("\tResolving identifiers: %d ms", timer.getDiff());
content->afterLoadFinalization();
@ -534,9 +517,4 @@ void CModHandler::trySetActiveMods(std::vector<TModID> saveActiveMods, const std
std::swap(activeMods, newActiveMods);
}
CIdentifierStorage & CModHandler::getIdentifiers()
{
return *identifiers;
}
VCMI_LIB_NAMESPACE_END