From 0e5190877ebc5232344ecea0c8396ed074f11786 Mon Sep 17 00:00:00 2001 From: Luke Meyers Date: Sun, 9 Feb 2020 08:44:27 -0800 Subject: [PATCH] nix extra ActiveRacer lookup in doCommand --- game/commands.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/game/commands.go b/game/commands.go index 1374933..b0058ae 100644 --- a/game/commands.go +++ b/game/commands.go @@ -35,6 +35,7 @@ func CommandLoop(w *pixelgl.Window, s State, stateCA chan<- State) { for i, cmd := range <-cmdC { s = doCommand(cmd, s, i) } + s = checkWin(s, sOld) turn++ if s.GameOver { @@ -87,9 +88,7 @@ func doCommand(cmd Command, s State, teamID int) State { s = updateRacer(s, *r) } - if r := ActiveRacer(s.Teams[teamID]); r != nil { - s = moveRacer(s, *r) - } + s = moveRacer(s, *r) s = maybePassBaton(s, teamID) return s