Fix player reconnection by re-registering sync context
When an existing player reconnects to a game, their sync context is now updated so they continue receiving real-time updates.
This commit is contained in:
@@ -196,6 +196,13 @@ func (gi *GameInstance) GetPlayerColor(pid PlayerID) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (gi *GameInstance) RegisterSync(playerID PlayerID, sync Syncable) {
|
||||
gi.playersMu.Lock()
|
||||
gi.players[playerID] = sync
|
||||
gi.playersMu.Unlock()
|
||||
gi.dirty = true
|
||||
}
|
||||
|
||||
func (gi *GameInstance) CreateRematch(gs *GameStore) *GameInstance {
|
||||
gi.gameMu.Lock()
|
||||
defer gi.gameMu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user