소스 검색

* hopefully fixed 152

mateuszb 15 년 전
부모
커밋
75f9f0c52f
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      lib/CGameState.cpp

+ 4 - 2
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)