Commit 3a883162 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Remove mostly all warnings

parent 7d337875
......@@ -232,7 +232,7 @@ void VelocityModel::ComputeNextTimeStep(double current, double deltaT, Building*
// calculate min spacing
std::sort(spacings.begin(), spacings.end(), sort_pred());
double spacing = spacings[0].first;
double winkel = spacings[0].second;
//double winkel = spacings[0].second;
Point tmp;
Point speed = direction.Normalized() *OptimalSpeed(ped, spacing);
result_acc.push_back(speed);
......
......@@ -699,12 +699,12 @@ void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t,
Triangle& ot = t->NeighborAcross(p);
Point& op = *ot.OppositePoint(*t, p);
if (&ot == NULL) {
// If we want to integrate the fillEdgeEvent do it here
// With current implementation we should never get here
//throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
assert(0);
}
// if (&ot == NULL) {
// // If we want to integrate the fillEdgeEvent do it here
// // With current implementation we should never get here
// //throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
// assert(0);
// }
if (InScanArea(p, *t->PointCCW(p), *t->PointCW(p), op)) {
// Lets rotate shared edge one vertex CW
......@@ -772,12 +772,12 @@ void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle&
Triangle& ot = t.NeighborAcross(p);
Point& op = *ot.OppositePoint(t, p);
if (&t.NeighborAcross(p) == NULL) {
// If we want to integrate the fillEdgeEvent do it here
// With current implementation we should never get here
//throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
assert(0);
}
// if (&t.NeighborAcross(p) == NULL) {
// // If we want to integrate the fillEdgeEvent do it here
// // With current implementation we should never get here
// //throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
// assert(0);
// }
if (InScanArea(eq, *flip_triangle.PointCCW(eq), *flip_triangle.PointCW(eq), op)) {
// flip with new edge op->eq
......
......@@ -40,6 +40,7 @@
#include <chrono>
#include <ctime>
#define UNUSED(x) [&x]{}() // c++11 silence warnings
DirectionStrategy::DirectionStrategy()
{
......@@ -52,13 +53,13 @@ DirectionStrategy::~DirectionStrategy()
/// 1
Point DirectionMiddlePoint::GetTarget(Room* room, Pedestrian* ped) const
{
(void)room; // suppress the unused warning
UNUSED(room); // suppress the unused warning
return (ped->GetExitLine()->GetPoint1() + ped->GetExitLine()->GetPoint2())*0.5;
}
/// 2
Point DirectionMinSeperationShorterLine::GetTarget(Room* room, Pedestrian* ped) const
{
(void)room; // suppress the unused warning
UNUSED(room); // suppress the unused warning
double d = ped->GetEllipse().GetBmin() + 0.1 ; // shoulder//0.5;
const Point& p1 = ped->GetExitLine()->GetPoint1();
......@@ -89,7 +90,7 @@ Point DirectionMinSeperationShorterLine::GetTarget(Room* room, Pedestrian* ped)
/// 3
Point DirectionInRangeBottleneck::GetTarget(Room* room, Pedestrian* ped) const
{
(void)room; // suppress the unused warning
UNUSED(room); // suppress the unused warning
const Point& p1 = ped->GetExitLine()->GetPoint1();
const Point& p2 = ped->GetExitLine()->GetPoint2();
......@@ -279,6 +280,7 @@ Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const
/// 6
Point DirectionFloorfield::GetTarget(Room* room, Pedestrian* ped) const
{
UNUSED(room);
#if DEBUG
if (initDone && (ffviafm != nullptr)) {
#endif // DEBUG
......@@ -350,6 +352,7 @@ DirectionFloorfield::~DirectionFloorfield() {
/// 7
Point DirectionGoalFloorfield::GetTarget(Room* room, Pedestrian* ped) const
{
UNUSED(room);
#if DEBUG
if (initDone && (ffviafm != nullptr)) {
#endif // DEBUG
......@@ -497,8 +500,8 @@ void DirectionLocalFloorfield::Init(Building* buildingArg, double stepsize,
//for (auto& roomPair : building->GetAllRooms()) {
auto roomPairIt = building->GetAllRooms().begin();
std::advance(roomPairIt, i);
locffviafm[(*roomPairIt).first] = new LocalFloorfieldViaFM((*roomPairIt).second.get(), building,
hx, hy, wallAvoidDistance, useDistancefield, "FF_filename");
locffviafm[(*roomPairIt).first] = new LocalFloorfieldViaFM((*roomPairIt).second.get(), building, hx, hy,
wallAvoidDistance, useDistancefield);
}
end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end-start;
......@@ -567,6 +570,7 @@ DirectionLocalFloorfield::~DirectionLocalFloorfield() {
///9
Point DirectionSubLocalFloorfield::GetTarget(Room* room, Pedestrian* ped) const
{
(void)room; // silence warning
#if DEBUG
if (initDone && (ffviafm != nullptr)) {
#endif // DEBUG
......@@ -642,10 +646,8 @@ void DirectionSubLocalFloorfield::Init(Building* buildingArg, double stepsize,
#pragma omp critical
subUIDs.emplace_back(subUID);
Log->Write("Creating SubLocFF at key: %d", subUID);
locffviafm[subUID] = new SubLocalFloorfieldViaFM(
subroomIt->second.get(), building,
hx, hy, wallAvoidDistance, useDistancefield,
"FF_filename");
locffviafm[subUID] = new SubLocalFloorfieldViaFM(subroomIt->second.get(), building, hx, hy,
wallAvoidDistance, useDistancefield);
auto targets = subroomIt->second->GetAllGoalIDs();
for (auto targetUID : targets) {
subAndTarget.emplace_back(std::make_pair(subUID, targetUID));
......
......@@ -1189,9 +1189,9 @@ void FloorfieldViaFM::setSpeed(bool useDistance2WallArg) {
}
}
void FloorfieldViaFM::setSpeedFromLCGrid(double* newspeed) {
// building->GetGrid()->HALLOHIERBINICHAMMONTAG
}
//void FloorfieldViaFM::setSpeedFromLCGrid(double* newspeed) {
//// building->GetGrid()->HALLOHIERBINICHAMMONTAG
//}
void FloorfieldViaFM::calculateFloorfield(std::vector<Line>& targetlines, double* costarray, Point* neggradarray) {
calculateFloorfield(targetlines, costarray, neggradarray, modifiedspeed);
......
......@@ -134,7 +134,7 @@ protected:
RectGrid* grid = nullptr;
std::vector<Line> wall;
std::vector<Line> exitsFromScope;
int numOfExits;
unsigned int numOfExits;
const Building* building;
......
......@@ -819,7 +819,7 @@ int GlobalRouter::GetBestDefaultRandomExit(Pedestrian* ped)
int bestAPsID = -1;
double minDistGlobal = FLT_MAX;
double minDistLocal = FLT_MAX;
//double minDistLocal = FLT_MAX;
// get the opened exits
SubRoom* sub = _building->GetRoom(ped->GetRoomID())->GetSubRoom(
......@@ -829,7 +829,7 @@ int GlobalRouter::GetBestDefaultRandomExit(Pedestrian* ped)
{
AccessPoint* ap=relevantAPs[g];
if (ap->isInRange(sub->GetUID()) == false)
if (!ap->isInRange(sub->GetUID()))
continue;
//check if that exit is open.
if (ap->IsClosed())
......@@ -844,7 +844,7 @@ int GlobalRouter::GetBestDefaultRandomExit(Pedestrian* ped)
//check if visible
//only if the room is convex
//otherwise check all rooms at that level
if(_building->IsVisible(posA, posC, _subroomsAtElevation[sub->GetElevation(sub->GetCentroid())],true)==false)
if(!_building->IsVisible(posA, posC, _subroomsAtElevation[sub->GetElevation(sub->GetCentroid())],true))
{
ped->RerouteIn(10);
continue;
......@@ -857,7 +857,7 @@ int GlobalRouter::GetBestDefaultRandomExit(Pedestrian* ped)
{
bestAPsID = ap->GetID();
minDistGlobal = dist;
minDistLocal=dist2;
//minDistLocal=dist2;
}
}
......@@ -888,7 +888,7 @@ int GlobalRouter::GetBestDefaultRandomExit(Pedestrian* ped)
ped->RerouteIn(5);
return relevantAPs[0]->GetID();
}
//return -1;
return -1;
}
}
......@@ -959,13 +959,13 @@ void GlobalRouter::GetRelevantRoutesTofinalDestination(Pedestrian *ped, vector<A
//the line from the current position to the centre of the nav line.
// at least the line in that direction minus EPS
AccessPoint* ap2=_accessPoints[goals[g2]];
const Point& posA = ped->GetPos();
const Point& posB = ap2->GetNavLine()->GetCentre();
const Point& posC = (posB - posA).Normalized()* ((posA - posB).Norm() - J_EPS) + posA;
const Point& posA_ = ped->GetPos();
const Point& posB_ = ap2->GetNavLine()->GetCentre();
const Point& posC_ = (posB_ - posA_).Normalized()* ((posA_ - posB_).Norm() - J_EPS) + posA_;
//it points to a destination that I can see anyway
if (_building->IsVisible(posA, posC, _subroomsAtElevation[sub->GetElevation(sub->GetCentroid())],true))
//if (sub->IsVisible(posA, posC, true) == true)
if (_building->IsVisible(posA_, posC_, _subroomsAtElevation[sub->GetElevation(sub->GetCentroid())],true))
//if (sub->IsVisible(posA_, posC_, true) == true)
{
relevant=false;
}
......@@ -984,9 +984,8 @@ void GlobalRouter::GetRelevantRoutesTofinalDestination(Pedestrian *ped, vector<A
//fallback
if(relevantAPS.size()==0)
{
//fixme: this should also never happened. But hapen due to previvous bugs..
//fixme: this should also never happened. But happen due to previous bugs..
const vector<int>& goals=sub->GetAllGoalIDs();
auto isinsub = sub->IsInSubRoom(ped);
for(unsigned int g1=0; g1<goals.size(); g1++)
{
relevantAPS.push_back(_accessPoints[goals[g1]]);
......@@ -1082,8 +1081,8 @@ void GlobalRouter::WriteGraphGV(string filename, int finalDestination,
bool isSink = true;
for (unsigned int j = 0; j < from_aps.size(); j++)
{
int room_id = from_aps[j]->GetConnectingRoom1();
if (IsElementInVector(rooms_ids, room_id) == true)
int room_id_ = from_aps[j]->GetConnectingRoom1();
if (IsElementInVector(rooms_ids, room_id_))
{
isSink = false;
break;
......
......@@ -8,8 +8,8 @@ LocalFloorfieldViaFM::LocalFloorfieldViaFM(){};
LocalFloorfieldViaFM::LocalFloorfieldViaFM(const Room* const roomArg,
const Building* buildingArg,
const double hxArg, const double hyArg,
const double wallAvoidDistance, const bool useDistancefield,
const std::string& filename) {
const double wallAvoidDistance, const bool useDistancefield
) {
//ctor
threshold = -1; //negative value means: ignore threshold
threshold = wallAvoidDistance;
......@@ -44,9 +44,9 @@ void LocalFloorfieldViaFM::getDirectionToDestination(Pedestrian* ped,
return;
}
void LocalFloorfieldViaFM::getDirectionToGoalID(const int goalID){
std::cerr << "invalid call to LocalFloorfieldViaFM::getDirectionToGoalID!" << std::endl;
};
//void LocalFloorfieldViaFM::getDirectionToGoalID(const int goalID){
// std::cerr << "invalid call to LocalFloorfieldViaFM::getDirectionToGoalID!" << std::endl;
//};
void LocalFloorfieldViaFM::parseRoom(const Room* const roomArg,
const double hxArg, const double hyArg)
......@@ -177,7 +177,7 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
//std::vector<Line> exits(wall.begin(), wall.begin()+numOfExits);
//grid handeling local vars:
long int iMax = grid->GetiMax();
//long int iMax = grid->GetiMax();
long int iStart, iEnd;
long int jStart, jEnd;
......@@ -212,7 +212,7 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
jDot = jEnd;
xe = iStart;
}
crossOutOutsideNeighbors(jDot*iMax + iDot);
//crossOutOutsideNeighbors(jDot*iMax + iDot);
for (i=0; iDot < xe; ++i) {
++iDot;
if(px<0) {
......@@ -225,7 +225,7 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
}
px+=2*(deltaY1-deltaX1);
}
crossOutOutsideNeighbors(jDot*iMax + iDot);
//crossOutOutsideNeighbors(jDot*iMax + iDot);
}
} else {
if(deltaY>=0) {
......@@ -237,7 +237,7 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
jDot = jEnd;
ye = jStart;
}
crossOutOutsideNeighbors(jDot*iMax + iDot);
//crossOutOutsideNeighbors(jDot*iMax + iDot);
for(i=0; jDot<ye; ++i) {
++jDot;
if (py<=0) {
......@@ -250,7 +250,7 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
}
py+=2*(deltaX1-deltaY1);
}
crossOutOutsideNeighbors(jDot*iMax + iDot);
// crossOutOutsideNeighbors(jDot*iMax + iDot);
}
}
} //loop over all walls
......@@ -282,7 +282,7 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
jDot = jEnd;
xe = iStart;
}
crossOutOutsideNeighbors(jDot*iMax + iDot);
//crossOutOutsideNeighbors(jDot*iMax + iDot);
for (i=0; iDot < xe; ++i) {
++iDot;
if(px<0) {
......@@ -295,7 +295,7 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
}
px+=2*(deltaY1-deltaX1);
}
crossOutOutsideNeighbors(jDot*iMax + iDot);
//crossOutOutsideNeighbors(jDot*iMax + iDot);
}
} else {
if(deltaY>=0) {
......@@ -307,7 +307,7 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
jDot = jEnd;
ye = jStart;
}
crossOutOutsideNeighbors(jDot*iMax + iDot);
//crossOutOutsideNeighbors(jDot*iMax + iDot);
for(i=0; jDot<ye; ++i) {
++jDot;
if (py<=0) {
......@@ -320,14 +320,14 @@ void LocalFloorfieldViaFM::drawBlockerLines() {
}
py+=2*(deltaX1-deltaY1);
}
crossOutOutsideNeighbors(jDot*iMax + iDot);
// crossOutOutsideNeighbors(jDot*iMax + iDot);
}
}
} //loop over all exits
}
void LocalFloorfieldViaFM::crossOutOutsideNeighbors(const long int key){
//@todo Arne: Is this function needed? delete?
//void LocalFloorfieldViaFM::crossOutOutsideNeighbors(const long int key){
// directNeighbor dNeigh = grid->getNeighbors(key);
// long int aux = -1;
//
......@@ -406,7 +406,7 @@ void LocalFloorfieldViaFM::crossOutOutsideNeighbors(const long int key){
//// cost[aux] = -8.;
//// }
//// }
}
//}
int LocalFloorfieldViaFM::isInside(const long int key) {
int temp = 0;
......@@ -431,8 +431,7 @@ SubLocalFloorfieldViaFM::SubLocalFloorfieldViaFM(){};
SubLocalFloorfieldViaFM::SubLocalFloorfieldViaFM(const SubRoom* const roomArg,
const Building* buildingArg,
const double hxArg, const double hyArg,
const double wallAvoidDistance, const bool useDistancefield,
const std::string& filename) {
const double wallAvoidDistance, const bool useDistancefield) {
//ctor
threshold = -1; //negative value means: ignore threshold
threshold = wallAvoidDistance;
......@@ -466,7 +465,7 @@ void SubLocalFloorfieldViaFM::getDirectionToDestination(Pedestrian* ped,
}
void SubLocalFloorfieldViaFM::getDirectionToGoalID(const int goalID){
std::cerr << "invalid call to SubLocalFloorfieldViaFM::getDirectionToGoalID!" << std::endl;
std::cerr << "invalid call to SubLocalFloorfieldViaFM::getDirectionToGoalID with goalID: " << goalID << std::endl;
};
......
......@@ -39,14 +39,12 @@
class LocalFloorfieldViaFM : public FloorfieldViaFM{
public:
LocalFloorfieldViaFM();
LocalFloorfieldViaFM(const Room* const room, const Building* buildingArg,
const double hxArg, const double hyArg,
const double wallAvoidDistance,
const bool useDistancefield, const std::string& filename);
LocalFloorfieldViaFM(const Room* const room, const Building* buildingArg, const double hxArg,
const double hyArg, const double wallAvoidDistance, const bool useDistancefield);
void parseRoom(const Room* const roomArg, const double hxArg, const double hyArg);
void getDirectionToDestination (Pedestrian* ped, Point& direction);
void getDirectionToGoalID(const int goalID);
void getDirectionToDestination (Pedestrian* ped, Point& direction);//@todo hides non-virtual function
// void getDirectionToGoalID(const int goalID);
void drawBlockerLines();
void crossOutOutsideNeighbors(const long int key);
virtual int isInside(const long int key);
......@@ -58,9 +56,7 @@ class SubLocalFloorfieldViaFM : public FloorfieldViaFM{
public:
SubLocalFloorfieldViaFM();
SubLocalFloorfieldViaFM(const SubRoom* const subroom, const Building* buildingArg,
const double hxArg, const double hyArg,
const double wallAvoidDistance,
const bool useDistancefield, const std::string& filename);
const double hxArg, const double hyArg, const double wallAvoidDistance, const bool useDistancefield);
void parseRoom(const SubRoom* const subroomArg, const double hxArg, const double hyArg);
void getDirectionToDestination (Pedestrian* ped, Point& direction);
......
......@@ -465,7 +465,7 @@ NavLine MeshRouter::Funnel(Point& start,Point& goal,vector<MeshEdge*> edge_path)
}//END IF
}
MeshEdge* MeshRouter::Visibility(Point& start,Point& goal,vector<MeshEdge*> edge_path)const
MeshEdge* MeshRouter::Visibility(Point& start, vector<MeshEdge*> edge_path) const
{
//return *(edge_path.begin());
......@@ -601,7 +601,7 @@ vector<MeshEdge*> MeshRouter::AStar(Pedestrian* p,int& status)const
MeshCell* nb_cell=_meshdata->GetCellAtPos(nb_id);
// Calculate
if (nb_cell->GetEdges().size()==3) {
//@todo: What happend in this cas?
}
if (!closedlist[nb_id] && length>0.2) { // neighbour-cell not fully evaluated
//MeshCell* nb_cell=_meshdata->GetCellAtPos(nb_id);
......@@ -613,8 +613,8 @@ vector<MeshEdge*> MeshRouter::AStar(Pedestrian* p,int& status)const
costlist[nb_id]=new_cost;
inopenlist[nb_id]=true;
double f=new_cost+(nb_cell->GetMidpoint()-point_goal).Norm();
openlist.push_back(make_pair(f,nb_cell));
double fc=new_cost+(nb_cell->GetMidpoint()-point_goal).Norm();
openlist.push_back(make_pair(fc,nb_cell));
} else {
if (new_cost<costlist[nb_id]) {
//cout<<"ERROR"<<endl;
......@@ -624,9 +624,9 @@ vector<MeshEdge*> MeshRouter::AStar(Pedestrian* p,int& status)const
// update nb in openlist
for(unsigned int j=0; j<openlist.size(); j++) {
if(openlist.at(i).second->GetID()==nb_id) {
MeshCell* nb_cell=openlist.at(i).second;
double f=new_cost+(nb_cell->GetMidpoint()-point_goal).Norm();
openlist.at(i)=make_pair(f,nb_cell);
MeshCell* nb_cell_=openlist.at(i).second;
double fcost=new_cost+(nb_cell_->GetMidpoint()-point_goal).Norm();
openlist.at(i)=make_pair(fcost,nb_cell_);
break;
}
}
......@@ -834,8 +834,8 @@ void MeshRouter::FixMeshEdges()
MeshEdge* edge=_meshdata->GetEdges().at(i);
if(edge->GetRoom1()==NULL) {
for (int i = 0; i < _building->GetNumberOfRooms(); i++) {
Room* room = _building->GetRoom(i);
for (int numRooms = 0; numRooms < _building->GetNumberOfRooms(); numRooms++) {
Room* room = _building->GetRoom(numRooms);
for (int j = 0; j < room->GetNumberOfSubRooms(); j++) {
SubRoom* sub = room->GetSubRoom(j);
if(sub->IsInSubRoom( edge->GetCentre())) {
......@@ -926,10 +926,10 @@ bool MeshRouter::Init(Building* b)
for(unsigned int i=0; i<countCells; i++) {
double midx,midy;
meshfile>>midx>>midy;
unsigned int countNodes=0;
meshfile>>countNodes;
unsigned int countNodes_=0;
meshfile>>countNodes_;
vector<int> node_id;
for(unsigned int j=0; j<countNodes; j++) {
for(unsigned int j=0; j<countNodes_; j++) {
int tmp;
meshfile>>tmp;
node_id.push_back(tmp);
......
......@@ -41,7 +41,7 @@ private:
std::vector<MeshEdge*> AStar(Pedestrian* p,int& status)const;
NavLine Funnel(Point&,Point&,std::vector<MeshEdge*>)const;
NavLine FunnelRad(Point&,Point&,std::vector<MeshEdge*>);
MeshEdge* Visibility(Point&,Point&,std::vector<MeshEdge*>)const;
MeshEdge* Visibility(Point&, std::vector<MeshEdge*>) const;
std::string GetMeshFileName() const;
void WriteMeshToFile(const std::string& filename);
void FixMeshEdges();
......
......@@ -1007,37 +1007,37 @@ void NavMesh::WriteToFile(std::string fileName)
file<<ngroup_to_size[previousGroup]<<"";
for (unsigned int n=0; n<_nodes.size(); n++) {
JNode* JNode=_nodes[n];
string actualGroup=JNode->pGroup;
JNode* JNode_=_nodes[n];
string actualGroup=JNode_->pGroup;
if(actualGroup!=previousGroup) {
previousGroup=actualGroup;
//file<<"# JNode group"<<endl;
//file<<"# JNode_ group"<<endl;
file<<endl<<previousGroup<<endl;
file<<ngroup_to_size[previousGroup]<<"";
}
//assert(JNode->pObstacles.size()<20);
//assert(JNode->pPortals.size()<20);
//file<<"nodeid "<<JNode->id<<endl;
//assert(JNode_->pObstacles.size()<20);
//assert(JNode_->pPortals.size()<20);
//file<<"nodeid "<<JNode_->id<<endl;
file<<endl;
file<<"\t"<<JNode->pCentroid._x<<" "<<JNode->pCentroid._y<<endl;
file<<"\t"<<JNode->pHull.size()<<" ";
for(unsigned int i=0; i<JNode->pHull.size(); i++) {
file<<JNode->pHull[i].id<<" ";
file<<"\t"<<JNode_->pCentroid._x<<" "<<JNode_->pCentroid._y<<endl;
file<<"\t"<<JNode_->pHull.size()<<" ";
for(unsigned int i=0; i<JNode_->pHull.size(); i++) {
file<<JNode_->pHull[i].id<<" ";
}
file<<endl;
file<<"\t"<<JNode->pNormalVec[0]<<" "<<JNode->pNormalVec[1]<<" "<<JNode->pNormalVec[2]<<endl;
file<<"\t"<<JNode_->pNormalVec[0]<<" "<<JNode_->pNormalVec[1]<<" "<<JNode_->pNormalVec[2]<<endl;
file<<"\t"<<JNode->pPortals.size()<<" ";
for(unsigned int i=0; i<JNode->pPortals.size(); i++) {
file<<JNode->pPortals[i]<<" ";
file<<"\t"<<JNode_->pPortals.size()<<" ";
for(unsigned int i=0; i<JNode_->pPortals.size(); i++) {
file<<JNode_->pPortals[i]<<" ";
}
file<<endl;
file<<"\t"<<JNode->pObstacles.size()<<" ";
for(unsigned int i=0; i<JNode->pObstacles.size(); i++) {
file<<JNode->pObstacles[i]<<" ";
file<<"\t"<<JNode_->pObstacles.size()<<" ";
for(unsigned int i=0; i<JNode_->pObstacles.size(); i++) {
file<<JNode_->pObstacles[i]<<" ";
}
file<<endl;
......@@ -1415,10 +1415,10 @@ void NavMesh::FinalizeAlphaShape()
for (int index=0; index<3; index++) {
Point P0 = Point (tr->GetPoint(index%3)->x,tr->GetPoint(index%3)->y);
Point P1 = Point (tr->GetPoint((index+1)%3)->x,tr->GetPoint((index+1)%3)->y);
Point P0_ = Point (tr->GetPoint(index%3)->x,tr->GetPoint(index%3)->y);
Point P1_ = Point (tr->GetPoint((index+1)%3)->x,tr->GetPoint((index+1)%3)->y);
int edge_id=IsPortal(P0,P1);
int edge_id=IsPortal(P0_,P1_);
if(edge_id != -1) {
//if(IsElementInVector(new_node->pPortals,edge_id)==false)
new_node->pPortals.push_back(edge_id);
......@@ -1430,7 +1430,7 @@ void NavMesh::FinalizeAlphaShape()
e->pNode1=-1;
}
int obstacle_id=IsObstacle(P0,P1);
int obstacle_id=IsObstacle(P0_,P1_);
if(obstacle_id != -1) {
//std::cerr<<"Error: the convexification has created an JObstacle"<<endl;
//if(IsElementInVector(new_node->pObstacles,obstacle_id)==false)
......@@ -1442,8 +1442,8 @@ void NavMesh::FinalizeAlphaShape()
if ((obstacle_id==-1) && (edge_id==-1)) {
JEdge* e= new JEdge();
e->pEnd=*GetVertex(P1);
e->pStart= *GetVertex(P0);
e->pEnd=*GetVertex(P1_);
e->pStart= *GetVertex(P0_);
AddEdge(e);
//invalidate any previous information
......@@ -1509,10 +1509,10 @@ void NavMesh::Finalize()
for (unsigned w = 0; w < walls.size(); w++) {
bool skip=false;
for(unsigned int i=0; i<centroids.size(); i++) {
if(walls[w].DistTo(centroids[i])<25) skip=true;
for(unsigned int j=0; j<centroids.size(); j++) {
if(walls[w].DistTo(centroids[j])<25) skip=true;
}
if(skip==true) continue;
if(skip) continue;
//first attempt
Point P0 = walls[w].GetPoint1();
......@@ -1533,10 +1533,10 @@ void NavMesh::Finalize()
if(transitions[t]->GetSubRoom2() != NULL) continue;
bool skip=false;
for(unsigned int i=0; i<centroids.size(); i++) {
if(transitions[t]->DistTo(centroids[i])<25) skip=true;
for(unsigned int c=0; c<centroids.size(); c++) {
if(transitions[t]->DistTo(centroids[c])<25) skip=true;
}
if(skip==true) continue;
if(skip) continue;
//first attempt
Point P0 = transitions[t]->GetPoint1();
......@@ -1677,10 +1677,10 @@ void NavMesh::Finalize()
for (int index=0; index<3; index++) {
Point P0 = Point (tr->GetPoint(index%3)->x,tr->GetPoint(index%3)->y);
Point P1 = Point (tr->GetPoint((index+1)%3)->x,tr->GetPoint((index+1)%3)->y);
Point P0_ = Point (tr->GetPoint(index%3)->x,tr->GetPoint(index%3)->y);
Point P1_ = Point (tr->GetPoint((index+1)%3)->x,tr->GetPoint((index+1)%3)->y);
int edge_id=IsPortal(P0,P1);
int edge_id=IsPortal(P0_,P1_);
if(edge_id != -1) {
//if(IsElementInVector(new_node->pPortals,edge_id)==false)
new_node->pPortals.push_back(edge_id);
......@@ -1692,7 +1692,7 @@ void NavMesh::Finalize()
e->pNode1=-1;
}
int obstacle_id=IsObstacle(P0,P1);
int obstacle_id=IsObstacle(P0_,P1_);