fix: delayed piece texture cleanup

This commit is contained in:
2026-02-05 21:43:47 +08:00
parent e66e997a16
commit 2ea18a0b7a
2 changed files with 2 additions and 1 deletions

View File

@@ -100,6 +100,7 @@ bool GameSession::executeAction(int toRow, int toCol) {
if (!toPiece) { if (!toPiece) {
m_gamePieceEventCallback(GamePieceEvent::MOVE_PIECE, fromRow, fromCol, toRow, toCol); m_gamePieceEventCallback(GamePieceEvent::MOVE_PIECE, fromRow, fromCol, toRow, toCol);
auto fromInfo = fromPiece->getPieceInfo(); auto fromInfo = fromPiece->getPieceInfo();
m_gamePieceEventCallback(GamePieceEvent::REMOVE_PIECE, fromRow, fromCol, -1, -1);
m_board->removePieceAt(fromRow, fromCol); m_board->removePieceAt(fromRow, fromCol);
m_board->placePieceAt(toRow, toCol, m_currentPlayer); m_board->placePieceAt(toRow, toCol, m_currentPlayer);
m_board->setPieceInfo(toRow, toCol, fromInfo); m_board->setPieceInfo(toRow, toCol, fromInfo);

View File

@@ -30,7 +30,7 @@ enum class GameMode {
}; };
enum class GamePieceEvent { enum class GamePieceEvent {
REMOVE_PIECE, REMOVE_PIECE, // 用于销毁棋子的材质释放内存的
PLACE_PIECE, PLACE_PIECE,
MOVE_PIECE, MOVE_PIECE,
GROW_PIECE, GROW_PIECE,