Removed extra variables

This commit is contained in:
Stephen McQuay 2014-03-29 01:37:05 -07:00
parent a3fa670c3d
commit 2fd97a7092
2 changed files with 1 additions and 20 deletions

19
game.go
View File

@ -87,7 +87,6 @@ type Game struct {
stats GameStats
mode GameMode
bw *bandwidth.Bandwidth
Verbose bool
}
type GameMode interface {
@ -294,7 +293,6 @@ func (g *Game) sendUpdate(payload *Boardstate) {
}
func (g *Game) run() {
var t0, t1 time.Time
ticker := time.NewTicker(time.Duration(g.tick_duration) * time.Millisecond)
for {
select {
@ -327,17 +325,10 @@ func (g *Game) run() {
delete(g.spectators, s)
close(s.send)
case <-ticker.C:
t0 = time.Now()
payload := NewBoardstate()
g.turn++
payload.Turn = g.turn
if g.Verbose {
log.Printf("\033[2JTurn: %v", g.turn)
log.Printf("Players: %v", len(g.players))
log.Printf("Projectiles: %v", len(g.projectiles))
log.Printf("Explosions: %v", len(g.splosions))
}
// UPDATE GAME STATE
if end, data := g.mode.gameOver(g); end {
@ -347,18 +338,8 @@ func (g *Game) run() {
g.tick(payload)
g.mode.tick(g, payload)
t1 = time.Now()
if g.Verbose {
log.Printf("Turn Processes %v\n", t1.Sub(t0))
}
// SEND THE UPDATE TO EACH PLAYER
g.sendUpdate(payload)
t1 = time.Now()
if g.Verbose {
log.Printf("Sent Payload %v\n", t1.Sub(t0))
}
}
}
log.Println("run done")

View File

@ -72,7 +72,7 @@ func NewProtoTalker(id string, ws *websocket.Conn, bw *bandwidth.Bandwidth, enco
}
func (pt *protoTalker) sender() {
log.Printf("%s: client launched", pt.Id)
log.Printf("%s: %T sender launched", pt.Id, pt.enc)
for things := range pt.send {
err := pt.enc.Encode(things)
if err != nil {