Skip to content

Commit

Permalink
small refactoring and fixing one memory leak #12 #13
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Feb 8, 2024
1 parent 142c170 commit 159a017
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/microsim/transportables/MSPModel_JuPedSim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,9 @@ MSPModel_JuPedSim::execute(SUMOTime time) {

// Remove pedestrians that are in a predefined area, at a predefined rate.
for (const auto& vanishingArea : myVanishingAreas) {
std::vector<JPS_Point> vanishingAreaBoundary = vanishingArea.second.vanishingAreaBoundary;
const std::vector<JPS_Point>& vanishingAreaBoundary = vanishingArea.second.vanishingAreaBoundary;
JPS_AgentIdIterator agentsInVanishingAreaIterator = JPS_Simulation_AgentsInPolygon(myJPSSimulation, vanishingAreaBoundary.data(), vanishingAreaBoundary.size());
SUMOTime elapsedTime = time - myLastRemovalTime;
if (elapsedTime >= vanishingArea.second.period) {
if (time - myLastRemovalTime >= vanishingArea.second.period) {
const JPS_AgentId agentID = JPS_AgentIdIterator_Next(agentsInVanishingAreaIterator);
if (agentID != 0) {
auto lambda = [agentID](PState * p) {
Expand All @@ -375,6 +374,7 @@ MSPModel_JuPedSim::execute(SUMOTime time) {
}
}
}
JPS_AgentIdIterator_Free(agentsInVanishingAreaIterator);
}

JPS_ErrorMessage_Free(message);
Expand Down

0 comments on commit 159a017

Please sign in to comment.