1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fixed CID 1366350

This commit is contained in:
AlexVinS 2016-11-25 15:34:38 +03:00
parent 20de754141
commit fa4e00573f

View File

@ -1263,6 +1263,7 @@ CBonusSystemNode * CGHeroInstance::whereShouldBeAttached(CGameState *gs)
int CGHeroInstance::movementPointsAfterEmbark(int MPsBefore, int basicCost, bool disembark /*= false*/, const TurnInfo * ti) const
{
int ret = 0; //take all MPs by default
bool localTi = false;
if(!ti)
{
@ -1273,12 +1274,12 @@ int CGHeroInstance::movementPointsAfterEmbark(int MPsBefore, int basicCost, bool
int mp1 = ti->getMaxMovePoints(disembark ? EPathfindingLayer::LAND : EPathfindingLayer::SAIL);
int mp2 = ti->getMaxMovePoints(disembark ? EPathfindingLayer::SAIL : EPathfindingLayer::LAND);
if(ti->hasBonusOfType(Bonus::FREE_SHIP_BOARDING))
return (MPsBefore - basicCost) * static_cast<double>(mp1) / mp2;
ret = (MPsBefore - basicCost) * static_cast<double>(mp1) / mp2;
if(localTi)
delete ti;
return 0; //take all MPs otherwise
return ret;
}
EDiggingStatus CGHeroInstance::diggingStatus() const