diff --git a/Contractor/EdgeBasedGraphFactory.cpp b/Contractor/EdgeBasedGraphFactory.cpp index c4e3f3be4..47d3f4f66 100644 --- a/Contractor/EdgeBasedGraphFactory.cpp +++ b/Contractor/EdgeBasedGraphFactory.cpp @@ -327,9 +327,9 @@ void EdgeBasedGraphFactory::Run(const char * originalEdgeDataFilename, lua_State } TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w, unsigned& penalty, lua_State *myLuaState) const { - double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]); + const double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]); - if( speedProfile.has_turn_function ) { + if( speedProfile.has_turn_penalty_function ) { try { //call lua profile to compute turn penalty penalty = luabind::call_function( myLuaState, "turn_function", 180-angle ); @@ -364,18 +364,19 @@ TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID if( 1 == (_nodeBasedGraph->EndEdges(v) - _nodeBasedGraph->BeginEdges(v)) ) { //No turn possible. return TurnInstructions.NoTurn; - } else { - return TurnInstructions.StayOnRoundAbout; } + return TurnInstructions.StayOnRoundAbout; } //Does turn start or end on roundabout? if(data1.roundabout || data2.roundabout) { //We are entering the roundabout - if( (!data1.roundabout) && data2.roundabout) + if( (!data1.roundabout) && data2.roundabout) { return TurnInstructions.EnterRoundAbout; + } //We are leaving the roundabout - else if(data1.roundabout && (!data2.roundabout) ) + if(data1.roundabout && (!data2.roundabout) ) { return TurnInstructions.LeaveRoundAbout; + } } //If street names stay the same and if we are certain that it is not a roundabout, we skip it. diff --git a/Contractor/EdgeBasedGraphFactory.h b/Contractor/EdgeBasedGraphFactory.h index 76390fbc5..f5d2f6607 100644 --- a/Contractor/EdgeBasedGraphFactory.h +++ b/Contractor/EdgeBasedGraphFactory.h @@ -79,10 +79,10 @@ public: }; struct SpeedProfileProperties{ - SpeedProfileProperties() : trafficSignalPenalty(0), uTurnPenalty(0), has_turn_function(false) {} + SpeedProfileProperties() : trafficSignalPenalty(0), uTurnPenalty(0), has_turn_penalty_function(false) {} int trafficSignalPenalty; int uTurnPenalty; - bool has_turn_function; + bool has_turn_penalty_function; } speedProfile; private: diff --git a/createHierarchy.cpp b/createHierarchy.cpp index 04ade55f4..7156cef32 100644 --- a/createHierarchy.cpp +++ b/createHierarchy.cpp @@ -134,7 +134,7 @@ int main (int argc, char *argv[]) { } speedProfile.uTurnPenalty = 10*lua_tointeger(myLuaState, -1); - speedProfile.has_turn_function = lua_function_exists( myLuaState, "turn_function" ); + speedProfile.has_turn_penalty_function = lua_function_exists( myLuaState, "turn_function" ); std::vector edgeList; NodeID nodeBasedNodeNumber = readBinaryOSRMGraphFromStream(in, edgeList, bollardNodes, trafficLightNodes, &internalToExternalNodeMapping, inputRestrictions);