mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-07 13:08:09 +02:00
Do not aquire pointer to Terrain type multiple times
This commit is contained in:
parent
2272707175
commit
94981076a2
@ -596,11 +596,12 @@ void CPathfinderHelper::getNeighbours(
|
||||
continue;
|
||||
|
||||
const TerrainTile & destTile = map->getTile(destCoord);
|
||||
if(!destTile.getTerrain()->isPassable())
|
||||
const TerrainType* terrain = destTile.getTerrain();
|
||||
if(!terrain->isPassable())
|
||||
continue;
|
||||
|
||||
/// Following condition let us avoid diagonal movement over coast when sailing
|
||||
if(srcTile.isWater() && limitCoastSailing && destTile.isWater() && dir.x && dir.y) //diagonal move through water
|
||||
if(srcTile.isWater() && limitCoastSailing && terrain->isWater() && dir.x && dir.y) //diagonal move through water
|
||||
{
|
||||
const int3 horizontalNeighbour = srcCoord + int3{dir.x, 0, 0};
|
||||
const int3 verticalNeighbour = srcCoord + int3{0, dir.y, 0};
|
||||
@ -608,7 +609,7 @@ void CPathfinderHelper::getNeighbours(
|
||||
continue;
|
||||
}
|
||||
|
||||
if(indeterminate(onLand) || onLand == destTile.isLand())
|
||||
if(indeterminate(onLand) || onLand == terrain->isLand())
|
||||
{
|
||||
vec.push_back(destCoord);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user