diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp index 11000b37..c430246c 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp @@ -424,12 +424,12 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const { DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has an edge to a non-existent node\n")); insaneCount++; - } - - if(!neighborNode->hasEdge(getIndex())) - { - DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has a one-way edge to another node\n")); - insaneCount++; + } else { + if(!neighborNode->hasEdge(getIndex())) + { + DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has a one-way edge to another node\n")); + insaneCount++; + } } } diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp index 109ba9c4..c4abfb29 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp @@ -1141,30 +1141,31 @@ void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const float dist2 = REAL_MAX; - if(m_path && !m_path->empty()) dist2 = m_path->back().getPosition_w().magnitudeBetweenSquared(loc.getPosition_w()); + if(m_path && !m_path->empty()) { + dist2 = m_path->back().getPosition_w().magnitudeBetweenSquared(loc.getPosition_w()); - if(dist2 > 0.01) - { - // jitter the node if it's a city waypoint - - if(m_enableJitter && (node->getType() == PNT_CityWaypoint)) + if(dist2 > 0.01) { - Vector offset = Vector::zero; - - do + // jitter the node if it's a city waypoint + if(m_enableJitter && (node->getType() == PNT_CityWaypoint)) { - offset = Vector( Random::randomReal(-1.0f,1.0f), 0.0f, Random::randomReal(-1.0f,1.0f) ); + Vector offset = Vector::zero; + + do + { + offset = Vector( Random::randomReal(-1.0f,1.0f), 0.0f, Random::randomReal(-1.0f,1.0f) ); + } + while(offset.magnitudeSquared() > 1.0f); + + static float tweakValue = 1.0f; + + offset *= tweakValue; + + loc.setPosition_p( loc.getPosition_p() + offset ); } - while(offset.magnitudeSquared() > 1.0f); - - static float tweakValue = 1.0f; - - offset *= tweakValue; - - loc.setPosition_p( loc.getPosition_p() + offset ); + + m_path->push_back(loc); } - - m_path->push_back(loc); } } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp index 23b456d5..c88155a8 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp @@ -1942,8 +1942,10 @@ std::string name; { // we need to read the next line to continue parsing line = goToNextLine(); - if (line == CHAR_ERROR) + if (line == CHAR_ERROR) { + delete newData; return line; + } } line = parseDynamicVariableParameterList(*newData, line); }