newer standards prefer nullptr over NULL - this is most of them but there are others too

This commit is contained in:
DarthArgus
2016-02-11 15:16:14 -06:00
parent a7f2d0ea6a
commit 3e4cc36e7e
937 changed files with 14983 additions and 14983 deletions
@@ -25,10 +25,10 @@ DynamicPathGraph::~DynamicPathGraph()
clear();
delete m_nodeList;
m_nodeList = NULL;
m_nodeList = nullptr;
delete m_dirtyNodes;
m_dirtyNodes = NULL;
m_dirtyNodes = nullptr;
}
// ----------
@@ -72,7 +72,7 @@ int DynamicPathGraph::getEdgeCount ( int nodeIndex ) const
{
DynamicPathNode const * node = _getNode(nodeIndex);
if(node == NULL)
if(node == nullptr)
{
return 0;
}
@@ -86,13 +86,13 @@ PathEdge * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex )
{
DynamicPathNode * node = _getNode(nodeIndex);
if(node != NULL)
if(node != nullptr)
{
return node->getEdge(edgeIndex);
}
else
{
return NULL;
return nullptr;
}
}
@@ -100,13 +100,13 @@ PathEdge const * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) cons
{
DynamicPathNode const * node = _getNode(nodeIndex);
if(node != NULL)
if(node != nullptr)
{
return node->getEdge(edgeIndex);
}
else
{
return NULL;
return nullptr;
}
}
@@ -114,7 +114,7 @@ PathEdge const * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) cons
int DynamicPathGraph::addNode ( DynamicPathNode * newNode )
{
if(newNode == NULL) return -1;
if(newNode == nullptr) return -1;
int listSize = m_nodeList->size();
@@ -124,7 +124,7 @@ int DynamicPathGraph::addNode ( DynamicPathNode * newNode )
{
for(int i = 0; i < listSize; i++)
{
if(m_nodeList->at(i) == NULL)
if(m_nodeList->at(i) == nullptr)
{
nodeIndex = i;
break;
@@ -155,11 +155,11 @@ void DynamicPathGraph::removeNode ( int nodeIndex )
DynamicPathNode * node = _getNode(nodeIndex);
if(node != NULL)
if(node != nullptr)
{
unlinkNode(nodeIndex);
m_nodeList->at(nodeIndex) = NULL;
m_nodeList->at(nodeIndex) = nullptr;
delete node;
@@ -171,7 +171,7 @@ void DynamicPathGraph::moveNode ( int nodeIndex, Vector const & newPosition )
{
DynamicPathNode * node = _getNode(nodeIndex);
if(node != NULL)
if(node != nullptr)
{
node->setPosition_p(newPosition);
@@ -230,7 +230,7 @@ void DynamicPathGraph::unlinkNode ( int nodeIndex )
{
DynamicPathNode * node = _getNode(nodeIndex);
if(node == NULL) return;
if(node == nullptr) return;
// ----------
@@ -254,7 +254,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex )
{
DynamicPathNode * nodeA = _getNode(nodeIndex);
if(nodeA == NULL) return;
if(nodeA == nullptr) return;
// ----------
@@ -268,7 +268,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex )
{
DynamicPathNode * nodeB = _getNode(i);
if(nodeB == NULL) continue;
if(nodeB == nullptr) continue;
if(nodeA == nodeB) continue;
Vector const & posA = nodeA->getPosition_p();
@@ -314,7 +314,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex )
{
DynamicPathNode * neighborNode = _getNode(neighborList[i]);
if(neighborNode != NULL)
if(neighborNode != nullptr)
{
neighborNode->markRedundantEdges();
neighborNode->removeMarkedEdges();
@@ -326,7 +326,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex )
DynamicPathNode * DynamicPathGraph::_getNode ( int nodeIndex )
{
if(nodeIndex == -1) return NULL;
if(nodeIndex == -1) return nullptr;
return m_nodeList->at(nodeIndex);
}
@@ -335,7 +335,7 @@ DynamicPathNode * DynamicPathGraph::_getNode ( int nodeIndex )
DynamicPathNode const * DynamicPathGraph::_getNode ( int nodeIndex ) const
{
if(nodeIndex == -1) return NULL;
if(nodeIndex == -1) return nullptr;
return m_nodeList->at(nodeIndex);
}
@@ -20,7 +20,7 @@ class DynamicPathNode;
// and remove nodes on the fly (such as city graphs)
// DynamicPathGraph uses a sparse array to store its nodes. Calling
// getNode with a nodeIndex in [0,nodeCount) may return NULL. If you
// getNode with a nodeIndex in [0,nodeCount) may return nullptr. If you
// want to know the number of live nodes in the graph, call getLiveNodeCount.
class DynamicPathGraph : public PathGraph
@@ -105,7 +105,7 @@ bool DynamicPathNode::removeEdge ( int nodeIndex )
{
DynamicPathNode * neighbor = _getGraph()->_getNode(nodeIndex);
if(neighbor == NULL) return false;
if(neighbor == nullptr) return false;
if(!_removeEdge(nodeIndex)) return false;
@@ -175,8 +175,8 @@ int DynamicPathNode::markRedundantEdges ( void ) const
PathEdge const * edgeA = getEdge(i);
PathEdge const * edgeB = getEdge(j);
if(edgeA == NULL) continue;
if(edgeB == NULL) continue;
if(edgeA == nullptr) continue;
if(edgeB == nullptr) continue;
int iA = edgeA->getIndexA();
int iB = edgeA->getIndexB();
@@ -69,7 +69,7 @@ int PathGraph::findNode ( PathNodeType type, int key ) const
if(getEdgeCount(i) == 0) continue;
if((node != NULL) && (node->getType() == type) && (node->getKey() == key))
if((node != nullptr) && (node->getType() == type) && (node->getKey() == key))
{
return i;
}
@@ -88,7 +88,7 @@ int PathGraph::findEntrance ( int key ) const
{
PathNode const * node = getNode(i);
if(node == NULL) continue;
if(node == nullptr) continue;
if(getEdgeCount(i) == 0) continue;
@@ -119,7 +119,7 @@ int PathGraph::findNearestNode ( Vector const & position_p ) const
{
PathNode const * node = getNode(i);
if(node == NULL) continue;
if(node == nullptr) continue;
if(getEdgeCount(i) == 0) continue;
@@ -148,7 +148,7 @@ int PathGraph::findNearestNode ( PathNodeType searchType, Vector const & positio
{
PathNode const * node = getNode(i);
if(node == NULL) continue;
if(node == nullptr) continue;
if(getEdgeCount(i) == 0) continue;
@@ -180,7 +180,7 @@ void PathGraph::findNodesInRange ( Vector const & position_p, float range, PathN
{
PathNode const * node = getNode(i);
if(node == NULL) continue;
if(node == nullptr) continue;
if(getEdgeCount(i) == 0) continue;
@@ -14,7 +14,7 @@
// ======================================================================
PathGraphIterator::PathGraphIterator ()
: m_graph(NULL),
: m_graph(nullptr),
m_nodeIndex(-1)
{
}
@@ -29,18 +29,18 @@ PathGraphIterator::PathGraphIterator ( PathGraph const * graph, int nodeIndex )
bool PathGraphIterator::isValid ( void ) const
{
return (m_graph != NULL) && (m_nodeIndex != -1) && (m_graph->getNode(m_nodeIndex) != NULL);
return (m_graph != nullptr) && (m_nodeIndex != -1) && (m_graph->getNode(m_nodeIndex) != nullptr);
}
PathNode const * PathGraphIterator::getNode ( void ) const
{
if( (m_graph != NULL) && (m_nodeIndex != -1) )
if( (m_graph != nullptr) && (m_nodeIndex != -1) )
{
return m_graph->getNode( m_nodeIndex );
}
else
{
return NULL;
return nullptr;
}
}
@@ -53,7 +53,7 @@ int PathGraphIterator::getNeighborCount ( void ) const
PathNode const * PathGraphIterator::getNeighbor ( int whichNeighbor ) const
{
if(!isValid()) return NULL;
if(!isValid()) return nullptr;
return m_graph->getNode( m_graph->getEdge( m_nodeIndex, whichNeighbor )->getIndexB() );
}
@@ -13,7 +13,7 @@
// ======================================================================
PathNode::PathNode()
: m_graph(NULL),
: m_graph(nullptr),
m_index(-1),
m_id(-1),
m_key(-1),
@@ -27,7 +27,7 @@ PathNode::PathNode()
}
PathNode::PathNode ( Vector const & position )
: m_graph(NULL),
: m_graph(nullptr),
m_index(-1),
m_id(-1),
m_key(-1),
@@ -137,7 +137,7 @@ MEMORY_BLOCK_MANAGER_IMPLEMENTATION_WITH_INSTALL(PathSearchNode, true, 0, 0, 0);
PathSearchNode::PathSearchNode ( PathSearch * search, PathGraph const * graph, PathNode const * node )
: m_search(search),
m_parent(NULL),
m_parent(nullptr),
m_graph(graph),
m_node(node),
m_queued(false),
@@ -164,13 +164,13 @@ PathSearchNode * PathSearchNode::getNeighbor ( int whichNeighbor )
PathNode const * neighborNode = m_graph->getNode(neighborIndex);
if(neighborNode != NULL)
if(neighborNode != nullptr)
{
return getSearchNode(neighborNode);
}
else
{
return NULL;
return nullptr;
}
}
@@ -180,7 +180,7 @@ PathSearchNode * PathSearchNode::createSearchNode( PathNode const * node )
{
// doing bad voodoo with the node marks
PathSearchNode * oldNode = NULL;
PathSearchNode * oldNode = nullptr;
int mark = node->getMark(3);
@@ -206,7 +206,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node )
{
// doing bad voodoo with the node marks
PathSearchNode * searchNode = NULL;
PathSearchNode * searchNode = nullptr;
int mark = node->getMark(3);
@@ -215,7 +215,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node )
searchNode = (PathSearchNode*)((void*)mark);
}
if(searchNode == NULL)
if(searchNode == nullptr)
{
return createSearchNode(node);
}
@@ -305,9 +305,9 @@ void PathSearch::install()
// ----------------------------------------------------------------------
PathSearch::PathSearch ( void )
: m_graph(NULL),
m_start(NULL),
m_goal(NULL),
: m_graph(nullptr),
m_start(nullptr),
m_goal(nullptr),
m_multiGoal(false),
m_goals(new NodeList()),
m_queue(new PathSearchQueue()),
@@ -321,16 +321,16 @@ PathSearch::PathSearch ( void )
PathSearch::~PathSearch()
{
delete m_goals;
m_goals = NULL;
m_goals = nullptr;
delete m_queue;
m_queue = NULL;
m_queue = nullptr;
delete m_path;
m_path = NULL;
m_path = nullptr;
delete m_visitedNodes;
m_visitedNodes = NULL;
m_visitedNodes = nullptr;
}
// ----------------------------------------------------------------------
@@ -361,7 +361,7 @@ PathSearchNode * PathSearch::search ( void )
{
PathSearchNode * neighbor = node->getNeighbor(i);
if(neighbor != NULL)
if(neighbor != nullptr)
{
float newCost = node->getCost() + costBetween(node->getPathNode(),neighbor->getPathNode());
@@ -377,7 +377,7 @@ PathSearchNode * PathSearch::search ( void )
}
}
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
@@ -395,8 +395,8 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, int goalIndex
m_goal = graph->getNode(goalIndex);
m_multiGoal = false;
if(m_start == NULL) return false;
if(m_goal == NULL) return false;
if(m_start == nullptr) return false;
if(m_goal == nullptr) return false;
m_path->clear();
@@ -429,7 +429,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con
int goalCount = goalIndices.size();
if(goalCount == 0) return false;
if(m_start == NULL) return false;
if(m_start == nullptr) return false;
m_goals->resize(goalCount);
@@ -455,7 +455,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con
bool PathSearch::buildPath ( PathSearchNode * endNode )
{
if( endNode == NULL )
if( endNode == nullptr )
{
m_path->clear();
return false;
@@ -633,13 +633,13 @@ IndexList const & PathSearch::getPath ( void ) const
bool PathSearch::atGoal ( PathSearchNode * searchNode ) const
{
if(searchNode == NULL) return false;
if(searchNode == nullptr) return false;
if(m_multiGoal)
{
PathNode const * pathNode = searchNode->getPathNode();
if(pathNode == NULL) return false;
if(pathNode == nullptr) return false;
return std::find( m_goals->begin(), m_goals->end(), pathNode ) != m_goals->end();
}
@@ -69,7 +69,7 @@ BaseClass * Pathfinding::graphFactory ( Iff & iff )
{
DEBUG_WARNING(true,("Pathfinding::graphFactory - Don't know how to construct a path graph from the IFF in %s\n",iff.getFileName()));
return NULL;
return nullptr;
}
}
@@ -67,7 +67,7 @@ int findNeighbor ( PathNode * node, PathNodeType neighborType, int neighborKey )
BaseClass * expandBuildingGraph ( PortalPropertyTemplate * portalTemplate, BaseClass * baseBuildingGraph )
{
if(baseBuildingGraph == NULL) return NULL;
if(baseBuildingGraph == nullptr) return nullptr;
SimplePathGraph * buildingGraph = safe_cast<SimplePathGraph*>(baseBuildingGraph);
@@ -92,11 +92,11 @@ BaseClass * expandBuildingGraph ( PortalPropertyTemplate * portalTemplate, BaseC
FloorMesh const * floorMesh = cell->getFloorMesh();
if(floorMesh == NULL) continue;
if(floorMesh == nullptr) continue;
PathGraph const * cellGraph = safe_cast<PathGraph const *>(floorMesh->getPathGraph());
if(cellGraph == NULL) continue;
if(cellGraph == nullptr) continue;
// ----------
@@ -39,7 +39,7 @@ void readArray_Class ( Iff & iff, T * & array, Tag tag )
{
int count = iff.read_int32();
if(array == NULL) array = new T();
if(array == nullptr) array = new T();
array->resize(count);
@@ -58,7 +58,7 @@ void readArray_Class ( Iff & iff, T * & array, Tag tag, Reader R )
{
int count = iff.read_int32();
if(array == NULL) array = new T();
if(array == nullptr) array = new T();
array->resize(count);
@@ -77,7 +77,7 @@ void readArray_Struct ( Iff & iff, T * & array, Tag tag )
{
int count = iff.read_int32();
if(array == NULL) array = new T();
if(array == nullptr) array = new T();
array->resize(count);
@@ -157,7 +157,7 @@ SimplePathGraph::SimplePathGraph ( PathGraphType type )
{
#ifdef _DEBUG
m_debugLines = NULL;
m_debugLines = nullptr;
#endif
}
@@ -181,7 +181,7 @@ SimplePathGraph::SimplePathGraph( SimplePathGraph::NodeList * nodes, SimplePathG
#ifdef _DEBUG
m_debugLines = NULL;
m_debugLines = nullptr;
#endif
}
@@ -189,21 +189,21 @@ SimplePathGraph::SimplePathGraph( SimplePathGraph::NodeList * nodes, SimplePathG
SimplePathGraph::~SimplePathGraph()
{
delete m_nodes;
m_nodes = NULL;
m_nodes = nullptr;
delete m_edges;
m_edges = NULL;
m_edges = nullptr;
delete m_edgeCounts;
m_edgeCounts = NULL;
m_edgeCounts = nullptr;
delete m_edgeStarts;
m_edgeStarts = NULL;
m_edgeStarts = nullptr;
#ifdef _DEBUG
delete m_debugLines;
m_debugLines = NULL;
m_debugLines = nullptr;
#endif
}
@@ -265,7 +265,7 @@ PathNode * SimplePathGraph::getNode ( int nodeIndex )
if (static_cast<unsigned int>(nodeIndex) < m_nodes->size())
return &m_nodes->at(nodeIndex);
return NULL;
return nullptr;
}
PathNode const * SimplePathGraph::getNode ( int nodeIndex ) const
@@ -273,7 +273,7 @@ PathNode const * SimplePathGraph::getNode ( int nodeIndex ) const
if (static_cast<unsigned int>(nodeIndex) < m_nodes->size())
return &m_nodes->at(nodeIndex);
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
@@ -507,7 +507,7 @@ void SimplePathGraph::drawDebugShapes ( DebugShapeRenderer * renderer ) const
#ifdef _DEBUG
if(renderer == NULL) return;
if(renderer == nullptr) return;
if( m_debugLines ) renderer->drawLineList( *m_debugLines, VectorArgb::solidYellow );