From 75f9f0c52ff8be0dcc5a356cb3f50469533d71ac Mon Sep 17 00:00:00 2001 From: mateuszb Date: Thu, 15 Jul 2010 17:50:33 +0000 Subject: [PATCH] * hopefully fixed 152 --- lib/CGameState.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index dc960ade0..0d1301580 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -3668,10 +3668,12 @@ si8 BattleInfo::hasDistancePenalty( int stackID, int destHex ) { const CStack * stack = getStack(stackID); - int distance = std::abs(destHex % BFIELD_WIDTH - stack->position % BFIELD_WIDTH); + int xDst = std::abs(destHex % BFIELD_WIDTH - stack->position % BFIELD_WIDTH), + yDst = std::abs(destHex / BFIELD_WIDTH - stack->position / BFIELD_WIDTH); + int distance = std::max(xDst, yDst) + std::min(xDst, yDst) - (std::max(xDst, yDst) + 1)/2; //I hope it's approximately correct - return distance > 8 && !stack->hasBonusOfType(Bonus::NO_DISTANCE_PENALTY); + return distance > 10 && !stack->hasBonusOfType(Bonus::NO_DISTANCE_PENALTY); } si8 BattleInfo::sameSideOfWall(int pos1, int pos2)