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

Map/Road/River identifiers are now private members

This commit is contained in:
Ivan Savenko
2023-01-01 17:10:47 +02:00
parent f3985d205b
commit 7c7ae26e67
31 changed files with 92 additions and 82 deletions

View File

@@ -75,7 +75,7 @@ public:
static std::string encode(const si32 index)
{
return VLC->terrainTypeHandler->getByIndex(index)->identifier;
return VLC->terrainTypeHandler->getByIndex(index)->getName();
}
};
@@ -154,7 +154,7 @@ ZoneOptions::ZoneOptions()
{
for(const auto & terr : VLC->terrainTypeHandler->objects)
if(terr->isLand() && terr->isPassable())
terrainTypes.insert(terr->id);
terrainTypes.insert(terr->getId());
}
ZoneOptions & ZoneOptions::operator=(const ZoneOptions & other)
@@ -365,7 +365,7 @@ void ZoneOptions::serializeJson(JsonSerializeFormat & handler)
for(auto & ttype : terrainTypes)
{
JsonNode n;
n.String() = VLC->terrainTypeHandler->getById(ttype)->identifier;
n.String() = VLC->terrainTypeHandler->getById(ttype)->getName();
node.Vector().push_back(n);
}
}

View File

@@ -121,7 +121,7 @@ void initTerrainType(Zone & zone, CMapGenerator & gen)
std::vector<TerrainId> waterTerrains;
for(const auto & terrain : VLC->terrainTypeHandler->objects)
if(terrain->isWater())
waterTerrains.push_back(terrain->id);
waterTerrains.push_back(terrain->getId());
zone.setTerrainType(*RandomGeneratorUtil::nextItem(waterTerrains, gen.rand));
}

View File

@@ -323,7 +323,7 @@ void RiverPlacer::connectRiver(const int3 & tile)
{
auto riverType = VLC->terrainTypeHandler->getById(zone.getTerrainType())->river;
const auto * river = VLC->riverTypeHandler->getById(riverType);
if(river->id == River::NO_RIVER)
if(river->getId() == River::NO_RIVER)
return;
rmg::Area roads;

View File

@@ -121,7 +121,7 @@ void Object::Instance::setTemplate(TerrainId terrain)
auto templates = VLC->objtypeh->getHandlerFor(dObject.ID, dObject.subID)->getTemplates(terrain);
if (templates.empty())
{
auto terrainName = VLC->terrainTypeHandler->getById(terrain)->identifier;
auto terrainName = VLC->terrainTypeHandler->getById(terrain)->getName();
throw rmgException(boost::to_string(boost::format("Did not find graphics for object (%d,%d) at %s") % dObject.ID % dObject.subID % terrainName));
}
dObject.appearance = templates.front();
@@ -293,14 +293,14 @@ void Object::Instance::finalize(RmgMap & map)
if (!dObject.appearance)
{
auto terrainType = map.map().getTile(getPosition(true)).terType;
auto templates = VLC->objtypeh->getHandlerFor(dObject.ID, dObject.subID)->getTemplates(terrainType->id);
auto templates = VLC->objtypeh->getHandlerFor(dObject.ID, dObject.subID)->getTemplates(terrainType->getId());
if (templates.empty())
{
throw rmgException(boost::to_string(boost::format("Did not find graphics for object (%d,%d) at %s (terrain %d)") % dObject.ID % dObject.subID % getPosition(true).toString() % terrainType));
}
else
{
setTemplate(terrainType->id);
setTemplate(terrainType->getId());
}
}

View File

@@ -44,7 +44,7 @@ void WaterProxy::process()
{
MAYBE_UNUSED(t);
assert(map.isOnMap(t));
assert(map.map().getTile(t).terType->id == zone.getTerrainType());
assert(map.map().getTile(t).terType->getId() == zone.getTerrainType());
}
for(auto z : map.getZones())
@@ -54,7 +54,7 @@ void WaterProxy::process()
for(auto & t : z.second->area().getTilesVector())
{
if(map.map().getTile(t).terType->id == zone.getTerrainType())
if(map.map().getTile(t).terType->getId() == zone.getTerrainType())
{
z.second->areaPossible().erase(t);
z.second->area().erase(t);