feat: add time for heart beat

This commit is contained in:
2026-06-19 02:29:00 +03:30
parent 0827858752
commit 32f0406e63
4 changed files with 38 additions and 23 deletions
+6 -5
View File
@@ -76,10 +76,11 @@ type stateMsg struct {
HandCounts [4]int `json:"hand_counts"`
Trick []trickView `json:"trick"`
LeadSuit string `json:"lead_suit,omitempty"`
TricksWon [2]int `json:"tricks_won"`
Scores [2]int `json:"scores"`
TargetScore int `json:"target_score"`
Players []PlayerInfo `json:"players"`
TricksWon [2]int `json:"tricks_won"`
Scores [2]int `json:"scores"`
TargetScore int `json:"target_score"`
TurnTimeoutMs int `json:"turn_timeout_ms"` // مهلتِ نوبتِ انسان (برای شمارنده‌ی کلاینت)
Players []PlayerInfo `json:"players"`
}
// handOverMsg نتیجه یک هَند.
@@ -118,7 +119,7 @@ type playerStatusMsg struct {
}
// buildState نمای بازی را برای جایگاه seat می‌سازد (کارت بقیه مخفی می‌ماند).
func buildState(g *game.Game, roomID string, seat int, players []PlayerInfo) stateMsg {
func buildState(g *game.Game, roomID string, seat int, players []PlayerInfo, turnTimeoutMs int) stateMsg {
hand := g.Hand(seat)
handStr := make([]string, len(hand))
for i, c := range hand {