Enha: stop timer if turn ended

This commit is contained in:
Grail Finder
2025-07-01 09:38:03 +03:00
parent e6177df5d8
commit 036def3819
7 changed files with 50 additions and 25 deletions

View File

@ -84,6 +84,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) {
fi.Room.OpenedThisTurn = 0
fi.Room.ThisTurnLimit = 0
fi.Room.ClearMarks()
StopTurnTimer(fi.Room.ID)
}
switch string(color) {
case string(models.WordColorBlack):
@ -102,6 +103,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) {
fi.Room.ThisTurnLimit = 0
fi.Room.ActionHistory = append(fi.Room.ActionHistory, action)
fi.Room.ClearMarks()
StopTurnTimer(fi.Room.ID)
case string(models.WordColorWhite), string(oppositeColor):
log.Debug("opened opposite color word", "room", fi.Room, "opposite-color", oppositeColor)
// end turn
@ -109,6 +111,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) {
fi.Room.MimeDone = false
fi.Room.OpenedThisTurn = 0
fi.Room.ThisTurnLimit = 0
StopTurnTimer(fi.Room.ID)
// check if no cards left => game over
if fi.Room.BlueCounter == 0 {
// blue won