From ce9949a20544bc7dd005c1a83e7ba4b58bde19f0 Mon Sep 17 00:00:00 2001
From: Oliver Schmidts <schmidts.oli@gmail.com>
Date: Fri, 24 Jul 2015 23:58:54 +0200
Subject: [PATCH] fixes for 0.8 visual studio compiler

---
 geometry/Building.cpp          |  2 +-
 geometry/Line.cpp              |  4 ++--
 geometry/SubRoom.cpp           | 10 +++++-----
 main.cpp                       |  2 +-
 pedestrian/AgentsSource.cpp    |  2 +-
 pedestrian/AgentsSource.h      |  3 ++-
 routing/GlobalRouter.cpp       |  2 +-
 routing/GlobalRouter.h         |  2 +-
 routing/QuickestPathRouter.cpp |  2 +-
 9 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/geometry/Building.cpp b/geometry/Building.cpp
index f7e30276..6b7ce4cb 100644
--- a/geometry/Building.cpp
+++ b/geometry/Building.cpp
@@ -972,7 +972,7 @@ bool Building::IsVisible(const Point& p1, const Point& p2, const std::vector<Sub
      {
           for(auto&& sub: subrooms)
           {
-               if(sub and sub->IsVisible(p1,p2,considerHlines)==false) return false;
+               if(sub && sub->IsVisible(p1,p2,considerHlines)==false) return false;
           }
      }
 
diff --git a/geometry/Line.cpp b/geometry/Line.cpp
index e47fe2a7..0d0d3954 100644
--- a/geometry/Line.cpp
+++ b/geometry/Line.cpp
@@ -263,13 +263,13 @@ bool Line::Overlapp(const Line& l) const
      if(fabs(vecAB.Determinant(vecDC))<J_EPS)
      {
 
-          if( IsInLineSegment(l.GetPoint1()) and  not  HasEndPoint(l.GetPoint1()))
+          if( IsInLineSegment(l.GetPoint1()) &&  !HasEndPoint(l.GetPoint1()))
           {
                //Log->Write("ERROR: 1. Overlapping walls %s and %s ", toString().c_str(),l.toString().c_str());
                return true;
           }
 
-          if( IsInLineSegment(l.GetPoint2()) and not HasEndPoint(l.GetPoint2()))
+          if( IsInLineSegment(l.GetPoint2()) && !HasEndPoint(l.GetPoint2()))
           {
                //Log->Write("ERROR: 2. Overlapping walls %s and %s ", toString().c_str(),l.toString().c_str());
                return true;
diff --git a/geometry/SubRoom.cpp b/geometry/SubRoom.cpp
index 6ba8d49c..e75a8bc8 100644
--- a/geometry/SubRoom.cpp
+++ b/geometry/SubRoom.cpp
@@ -191,7 +191,7 @@ bool SubRoom::AddTransition(Transition* line)
 
 void SubRoom::AddNeighbor(SubRoom* sub)
 {
-     if(sub and (IsElementInVector(_neighbors, sub)==false))
+     if(sub && (IsElementInVector(_neighbors, sub)==false))
      {
           _neighbors.push_back(sub);
      }
@@ -541,7 +541,7 @@ bool SubRoom::SanityCheck()
                     exit(EXIT_FAILURE);
                     //return false;
                }
-               connected=connected or w1.ShareCommonPointWith(w2);
+               connected=connected || w1.ShareCommonPointWith(w2);
           }
           //overlapping with lines
           for(auto&& hline: _hlines)
@@ -562,7 +562,7 @@ bool SubRoom::SanityCheck()
                     exit(EXIT_FAILURE);
                     //return false;
                }
-               connected=connected or w1.ShareCommonPointWith(*c);
+               connected=connected || w1.ShareCommonPointWith(*c);
           }
           //overlaping with transitions
           for(auto&& t: _transitions)
@@ -573,10 +573,10 @@ bool SubRoom::SanityCheck()
                     exit(EXIT_FAILURE);
                     //return false;
                }
-               connected=connected or w1.ShareCommonPointWith(*t);
+               connected=connected || w1.ShareCommonPointWith(*t);
           }
 
