mirror of
https://github.com/SWG-Source/src.git
synced 2026-08-02 02:15:58 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -72,13 +72,13 @@ CityPathGraph::CityPathGraph ( int cityToken )
|
||||
CityPathGraph::~CityPathGraph()
|
||||
{
|
||||
delete m_namedNodes;
|
||||
m_namedNodes = NULL;
|
||||
m_namedNodes = nullptr;
|
||||
|
||||
delete m_nodeTree;
|
||||
m_nodeTree = NULL;
|
||||
m_nodeTree = nullptr;
|
||||
|
||||
delete m_dirtyBoxes;
|
||||
m_dirtyBoxes = NULL;
|
||||
m_dirtyBoxes = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -92,7 +92,7 @@ int CityPathGraph::addNode ( DynamicPathNode * newNode )
|
||||
int index = DynamicPathGraph::addNode(newNode);
|
||||
|
||||
SpatialHandle * handle = m_nodeTree->addObject( cityNode );
|
||||
if (handle != NULL)
|
||||
if (handle != nullptr)
|
||||
{
|
||||
if (cityNode->getName() != Unicode::emptyString)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ void CityPathGraph::removeNode ( int nodeIndex )
|
||||
|
||||
SpatialHandle * handle = cityNode->getSpatialHandle();
|
||||
|
||||
if (m_namedNodes != NULL)
|
||||
if (m_namedNodes != nullptr)
|
||||
{
|
||||
std::map<Unicode::String, std::set<CityPathNode *> >::iterator found = m_namedNodes->find(cityNode->getName());
|
||||
if (found != m_namedNodes->end())
|
||||
@@ -146,7 +146,7 @@ void CityPathGraph::removeNode ( int nodeIndex )
|
||||
}
|
||||
m_nodeTree->removeObject( handle );
|
||||
|
||||
cityNode->setSpatialHandle(NULL);
|
||||
cityNode->setSpatialHandle(nullptr);
|
||||
|
||||
DynamicPathGraph::removeNode(nodeIndex);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ void CityPathGraph::destroyNode ( int nodeIndex )
|
||||
{
|
||||
CityPathNode * cityNode = _getNode(nodeIndex);
|
||||
|
||||
if(cityNode == NULL) return;
|
||||
if(cityNode == nullptr) return;
|
||||
|
||||
// ----------
|
||||
// Remember which nodes were adjacent to the node we're removing
|
||||
@@ -185,7 +185,7 @@ void CityPathGraph::destroyNode ( int nodeIndex )
|
||||
|
||||
m_nodeTree->removeObject( handle );
|
||||
|
||||
cityNode->setSpatialHandle(NULL);
|
||||
cityNode->setSpatialHandle(nullptr);
|
||||
|
||||
// ----------
|
||||
// Remove the node
|
||||
@@ -217,7 +217,7 @@ void CityPathGraph::moveNode ( int nodeIndex, Vector const & newPosition )
|
||||
{
|
||||
CityPathNode * cityNode = _getNode(nodeIndex);
|
||||
|
||||
if(cityNode == NULL) return;
|
||||
if(cityNode == nullptr) return;
|
||||
|
||||
// ----------
|
||||
// Remember which nodes were adjacent to the node we're removing
|
||||
@@ -272,7 +272,7 @@ void CityPathGraph::relinkNode ( int nodeIndex )
|
||||
{
|
||||
CityPathNode * nodeA = _getNode(nodeIndex);
|
||||
|
||||
if(nodeA == NULL) return;
|
||||
if(nodeA == nullptr) return;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -293,16 +293,16 @@ void CityPathGraph::relinkNode ( int nodeIndex )
|
||||
{
|
||||
CityPathNode * nodeB = _getNode(i);
|
||||
|
||||
if(nodeB == NULL) continue;
|
||||
if(nodeB == nullptr) continue;
|
||||
if(nodeA == nodeB) continue;
|
||||
|
||||
PathNodeType typeB = nodeB->getType();
|
||||
|
||||
if(typeB != PNT_CityBuildingEntrance) continue;
|
||||
|
||||
if(nodeA->getCreatorObject() == NULL) continue;
|
||||
if(nodeA->getCreatorObject() == nullptr) continue;
|
||||
|
||||
if(nodeB->getCreatorObject() == NULL) continue;
|
||||
if(nodeB->getCreatorObject() == nullptr) continue;
|
||||
|
||||
if(nodeA->getCreatorObject() != nodeB->getCreatorObject()) continue;
|
||||
|
||||
@@ -330,16 +330,16 @@ void CityPathGraph::relinkNode ( int nodeIndex )
|
||||
{
|
||||
CityPathNode * nodeB = _getNode(i);
|
||||
|
||||
if(nodeB == NULL) continue;
|
||||
if(nodeB == nullptr) continue;
|
||||
if(nodeA == nodeB) continue;
|
||||
|
||||
PathNodeType typeB = nodeB->getType();
|
||||
|
||||
if(typeB != PNT_CityBuilding) continue;
|
||||
|
||||
if(nodeA->getCreatorObject() == NULL) continue;
|
||||
if(nodeA->getCreatorObject() == nullptr) continue;
|
||||
|
||||
if(nodeB->getCreatorObject() == NULL) continue;
|
||||
if(nodeB->getCreatorObject() == nullptr) continue;
|
||||
|
||||
if(nodeA->getCreatorObject() != nodeB->getCreatorObject()) continue;
|
||||
|
||||
@@ -367,7 +367,7 @@ void CityPathGraph::relinkNode ( int nodeIndex )
|
||||
{
|
||||
CityPathNode * nodeB = static_cast<CityPathNode*>(results[i]);
|
||||
|
||||
if(nodeB == NULL) continue;
|
||||
if(nodeB == nullptr) continue;
|
||||
if(nodeA == nodeB) continue;
|
||||
|
||||
PathNodeType typeB = nodeB->getType();
|
||||
@@ -420,7 +420,7 @@ void CityPathGraph::relinkNode ( int nodeIndex )
|
||||
{
|
||||
CityPathNode * neighborNode = _getNode(neighborList[i]);
|
||||
|
||||
if(neighborNode != NULL)
|
||||
if(neighborNode != nullptr)
|
||||
{
|
||||
neighborNode->markRedundantEdges();
|
||||
neighborNode->removeMarkedEdges();
|
||||
@@ -467,11 +467,11 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object )
|
||||
{
|
||||
CityPathNode * node = _getNode(i);
|
||||
|
||||
if(node == NULL) continue;
|
||||
if(node == nullptr) continue;
|
||||
|
||||
ServerObject const * source = node->getSourceObject();
|
||||
|
||||
if(source == NULL) continue;
|
||||
if(source == nullptr) continue;
|
||||
|
||||
if(source == &object)
|
||||
{
|
||||
@@ -479,7 +479,7 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object )
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -492,11 +492,11 @@ CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & obj
|
||||
{
|
||||
CityPathNode const * node = _getNode(i);
|
||||
|
||||
if(node == NULL) continue;
|
||||
if(node == nullptr) continue;
|
||||
|
||||
ServerObject const * source = node->getSourceObject();
|
||||
|
||||
if(source == NULL) continue;
|
||||
if(source == nullptr) continue;
|
||||
|
||||
if(source == &object)
|
||||
{
|
||||
@@ -504,15 +504,15 @@ CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & obj
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & nodeName, Vector const & pos )
|
||||
{
|
||||
if (m_namedNodes == NULL)
|
||||
return NULL;
|
||||
if (m_namedNodes == nullptr)
|
||||
return nullptr;
|
||||
|
||||
std::map<Unicode::String, std::set<CityPathNode *> >::iterator found = m_namedNodes->find(nodeName);
|
||||
if (found != m_namedNodes->end() && !found->second.empty())
|
||||
@@ -521,12 +521,12 @@ CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & no
|
||||
if (nodes.size() == 1)
|
||||
return *(nodes.begin());
|
||||
|
||||
CityPathNode * node = NULL;
|
||||
CityPathNode * node = nullptr;
|
||||
float distance = FLT_MAX;
|
||||
for (std::set<CityPathNode *>::iterator i = nodes.begin(); i != nodes.end(); ++i)
|
||||
{
|
||||
float testDistance = pos.magnitudeBetweenSquared((*i)->getPosition_w());
|
||||
if (node == NULL || testDistance < distance)
|
||||
if (node == nullptr || testDistance < distance)
|
||||
{
|
||||
distance = testDistance;
|
||||
node = *i;
|
||||
@@ -535,15 +535,15 @@ CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & no
|
||||
return node;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String const & nodeName, Vector const & pos ) const
|
||||
{
|
||||
if (m_namedNodes == NULL)
|
||||
return NULL;
|
||||
if (m_namedNodes == nullptr)
|
||||
return nullptr;
|
||||
|
||||
std::map<Unicode::String, std::set<CityPathNode *> >::const_iterator found = m_namedNodes->find(nodeName);
|
||||
if (found != m_namedNodes->end() && !found->second.empty())
|
||||
@@ -552,12 +552,12 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons
|
||||
if (nodes.size() == 1)
|
||||
return *(nodes.begin());
|
||||
|
||||
CityPathNode const * node = NULL;
|
||||
CityPathNode const * node = nullptr;
|
||||
float distance = FLT_MAX;
|
||||
for (std::set<CityPathNode *>::const_iterator i = nodes.begin(); i != nodes.end(); ++i)
|
||||
{
|
||||
float testDistance = pos.magnitudeBetweenSquared((*i)->getPosition_w());
|
||||
if (node == NULL || testDistance < distance)
|
||||
if (node == nullptr || testDistance < distance)
|
||||
{
|
||||
distance = testDistance;
|
||||
node = *i;
|
||||
@@ -566,14 +566,14 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons
|
||||
return node;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
int CityPathGraph::findNearestNode ( Vector const & position ) const
|
||||
{
|
||||
PathNode * temp = NULL;
|
||||
PathNode * temp = nullptr;
|
||||
|
||||
float dummy1 = REAL_MAX;
|
||||
float dummy2 = REAL_MAX;
|
||||
@@ -713,7 +713,7 @@ int CityPathGraph::getNeighborCode ( int whichNode ) const
|
||||
{
|
||||
CityPathNode const * node = _getNode(whichNode);
|
||||
|
||||
if(node == NULL) return 0;
|
||||
if(node == nullptr) return 0;
|
||||
|
||||
int edgeCount = node->getEdgeCount();
|
||||
|
||||
@@ -725,7 +725,7 @@ int CityPathGraph::getNeighborCode ( int whichNode ) const
|
||||
|
||||
CityPathNode const * neighbor = _getNode(neighborId);
|
||||
|
||||
if(neighbor == NULL) continue;
|
||||
if(neighbor == nullptr) continue;
|
||||
|
||||
int neighborInt = reinterpret_cast<int>(neighbor);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
struct RegionCacheEntry
|
||||
{
|
||||
RegionCacheEntry ( void )
|
||||
: m_shape(), m_graph(NULL)
|
||||
: m_shape(), m_graph(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void CityPathGraphManager::update ( float time )
|
||||
|
||||
CityPathGraph * graph = g_regionCache[g_scrubberGraphIndex].m_graph;
|
||||
|
||||
if(graph == NULL) return;
|
||||
if(graph == nullptr) return;
|
||||
|
||||
if(g_scrubberNodeIndex >= graph->getNodeCount())
|
||||
{
|
||||
@@ -156,7 +156,7 @@ void CityPathGraphManager::update ( float time )
|
||||
|
||||
g_scrubberNodeIndex++;
|
||||
|
||||
if(node == NULL) return;
|
||||
if(node == nullptr) return;
|
||||
|
||||
if(!node->sanityCheck(false))
|
||||
{
|
||||
@@ -233,14 +233,14 @@ Region const * getCityRegionFor( Vector const & position )
|
||||
return results[0];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
int getCityTokenFor ( Region const * region )
|
||||
{
|
||||
if(region == NULL) return -1;
|
||||
if(region == nullptr) return -1;
|
||||
|
||||
Unicode::String const & name = region->getName();
|
||||
|
||||
@@ -294,7 +294,7 @@ bool checkRegionCache ( Vector const & position, CityPathGraph * & outGraph )
|
||||
|
||||
bool addToRegionCache ( MultiShape const & shape, CityPathGraph * graph )
|
||||
{
|
||||
if(graph == NULL) return false;
|
||||
if(graph == nullptr) return false;
|
||||
|
||||
RegionCacheEntry entry(shape,graph);
|
||||
|
||||
@@ -325,12 +325,12 @@ bool addToRegionCache ( AxialBox const & box, CityPathGraph * graph )
|
||||
|
||||
bool addToRegionCache ( Region const * region, CityPathGraph * graph )
|
||||
{
|
||||
if(region == NULL) return false;
|
||||
if(graph == NULL) return false;
|
||||
if(region == nullptr) return false;
|
||||
if(graph == nullptr) return false;
|
||||
|
||||
MxCifQuadTreeBounds const * bounds = ®ion->getBounds();
|
||||
|
||||
if(bounds == NULL) return false;
|
||||
if(bounds == nullptr) return false;
|
||||
|
||||
MxCifQuadTreeCircleBounds const * circleBounds = dynamic_cast<MxCifQuadTreeCircleBounds const *>(bounds);
|
||||
|
||||
@@ -390,7 +390,7 @@ CityPathGraph * createCityGraphFor ( Region const * region )
|
||||
{
|
||||
int token = getCityTokenFor(region);
|
||||
|
||||
if(token == -1) return NULL;
|
||||
if(token == -1) return nullptr;
|
||||
|
||||
CityPathGraph * graph = new CityPathGraph(token);
|
||||
|
||||
@@ -401,7 +401,7 @@ CityPathGraph * createCityGraphFor ( Region const * region )
|
||||
|
||||
CityPathGraph * createCityGraphFor ( ServerObject const * creator, MultiShape const & shape )
|
||||
{
|
||||
if(creator == NULL) return NULL;
|
||||
if(creator == nullptr) return nullptr;
|
||||
|
||||
CityPathGraph * newGraph = new CityPathGraph(-1);
|
||||
|
||||
@@ -416,7 +416,7 @@ CityPathGraph * createCityGraphFor ( ServerObject const * creator, MultiShape co
|
||||
|
||||
CityPathGraph * _getCityGraphFor ( Vector const & position )
|
||||
{
|
||||
CityPathGraph * graph = NULL;
|
||||
CityPathGraph * graph = nullptr;
|
||||
|
||||
if(checkRegionCache(position,graph))
|
||||
{
|
||||
@@ -436,9 +436,9 @@ CityPathGraph * _getCityGraphFor ( Vector const & position )
|
||||
|
||||
CityPathGraph * _getCityGraphFor ( ServerObject const * object )
|
||||
{
|
||||
if(object == NULL)
|
||||
if(object == nullptr)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -450,8 +450,8 @@ CityPathGraph * _getCityGraphFor ( ServerObject const * object )
|
||||
|
||||
CityPathNode * _getCityNodeFor ( ServerObject const * object, CityPathGraph * graph )
|
||||
{
|
||||
if(object == NULL) return NULL;
|
||||
if(graph == NULL) return NULL;
|
||||
if(object == nullptr) return nullptr;
|
||||
if(graph == nullptr) return nullptr;
|
||||
|
||||
return graph->findNodeForObject(*object);
|
||||
}
|
||||
@@ -462,7 +462,7 @@ CityPathNode * _getCityNodeFor ( ServerObject const * object )
|
||||
{
|
||||
CityPathGraph * graph = _getCityGraphFor(object);
|
||||
|
||||
if(graph == NULL) return NULL;
|
||||
if(graph == nullptr) return nullptr;
|
||||
|
||||
return _getCityNodeFor(object,graph);
|
||||
}
|
||||
@@ -471,19 +471,19 @@ CityPathNode * _getCityNodeFor ( ServerObject const * object )
|
||||
|
||||
PathGraph const * _getExteriorGraph ( ServerObject const * object )
|
||||
{
|
||||
if(object == NULL) return NULL;
|
||||
if(object == nullptr) return nullptr;
|
||||
|
||||
CollisionProperty const * collision = object->getCollisionProperty();
|
||||
|
||||
if(collision == NULL) return NULL;
|
||||
if(collision == nullptr) return nullptr;
|
||||
|
||||
Floor const * floor = collision->getFloor();
|
||||
|
||||
if(floor == NULL) return NULL;
|
||||
if(floor == nullptr) return nullptr;
|
||||
|
||||
FloorMesh const * floorMesh = floor->getFloorMesh();
|
||||
|
||||
if(floorMesh == NULL) return NULL;
|
||||
if(floorMesh == nullptr) return nullptr;
|
||||
|
||||
PathGraph const * pathGraph = safe_cast<PathGraph const *>(floorMesh->getPathGraph());
|
||||
|
||||
@@ -507,8 +507,8 @@ CityPathGraph const * CityPathGraphManager::getCityGraphFor ( Vector const & pos
|
||||
CityPathNode const * CityPathGraphManager::getNamedNodeFor( ServerObject const & object, Unicode::String const & nodeName )
|
||||
{
|
||||
CityPathGraph const * cityGraph = getCityGraphFor(&object);
|
||||
if (cityGraph == NULL)
|
||||
return NULL;
|
||||
if (cityGraph == nullptr)
|
||||
return nullptr;
|
||||
|
||||
return cityGraph->findNearestNodeForName(nodeName, object.getPosition_w());
|
||||
}
|
||||
@@ -517,7 +517,7 @@ CityPathNode const * CityPathGraphManager::getNamedNodeFor( ServerObject const &
|
||||
|
||||
bool CityPathGraphManager::getClosestPathNodePos ( ServerObject const * object, Vector & outPos )
|
||||
{
|
||||
if(object == NULL) return false;
|
||||
if(object == nullptr) return false;
|
||||
|
||||
if(object->getParentCell() == CellProperty::getWorldCellProperty())
|
||||
{
|
||||
@@ -548,11 +548,11 @@ bool CityPathGraphManager::getClosestPathNodePos ( ServerObject const * object,
|
||||
|
||||
void CityPathGraphManager::addWaypoint ( ServerObject * sourceObject )
|
||||
{
|
||||
if(sourceObject == NULL) return;
|
||||
if(sourceObject == nullptr) return;
|
||||
|
||||
CityPathGraph * graph = _getCityGraphFor(sourceObject);
|
||||
|
||||
if(graph == NULL)
|
||||
if(graph == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -561,7 +561,7 @@ void CityPathGraphManager::addWaypoint ( ServerObject * sourceObject )
|
||||
|
||||
DynamicVariableList const & objvars = sourceObject->getObjVars();
|
||||
|
||||
CityPathNode * newNode = NULL;
|
||||
CityPathNode * newNode = nullptr;
|
||||
|
||||
Vector sourcePos_w = sourceObject->getPosition_w();
|
||||
|
||||
@@ -626,11 +626,11 @@ void CityPathGraphManager::removeWaypoint ( ServerObject * sourceObject )
|
||||
{
|
||||
CityPathGraph * graph = _getCityGraphFor(sourceObject);
|
||||
|
||||
if(graph == NULL) return;
|
||||
if(graph == nullptr) return;
|
||||
|
||||
CityPathNode * unloadingNode = _getCityNodeFor(sourceObject,graph);
|
||||
|
||||
if(unloadingNode == NULL) return;
|
||||
if(unloadingNode == nullptr) return;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -679,15 +679,15 @@ void CityPathGraphManager::moveWaypoint ( ServerObject * sourceObject, Vector co
|
||||
{
|
||||
UNREF(oldPosition);
|
||||
|
||||
if(sourceObject == NULL) return;
|
||||
if(sourceObject == nullptr) return;
|
||||
|
||||
CityPathGraph * graph = _getCityGraphFor(sourceObject);
|
||||
|
||||
if(graph == NULL) return;
|
||||
if(graph == nullptr) return;
|
||||
|
||||
CityPathNode * node = _getCityNodeFor(sourceObject,graph);
|
||||
|
||||
if(node == NULL) return;
|
||||
if(node == nullptr) return;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -719,11 +719,11 @@ void CityPathGraphManager::moveWaypoint ( ServerObject * sourceObject, Vector co
|
||||
|
||||
void CityPathGraphManager::addBuilding ( BuildingObject * building )
|
||||
{
|
||||
if(building == NULL) return;
|
||||
if(building == nullptr) return;
|
||||
|
||||
CityPathGraph * graph = _getCityGraphFor(building);
|
||||
|
||||
if(graph == NULL)
|
||||
if(graph == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -752,11 +752,11 @@ void CityPathGraphManager::addBuilding ( BuildingObject * building )
|
||||
{
|
||||
ServerObject * serverObject = ServerWorld::findObjectByNetworkId(ids[i]);
|
||||
|
||||
if(serverObject == NULL) continue;
|
||||
if(serverObject == nullptr) continue;
|
||||
|
||||
CityPathNode * node = _getCityNodeFor(serverObject,graph);
|
||||
|
||||
if(node == NULL) continue;
|
||||
if(node == nullptr) continue;
|
||||
|
||||
node->setCreator(building->getNetworkId());
|
||||
}
|
||||
@@ -783,11 +783,11 @@ void CityPathGraphManager::destroyBuilding ( BuildingObject * building )
|
||||
|
||||
void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector const & oldPosition )
|
||||
{
|
||||
if(building == NULL) return;
|
||||
if(building == nullptr) return;
|
||||
|
||||
CityPathGraph * graph = _getCityGraphFor(building);
|
||||
|
||||
if(graph == NULL) return;
|
||||
if(graph == nullptr) return;
|
||||
|
||||
UNREF(oldPosition);
|
||||
|
||||
@@ -800,11 +800,11 @@ void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector cons
|
||||
{
|
||||
ServerObject * serverObject = ServerWorld::findObjectByNetworkId(ids[i]);
|
||||
|
||||
if(serverObject == NULL) continue;
|
||||
if(serverObject == nullptr) continue;
|
||||
|
||||
CityPathNode * node = _getCityNodeFor(serverObject,graph);
|
||||
|
||||
if(node == NULL) continue;
|
||||
if(node == nullptr) continue;
|
||||
|
||||
Vector relativePos_o = node->getRelativePosition_o();
|
||||
|
||||
@@ -851,7 +851,7 @@ bool CityPathGraphManager::destroyPathGraph ( ServerObject const * creator )
|
||||
|
||||
bool CityPathGraphManager::createPathNodes ( ServerObject * building )
|
||||
{
|
||||
if(building == NULL) return false;
|
||||
if(building == nullptr) return false;
|
||||
|
||||
// Destroy any old path nodes for the building
|
||||
|
||||
@@ -862,7 +862,7 @@ bool CityPathGraphManager::createPathNodes ( ServerObject * building )
|
||||
|
||||
PathGraph const * pathGraph = _getExteriorGraph(building);
|
||||
|
||||
if(pathGraph == NULL) return false;
|
||||
if(pathGraph == nullptr) return false;
|
||||
|
||||
// ----------
|
||||
// Go through all the nodes in the building's graph and create city
|
||||
@@ -878,7 +878,7 @@ bool CityPathGraphManager::createPathNodes ( ServerObject * building )
|
||||
{
|
||||
PathNode const * node = pathGraph->getNode(i);
|
||||
|
||||
if(node == NULL) continue;
|
||||
if(node == nullptr) continue;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -975,11 +975,11 @@ void CityPathGraphManager::destroyWaypoint ( ServerObject * object )
|
||||
{
|
||||
CityPathGraph * graph = _getCityGraphFor(object);
|
||||
|
||||
if(graph == NULL) return;
|
||||
if(graph == nullptr) return;
|
||||
|
||||
CityPathNode * deadNode = _getCityNodeFor(object,graph);
|
||||
|
||||
if(deadNode == NULL) return;
|
||||
if(deadNode == nullptr) return;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -1025,11 +1025,11 @@ void CityPathGraphManager::destroyWaypoint ( ServerObject * object )
|
||||
|
||||
bool CityPathGraphManager::destroyPathNodes ( ServerObject * object )
|
||||
{
|
||||
if(object == NULL) return false;
|
||||
if(object == nullptr) return false;
|
||||
|
||||
BuildingObject * building = dynamic_cast<BuildingObject*>(object);
|
||||
|
||||
if(building == NULL) return false;
|
||||
if(building == nullptr) return false;
|
||||
|
||||
NetworkIdList ids;
|
||||
if (!building->getObjVars().getItem(OBJVAR_PATHFINDING_BUILDING_WAYPOINTS,ids)) return false;
|
||||
@@ -1044,7 +1044,7 @@ bool CityPathGraphManager::destroyPathNodes ( ServerObject * object )
|
||||
|
||||
ServerObject * serverObject = ServerWorld::findObjectByNetworkId(id);
|
||||
|
||||
if(serverObject == NULL) continue;
|
||||
if(serverObject == nullptr) continue;
|
||||
|
||||
serverObject->permanentlyDestroy(DeleteReasons::Replaced);
|
||||
}
|
||||
@@ -1156,7 +1156,7 @@ void CityPathGraphManager::setLinkDistance ( float dist )
|
||||
|
||||
void CityPathGraphManager::relinkGraph ( CityPathGraph const * constGraph )
|
||||
{
|
||||
if(constGraph == NULL) return;
|
||||
if(constGraph == nullptr) return;
|
||||
|
||||
CityPathGraph * graph = const_cast<CityPathGraph*>(constGraph);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ CityPathNode::CityPathNode ( Vector const & position_w, NetworkId const & source
|
||||
m_source(sourceId),
|
||||
m_creator(),
|
||||
m_relativePosition_o(Vector::zero),
|
||||
m_spatialHandle(NULL),
|
||||
m_spatialHandle(nullptr),
|
||||
m_debugId( gs_debugIdCounter++ )
|
||||
{
|
||||
snapToTerrain();
|
||||
@@ -59,7 +59,7 @@ CityPathNode::CityPathNode ( Vector const & position_w, NetworkId const & source
|
||||
m_source(sourceId),
|
||||
m_creator(creatorId),
|
||||
m_relativePosition_o(Vector::zero),
|
||||
m_spatialHandle(NULL),
|
||||
m_spatialHandle(nullptr),
|
||||
m_debugId( gs_debugIdCounter++ )
|
||||
{
|
||||
updateRelativePosition();
|
||||
@@ -158,7 +158,7 @@ void CityPathNode::loadInfoFromObjvars ( void )
|
||||
{
|
||||
ServerObject const * sourceObject = getSourceObject();
|
||||
|
||||
if(sourceObject == NULL) return;
|
||||
if(sourceObject == nullptr) return;
|
||||
|
||||
const DynamicVariableList & objvars = sourceObject->getObjVars();
|
||||
|
||||
@@ -188,7 +188,7 @@ void CityPathNode::loadEdgesFromObjvars ( void )
|
||||
{
|
||||
ServerObject const * sourceObject = getSourceObject();
|
||||
|
||||
if(sourceObject == NULL) return;
|
||||
if(sourceObject == nullptr) return;
|
||||
|
||||
DynamicVariableList const & objvars = sourceObject->getObjVars();
|
||||
|
||||
@@ -203,11 +203,11 @@ void CityPathNode::loadEdgesFromObjvars ( void )
|
||||
{
|
||||
ServerObject * serverObject = ServerWorld::findObjectByNetworkId( idList[i] );
|
||||
|
||||
if(serverObject == NULL) continue;
|
||||
if(serverObject == nullptr) continue;
|
||||
|
||||
CityPathNode * otherNode = _getGraph()->findNodeForObject(*serverObject);
|
||||
|
||||
if(otherNode == NULL) continue;
|
||||
if(otherNode == nullptr) continue;
|
||||
|
||||
addEdge(otherNode->getIndex());
|
||||
otherNode->addEdge(getIndex());
|
||||
@@ -233,7 +233,7 @@ void CityPathNode::saveInfoToObjvars ( void )
|
||||
{
|
||||
ServerObject * sourceObject = getSourceObject();
|
||||
|
||||
if(sourceObject == NULL) return;
|
||||
if(sourceObject == nullptr) return;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -294,7 +294,7 @@ void CityPathNode::saveEdgesToObjvars ( void )
|
||||
|
||||
CityPathNode * neighborNode = _getGraph()->_getNode(neighborIndex);
|
||||
|
||||
if(neighborNode == NULL) continue;
|
||||
if(neighborNode == nullptr) continue;
|
||||
|
||||
NetworkId const & neighborSourceId = neighborNode->getSourceId();
|
||||
|
||||
@@ -327,7 +327,7 @@ void CityPathNode::saveNeighbors ( void )
|
||||
|
||||
CityPathNode * neighborNode = _getGraph()->_getNode(neighborIndex);
|
||||
|
||||
if(neighborNode == NULL) continue;
|
||||
if(neighborNode == nullptr) continue;
|
||||
|
||||
neighborNode->saveToObjvars();
|
||||
}
|
||||
@@ -420,7 +420,7 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const
|
||||
|
||||
CityPathNode const * neighborNode = _getGraph()->_getNode(neighborIndex);
|
||||
|
||||
if(neighborNode == NULL)
|
||||
if(neighborNode == nullptr)
|
||||
{
|
||||
DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has an edge to a non-existent node\n"));
|
||||
insaneCount++;
|
||||
@@ -458,7 +458,7 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const
|
||||
CityPathNode const * nodeA = this;
|
||||
CityPathNode const * nodeB = _getGraph()->_getNode(getNeighbor(i));
|
||||
|
||||
if(nodeB == NULL) continue;
|
||||
if(nodeB == nullptr) continue;
|
||||
|
||||
if(nodeB->getType() == PNT_CityBuilding) continue;
|
||||
|
||||
@@ -493,7 +493,7 @@ void CityPathNode::reload ( void )
|
||||
{
|
||||
ServerObject const * sourceObject = getSourceObject();
|
||||
|
||||
if(sourceObject == NULL) return;
|
||||
if(sourceObject == nullptr) return;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -521,7 +521,7 @@ bool CityPathNode::hasEdgeTo ( NetworkId const & neighborId ) const
|
||||
|
||||
CityPathNode const * neighborNode = _getGraph()->_getNode(neighborIndex);
|
||||
|
||||
if(neighborNode == NULL) continue;
|
||||
if(neighborNode == nullptr) continue;
|
||||
|
||||
if(neighborNode->getSourceId() == neighborId) return true;
|
||||
}
|
||||
@@ -535,7 +535,7 @@ void CityPathNode::snapToTerrain ( void )
|
||||
{
|
||||
CellProperty const * cell = getCell();
|
||||
|
||||
if((cell == NULL) || (cell == CellProperty::getWorldCellProperty()))
|
||||
if((cell == nullptr) || (cell == CellProperty::getWorldCellProperty()))
|
||||
{
|
||||
Vector pos_w = getPosition_w();
|
||||
|
||||
|
||||
@@ -48,14 +48,14 @@ Region const * PathAutoGenerator::findPathRegion(Vector const & pos_w)
|
||||
for (RegionMaster::RegionVector::const_iterator it = rv.begin(); it != rv.end(); ++it)
|
||||
{
|
||||
Region const * const r = *it;
|
||||
if (NULL != r)
|
||||
if (nullptr != r)
|
||||
{
|
||||
if (r->getGeography() == RegionNamespace::RG_pathfind)
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -63,7 +63,7 @@ Region const * PathAutoGenerator::findPathRegion(Vector const & pos_w)
|
||||
void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistance, float obstacleDistance, Unicode::String & result)
|
||||
{
|
||||
Region const * region = findPathRegion(pos_w);
|
||||
if (NULL == region)
|
||||
if (nullptr == region)
|
||||
{
|
||||
result += Unicode::narrowToWide("No pathfinding region at position");
|
||||
return;
|
||||
@@ -144,7 +144,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc
|
||||
++obstacleNearbySkipped;
|
||||
|
||||
#if USE_OBSTACLE_TEMPLATE
|
||||
if (NULL != PathAutoGeneratorNamespace::s_pathObstacleTemplate)
|
||||
if (nullptr != PathAutoGeneratorNamespace::s_pathObstacleTemplate)
|
||||
{
|
||||
Transform transform_w;
|
||||
transform_w.setPosition_p(testPos_w);
|
||||
@@ -164,7 +164,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc
|
||||
transform_w.setPosition_p(testPos_w);
|
||||
ServerObject * newObject = ServerWorld::createNewObject(s_pathWaypointTemplate, transform_w, 0, false);
|
||||
|
||||
if (NULL != newObject)
|
||||
if (nullptr != newObject)
|
||||
{
|
||||
newObject->addToWorld();
|
||||
newObject->persist();
|
||||
@@ -189,7 +189,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc
|
||||
void PathAutoGenerator::pathAutoCleanup(Vector const & pos_w, Unicode::String & result)
|
||||
{
|
||||
Region const * region = findPathRegion(pos_w);
|
||||
if (NULL == region)
|
||||
if (nullptr == region)
|
||||
{
|
||||
result += Unicode::narrowToWide("No pathfinding region at position");
|
||||
return;
|
||||
@@ -236,7 +236,7 @@ void PathAutoGenerator::pathAutoCleanup(Vector const & pos_w, Unicode::String &
|
||||
}
|
||||
|
||||
#if USE_OBSTACLE_TEMPLATE
|
||||
if (NULL != s_pathObstacleTemplate && !strcmp(so->getTemplateName(), s_pathObstacleTemplate))
|
||||
if (nullptr != s_pathObstacleTemplate && !strcmp(so->getTemplateName(), s_pathObstacleTemplate))
|
||||
{
|
||||
so->permanentlyDestroy(DeleteReasons::Script);
|
||||
++obstacleDestroyCount;
|
||||
|
||||
@@ -41,7 +41,7 @@ const float gs_maxCanMoveDistance2 = (64.0f * 64.0f);
|
||||
|
||||
int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGraph const * graph )
|
||||
{
|
||||
if(graph == NULL) return -1;
|
||||
if(graph == nullptr) return -1;
|
||||
|
||||
Vector creaturePos = creature->getPosition_p();
|
||||
|
||||
@@ -53,7 +53,7 @@ int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGrap
|
||||
|
||||
int resultCount = results.size();
|
||||
|
||||
PathNode const * reachableNode = NULL;
|
||||
PathNode const * reachableNode = nullptr;
|
||||
float reachableDist2 = gs_maxCanMoveDistance2;
|
||||
|
||||
for(int i = 0; i < resultCount; i++)
|
||||
@@ -81,7 +81,7 @@ int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGrap
|
||||
|
||||
int findClosestReachablePathNode( CreatureObject const * creature, PathGraph const * graph )
|
||||
{
|
||||
if(graph == NULL) return -1;
|
||||
if(graph == nullptr) return -1;
|
||||
|
||||
Vector creaturePos = creature->getPosition_p();
|
||||
|
||||
@@ -98,7 +98,7 @@ int findClosestReachablePathNode( CreatureObject const * creature, PathGraph con
|
||||
|
||||
PathNode const * node = graph->getNode(closestIndex);
|
||||
|
||||
if(node == NULL) return -2;
|
||||
if(node == nullptr) return -2;
|
||||
|
||||
Vector nodePos = node->getPosition_p();
|
||||
float dist2 = nodePos.magnitudeBetweenSquared(creaturePos);
|
||||
@@ -135,7 +135,7 @@ int findClosestReachablePathNode_slow ( CellProperty const * cell, Vector const
|
||||
|
||||
int resultCount = results.size();
|
||||
|
||||
PathNode const * reachableNode = NULL;
|
||||
PathNode const * reachableNode = nullptr;
|
||||
float reachableDist2 = gs_maxCanMoveDistance2;
|
||||
|
||||
for(int i = 0; i < resultCount; i++)
|
||||
@@ -173,7 +173,7 @@ int findClosestReachablePathNode ( CellProperty const * cell, Vector const & goa
|
||||
|
||||
PathNode const * node = graph->getNode(closestIndex);
|
||||
|
||||
if(node == NULL) return -2;
|
||||
if(node == nullptr) return -2;
|
||||
|
||||
Vector nodePos = node->getPosition_p();
|
||||
float dist2 = nodePos.magnitudeBetweenSquared(goal);
|
||||
@@ -199,7 +199,7 @@ PathGraph const * getGraph ( CellProperty const * cell )
|
||||
if(cell)
|
||||
return safe_cast<PathGraph const *>(cell->getPathGraph());
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PathGraph const * getGraph ( PortalProperty const * building )
|
||||
@@ -207,7 +207,7 @@ PathGraph const * getGraph ( PortalProperty const * building )
|
||||
if(building)
|
||||
return safe_cast<PathGraph const *>(building->getPortalPropertyTemplate().getBuildingPathGraph());
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------
|
||||
@@ -237,19 +237,19 @@ PortalProperty const * getBuilding ( BuildingObject const * buildingObject )
|
||||
if(buildingObject)
|
||||
return buildingObject->getPortalProperty();
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PortalProperty const * getBuilding ( CreatureObject const * creature )
|
||||
{
|
||||
if(creature == NULL) return NULL;
|
||||
if(creature == nullptr) return nullptr;
|
||||
|
||||
CellProperty const * cell = creature->getParentCell();
|
||||
|
||||
if(cell)
|
||||
return cell->getPortalProperty();
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PortalProperty const * getBuilding ( AiLocation const & loc )
|
||||
@@ -259,7 +259,7 @@ PortalProperty const * getBuilding ( AiLocation const & loc )
|
||||
if(cell)
|
||||
return cell->getPortalProperty();
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------
|
||||
@@ -388,26 +388,26 @@ int getIndexFor ( CellProperty const * cell, PathGraph const * graph, AiLocation
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
ServerPathBuilder::ServerPathBuilder()
|
||||
: m_creatureCell(NULL),
|
||||
m_creatureCellGraph(NULL),
|
||||
: m_creatureCell(nullptr),
|
||||
m_creatureCellGraph(nullptr),
|
||||
m_creatureCellKey(-1),
|
||||
m_creatureCellNodeIndex(-1),
|
||||
m_creatureCellPart(-1),
|
||||
m_creatureBuilding(NULL),
|
||||
m_creatureBuildingGraph(NULL),
|
||||
m_creatureBuilding(nullptr),
|
||||
m_creatureBuildingGraph(nullptr),
|
||||
m_creatureBuildingKey(-1),
|
||||
m_creatureBuildingNodeIndex(-1),
|
||||
m_creaturePosition(),
|
||||
m_goalCell(NULL),
|
||||
m_goalCellGraph(NULL),
|
||||
m_goalCell(nullptr),
|
||||
m_goalCellGraph(nullptr),
|
||||
m_goalCellKey(-1),
|
||||
m_goalCellNodeIndex(-1),
|
||||
m_goalCellPart(-1),
|
||||
m_goalBuilding(NULL),
|
||||
m_goalBuildingGraph(NULL),
|
||||
m_goalBuilding(nullptr),
|
||||
m_goalBuildingGraph(nullptr),
|
||||
m_goalBuildingKey(-1),
|
||||
m_goalBuildingNodeIndex(-1),
|
||||
m_goalCityGraph(NULL),
|
||||
m_goalCityGraph(nullptr),
|
||||
m_goalCityNodeIndex(-1),
|
||||
m_path(new AiPath()),
|
||||
m_async(false),
|
||||
@@ -427,16 +427,16 @@ ServerPathBuilder::~ServerPathBuilder()
|
||||
ServerPathBuildManager::unqueue(this);
|
||||
|
||||
delete m_path;
|
||||
m_path = NULL;
|
||||
m_path = nullptr;
|
||||
|
||||
delete m_cellSearch;
|
||||
m_cellSearch = NULL;
|
||||
m_cellSearch = nullptr;
|
||||
|
||||
delete m_buildingSearch;
|
||||
m_buildingSearch = NULL;
|
||||
m_buildingSearch = nullptr;
|
||||
|
||||
delete m_citySearch;
|
||||
m_citySearch = NULL;
|
||||
m_citySearch = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -462,7 +462,7 @@ bool ServerPathBuilder::buildPathInternal( CellProperty const * cell, PathGraph
|
||||
|
||||
PathNode const * node = graph->getNode(nodeIndex);
|
||||
|
||||
if(node == NULL) return false;
|
||||
if(node == nullptr) return false;
|
||||
|
||||
addPathNode( cell, node );
|
||||
}
|
||||
@@ -484,9 +484,9 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat
|
||||
|
||||
// ----------
|
||||
|
||||
PathNode const * nodeA = NULL;
|
||||
PathNode const * nodeB = NULL;
|
||||
PathNode const * nodeC = NULL;
|
||||
PathNode const * nodeA = nullptr;
|
||||
PathNode const * nodeB = nullptr;
|
||||
PathNode const * nodeC = nullptr;
|
||||
|
||||
int pathLength = path.size();
|
||||
|
||||
@@ -496,7 +496,7 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat
|
||||
{
|
||||
PathNode const * nextNode = graph->getNode(path[i]);
|
||||
|
||||
if(nextNode == NULL) continue;
|
||||
if(nextNode == nullptr) continue;
|
||||
|
||||
nodeA = nodeB;
|
||||
nodeB = nodeC;
|
||||
@@ -506,10 +506,10 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat
|
||||
{
|
||||
nodeA = nodeB;
|
||||
nodeB = nodeC;
|
||||
nodeC = NULL;
|
||||
nodeC = nullptr;
|
||||
}
|
||||
|
||||
if( nodeB == NULL ) continue;
|
||||
if( nodeB == nullptr ) continue;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -519,11 +519,11 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat
|
||||
|
||||
CellProperty const * subobject = building->getCell(cellIndex);
|
||||
|
||||
if(subobject == NULL) return false;
|
||||
if(subobject == nullptr) return false;
|
||||
|
||||
PathGraph const * subgraph = getGraph(subobject);
|
||||
|
||||
if(subgraph == NULL) return false;
|
||||
if(subgraph == nullptr) return false;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -576,9 +576,9 @@ bool ServerPathBuilder::buildPathInternal ( CityPathGraph const * graph, int ind
|
||||
|
||||
bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList const & path )
|
||||
{
|
||||
PathNode const * nodeA = NULL;
|
||||
PathNode const * nodeB = NULL;
|
||||
PathNode const * nodeC = NULL;
|
||||
PathNode const * nodeA = nullptr;
|
||||
PathNode const * nodeB = nullptr;
|
||||
PathNode const * nodeC = nullptr;
|
||||
|
||||
int pathLength = path.size();
|
||||
|
||||
@@ -588,7 +588,7 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons
|
||||
{
|
||||
PathNode const * nextNode = graph->getNode(path[i]);
|
||||
|
||||
if(nextNode == NULL) continue;
|
||||
if(nextNode == nullptr) continue;
|
||||
|
||||
nodeA = nodeB;
|
||||
nodeB = nodeC;
|
||||
@@ -598,10 +598,10 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons
|
||||
{
|
||||
nodeA = nodeB;
|
||||
nodeB = nodeC;
|
||||
nodeC = NULL;
|
||||
nodeC = nullptr;
|
||||
}
|
||||
|
||||
if( nodeB == NULL ) continue;
|
||||
if( nodeB == nullptr ) continue;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -609,19 +609,19 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons
|
||||
{
|
||||
CityPathNode const * cityNode = safe_cast<CityPathNode const *>(nodeB);
|
||||
|
||||
if(cityNode == NULL) return false;
|
||||
if(cityNode == nullptr) return false;
|
||||
|
||||
BuildingObject const * buildingObject = safe_cast<BuildingObject const *>(cityNode->getCreatorObject());
|
||||
|
||||
if(buildingObject == NULL) return false;
|
||||
if(buildingObject == nullptr) return false;
|
||||
|
||||
PortalProperty const * subobject = getBuilding(buildingObject);
|
||||
|
||||
if(subobject == NULL) return false;
|
||||
if(subobject == nullptr) return false;
|
||||
|
||||
PathGraph const * subgraph = getGraph(subobject);
|
||||
|
||||
if(subgraph == NULL) return false;
|
||||
if(subgraph == nullptr) return false;
|
||||
|
||||
// ----------
|
||||
|
||||
@@ -652,7 +652,7 @@ bool ServerPathBuilder::buildPath_World ( void )
|
||||
{
|
||||
Vector exitPoint(m_creature ? m_creature->getPosition_w() : m_creaturePosition);
|
||||
|
||||
if((m_creatureCityGraph != NULL) && (m_creatureCityNodeIndex >= 0))
|
||||
if((m_creatureCityGraph != nullptr) && (m_creatureCityNodeIndex >= 0))
|
||||
{
|
||||
int indexA = m_creatureCityNodeIndex;
|
||||
int indexB = m_creatureCityGraph->findNearestNode(m_goal.getPosition_w());
|
||||
@@ -670,7 +670,7 @@ bool ServerPathBuilder::buildPath_World ( void )
|
||||
}
|
||||
}
|
||||
|
||||
if((m_goalCityGraph != NULL) && (m_goalCityNodeIndex >= 0))
|
||||
if((m_goalCityGraph != nullptr) && (m_goalCityNodeIndex >= 0))
|
||||
{
|
||||
int indexA = m_goalCityGraph->findNearestNode(exitPoint);
|
||||
int indexB = m_goalCityNodeIndex;
|
||||
@@ -701,8 +701,8 @@ bool ServerPathBuilder::buildPath_ToGoal ( void )
|
||||
m_creatureCell = m_creature->getParentCell();
|
||||
m_goalCell = m_goal.getCell();
|
||||
|
||||
if(m_creatureCell == NULL) m_creatureCell = worldCell;
|
||||
if(m_goalCell == NULL) m_goalCell = worldCell;
|
||||
if(m_creatureCell == nullptr) m_creatureCell = worldCell;
|
||||
if(m_goalCell == nullptr) m_goalCell = worldCell;
|
||||
|
||||
{
|
||||
Vector goalPos_p = m_goal.getPosition_p(m_creatureCell);
|
||||
@@ -724,23 +724,23 @@ bool ServerPathBuilder::buildPath_ToGoal ( void )
|
||||
// we can skip some work with looking up their cell and building
|
||||
// info.
|
||||
|
||||
m_creatureCellGraph = NULL;
|
||||
m_creatureCellGraph = nullptr;
|
||||
m_creatureCellKey = -1;
|
||||
m_creatureCellNodeIndex = -1;
|
||||
m_creatureCellPart = -1;
|
||||
|
||||
m_goalCellGraph = NULL;
|
||||
m_goalCellGraph = nullptr;
|
||||
m_goalCellKey = -1;
|
||||
m_goalCellNodeIndex = -1;
|
||||
m_goalCellPart = -1;
|
||||
|
||||
m_creatureBuilding = NULL;
|
||||
m_creatureBuildingGraph = NULL;
|
||||
m_creatureBuilding = nullptr;
|
||||
m_creatureBuildingGraph = nullptr;
|
||||
m_creatureBuildingKey = -1;
|
||||
m_creatureBuildingNodeIndex = -1;
|
||||
|
||||
m_goalBuilding = NULL;
|
||||
m_goalBuildingGraph = NULL;
|
||||
m_goalBuilding = nullptr;
|
||||
m_goalBuildingGraph = nullptr;
|
||||
m_goalBuildingKey = -1;
|
||||
m_goalBuildingNodeIndex = -1;
|
||||
}
|
||||
@@ -776,7 +776,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void )
|
||||
|
||||
// If they're in the same cell, start the search in the cell
|
||||
|
||||
if((m_creatureCell == m_goalCell) && (m_creatureCell != NULL) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart))
|
||||
if((m_creatureCell == m_goalCell) && (m_creatureCell != nullptr) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart))
|
||||
{
|
||||
return buildPathInternal(m_creatureCell,m_creatureCellGraph,m_creatureCellNodeIndex,m_goalCellNodeIndex);
|
||||
}
|
||||
@@ -795,7 +795,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void )
|
||||
|
||||
// If they're in the same building, start the search in the building
|
||||
|
||||
if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != NULL))
|
||||
if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != nullptr))
|
||||
{
|
||||
return buildPathInternal(m_creatureBuilding,m_creatureBuildingGraph,m_creatureBuildingNodeIndex,m_goalBuildingNodeIndex);
|
||||
}
|
||||
@@ -810,7 +810,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void )
|
||||
m_goalCityGraph = CityPathGraphManager::getCityGraphFor(m_goal.getPosition_w());
|
||||
m_goalCityNodeIndex = getIndexFor(m_goalCityGraph,m_goalBuilding,m_goal);
|
||||
|
||||
if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != NULL))
|
||||
if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != nullptr))
|
||||
{
|
||||
// hack - If a creature in a city region tries to path search but it's not near a path node,
|
||||
// make its path search succeed
|
||||
@@ -875,7 +875,7 @@ bool ServerPathBuilder::buildPath_Named ( void )
|
||||
|
||||
// ----------
|
||||
|
||||
if(m_creatureCityGraph != NULL)
|
||||
if(m_creatureCityGraph != nullptr)
|
||||
{
|
||||
IndexList goalList;
|
||||
|
||||
@@ -885,7 +885,7 @@ bool ServerPathBuilder::buildPath_Named ( void )
|
||||
{
|
||||
CityPathNode const * node = m_creatureCityGraph->_getNode(i);
|
||||
|
||||
if(node == NULL) continue;
|
||||
if(node == nullptr) continue;
|
||||
|
||||
if(node->getName() == m_goalName)
|
||||
{
|
||||
@@ -954,7 +954,7 @@ void ServerPathBuilder::update ( void )
|
||||
|
||||
bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, AiLocation const & goal )
|
||||
{
|
||||
if(creature == NULL) return false;
|
||||
if(creature == nullptr) return false;
|
||||
if(!goal.isValid()) return false;
|
||||
|
||||
m_creature = creature;
|
||||
@@ -971,7 +971,7 @@ bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, AiLoca
|
||||
|
||||
bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, Unicode::String const & goalName )
|
||||
{
|
||||
if(creature == NULL) return false;
|
||||
if(creature == nullptr) return false;
|
||||
if(goalName.empty()) return false;
|
||||
|
||||
m_creature = creature;
|
||||
@@ -1058,23 +1058,23 @@ bool ServerPathBuilder::buildWorldPath(AiLocation const &startLocation, AiLocati
|
||||
// we can skip some work with looking up their cell and building
|
||||
// info.
|
||||
|
||||
m_creatureCellGraph = NULL;
|
||||
m_creatureCellGraph = nullptr;
|
||||
m_creatureCellKey = -1;
|
||||
m_creatureCellNodeIndex = -1;
|
||||
m_creatureCellPart = -1;
|
||||
|
||||
m_goalCellGraph = NULL;
|
||||
m_goalCellGraph = nullptr;
|
||||
m_goalCellKey = -1;
|
||||
m_goalCellNodeIndex = -1;
|
||||
m_goalCellPart = -1;
|
||||
|
||||
m_creatureBuilding = NULL;
|
||||
m_creatureBuildingGraph = NULL;
|
||||
m_creatureBuilding = nullptr;
|
||||
m_creatureBuildingGraph = nullptr;
|
||||
m_creatureBuildingKey = -1;
|
||||
m_creatureBuildingNodeIndex = -1;
|
||||
|
||||
m_goalBuilding = NULL;
|
||||
m_goalBuildingGraph = NULL;
|
||||
m_goalBuilding = nullptr;
|
||||
m_goalBuildingGraph = nullptr;
|
||||
m_goalBuildingKey = -1;
|
||||
m_goalBuildingNodeIndex = -1;
|
||||
|
||||
@@ -1134,8 +1134,8 @@ bool ServerPathBuilder::buildWorldPath(AiLocation const &startLocation, AiLocati
|
||||
|
||||
void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const * node )
|
||||
{
|
||||
if(node == NULL) return;
|
||||
if(cell == NULL) cell = CellProperty::getWorldCellProperty();
|
||||
if(node == nullptr) return;
|
||||
if(cell == nullptr) cell = CellProperty::getWorldCellProperty();
|
||||
|
||||
AiLocation loc(cell,node->getPosition_p());
|
||||
|
||||
@@ -1173,7 +1173,7 @@ void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const
|
||||
|
||||
bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocation const & goal)
|
||||
{
|
||||
m_creature = NULL;
|
||||
m_creature = nullptr;
|
||||
m_goal = goal;
|
||||
m_buildDone = false;
|
||||
m_buildFailed = false;
|
||||
@@ -1190,9 +1190,9 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati
|
||||
|
||||
// ----------
|
||||
CellProperty const * worldCell = CellProperty::getWorldCellProperty();
|
||||
if(m_creatureCell == NULL)
|
||||
if(m_creatureCell == nullptr)
|
||||
m_creatureCell = worldCell;
|
||||
if(m_goalCell == NULL)
|
||||
if(m_goalCell == nullptr)
|
||||
m_goalCell = worldCell;
|
||||
|
||||
|
||||
@@ -1236,14 +1236,14 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati
|
||||
m_goalBuildingNodeIndex = getIndexFor(m_goalBuilding, m_goalBuildingGraph, m_goal, m_goalCellPart);
|
||||
|
||||
// If they're in the same building, start the search in the building
|
||||
if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != NULL))
|
||||
if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != nullptr))
|
||||
{
|
||||
if (buildPathInternal(m_creatureBuilding, m_creatureBuildingGraph, m_creatureBuildingNodeIndex, m_goalBuildingNodeIndex))
|
||||
return true;
|
||||
}
|
||||
|
||||
// If they're in the same cell, start the search in the cell
|
||||
if((m_creatureCell == m_goalCell) && (m_creatureCell != NULL) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart))
|
||||
if((m_creatureCell == m_goalCell) && (m_creatureCell != nullptr) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart))
|
||||
{
|
||||
if (buildPathInternal(m_creatureCell, m_creatureCellGraph, m_creatureCellNodeIndex, m_goalCellNodeIndex))
|
||||
return true;
|
||||
@@ -1257,7 +1257,7 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati
|
||||
m_goalCityGraph = CityPathGraphManager::getCityGraphFor(m_goal.getPosition_w());
|
||||
m_goalCityNodeIndex = getIndexFor(m_goalCityGraph,m_goalBuilding,m_goal);
|
||||
|
||||
if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != NULL))
|
||||
if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != nullptr))
|
||||
{
|
||||
// hack - If a creature in a city region tries to path search but it's not near a path node,
|
||||
// make its path search succeed
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
ServerPathfindingMessaging * g_messaging = NULL;
|
||||
ServerPathfindingMessaging * g_messaging = nullptr;
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -51,7 +51,7 @@ void ServerPathfindingMessaging::remove ( void )
|
||||
g_messaging->disconnectFromMessage(RequestUnstick::MESSAGE_TYPE);
|
||||
|
||||
delete g_messaging;
|
||||
g_messaging = NULL;
|
||||
g_messaging = nullptr;
|
||||
}
|
||||
|
||||
ServerPathfindingMessaging & ServerPathfindingMessaging::getInstance ( void )
|
||||
@@ -75,10 +75,10 @@ ServerPathfindingMessaging::~ServerPathfindingMessaging()
|
||||
}
|
||||
|
||||
delete m_clientList;
|
||||
m_clientList = NULL;
|
||||
m_clientList = nullptr;
|
||||
|
||||
delete m_callback;
|
||||
m_callback = NULL;
|
||||
m_callback = nullptr;
|
||||
}
|
||||
|
||||
// ----------
|
||||
@@ -178,7 +178,7 @@ void ServerPathfindingMessaging::receiveMessage(const MessageDispatch::Emitter &
|
||||
{
|
||||
Transform newTransform = Transform::identity;
|
||||
newTransform.setPosition_p(unstickPoint);
|
||||
controller->teleport(newTransform, NULL);
|
||||
controller->teleport(newTransform, nullptr);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -188,7 +188,7 @@ void ServerPathfindingMessaging::receiveMessage(const MessageDispatch::Emitter &
|
||||
|
||||
Vector unstickPoint;
|
||||
CellObject * cell = ContainerInterface::getContainingCellObject(*s);
|
||||
if (cell != NULL && s->asCreatureObject() != NULL)
|
||||
if (cell != nullptr && s->asCreatureObject() != nullptr)
|
||||
{
|
||||
// try finding a waypoint in the cell first
|
||||
if (!cell->getClosestPathNodePos(*s, unstickPoint))
|
||||
@@ -266,7 +266,7 @@ void ServerPathfindingMessaging::ignoreObjectPath(Client * client, const Network
|
||||
|
||||
void ServerPathfindingMessaging::watchPathMap(Client * client)
|
||||
{
|
||||
if(client == NULL) return;
|
||||
if(client == nullptr) return;
|
||||
|
||||
// Add the client to our client list
|
||||
|
||||
@@ -290,7 +290,7 @@ void ServerPathfindingMessaging::watchPathMap(Client * client)
|
||||
|
||||
void ServerPathfindingMessaging::ignorePathMap(Client * client)
|
||||
{
|
||||
if(client == NULL) return;
|
||||
if(client == nullptr) return;
|
||||
|
||||
m_clientList->erase(client);
|
||||
|
||||
@@ -319,7 +319,7 @@ void ServerPathfindingMessaging::onClientDestroy(ClientDestroy & d)
|
||||
|
||||
void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph )
|
||||
{
|
||||
if(graph == NULL) return;
|
||||
if(graph == nullptr) return;
|
||||
|
||||
for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it)
|
||||
{
|
||||
@@ -331,8 +331,8 @@ void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph )
|
||||
|
||||
void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph, Client * client )
|
||||
{
|
||||
if(client == NULL) return;
|
||||
if(graph == NULL) return;
|
||||
if(client == nullptr) return;
|
||||
if(graph == nullptr) return;
|
||||
|
||||
int nodeCount = graph->getNodeCount();
|
||||
|
||||
@@ -348,7 +348,7 @@ void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph, Cl
|
||||
|
||||
void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph )
|
||||
{
|
||||
if(graph == NULL) return;
|
||||
if(graph == nullptr) return;
|
||||
|
||||
for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it)
|
||||
{
|
||||
@@ -360,8 +360,8 @@ void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph )
|
||||
|
||||
void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph, Client * client )
|
||||
{
|
||||
if(client == NULL) return;
|
||||
if(graph == NULL) return;
|
||||
if(client == nullptr) return;
|
||||
if(graph == nullptr) return;
|
||||
|
||||
int nodeCount = graph->getNodeCount();
|
||||
|
||||
@@ -377,7 +377,7 @@ void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph, C
|
||||
|
||||
void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node )
|
||||
{
|
||||
if(node == NULL) return;
|
||||
if(node == nullptr) return;
|
||||
|
||||
for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it)
|
||||
{
|
||||
@@ -389,8 +389,8 @@ void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node )
|
||||
|
||||
void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node, Client * client )
|
||||
{
|
||||
if(node == NULL) return;
|
||||
if(client == NULL) return;
|
||||
if(node == nullptr) return;
|
||||
if(client == nullptr) return;
|
||||
|
||||
AINodeInfo m;
|
||||
|
||||
@@ -428,7 +428,7 @@ void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node, Clien
|
||||
|
||||
void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node )
|
||||
{
|
||||
if(node == NULL) return;
|
||||
if(node == nullptr) return;
|
||||
|
||||
for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it)
|
||||
{
|
||||
@@ -440,8 +440,8 @@ void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node )
|
||||
|
||||
void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node, Client * client )
|
||||
{
|
||||
if(node == NULL) return;
|
||||
if(client == NULL) return;
|
||||
if(node == nullptr) return;
|
||||
if(client == nullptr) return;
|
||||
|
||||
int edgeCount = node->getEdgeCount();
|
||||
|
||||
@@ -459,7 +459,7 @@ void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node, C
|
||||
|
||||
void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node )
|
||||
{
|
||||
if(node == NULL) return;
|
||||
if(node == nullptr) return;
|
||||
|
||||
for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it)
|
||||
{
|
||||
@@ -471,8 +471,8 @@ void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node )
|
||||
|
||||
void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node, Client * client )
|
||||
{
|
||||
if(node == NULL) return;
|
||||
if(client == NULL) return;
|
||||
if(node == nullptr) return;
|
||||
if(client == nullptr) return;
|
||||
|
||||
AINodeInfo m;
|
||||
|
||||
@@ -497,7 +497,7 @@ void ServerPathfindingMessaging::sendWaypointInfo ( AiLocation const & loc )
|
||||
|
||||
void ServerPathfindingMessaging::sendWaypointInfo ( AiLocation const & loc, Client * client )
|
||||
{
|
||||
if(client == NULL) return;
|
||||
if(client == nullptr) return;
|
||||
|
||||
AINodeInfo m;
|
||||
|
||||
@@ -531,7 +531,7 @@ void ServerPathfindingMessaging::sendEraseWaypoint ( AiLocation const & loc )
|
||||
|
||||
void ServerPathfindingMessaging::sendEraseWaypoint ( AiLocation const & loc, Client * client )
|
||||
{
|
||||
if(client == NULL) return;
|
||||
if(client == nullptr) return;
|
||||
|
||||
AINodeInfo m;
|
||||
|
||||
|
||||
+4
-4
@@ -44,7 +44,7 @@ void ServerPathfindingNotification::addToWorld ( Object & object ) const
|
||||
{
|
||||
CityPathGraphManager::addBuilding( building );
|
||||
}
|
||||
else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint())
|
||||
else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint())
|
||||
{
|
||||
CityPathGraphManager::addWaypoint( object.asServerObject() );
|
||||
}
|
||||
@@ -61,7 +61,7 @@ void ServerPathfindingNotification::removeFromWorld ( Object & object ) const
|
||||
{
|
||||
CityPathGraphManager::removeBuilding( building );
|
||||
}
|
||||
else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint())
|
||||
else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint())
|
||||
{
|
||||
CityPathGraphManager::removeWaypoint( object.asServerObject() );
|
||||
}
|
||||
@@ -79,7 +79,7 @@ bool ServerPathfindingNotification::positionChanged ( Object & object, bool /*du
|
||||
{
|
||||
CityPathGraphManager::moveBuilding( building, oldPosition );
|
||||
}
|
||||
else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint())
|
||||
else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint())
|
||||
{
|
||||
CityPathGraphManager::moveWaypoint( object.asServerObject(), oldPosition );
|
||||
}
|
||||
@@ -95,7 +95,7 @@ bool ServerPathfindingNotification::positionAndRotationChanged ( Object & object
|
||||
{
|
||||
CityPathGraphManager::moveBuilding( building, oldPosition );
|
||||
}
|
||||
else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint())
|
||||
else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint())
|
||||
{
|
||||
CityPathGraphManager::moveWaypoint( object.asServerObject(), oldPosition );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user