Feat: New Game UI Features and bug fixed #308

Merged
j.kropff merged 19 commits from feat/game-ui-optimation into main 2026-04-26 17:52:41 +02:00
Showing only changes of commit 5c0f3a7c86 - Show all commits
@@ -35,6 +35,7 @@ public class GameState {
private int currentPlayerIndex; private int currentPlayerIndex;
private boolean handActive; private boolean handActive;
private boolean allowOutOfTurn; private boolean allowOutOfTurn;
private boolean winnerPersistedForHand;
private GamePhase phase; private GamePhase phase;
private int dealerIndex; private int dealerIndex;
@@ -551,6 +552,7 @@ public class GameState {
*/ */
public void startNewHand() { public void startNewHand() {
handActive = true; handActive = true;
resetWinnerPersistedForHand();
phase = GamePhase.PREFLOP; phase = GamePhase.PREFLOP;
pot = new Pot(); pot = new Pot();
@@ -575,6 +577,24 @@ public class GameState {
setCurrentPlayerToPreflopFirstToAct(); setCurrentPlayerToPreflopFirstToAct();
} }
/**
* Marks the winner as already persisted for the current hand.
*
* @return true exactly once per hand; false on all subsequent calls.
*/
public synchronized boolean tryMarkWinnerPersistedForHand() {
if (winnerPersistedForHand) {
return false;
}
winnerPersistedForHand = true;
return true;
}
/** Resets the winner persistence guard for a new hand. */
public synchronized void resetWinnerPersistedForHand() {
winnerPersistedForHand = false;
}
public void foldPlayer(PlayerId playerId) { public void foldPlayer(PlayerId playerId) {
getPlayer(playerId).setFolded(true); getPlayer(playerId).setFolded(true);
} }