mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-28 22:15:49 -04:00
fix a mem leak and some other "potential issues" clang found
This commit is contained in:
@@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user