Browse Source

text identifiers from game files

Laserlicht 1 month ago
parent
commit
257803a69b

+ 0 - 7
Mods/vcmi/Content/config/english.json

@@ -1085,12 +1085,5 @@
 	"spellSchool.core.fire.name" : "Fire",
 	"spellSchool.core.water.name" : "Water",
 
-	"resources.core.wood.name" : "Wood",
-	"resources.core.mercury.name" : "Mercury",
-	"resources.core.ore.name" : "Ore",
-	"resources.core.sulfur.name" : "Sulfur",
-	"resources.core.crystal.name" : "Crystal",
-	"resources.core.gems.name" : "Gems",
-	"resources.core.gold.name" : "Gold",
 	"resources.core.mithril.name" : "Mithril"
 }

+ 0 - 7
Mods/vcmi/Content/config/german.json

@@ -1078,12 +1078,5 @@
 	"spellSchool.core.fire.name" : "Feuer",
 	"spellSchool.core.water.name" : "Wasser",
 
-	"resources.core.wood.name" : "Holz",
-	"resources.core.mercury.name" : "Quecksilber",
-	"resources.core.ore.name" : "Erz",
-	"resources.core.sulfur.name" : "Schwefel",
-	"resources.core.crystal.name" : "Kristall",
-	"resources.core.gems.name" : "Edelsteine",
-	"resources.core.gold.name" : "Gold",
 	"resources.core.mithril.name" : "Mithril"
 }

+ 4 - 1
lib/entities/ResourceTypeHandler.cpp

@@ -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;
 }