Override incoming commands rather than appending

This commit is contained in:
Marc Di Luzio 2020-07-05 13:16:19 +01:00
parent 233a6b3281
commit a112c3ed47

View file

@ -393,12 +393,8 @@ func (w *World) Enqueue(rover string, commands ...Command) error {
w.cmdMutex.Lock()
defer w.cmdMutex.Unlock()
// Append the commands to the incoming set
if cmds, ok := w.Incoming[rover]; ok {
w.Incoming[rover] = append(cmds, commands...)
} else {
w.Incoming[rover] = commands
}
// Override the incoming command set
w.CommandIncoming[rover] = commands
return nil
}