1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-15 20:03:15 +02:00

fix movement cost on roads

This commit is contained in:
Andrey Filipenkov
2023-03-12 19:01:54 +03:00
parent 0c7b5ac793
commit bfb0dc26d5

View File

@@ -66,10 +66,10 @@ ui32 CGHeroInstance::getTileCost(const TerrainTile & dest, const TerrainTile & f
{ {
int64_t ret = GameConstants::BASE_MOVEMENT_COST; int64_t ret = GameConstants::BASE_MOVEMENT_COST;
//if there is road both on dest and src tiles - use road movement cost //if there is road both on dest and src tiles - use src road movement cost
if(dest.roadType->getId() != Road::NO_ROAD && from.roadType->getId() != Road::NO_ROAD) if(dest.roadType->getId() != Road::NO_ROAD && from.roadType->getId() != Road::NO_ROAD)
{ {
ret = std::max(dest.roadType->movementCost, from.roadType->movementCost); ret = from.roadType->movementCost;
} }
else if(ti->nativeTerrain != from.terType->getId() &&//the terrain is not native else if(ti->nativeTerrain != from.terType->getId() &&//the terrain is not native
ti->nativeTerrain != ETerrainId::ANY_TERRAIN && //no special creature bonus ti->nativeTerrain != ETerrainId::ANY_TERRAIN && //no special creature bonus