remove game from player struct
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
type player struct {
|
||||
ws *websocket.Conn
|
||||
game *game
|
||||
Robot bot.Robot
|
||||
send chan *bot.Boardstate
|
||||
Instruction instruction
|
||||
@@ -61,9 +60,10 @@ func (p *player) nudge() {
|
||||
p.Robot.Position.Y = newPos.Y
|
||||
}
|
||||
|
||||
func (p *player) scan() {
|
||||
func (p *player) scan(players map[*player]bool) {
|
||||
// TODO: perhaps keep the same one around?
|
||||
p.Robot.Scanners = make([]bot.Scanner, 0)
|
||||
for player := range p.game.players {
|
||||
for player, _ := range players {
|
||||
if player.Robot.Id == p.Robot.Id || player.Robot.Health <= 0 {
|
||||
continue
|
||||
}
|
||||
@@ -80,8 +80,10 @@ func (p *player) scan() {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *player) fire() *bot.Projectile {
|
||||
for proj := range p.game.projectiles {
|
||||
func (p *player) fire(projectiles map[*bot.Projectile]bool) *bot.Projectile {
|
||||
// XXX: is this to prevent us from having multiple projectiles from the
|
||||
// same bot?
|
||||
for proj := range projectiles {
|
||||
if proj.Id == p.Robot.Id {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user