mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +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())
|
if(!isTile2Terrain || out.empty())
|
||||||
out = t.terType->getName();
|
out = t.terType->getNameTranslated();
|
||||||
|
|
||||||
if(t.getDiggingStatus(false) == EDiggingStatus::CAN_DIG)
|
if(t.getDiggingStatus(false) == EDiggingStatus::CAN_DIG)
|
||||||
{
|
{
|
||||||
@ -1486,4 +1486,3 @@ TerrainTileObject::TerrainTileObject(const CGObjectInstance * obj_, SDL_Rect rec
|
|||||||
TerrainTileObject::~TerrainTileObject()
|
TerrainTileObject::~TerrainTileObject()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,25 +20,13 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
//("allowedTerrain"\s*:\s*\[.*)9(.*\],\n)
|
//("allowedTerrain"\s*:\s*\[.*)9(.*\],\n)
|
||||||
//\1"rock"\2
|
//\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 * TerrainTypeHandler::loadFromJson( const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index)
|
||||||
{
|
{
|
||||||
TerrainType * info = new TerrainType;
|
TerrainType * info = new TerrainType;
|
||||||
|
|
||||||
info->id = TerrainId(index);
|
info->id = TerrainId(index);
|
||||||
info->identifier = identifier;
|
info->identifier = identifier;
|
||||||
|
info->modScope = scope;
|
||||||
|
|
||||||
info->moveCost = static_cast<int>(json["moveCost"].Integer());
|
info->moveCost = static_cast<int>(json["moveCost"].Integer());
|
||||||
info->musicFilename = json["music"].String();
|
info->musicFilename = json["music"].String();
|
||||||
@ -47,7 +35,8 @@ TerrainType * TerrainTypeHandler::loadFromJson( const std::string & scope, const
|
|||||||
info->horseSoundPenalty = json["horseSoundPenalty"].String();
|
info->horseSoundPenalty = json["horseSoundPenalty"].String();
|
||||||
info->transitionRequired = json["transitionRequired"].Bool();
|
info->transitionRequired = json["transitionRequired"].Bool();
|
||||||
info->terrainViewPatterns = json["terrainViewPatterns"].String();
|
info->terrainViewPatterns = json["terrainViewPatterns"].String();
|
||||||
//info->nameTranslated = json["nameTranslated"].String();
|
|
||||||
|
VLC->generaltexth->registerString(info->getNameTextID(), json["text"].String());
|
||||||
|
|
||||||
const JsonVector & unblockedVec = json["minimapUnblocked"].Vector();
|
const JsonVector & unblockedVec = json["minimapUnblocked"].Vector();
|
||||||
info->minimapUnblocked =
|
info->minimapUnblocked =
|
||||||
@ -266,6 +255,17 @@ bool TerrainType::isTransitionRequired() const
|
|||||||
return transitionRequired;
|
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()
|
TerrainType::TerrainType()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
class DLL_LINKAGE TerrainType : public EntityT<TerrainId>
|
class DLL_LINKAGE TerrainType : public EntityT<TerrainId>
|
||||||
{
|
{
|
||||||
friend class TerrainTypeHandler;
|
friend class TerrainTypeHandler;
|
||||||
|
std::string modScope;
|
||||||
std::string identifier;
|
std::string identifier;
|
||||||
TerrainId id;
|
TerrainId id;
|
||||||
ui8 passabilityType;
|
ui8 passabilityType;
|
||||||
@ -79,6 +80,7 @@ public:
|
|||||||
h & prohibitTransitions;
|
h & prohibitTransitions;
|
||||||
h & minimapBlocked;
|
h & minimapBlocked;
|
||||||
h & minimapUnblocked;
|
h & minimapUnblocked;
|
||||||
|
h & modScope;
|
||||||
h & identifier;
|
h & identifier;
|
||||||
h & musicFilename;
|
h & musicFilename;
|
||||||
h & tilesFilename;
|
h & tilesFilename;
|
||||||
|
Reference in New Issue
Block a user