24 lines
421 B
Go
24 lines
421 B
Go
package engine
|
|
|
|
import (
|
|
"fmt"
|
|
"sirlab.de/go/knowyt/syncdata"
|
|
)
|
|
|
|
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)
|
|
eng.obs.Update(data)
|
|
}
|