1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Finalization of refactoring:

- Entity interface now has getNameTranslated & getNameTextID methods
- Entity interface no longer has getName method
- removed (most) usages of normalizeIndentifier workaround method
- all moddable objects have identifier in form of mod:name
- all moddable object register strings in form of mod.type.name
This commit is contained in:
Ivan Savenko
2023-01-18 23:56:01 +02:00
parent 05a1d7c6e3
commit 47c1803c42
41 changed files with 154 additions and 193 deletions

View File

@@ -33,14 +33,9 @@ int32_t CCreature::getIconIndex() const
return iconIndex;
}
const std::string & CCreature::getName() const
std::string CCreature::getJsonKey() const
{
return identifier;
}
const std::string & CCreature::getJsonKey() const
{
return identifier;
return modScope + ':' + identifier;;
}
void CCreature::registerIcons(const IconRegistar & cb) const
@@ -598,6 +593,9 @@ std::vector<JsonNode> CCreatureHandler::loadLegacyData(size_t dataSize)
CCreature * CCreatureHandler::loadFromJson(const std::string & scope, const JsonNode & node, const std::string & identifier, size_t index)
{
assert(identifier.find(':') == std::string::npos);
assert(!scope.empty());
auto cre = new CCreature();
if(node["hasDoubleWeek"].Bool())
@@ -607,6 +605,7 @@ CCreature * CCreatureHandler::loadFromJson(const std::string & scope, const Json
cre->idNumber = CreatureID(index);
cre->iconIndex = cre->getIndex() + 2;
cre->identifier = identifier;
cre->modScope = scope;
JsonDeserializer handler(nullptr, node);
cre->serializeJson(handler);