knowyt/server/src/engine/publish.go

24 lines
421 B
Go
Raw Normal View History

2021-08-12 23:07:06 +00:00
package engine
import (
"fmt"
"sirlab.de/go/knowyt/syncdata"
2021-08-12 23:07:06 +00:00
)
func (eng *Engine) publish(populateSyncDataCb PopulateSyncDataCb) {
eng.mu.Lock()
defer eng.mu.Unlock()
eng.versionRef++
data := syncdata.SyncData{
VersionRef: eng.versionRef,
}
if populateSyncDataCb != nil {
populateSyncDataCb(&data)
}
fmt.Printf("%s engine versionRef %d\n", data.GameInfo.GameId, eng.versionRef)
2021-08-12 23:07:06 +00:00
eng.obs.Update(data)
}