fixed resetart error vis-a-vis obstacles

This commit is contained in:
Stephen McQuay 2013-11-18 08:52:59 -08:00
parent cacb8b547d
commit 4eb849a63f
1 changed files with 3 additions and 1 deletions

View File

@ -51,6 +51,7 @@ type game struct {
projectiles map[*Projectile]bool
splosions map[*Splosion]bool
obstacles []Obstacle
obstacle_count int
register chan *player
unregister chan *player
turn int
@ -74,6 +75,7 @@ func NewGame(id string, width, height float32, obstacles, tick int) *game {
projectiles: make(map[*Projectile]bool),
splosions: make(map[*Splosion]bool),
obstacles: GenerateObstacles(obstacles, width, height),
obstacle_count: obstacles,
players: make(map[*player]bool),
turn: 0,
width: width,
@ -307,7 +309,7 @@ func (g *game) gameOver() (bool, *GameOver) {
var stats *GameOver
if g.players_remaining <= 1 && len(g.players) > 1 {
g.obstacles = GenerateObstacles(conf.Obstacles, g.width, g.height)
g.obstacles = GenerateObstacles(g.obstacle_count, g.width, g.height)
log.Printf("game %s: game over", g.id)
stats = NewGameOver()