Browse Source

Consider units on wall hexes as 'inside' town for tower target selection

Ivan Savenko 9 months ago
parent
commit
abc7168ff6
2 changed files with 7 additions and 1 deletions
  1. 6 0
      lib/battle/BattleHex.h
  2. 1 1
      lib/battle/CBattleInfoCallback.cpp

+ 6 - 0
lib/battle/BattleHex.h

@@ -267,6 +267,12 @@ public:
 		return hex < other.hex;
 	}
 
+	[[nodiscard]] bool operator <=(const BattleHex & other) const noexcept
+	{
+		return hex <= other.hex;
+	}
+
+
 	template <typename Handler>
 	void serialize(Handler & h)
 	{

+ 1 - 1
lib/battle/CBattleInfoCallback.cpp

@@ -51,7 +51,7 @@ static bool sameSideOfWall(const BattleHex & pos1, const BattleHex & pos2)
 
 static bool isInsideWalls(const BattleHex & pos)
 {
-	return lineToWallHex(pos.getY()) < pos;
+	return lineToWallHex(pos.getY()) <= pos;
 }
 
 // parts of wall