Skip to content

Commit

Permalink
Merge branch 'main' into remap-minimize
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jul 19, 2023
2 parents b76e486 + 4491f10 commit 05ae6c5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Swarm/Game/Step.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1584,12 +1584,16 @@ execConst c vs s k = do
| otherwise -> es |> e
let addToRobotLog :: Has (State GameState) sgn m => Robot -> m ()
addToRobotLog r = do
r' <- execState r $ do
maybeRidLoc <- evalState r $ do
hasLog <- hasCapability CLog
hasListen <- hasCapability CListen
loc' <- use robotLocation
when (hasLog && hasListen) (robotLog %= addLatestClosest loc')
addRobot r'
rid <- use robotID
return $ do
guard $ hasLog && hasListen
Just (rid, loc')
forM_ maybeRidLoc $ \(rid, loc') ->
robotMap . at rid . _Just . robotLog %= addLatestClosest loc'
robotsAround <-
if isPrivileged
then use $ robotMap . to IM.elems
Expand Down

0 comments on commit 05ae6c5

Please sign in to comment.