1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +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

@@ -54,11 +54,6 @@ int32_t CSkill::getIconIndex() const
return getIndex(); //TODO: actual value with skill level
}
const std::string & CSkill::getName() const
{
return identifier;
}
std::string CSkill::getNameTextID() const
{
TextIdentifier id("skill", modScope, identifier, "name");
@@ -70,9 +65,9 @@ std::string CSkill::getNameTranslated() const
return VLC->generaltexth->translate(getNameTextID());
}
const std::string & CSkill::getJsonKey() const
std::string CSkill::getJsonKey() const
{
return identifier;
return modScope + ':' + identifier;;
}
std::string CSkill::getDescriptionTextID(int level) const
@@ -210,7 +205,11 @@ const std::vector<std::string> & CSkillHandler::getTypeNames() const
CSkill * CSkillHandler::loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index)
{
assert(identifier.find(':') == std::string::npos);
assert(!scope.empty());
CSkill * skill = new CSkill(SecondarySkill((si32)index), identifier);
skill->modScope = scope;
VLC->generaltexth->registerString(skill->getNameTextID(), json["name"].String());
switch(json["gainChance"].getType())