Skip to content
This repository has been archived by the owner on Jan 6, 2019. It is now read-only.

Commit

Permalink
Actually adding to wait times now
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Johnson <[email protected]>
  • Loading branch information
Stephen Johnson committed Apr 25, 2011
1 parent bf2d89e commit d6faa9e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/coord/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,19 @@ func (self *Coordinator) transformsForNextTurn(peers []*game.GameStateResponse)
if state.Alive && state.Move.Valid {
if state.Wait == 0 && !state.Move.Position.IsZero() {
requestedPosition := *state.Move.Position.Add(state.Position)
if occ, has := moves[requestedPosition.Complex()]; occ != state.Id && has {
impassible := (self.availableGameState.Terrain.ValueAt(requestedPosition) == -1)
occ, has := moves[requestedPosition.Complex()]
if impassible || (occ != state.Id && has) {
self.log.Print("Agent ", state.Id, " fails move ", state.Position, " - ", requestedPosition)
t.pos = state.Position
} else {
self.log.Print("Agent ", state.Id, " performs move ", state.Position, " - ", requestedPosition)
moves[requestedPosition.Complex()] = state.Id
t.pos = requestedPosition
}
if !impassible {
t.wait = uint16(self.availableGameState.Terrain.ValueAt(t.pos))
}
}

for _, msg := range state.Move.Messages {
Expand Down

0 comments on commit d6faa9e

Please sign in to comment.