From fa4e00573f09c11704c06042d5de7ee7cf94d3aa Mon Sep 17 00:00:00 2001 From: AlexVinS Date: Fri, 25 Nov 2016 15:34:38 +0300 Subject: [PATCH] Fixed CID 1366350 --- lib/mapObjects/CGHeroInstance.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/mapObjects/CGHeroInstance.cpp b/lib/mapObjects/CGHeroInstance.cpp index 8ff9ce748..60ff5cd2c 100644 --- a/lib/mapObjects/CGHeroInstance.cpp +++ b/lib/mapObjects/CGHeroInstance.cpp @@ -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(mp1) / mp2; + ret = (MPsBefore - basicCost) * static_cast(mp1) / mp2; if(localTi) delete ti; - return 0; //take all MPs otherwise + return ret; } EDiggingStatus CGHeroInstance::diggingStatus() const