mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
Names for terrains now pass through translator
This commit is contained in:
@ -1390,7 +1390,7 @@ void CMapHandler::getTerrainDescr(const int3 & pos, std::string & out, bool isRM
|
||||
}
|
||||
|
||||
if(!isTile2Terrain || out.empty())
|
||||
out = t.terType->getName();
|
||||
out = t.terType->getNameTranslated();
|
||||
|
||||
if(t.getDiggingStatus(false) == EDiggingStatus::CAN_DIG)
|
||||
{
|
||||
@ -1486,4 +1486,3 @@ TerrainTileObject::TerrainTileObject(const CGObjectInstance * obj_, SDL_Rect rec
|
||||
TerrainTileObject::~TerrainTileObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -20,25 +20,13 @@ VCMI_LIB_NAMESPACE_BEGIN
|
||||
//("allowedTerrain"\s*:\s*\[.*)9(.*\],\n)
|
||||
//\1"rock"\2
|
||||
|
||||
/*
|
||||
TerrainTypeHandler::TerrainTypeHandler()
|
||||
{
|
||||
auto allConfigs = VLC->modh->getActiveMods();
|
||||
allConfigs.insert(allConfigs.begin(), CModHandler::scopeBuiltin());
|
||||
|
||||
initRivers(allConfigs);
|
||||
recreateRiverMaps();
|
||||
initRoads(allConfigs);
|
||||
recreateRoadMaps();
|
||||
initTerrains(allConfigs); //maps will be populated inside
|
||||
}*/
|
||||
|
||||
TerrainType * TerrainTypeHandler::loadFromJson( const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index)
|
||||
{
|
||||
TerrainType * info = new TerrainType;
|
||||
|
||||
info->id = TerrainId(index);
|
||||
info->identifier = identifier;
|
||||
info->modScope = scope;
|
||||
|
||||
info->moveCost = static_cast<int>(json["moveCost"].Integer());
|
||||
info->musicFilename = json["music"].String();
|
||||
@ -47,7 +35,8 @@ TerrainType * TerrainTypeHandler::loadFromJson( const std::string & scope, const
|
||||
info->horseSoundPenalty = json["horseSoundPenalty"].String();
|
||||
info->transitionRequired = json["transitionRequired"].Bool();
|
||||
info->terrainViewPatterns = json["terrainViewPatterns"].String();
|
||||
//info->nameTranslated = json["nameTranslated"].String();
|
||||
|
||||
VLC->generaltexth->registerString(info->getNameTextID(), json["text"].String());
|
||||
|
||||
const JsonVector & unblockedVec = json["minimapUnblocked"].Vector();
|
||||
info->minimapUnblocked =
|
||||
@ -266,6 +255,17 @@ bool TerrainType::isTransitionRequired() const
|
||||
return transitionRequired;
|
||||
}
|
||||
|
||||
std::string TerrainType::getNameTextID() const
|
||||
{
|
||||
TextIdentifier id{ "terrain", modScope, identifier, "name" };
|
||||
return id.get();
|
||||
}
|
||||
|
||||
std::string TerrainType::getNameTranslated() const
|
||||
{
|
||||
return VLC->generaltexth->translate(getNameTextID());
|
||||
}
|
||||
|
||||
TerrainType::TerrainType()
|
||||
{}
|
||||
|
||||
|
@ -22,6 +22,7 @@ VCMI_LIB_NAMESPACE_BEGIN
|
||||
class DLL_LINKAGE TerrainType : public EntityT<TerrainId>
|
||||
{
|
||||
friend class TerrainTypeHandler;
|
||||
std::string modScope;
|
||||
std::string identifier;
|
||||
TerrainId id;
|
||||
ui8 passabilityType;
|
||||
@ -79,6 +80,7 @@ public:
|
||||
h & prohibitTransitions;
|
||||
h & minimapBlocked;
|
||||
h & minimapUnblocked;
|
||||
h & modScope;
|
||||
h & identifier;
|
||||
h & musicFilename;
|
||||
h & tilesFilename;
|
||||
|
Reference in New Issue
Block a user