Commit 848e9dec authored by Mohcine Chraibi's avatar Mohcine Chraibi

rremove duplicate code

parent 18d84d6e
Pipeline #14152 passed with stages
in 5 minutes and 46 seconds
...@@ -475,28 +475,27 @@ bool Building::RemoveOverlappingDoors(const std::shared_ptr<SubRoom>& subroom) c ...@@ -475,28 +475,27 @@ bool Building::RemoveOverlappingDoors(const std::shared_ptr<SubRoom>& subroom) c
isBigWall = true; // mark walls as big isBigWall = true; // mark walls as big
double dist_pt1 = (wall.GetPoint1() - e->GetPoint1()).NormSquare(); double dist_pt1 = (wall.GetPoint1() - e->GetPoint1()).NormSquare();
double dist_pt2 = (wall.GetPoint1() - e->GetPoint2()).NormSquare(); double dist_pt2 = (wall.GetPoint1() - e->GetPoint2()).NormSquare();
Point A, B;
if(dist_pt1<dist_pt2) if(dist_pt1<dist_pt2)
{ {
Wall NewWall(wall.GetPoint1(), e->GetPoint1()); A = e->GetPoint1();
Wall NewWall1(wall.GetPoint2(), e->GetPoint2()); B = e->GetPoint2();
std::cout << " 1 --> Wall replaced by: " << std::endl;
NewWall.WriteToErrorLog();
NewWall1.WriteToErrorLog();
// add new lines to be controled against overlap with exits
walls.push_back(NewWall);
walls.push_back(NewWall1);
} }
else else
{ {
Wall NewWall(wall.GetPoint1(), e->GetPoint2()); A = e->GetPoint2();
Wall NewWall1(wall.GetPoint2(), e->GetPoint1()); B = e->GetPoint1();
std::cout << " 2 --> Wall replaced by:" << std::endl;
NewWall.WriteToErrorLog();
NewWall1.WriteToErrorLog();
// add new lines to be controled against overlap with exits
walls.push_back(NewWall);
walls.push_back(NewWall1);
} }
Wall NewWall(wall.GetPoint1(), A);
Wall NewWall1(wall.GetPoint2(), B);
std::cout << " --> Wall replaced by: " << std::endl;
NewWall.WriteToErrorLog();
NewWall1.WriteToErrorLog();
// add new lines to be controled against overlap with exits
walls.push_back(NewWall);
walls.push_back(NewWall1);
subroom->RemoveWall(wall); subroom->RemoveWall(wall);
exits.erase(e); // we don't need to check this exit again exits.erase(e); // we don't need to check this exit again
break; // we are done with this wall. get next wall. break; // we are done with this wall. get next wall.
......
...@@ -207,15 +207,15 @@ bool SubRoom::AddWall(const Wall& w) ...@@ -207,15 +207,15 @@ bool SubRoom::AddWall(const Wall& w)
{ {
if(w==w1) if(w==w1)
{ {
Log->Write("WARNING:\t Subroom::AddWall, Wall %s already exists in Room/Subroom %d/%d. Won't AddWall.",_roomID,_id ,w.toString().c_str()); // Log->Write("WARNING:\t Subroom::AddWall, Wall %s already exists in Room/Subroom %d/%d. Won't AddWall.",_roomID,_id ,w.toString().c_str());
return false; return false;
} }
} }
//checking for wall chunks. //checking for wall chunks.
if(w.Length()<J_TOLERANZ) if(w.Length()<J_TOLERANZ)
{ {
Log->Write("WARNING:\t Subroom::AddWall, Wall too small (length = %lf) in Room/Subroom %d/%d %s. Won't AddWall.",w.Length(),_roomID,_id ,w.toString().c_str()); // Log->Write("WARNING:\t Subroom::AddWall, Wall too small (length = %lf) in Room/Subroom %d/%d %s. Won't AddWall.",w.Length(),_roomID,_id ,w.toString().c_str());
Log->Write("ERROR:\t will not be added"); // Log->Write("ERROR:\t will not be added");
return false; return false;
} }
_walls.push_back(w); _walls.push_back(w);
......
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