File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -536,19 +536,24 @@ namespace dsm {
536536 if (intersection.agents ().empty ()) {
537537 return false ;
538538 }
539- auto const [angle, agentId] = *(intersection.agents ().begin ());
540- const auto & nextStreet{m_graph.streetSet ()[m_agentNextStreetId[agentId]]};
541- if (!(nextStreet->isFull ())) {
539+ for (auto const [angle, agentId] : intersection.agents ()) {
540+ auto const & nextStreet{m_graph.streetSet ()[m_agentNextStreetId[agentId]]};
541+ if (nextStreet->isFull ()) {
542+ if (m_forcePriorities) {
543+ return false ;
544+ }
545+ continue ;
546+ }
542547 intersection.removeAgent (agentId);
543548 m_agents[agentId]->setStreetId (nextStreet->id ());
544549 this ->setAgentSpeed (agentId);
545550 m_agents[agentId]->incrementDelay (
546551 std::ceil (nextStreet->length () / m_agents[agentId]->speed ()));
547552 nextStreet->addAgent (agentId);
548553 m_agentNextStreetId.erase (agentId);
549- } else if (m_forcePriorities) {
550- return false ;
554+ return true ;
551555 }
556+ return false ;
552557 } else if (pNode->isRoundabout ()) {
553558 auto & roundabout = dynamic_cast <Roundabout&>(*pNode);
554559 if (roundabout.agents ().empty ()) {
You can’t perform that action at this time.
0 commit comments