You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
hexmap/server/state/synced.go

29 lines
596 B

package state
import (
"go.uber.org/zap/zapcore"
)
// Synced contains all state that is synced between the server and its clients.
type Synced struct {
Map HexMap `json:"map"`
User UserData `json:"user"`
}
func (s Synced) MarshalLogObject(encoder zapcore.ObjectEncoder) error {
mapErr := encoder.AddObject("map", s.Map)
userErr := encoder.AddObject("user", s.User)
if mapErr != nil {
return mapErr
} else {
return userErr
}
}
// Copy creates a deep copy of this Synced instance.
func (s Synced) Copy() Synced {
return Synced{
Map: s.Map.Copy(),
User: s.User.Copy(),
}
}