Skip to content

Commit

Permalink
Fix a false positive bug check
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt committed Aug 25, 2024
1 parent bdc7f78 commit df22f07
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions WalkerSim/Simulation.Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ private void ValidateAgentInCorrectCell(Agent agent)
return;
}

if (agent.CurrentState != Agent.State.Wandering)
{
// There is a potential race condition for active agents as the position gets updated from
// the main thread, this is in general fine as we skip querying active agents from the
// simulation thread, this is just annoying.
return;
}

var correctCellIndex = GetCellIndex(agent.Position);
if (agent.CellIndex != correctCellIndex)
{
Expand Down

0 comments on commit df22f07

Please sign in to comment.