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

Store TerrainType by havlue and handle by reference

This commit is contained in:
Tomasz Zieliński
2022-09-26 09:17:55 +02:00
parent cd3a1a02c2
commit 2bd30556a3
20 changed files with 162 additions and 137 deletions

View File

@@ -73,7 +73,7 @@ public:
static std::string encode(const si32 index)
{
const auto& terrains = VLC->terrainTypeHandler->terrains();
return (index >=0 && index < terrains.size()) ? terrains[index]->name : "<INVALID TERRAIN>";
return (index >=0 && index < terrains.size()) ? terrains[index].name : "<INVALID TERRAIN>";
}
};
@@ -150,9 +150,9 @@ ZoneOptions::ZoneOptions()
terrainTypeLikeZone(NO_ZONE),
treasureLikeZone(NO_ZONE)
{
for(const auto * terr : VLC->terrainTypeHandler->terrains())
if(terr->isLand() && terr->isPassable())
terrainTypes.insert(terr->id);
for(const auto & terr : VLC->terrainTypeHandler->terrains())
if(terr.isLand() && terr.isPassable())
terrainTypes.insert(terr.id);
}
ZoneOptions & ZoneOptions::operator=(const ZoneOptions & other)