Skip to content

Commit

Permalink
add Player#ID
Browse files Browse the repository at this point in the history
  • Loading branch information
lieuwex committed Jul 18, 2016
1 parent 313ca41 commit 491ac3a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions player.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (

// Player holds the state of a player.
type Player struct {
Conn *Connection
ID string
Nickname string
Conn *Connection
}

var players []*Player
Expand Down Expand Up @@ -40,8 +41,9 @@ func genNickname() string {

func makePlayer(ws *websocket.Conn) *Player {
player := &Player{
Conn: makeConnection(ws),
ID: UniqIDf(),
Nickname: genNickname(),
Conn: makeConnection(ws),
}
players = append(players, player)
return player
Expand Down

0 comments on commit 491ac3a

Please sign in to comment.