-          if(not connected)
+          if(!connected)
           {
                Log->Write("ERROR: loose wall found %s  in Room/Subroom %d/%d",w1.toString().c_str(),_roomID,_id);
                exit(EXIT_FAILURE);
diff --git a/main.cpp b/main.cpp
index 6508a342..60f823fb 100644
--- a/main.cpp
+++ b/main.cpp
@@ -25,7 +25,7 @@
  *
  *
  **/
-
+#define NOMINMAX
 #include "geometry/Building.h"
 #include "general/ArgumentParser.h"
 #include "./Simulation.h"
diff --git a/pedestrian/AgentsSource.cpp b/pedestrian/AgentsSource.cpp
index 3467a538..4ebaf93f 100644
--- a/pedestrian/AgentsSource.cpp
+++ b/pedestrian/AgentsSource.cpp
@@ -93,7 +93,7 @@ void AgentsSource::SetAgentsGenerated(int agentsGenerated)
 
 const double* AgentsSource::GetBoundaries() const
 {
-     return _boundaries;
+     return (_boundaries.data());
 }
 
 void AgentsSource::Setboundaries(double * bounds)
diff --git a/pedestrian/AgentsSource.h b/pedestrian/AgentsSource.h
index 4ed14215..39d4d92e 100644
--- a/pedestrian/AgentsSource.h
+++ b/pedestrian/AgentsSource.h
@@ -33,6 +33,7 @@
 #include <string>
 #include <vector>
 #include <memory>
+#include <array>
 
 class Pedestrian;
 class OutputHandler;
@@ -115,7 +116,7 @@ private:
      int _maxAgents=0;
      int _agentsGenerated=0;
      int _groupID=-1;
-     double _boundaries [4] = {0,0,0,0};
+	 std::array<double, 4> _boundaries = { { 0, 0, 0, 0 } };
      std::string _caption="no caption";
      std::vector<Pedestrian*> _agents;
      std::shared_ptr<StartDistribution> _startDistribution;
diff --git a/routing/GlobalRouter.cpp b/routing/GlobalRouter.cpp
index 518eebc4..7bc79098 100644
--- a/routing/GlobalRouter.cpp
+++ b/routing/GlobalRouter.cpp
@@ -1082,7 +1082,7 @@ void GlobalRouter::WriteGraphGV(string filename, int finalDestination,
           int room_id = from_AP->GetConnectingRoom1();
           int room_id1=from_AP->GetConnectingRoom2();
 
-          if ( (IsElementInVector(rooms_ids, room_id) == false) and (IsElementInVector(rooms_ids, room_id1) == false) )
+          if ( (IsElementInVector(rooms_ids, room_id) == false) && (IsElementInVector(rooms_ids, room_id1) == false) )
                continue;
           double px = from_AP->GetCentre().GetX();
           double py = from_AP->GetCentre().GetY();
diff --git a/routing/GlobalRouter.h b/routing/GlobalRouter.h
index f3cfde6b..bdd980cc 100644
--- a/routing/GlobalRouter.h
+++ b/routing/GlobalRouter.h
@@ -29,7 +29,7 @@
 
 #ifndef GLOBALROUTER_H_
 #define GLOBALROUTER_H_
-
+#define NOMINMAX
 #include <string>
 #include <sstream>
 #include <cfloat>
diff --git a/routing/QuickestPathRouter.cpp b/routing/QuickestPathRouter.cpp
index 410c70a5..3c1bfdef 100644
--- a/routing/QuickestPathRouter.cpp
+++ b/routing/QuickestPathRouter.cpp
@@ -207,7 +207,7 @@ double QuickestPathRouter::TAP (double alpha)
 }
 
 
-int QuickestPathRouter::GetQuickestRoute(Pedestrian*ped, AccessPoint* nearestAP __attribute__((unused)))
+int QuickestPathRouter::GetQuickestRoute(Pedestrian*ped, AccessPoint* nearestAPused)
 {
 
      //int preferredExit=nearestAP->GetNearestTransitAPTO(ped->GetFinalDestination());
-- 
GitLab