1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Terrain identifiers will also have mod:name format

This commit is contained in:
Ivan Savenko 2023-01-10 20:08:37 +02:00
parent 1caec0a8cb
commit 1b25043dab
2 changed files with 18 additions and 9 deletions

View File

@ -25,8 +25,11 @@ TerrainType * TerrainTypeHandler::loadFromJson( const std::string & scope, const
TerrainType * info = new TerrainType;
info->id = TerrainId(index);
info->identifier = identifier;
info->modScope = scope;
if (identifier.find(':') == std::string::npos)
info->identifier = scope + ":" + identifier;
else
info->identifier = identifier;
info->moveCost = static_cast<int>(json["moveCost"].Integer());
info->musicFilename = json["music"].String();
@ -151,7 +154,11 @@ RiverType * RiverTypeHandler::loadFromJson(
RiverType * info = new RiverType;
info->id = RiverId(index);
info->identifier = identifier;
if (identifier.find(':') == std::string::npos)
info->identifier = scope + ":" + identifier;
else
info->identifier = identifier;
info->tilesFilename = json["tilesFilename"].String();
info->shortIdentifier = json["shortIdentifier"].String();
info->deltaName = json["delta"].String();
@ -192,7 +199,11 @@ RoadType * RoadTypeHandler::loadFromJson(
RoadType * info = new RoadType;
info->id = RoadId(index);
info->identifier = identifier;
if (identifier.find(':') == std::string::npos)
info->identifier = scope + ":" + identifier;
else
info->identifier = identifier;
info->tilesFilename = json["tilesFilename"].String();
info->shortIdentifier = json["shortIdentifier"].String();
info->movementCost = json["moveCost"].Integer();
@ -261,7 +272,7 @@ bool TerrainType::isTransitionRequired() const
std::string TerrainType::getNameTextID() const
{
return TextIdentifier( "terrain", modScope, identifier, "name" ).get();
return TextIdentifier( "terrain", identifier, "name" ).get();
}
std::string TerrainType::getNameTranslated() const
@ -294,12 +305,12 @@ std::string RiverType::getNameTranslated() const
RiverType::RiverType():
id(River::NO_RIVER),
identifier("empty")
identifier("core:empty")
{}
RoadType::RoadType():
id(Road::NO_ROAD),
identifier("empty"),
identifier("core:empty"),
movementCost(GameConstants::BASE_MOVEMENT_COST)
{}
VCMI_LIB_NAMESPACE_END

View File

@ -22,7 +22,6 @@ VCMI_LIB_NAMESPACE_BEGIN
class DLL_LINKAGE TerrainType : public EntityT<TerrainId>
{
friend class TerrainTypeHandler;
std::string modScope;
std::string identifier;
TerrainId id;
ui8 passabilityType;
@ -80,7 +79,6 @@ public:
h & prohibitTransitions;
h & minimapBlocked;
h & minimapUnblocked;
h & modScope;
h & identifier;
h & musicFilename;
h & tilesFilename;