Commit f9d9783a authored by Mohcine Chraibi's avatar Mohcine Chraibi

Use FindRoute in sources

Better error messages by missing components
parent 61036989
Pipeline #14018 passed with stages
in 5 minutes and 51 seconds
......@@ -1143,8 +1143,7 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag
else if ((strategy == "smoke") &&
(std::find(usedRouter.begin(), usedRouter.end(), id) != usedRouter.end()) ) {
#ifndef JPSFIRE
std::cerr << "\nCan not use smoke router without jpsfire.\n";
std::cerr << "\nCan not use smoke router without jpsfire. Rerun cmake with option -DJPSFIRE=true and recompile.\n";
exit(EXIT_FAILURE);
#endif
Router *r = new SmokeRouter(id, ROUTING_SMOKE);
......@@ -1165,6 +1164,9 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag
///Parsing additional options
if (!ParseAIOpts(e))
return false;
#else
std::cerr << "\nCan not use AI Router. Rerun cmake with option -DAIROUTER=true and recompile.\n";
exit(EXIT_FAILURE);
#endif
}
else if ((strategy == "ff_global_shortest") &&
......
......@@ -194,13 +194,16 @@ void AgentsSource::GenerateAgents(std::vector<Pedestrian*>& peds, int count, Bui
{
//std::cout << "AgentsSource::GenerateAgents Generates an Agent\n";
auto ped = GetStartDistribution()->GenerateAgent(building, &pid,emptyPositions);
// here actually the router should initialize again
//
auto transitions = building->GetAllTransitions();
auto transition = transitions[0]; //dummy
int trans_ID = transition->GetID();
ped->SetExitLine(transition); // set dummy line
ped->SetExitIndex(trans_ID);
if(ped->FindRoute()==-1) {
Log->Write("WARNING: Can not set destination for source agent %d", ped->GetID());
// Sometimes the router can not find a target for ped
auto transitions = building->GetAllTransitions();
auto transition = transitions[0]; //dummy
int trans_ID = transition->GetID();
ped->SetExitLine(transition); // set dummy line
ped->SetExitIndex(trans_ID);
}
//
peds.push_back(ped);
}
......
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