1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

text identifiers from game files

This commit is contained in:
Laserlicht
2025-09-15 00:44:11 +02:00
parent d808bd6412
commit 257803a69b
3 changed files with 4 additions and 15 deletions

View File

@@ -20,6 +20,8 @@ VCMI_LIB_NAMESPACE_BEGIN
std::string Resource::getNameTextID() const
{
if(id.getNum() < 7) // OH3 resources
return TextIdentifier("core.restypes", id).get();
return TextIdentifier( "resources", modScope, identifier, "name" ).get();
}
@@ -55,7 +57,8 @@ std::shared_ptr<Resource> ResourceTypeHandler::loadFromJson(const std::string &
ret->iconMedium = json["images"]["medium"].String();
ret->iconLarge = json["images"]["large"].String();
LIBRARY->generaltexth->registerString(scope, ret->getNameTextID(), json["name"]);
if(ret->id.getNum() >= 7) // not OH3 resources
LIBRARY->generaltexth->registerString(scope, ret->getNameTextID(), json["name"]);
return ret;
}