mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	movementPointsAfterEmbark: get max move points from TurnInfo
Missed that when originally implemented TurnInfo. Not pretties code, but boost performance a lot.
This commit is contained in:
		| @@ -1169,8 +1169,10 @@ int CGHeroInstance::movementPointsAfterEmbark(int MPsBefore, int basicCost, bool | ||||
| 	if(!ti) | ||||
| 		ti = new TurnInfo(this); | ||||
|  | ||||
| 	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>(maxMovePoints(disembark)) / maxMovePoints(!disembark); | ||||
| 		return (MPsBefore - basicCost) * static_cast<double>(mp1) / mp2; | ||||
|  | ||||
| 	return 0; //take all MPs otherwise | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user