mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-08-04 05:15:51 -04:00
Revert "Revert "newer standards prefer nullptr over NULL - this is most of them but there are others too""
This reverts commit 8e2160f33e.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user