2
0
AlexVinS 9 жил өмнө
parent
commit
fa4e00573f

+ 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