mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-13 11:40:38 +02:00
Move base movement cost to GameConstants
This commit is contained in:
parent
3466e0fae7
commit
226650582d
@ -51,6 +51,7 @@ namespace GameConstants
|
|||||||
const int SPELLS_QUANTITY=70;
|
const int SPELLS_QUANTITY=70;
|
||||||
const int CREATURES_COUNT = 197;
|
const int CREATURES_COUNT = 197;
|
||||||
|
|
||||||
|
const ui32 BASE_MOVEMENT_COST = 100; //default cost for non-diagonal movement
|
||||||
}
|
}
|
||||||
|
|
||||||
class CArtifact;
|
class CArtifact;
|
||||||
|
@ -58,8 +58,7 @@ static int lowestSpeed(const CGHeroInstance * chi)
|
|||||||
|
|
||||||
ui32 CGHeroInstance::getTileCost(const TerrainTile &dest, const TerrainTile &from) const
|
ui32 CGHeroInstance::getTileCost(const TerrainTile &dest, const TerrainTile &from) const
|
||||||
{
|
{
|
||||||
//base move cost
|
unsigned ret = GameConstants::BASE_MOVEMENT_COST;
|
||||||
unsigned ret = 100;
|
|
||||||
|
|
||||||
//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 road movement cost
|
||||||
if(dest.roadType != ERoadType::NO_ROAD && from.roadType != ERoadType::NO_ROAD)
|
if(dest.roadType != ERoadType::NO_ROAD && from.roadType != ERoadType::NO_ROAD)
|
||||||
@ -95,7 +94,9 @@ ui32 CGHeroInstance::getTileCost(const TerrainTile &dest, const TerrainTile &fro
|
|||||||
{
|
{
|
||||||
ret = VLC->heroh->terrCosts[from.terType];
|
ret = VLC->heroh->terrCosts[from.terType];
|
||||||
ret -= getSecSkillLevel(SecondarySkill::PATHFINDING) * 25;
|
ret -= getSecSkillLevel(SecondarySkill::PATHFINDING) * 25;
|
||||||
ret = ret < 100 ? 100 : ret;
|
if(ret < GameConstants::BASE_MOVEMENT_COST)
|
||||||
|
ret = GameConstants::BASE_MOVEMENT_COST;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user