Commit 504b98b7 authored by Ulrich Kemloh's avatar Ulrich Kemloh

fixed memory leak in the simulation class

parent 1a169597
......@@ -570,6 +570,9 @@ int Simulation::RunBody(double maxSimTime)
//process the queue for incoming pedestrians
ProcessAgentsQueue();
//update the linked cells
_building->UpdateGrid();
// update the positions
_operationalModel->ComputeNextTimeStep(t, _deltaT, _building.get());
......@@ -584,8 +587,6 @@ int Simulation::RunBody(double maxSimTime)
//someone might have left the building
_nPeds = _building->GetAllPedestrians().size();
//update the linked cells
_building->UpdateGrid();
// update the global time
Pedestrian::SetGlobalTime(t);
......
......@@ -67,7 +67,7 @@ private:
int _externalServerPort=9999;
int _internalServerPort=9998;
std::string _externalServerName="localhost";
std::string _internalServerName="zam763";
std::string _internalServerName="localhost";
Building* _building=nullptr;
//TODO: the method should be passed bz reference in the main function
//std::unique_ptr<grpc::Server> _rpcServer;
......
......@@ -56,6 +56,10 @@ void JPSclient::ProcessAgentQueue(Building* building)
{
building->DeletePedestrian(ped);
}
else
{
AgentsQueueOut::Add(ped);
}
}
}
......
......@@ -39,7 +39,7 @@ using namespace std;
// initialize the static variables
double Pedestrian::_globalTime = 0.0;
int Pedestrian::_agentsCreated=0;
int Pedestrian::_agentsCreated=1;
AgentColorMode Pedestrian::_colorMode=BY_VELOCITY;
Pedestrian::Pedestrian()
......@@ -101,6 +101,10 @@ Pedestrian::~Pedestrian()
void Pedestrian::SetID(int i)
{
_id = i;
if(i<=0)
{
cout<<"invalid ID"<<i<<endl;exit(0);
}
}
void Pedestrian::SetRoomID(int i, string roomCaption)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment