Browse Source

Fixed CID 1366350

AlexVinS 9 years ago
parent
commit
fa4e00573f
1 changed files with 3 additions and 2 deletions
  1. 3 2
      lib/mapObjects/CGHeroInstance.cpp

+ 3 - 2
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<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