added NewSpectator and NewPlayer funcs

This commit is contained in:
sm
2014-02-17 01:07:29 -08:00
parent 0bc1575f81
commit 491d972a4b
2 changed files with 25 additions and 15 deletions
+2 -15
View File
@@ -230,14 +230,7 @@ func addPlayer(ws *websocket.Conn) {
}
}
p := &player{
Robots: []*Robot{},
protoTalker: protoTalker{
send: make(chan Message, 16),
ws: ws,
Id: player_id,
},
}
p := NewPlayer(player_id, ws)
log.Printf("%s: made a player: %s", gid.Id, p.Id)
convertedStats := map[string]Stats{}
@@ -292,13 +285,7 @@ func addPlayer(ws *websocket.Conn) {
gid.Id,
)
case "spectator":
s := &Spectator{
protoTalker{
send: make(chan Message, 16),
ws: ws,
Id: player_id,
},
}
s := NewSpectator(player_id, ws)
log.Printf("%s, %s: about to register this spectator", gid.Id, s.Id)
game.sregister <- s
log.Printf("%s, %s: registered spectator", gid.Id, s.Id)