From 191c353491282d19684a5cd4e5378dbdd55d76b6 Mon Sep 17 00:00:00 2001 From: Mike Hoffert Date: Sat, 19 Jul 2014 18:07:24 -0600 Subject: [PATCH] Fixing platform inconsistency It appears that the issue is a Windows problem, with Windows providing macros for min and max that interfere with using the proper ones defined in the algorithm header file. --- source/glest_game/world/unit_updater.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 16c5efc5..7a6ac884 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -2596,10 +2596,10 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac } // Can't take more resources than the faction has, otherwise we end up in the negatives else { - attacked->getFaction()->incResourceAmount(resource.getResourceType(), -min(resource.getLossPercentage() * factionTotalResource, factionTotalResource)); - attacked->getFaction()->incResourceAmount(resource.getResourceType(), -min(resource.getLossValue(), factionTotalResource)); - attacker->getFaction()->incResourceAmount(resource.getResourceType(), min(resource.getAmountPercentage() * factionTotalResource, factionTotalResource)); - attacker->getFaction()->incResourceAmount(resource.getResourceType(), min(resource.getAmountValue(), factionTotalResource)); + attacked->getFaction()->incResourceAmount(resource.getResourceType(), -(std::min)(static_cast(resource.getLossPercentage() * factionTotalResource), factionTotalResource)); + attacked->getFaction()->incResourceAmount(resource.getResourceType(), -(std::min)(resource.getLossValue(), factionTotalResource)); + attacker->getFaction()->incResourceAmount(resource.getResourceType(), (std::min)(static_cast(resource.getAmountPercentage() * factionTotalResource), factionTotalResource)); + attacker->getFaction()->incResourceAmount(resource.getResourceType(), (std::min)(resource.getAmountValue(), factionTotalResource)); } } }