From 3d73994360f96874b595d884562f8be495102e74 Mon Sep 17 00:00:00 2001 From: zhenyan121 <3367366583@qq.com> Date: Sat, 13 Dec 2025 18:44:27 +0800 Subject: [PATCH] Modified the rule to only allow moves for selected piece --- src/game/Rule.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/game/Rule.cpp b/src/game/Rule.cpp index 2f3b7df..3af84a4 100644 --- a/src/game/Rule.cpp +++ b/src/game/Rule.cpp @@ -106,11 +106,10 @@ bool Rule::canSpore(const Board* board, const int fromRow, const int fromCol, co int toPieceID = board->getPieceID(toRow, toCol); auto selectedComponent = board->getComponentByPieceID(fromPieceID); std::cout << "before action Component size: " << selectedComponent.size() << "\n"; - for (auto PieceID : selectedComponent) { - auto SporeRegion = board->getSporeRange(PieceID); - if (SporeRegion.find(toPieceID) != SporeRegion.end()) { - return true; - } + auto SporeRegion = board->getSporeRange(fromPieceID); + if (SporeRegion.find(toPieceID) != SporeRegion.end()) { + return true; + } return false;