put more of game init in NewGame

This commit is contained in:
Stephen McQuay 2013-09-04 00:06:39 -07:00
parent 9bccf60abc
commit 325a5c0f57

View File

@ -24,7 +24,7 @@ type game struct {
}
func NewGame(id string, width, height float64) *game {
return &game{
g := &game{
id: id,
register: make(chan *player),
unregister: make(chan *player),
@ -39,9 +39,7 @@ func NewGame(id string, width, height float64) *game {
sunregister: make(chan *Spectator),
kill: make(chan bool),
}
}
func (g *game) run() {
g.robot_id = make(chan int)
go func() {
for i := 0; ; i++ {
@ -49,6 +47,11 @@ func (g *game) run() {
}
}()
return g
}
func (g *game) run() {
for {
select {
case <-g.kill: