mirror of
https://github.com/Earth-Genesis-Games/Ajedrez_Purgatorio.git
synced 2026-09-11 09:47:35 +00:00
fix: StackOverflow in King.GetAvailableMoves -> IsInCheck recursion
CheckDetector.IsInCheck used GetAvailableMoves() which for King calls GameManager.IsInCheck -> CheckDetector.IsInCheck -> King.GetAvailableMoves creating infinite recursion. Changed to GetAttackSquares() which King overrides to return attack squares without the check test.
This commit is contained in:
@@ -34,7 +34,7 @@ public class CheckDetector
|
||||
{
|
||||
if (piece != null && piece.isWhite != forWhite)
|
||||
{
|
||||
var moves = piece.GetAvailableMoves(board);
|
||||
var moves = piece.GetAttackSquares(board);
|
||||
if (moves.Contains(king.currentPos))
|
||||
return true;
|
||||
}
|
||||
|
||||
+4358
-3
File diff suppressed because it is too large
Load Diff
+9369
-5014
File diff suppressed because it is too large
Load Diff
+9388
-5033
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user