fixed tick bombs

This commit is contained in:
Stephen McQuay 2013-10-01 21:37:53 -07:00
parent e06f70aed6
commit 158c7d90d8
1 changed files with 2 additions and 1 deletions

View File

@ -74,6 +74,7 @@ func NewGame(id string, width, height float64) *game {
func (g *game) run() {
var t0, t1 time.Time
payload := NewBoardstate()
ticker := time.NewTicker(time.Duration(*tick) * time.Millisecond)
for {
select {
case <-g.kill:
@ -95,7 +96,7 @@ func (g *game) run() {
case s := <-g.sunregister:
delete(g.spectators, s)
close(s.send)
case <-time.Tick(time.Duration(*tick) * time.Millisecond):
case <-ticker.C:
// XXX: This is very racy!! It was at bottom of loop and empty
// stuff was going out
payload.EmptySlices()