added NewSpectator and NewPlayer funcs
This commit is contained in:
+2
-15
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user