simplified some loops
These changes were done by running the following command: gofmt -s -w *.go
This commit is contained in:
parent
bc2d1cdd52
commit
da26e1ca46
@ -84,7 +84,7 @@ func listGames(w http.ResponseWriter, req *http.Request) {
|
|||||||
for id, g := range games.m {
|
for id, g := range games.m {
|
||||||
players := make([]pout, 0)
|
players := make([]pout, 0)
|
||||||
// TODO - players instead of robots?
|
// TODO - players instead of robots?
|
||||||
for p, _ := range g.players {
|
for p := range g.players {
|
||||||
for _, r := range p.Robots {
|
for _, r := range p.Robots {
|
||||||
players = append(players, pout{
|
players = append(players, pout{
|
||||||
Name: r.Name,
|
Name: r.Name,
|
||||||
|
4
robot.go
4
robot.go
@ -311,7 +311,7 @@ func (r *Robot) Tick(g *game) {
|
|||||||
|
|
||||||
func (r *Robot) scan(g *game) {
|
func (r *Robot) scan(g *game) {
|
||||||
r.Scanners = r.Scanners[:0]
|
r.Scanners = r.Scanners[:0]
|
||||||
for player, _ := range g.players {
|
for player := range g.players {
|
||||||
for _, bot := range player.Robots {
|
for _, bot := range player.Robots {
|
||||||
if bot.Id == r.Id || bot.Health <= 0 {
|
if bot.Id == r.Id || bot.Health <= 0 {
|
||||||
continue
|
continue
|
||||||
@ -327,7 +327,7 @@ func (r *Robot) scan(g *game) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for proj, _ := range g.projectiles {
|
for proj := range g.projectiles {
|
||||||
if proj.Owner == r {
|
if proj.Owner == r {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user