Merge: Codechange: Use null pointer literal instead of the NULL macro

This commit is contained in:
Jonathan G Rennison
2019-04-11 18:14:13 +01:00
585 changed files with 6604 additions and 6604 deletions

View File

@@ -42,7 +42,7 @@ public:
/** default constructor */
CNodeList_HashTableT() : m_open_queue(2048)
{
m_new_node = NULL;
m_new_node = nullptr;
}
/** destructor */
@@ -65,7 +65,7 @@ public:
/** allocate new data item from m_arr */
inline Titem_ *CreateNewNode()
{
if (m_new_node == NULL) m_new_node = m_arr.AppendC();
if (m_new_node == nullptr) m_new_node = m_arr.AppendC();
return m_new_node;
}
@@ -74,7 +74,7 @@ public:
{
/* for now it is enough to invalidate m_new_node if it is our given node */
if (&item == m_new_node) {
m_new_node = NULL;
m_new_node = nullptr;
}
/* TODO: do we need to store best nodes found in some extra list/array? Probably not now. */
}
@@ -82,11 +82,11 @@ public:
/** insert given item as open node (into m_open and m_open_queue) */
inline void InsertOpenNode(Titem_ &item)
{
assert(m_closed.Find(item.GetKey()) == NULL);
assert(m_closed.Find(item.GetKey()) == nullptr);
m_open.Push(item);
m_open_queue.Include(&item);
if (&item == m_new_node) {
m_new_node = NULL;
m_new_node = nullptr;
}
}
@@ -96,7 +96,7 @@ public:
if (!m_open_queue.IsEmpty()) {
return m_open_queue.Begin();
}
return NULL;
return nullptr;
}
/** remove and return the best open node */
@@ -107,10 +107,10 @@ public:
m_open.Pop(*item);
return item;
}
return NULL;
return nullptr;
}
/** return the open node specified by a key or NULL if not found */
/** return the open node specified by a key or nullptr if not found */
inline Titem_ *FindOpenNode(const Key &key)
{
Titem_ *item = m_open.Find(key);
@@ -129,11 +129,11 @@ public:
/** close node */
inline void InsertClosedNode(Titem_ &item)
{
assert(m_open.Find(item.GetKey()) == NULL);
assert(m_open.Find(item.GetKey()) == nullptr);
m_closed.Push(item);
}
/** return the closed node specified by a key or NULL if not found */
/** return the closed node specified by a key or nullptr if not found */
inline Titem_ *FindClosedNode(const Key &key)
{
Titem_ *item = m_closed.Find(key);

View File

@@ -81,11 +81,11 @@ public:
public:
/** default constructor */
inline CYapfBaseT()
: m_pBestDestNode(NULL)
, m_pBestIntermediateNode(NULL)
: m_pBestDestNode(nullptr)
, m_pBestIntermediateNode(nullptr)
, m_settings(&_settings_game.pf.yapf)
, m_max_search_nodes(PfGetSettings().max_search_nodes)
, m_veh(NULL)
, m_veh(nullptr)
, m_stats_cost_calcs(0)
, m_stats_cache_hits(0)
, m_num_steps(0)
@@ -131,12 +131,12 @@ public:
for (;;) {
m_num_steps++;
Node *n = m_nodes.GetBestOpenNode();
if (n == NULL) {
if (n == nullptr) {
break;
}
/* if the best open node was worse than the best path found, we can finish */
if (m_pBestDestNode != NULL && m_pBestDestNode->GetCost() < n->GetCostEstimate()) {
if (m_pBestDestNode != nullptr && m_pBestDestNode->GetCost() < n->GetCostEstimate()) {
break;
}
@@ -150,7 +150,7 @@ public:
}
}
bDestFound &= (m_pBestDestNode != NULL);
bDestFound &= (m_pBestDestNode != nullptr);
perf.Stop();
if (_debug_yapf_level >= 2) {
@@ -158,7 +158,7 @@ public:
_total_pf_time_us += t;
if (_debug_yapf_level >= 3) {
UnitID veh_idx = (m_veh != NULL) ? m_veh->unitnumber : 0;
UnitID veh_idx = (m_veh != nullptr) ? m_veh->unitnumber : 0;
char ttc = Yapf().TransportTypeChar();
float cache_hit_ratio = (m_stats_cache_hits == 0) ? 0.0f : ((float)m_stats_cache_hits / (float)(m_stats_cache_hits + m_stats_cost_calcs) * 100.0f);
int cost = bDestFound ? m_pBestDestNode->m_cost : -1;
@@ -180,7 +180,7 @@ public:
*/
inline Node *GetBestNode()
{
return (m_pBestDestNode != NULL) ? m_pBestDestNode : m_pBestIntermediateNode;
return (m_pBestDestNode != nullptr) ? m_pBestDestNode : m_pBestIntermediateNode;
}
/**
@@ -198,7 +198,7 @@ public:
{
Yapf().PfNodeCacheFetch(n);
/* insert the new node only if it is not there */
if (m_nodes.FindOpenNode(n.m_key) == NULL) {
if (m_nodes.FindOpenNode(n.m_key) == nullptr) {
m_nodes.InsertOpenNode(n);
} else {
/* if we are here, it means that node is already there - how it is possible?
@@ -237,7 +237,7 @@ public:
*/
void PruneIntermediateNodeBranch()
{
while (Yapf().m_pBestIntermediateNode != NULL && (Yapf().m_pBestIntermediateNode->m_segment->m_end_segment_reason & ESRB_CHOICE_FOLLOWS) == 0) {
while (Yapf().m_pBestIntermediateNode != nullptr && (Yapf().m_pBestIntermediateNode->m_segment->m_end_segment_reason & ESRB_CHOICE_FOLLOWS) == 0) {
Yapf().m_pBestIntermediateNode = Yapf().m_pBestIntermediateNode->m_parent;
}
}
@@ -270,20 +270,20 @@ public:
/* detect the destination */
bool bDestination = Yapf().PfDetectDestination(n);
if (bDestination) {
if (m_pBestDestNode == NULL || n < *m_pBestDestNode) {
if (m_pBestDestNode == nullptr || n < *m_pBestDestNode) {
m_pBestDestNode = &n;
}
m_nodes.FoundBestNode(n);
return;
}
if (m_max_search_nodes > 0 && (m_pBestIntermediateNode == NULL || (m_pBestIntermediateNode->GetCostEstimate() - m_pBestIntermediateNode->GetCost()) > (n.GetCostEstimate() - n.GetCost()))) {
if (m_max_search_nodes > 0 && (m_pBestIntermediateNode == nullptr || (m_pBestIntermediateNode->GetCostEstimate() - m_pBestIntermediateNode->GetCost()) > (n.GetCostEstimate() - n.GetCost()))) {
m_pBestIntermediateNode = &n;
}
/* check new node against open list */
Node *openNode = m_nodes.FindOpenNode(n.GetKey());
if (openNode != NULL) {
if (openNode != nullptr) {
/* another node exists with the same key in the open list
* is it better than new one? */
if (n.GetCostEstimate() < openNode->GetCostEstimate()) {
@@ -298,7 +298,7 @@ public:
/* check new node against closed list */
Node *closedNode = m_nodes.FindClosedNode(n.GetKey());
if (closedNode != NULL) {
if (closedNode != nullptr) {
/* another node exists with the same key in the closed list
* is it better than new one? */
int node_est = n.GetCostEstimate();

View File

@@ -46,7 +46,7 @@ public:
for (TrackdirBits tdb = m_orgTrackdirs; tdb != TRACKDIR_BIT_NONE; tdb = KillFirstBit(tdb)) {
Trackdir td = (Trackdir)FindFirstBit2x64(tdb);
Node &n1 = Yapf().CreateNewNode();
n1.Set(NULL, m_orgTile, td, is_choice);
n1.Set(nullptr, m_orgTile, td, is_choice);
Yapf().AddStartupNode(n1);
}
}
@@ -92,12 +92,12 @@ public:
{
if (m_orgTile != INVALID_TILE && m_orgTd != INVALID_TRACKDIR) {
Node &n1 = Yapf().CreateNewNode();
n1.Set(NULL, m_orgTile, m_orgTd, false);
n1.Set(nullptr, m_orgTile, m_orgTd, false);
Yapf().AddStartupNode(n1);
}
if (m_revTile != INVALID_TILE && m_revTd != INVALID_TRACKDIR) {
Node &n2 = Yapf().CreateNewNode();
n2.Set(NULL, m_revTile, m_revTd, false);
n2.Set(nullptr, m_revTile, m_revTd, false);
n2.m_cost = m_reverse_penalty;
Yapf().AddStartupNode(n2);
}

View File

@@ -143,7 +143,7 @@ struct CSegmentCostCacheT : public CSegmentCostCacheBase {
inline Tsegment& Get(Key &key, bool *found)
{
Tsegment *item = m_map.Find(key);
if (item == NULL) {
if (item == nullptr) {
*found = false;
item = new (m_heap.Append()) Tsegment(key);
m_map.Push(*item);

View File

@@ -269,7 +269,7 @@ private:
{
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, TrackdirToTrack(trackdir));
TraceRestrictProgramActionsUsedFlags flags_to_check = TRPAUF_PF;
if (is_res_through != NULL) {
if (is_res_through != nullptr) {
*is_res_through = false;
flags_to_check |= TRPAUF_RESERVE_THROUGH;
}
@@ -278,7 +278,7 @@ private:
}
if (prog && prog->actions_used_flags & flags_to_check) {
prog->Execute(Yapf().GetVehicle(), TraceRestrictProgramInput(tile, trackdir, &TraceRestrictPreviousSignalCallback, &n), out);
if (out.flags & TRPRF_RESERVE_THROUGH && is_res_through != NULL) {
if (out.flags & TRPRF_RESERVE_THROUGH && is_res_through != nullptr) {
*is_res_through = true;
}
if (out.flags & TRPRF_DENY) {
@@ -378,7 +378,7 @@ public:
if (ShouldCheckTraceRestrict(n, tile)) {
TraceRestrictProgramResult out;
if (ExecuteTraceRestrict(n, tile, trackdir, cost, out, NULL)) {
if (ExecuteTraceRestrict(n, tile, trackdir, cost, out, nullptr)) {
return -1;
}
}
@@ -396,7 +396,7 @@ public:
{
int cost = 0;
const Train *v = Yapf().GetVehicle();
assert(v != NULL);
assert(v != nullptr);
assert(v->type == VEH_TRAIN);
assert(v->gcache.cached_total_length != 0);
int missing_platform_length = CeilDiv(v->gcache.cached_total_length, TILE_SIZE) - platform_length;
@@ -430,7 +430,7 @@ public:
CPerfStart perf_cost(&Yapf().m_perf_cost);
/* Does the node have some parent node? */
bool has_parent = (n.m_parent != NULL);
bool has_parent = (n.m_parent != nullptr);
/* Do we already have a cached segment? */
CachedData &segment = *n.m_segment;
@@ -764,7 +764,7 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
/* Station platform-length penalty. */
if ((end_segment_reason & ESRB_STATION) != ESRB_NONE) {
const BaseStation *st = BaseStation::GetByTile(n.GetLastTile());
assert(st != NULL);
assert(st != nullptr);
uint platform_length = st->GetPlatformLength(n.GetLastTile(), ReverseDiagDir(TrackdirToExitdir(n.GetLastTrackdir())));
/* Reduce the extra cost caused by passing-station penalty (each station receives it in the segment cost). */
extra_cost -= Yapf().PfGetSettings().rail_station_penalty * platform_length;
@@ -782,7 +782,7 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
inline bool CanUseGlobalCache(Node &n) const
{
return !m_disable_cache
&& (n.m_parent != NULL)
&& (n.m_parent != nullptr)
&& (n.m_parent->m_num_signals_passed >= m_sig_look_ahead_costs.Size());
}

View File

@@ -72,7 +72,7 @@ struct CYapfNodeT {
inline void Set(Node *parent, TileIndex tile, Trackdir td, bool is_choice)
{
m_key.Set(tile, td);
m_hash_next = NULL;
m_hash_next = nullptr;
m_parent = parent;
m_cost = 0;
m_estimate = 0;

View File

@@ -83,7 +83,7 @@ struct CYapfRailSegment
, m_last_signal_tile(INVALID_TILE)
, m_last_signal_td(INVALID_TRACKDIR)
, m_end_segment_reason(ESRB_NONE)
, m_hash_next(NULL)
, m_hash_next(nullptr)
{}
inline const Key& GetKey() const
@@ -147,8 +147,8 @@ struct CYapfRailNodeT
inline void Set(CYapfRailNodeT *parent, TileIndex tile, Trackdir td, bool is_choice)
{
base::Set(parent, tile, td, is_choice);
m_segment = NULL;
if (parent == NULL) {
m_segment = nullptr;
if (parent == nullptr) {
m_num_signals_passed = 0;
m_num_signals_res_through_passed = 0;
m_last_non_reserve_through_signal_tile = INVALID_TILE;
@@ -181,19 +181,19 @@ struct CYapfRailNodeT
inline TileIndex GetLastTile() const
{
assert(m_segment != NULL);
assert(m_segment != nullptr);
return m_segment->m_last_tile;
}
inline Trackdir GetLastTrackdir() const
{
assert(m_segment != NULL);
assert(m_segment != nullptr);
return m_segment->m_last_td;
}
inline void SetLastTileTrackdir(TileIndex tile, Trackdir td)
{
assert(m_segment != NULL);
assert(m_segment != nullptr);
m_segment->m_last_tile = tile;
m_segment->m_last_td = td;
}

View File

@@ -35,15 +35,15 @@ template <typename Tpf> void DumpState(Tpf &pf1, Tpf &pf2)
#if defined(UNIX) && defined(__GLIBC__)
static unsigned int num = 0;
int pid = getpid();
const char *fn1 = NULL;
const char *fn2 = NULL;
FILE *f1 = NULL;
FILE *f2 = NULL;
const char *fn1 = nullptr;
const char *fn2 = nullptr;
FILE *f1 = nullptr;
FILE *f2 = nullptr;
for(;;) {
free(fn1);
fn1 = str_fmt("yapf-%d-%u-1.txt", pid, num);
f1 = fopen(fn1, "wx");
if (f1 == NULL && errno == EEXIST) {
if (f1 == nullptr && errno == EEXIST) {
num++;
continue;
}
@@ -59,8 +59,8 @@ template <typename Tpf> void DumpState(Tpf &pf1, Tpf &pf2)
FILE *f1 = fopen("yapf1.txt", "wt");
FILE *f2 = fopen("yapf2.txt", "wt");
#endif
assert(f1 != NULL);
assert(f2 != NULL);
assert(f1 != nullptr);
assert(f2 != nullptr);
fwrite(dmp1.m_out.Data(), 1, dmp1.m_out.Size(), f1);
fwrite(dmp2.m_out.Data(), 1, dmp2.m_out.Size(), f2);
fclose(f1);
@@ -115,7 +115,7 @@ private:
tile = TILE_ADD(tile, diff);
} while (IsCompatibleTrainStationTile(tile, start) && tile != m_origin_tile);
TriggerStationRandomisation(NULL, start, SRT_PATH_RESERVATION);
TriggerStationRandomisation(nullptr, start, SRT_PATH_RESERVATION);
return true;
}
@@ -169,7 +169,7 @@ public:
/** Check the node for a possible reservation target. */
inline void FindSafePositionOnNode(Node *node)
{
assert(node->m_parent != NULL);
assert(node->m_parent != nullptr);
/* We will never pass more than two non-reserve-through signals, no need to check for a safe tile. */
if (node->m_parent->m_num_signals_passed - node->m_parent->m_num_signals_res_through_passed >= 2) return;
@@ -185,7 +185,7 @@ public:
m_res_fail_tile = INVALID_TILE;
m_origin_tile = origin;
if (target != NULL) {
if (target != nullptr) {
target->tile = m_res_dest;
target->trackdir = m_res_dest_td;
target->okay = false;
@@ -195,7 +195,7 @@ public:
PBSWaitingPositionRestrictedSignalInfo restricted_signal_info;
if (!IsWaitingPositionFree(Yapf().GetVehicle(), m_res_dest, m_res_dest_td, false, &restricted_signal_info)) return false;
for (Node *node = m_res_node; node->m_parent != NULL; node = node->m_parent) {
for (Node *node = m_res_node; node->m_parent != nullptr; node = node->m_parent) {
node->IterateTiles(Yapf().GetVehicle(), Yapf(), *this, &CYapfReserveTrack<Types>::ReserveSingleTrack);
if (m_res_fail_tile != INVALID_TILE) {
/* Reservation failed, undo. */
@@ -205,7 +205,7 @@ public:
/* If this is the node that failed, stop at the failed tile. */
m_res_fail_tile = fail_node == node ? stop_tile : INVALID_TILE;
fail_node->IterateTiles(Yapf().GetVehicle(), Yapf(), *this, &CYapfReserveTrack<Types>::UnreserveSingleTrack);
} while (fail_node != node && (fail_node = fail_node->m_parent) != NULL);
} while (fail_node != node && (fail_node = fail_node->m_parent) != nullptr);
return false;
}
@@ -217,13 +217,13 @@ public:
extern TileIndex VehiclePosTraceRestrictPreviousSignalCallback(const Train *v, const void *);
TraceRestrictProgramResult out;
TraceRestrictProgramInput input(restricted_signal_info.tile, restricted_signal_info.trackdir, &VehiclePosTraceRestrictPreviousSignalCallback, NULL);
TraceRestrictProgramInput input(restricted_signal_info.tile, restricted_signal_info.trackdir, &VehiclePosTraceRestrictPreviousSignalCallback, nullptr);
input.permitted_slot_operations = TRPISP_PBS_RES_END_ACQUIRE | TRPISP_PBS_RES_END_RELEASE;
prog->Execute(Yapf().GetVehicle(), input, out);
}
}
if (target != NULL) target->okay = true;
if (target != nullptr) target->okay = true;
if (Yapf().CanUseGlobalCache(*m_res_node)) {
YapfNotifyTrackLayoutChange(INVALID_TILE, INVALID_TRACK);
@@ -238,12 +238,12 @@ public:
Node *n2 = pf2.GetBestNode();
uint depth = 0;
for (;;) {
if ((n1 != NULL) != (n2 != NULL)) {
DEBUG(desync, 0, "%s: node nonnull state at %u = [%d, %d]", name, depth, (n1 != NULL), (n2 != NULL));
if ((n1 != nullptr) != (n2 != nullptr)) {
DEBUG(desync, 0, "%s: node nonnull state at %u = [%d, %d]", name, depth, (n1 != nullptr), (n2 != nullptr));
DumpState(pf1, pf2);
return;
}
if (n1 == NULL) break;
if (n1 == nullptr) break;
if (n1->GetTile() != n2->GetTile()) {
DEBUG(desync, 0, "%s tile mismatch at %u = [0x%X, 0x%X]", name, depth, n1->GetTile(), n2->GetTile());
@@ -364,7 +364,7 @@ public:
/* walk through the path back to the origin */
Node *pNode = n;
while (pNode->m_parent != NULL) {
while (pNode->m_parent != nullptr) {
pNode = pNode->m_parent;
}
@@ -434,7 +434,7 @@ public:
return result1;
}
bool FindNearestSafeTile(const Train *v, TileIndex t1, Trackdir td, bool override_railtype, bool dont_reserve, bool *found_path = NULL)
bool FindNearestSafeTile(const Train *v, TileIndex t1, Trackdir td, bool override_railtype, bool dont_reserve, bool *found_path = nullptr)
{
/* Set origin and destination. */
Yapf().SetOrigin(t1, td);
@@ -449,15 +449,15 @@ public:
this->SetReservationTarget(pNode, pNode->GetLastTile(), pNode->GetLastTrackdir());
/* Walk through the path back to the origin. */
Node *pPrev = NULL;
while (pNode->m_parent != NULL) {
Node *pPrev = nullptr;
while (pNode->m_parent != nullptr) {
pPrev = pNode;
pNode = pNode->m_parent;
this->FindSafePositionOnNode(pPrev);
}
return dont_reserve || this->TryReservePath(NULL, pNode->GetLastTile());
return dont_reserve || this->TryReservePath(nullptr, pNode->GetLastTile());
}
};
@@ -521,7 +521,7 @@ public:
if (_debug_yapfdesync_level < 1 && _debug_desync_level < 2) {
result1 = pf1.ChooseRailTrack(v, tile, enterdir, tracks, path_found, reserve_track, target);
} else {
result1 = pf1.ChooseRailTrack(v, tile, enterdir, tracks, path_found, false, NULL);
result1 = pf1.ChooseRailTrack(v, tile, enterdir, tracks, path_found, false, nullptr);
Tpf pf2;
pf2.DisableCache(true);
Trackdir result2 = pf2.ChooseRailTrack(v, tile, enterdir, tracks, path_found, reserve_track, target);
@@ -538,7 +538,7 @@ public:
inline Trackdir ChooseRailTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool reserve_track, PBSTileInfo *target)
{
if (target != NULL) target->tile = INVALID_TILE;
if (target != nullptr) target->tile = INVALID_TILE;
/* set origin and destination nodes */
PBSTileInfo origin = FollowTrainReservation(v);
@@ -551,14 +551,14 @@ public:
/* if path not found - return INVALID_TRACKDIR */
Trackdir next_trackdir = INVALID_TRACKDIR;
Node *pNode = Yapf().GetBestNode();
if (pNode != NULL) {
if (pNode != nullptr) {
/* reserve till end of path */
this->SetReservationTarget(pNode, pNode->GetLastTile(), pNode->GetLastTrackdir());
/* path was found or at least suggested
* walk through the path back to the origin */
Node *pPrev = NULL;
while (pNode->m_parent != NULL) {
Node *pPrev = nullptr;
while (pNode->m_parent != nullptr) {
pPrev = pNode;
pNode = pNode->m_parent;
@@ -611,7 +611,7 @@ public:
/* path was found
* walk through the path back to the origin */
Node *pNode = Yapf().GetBestNode();
while (pNode->m_parent != NULL) {
while (pNode->m_parent != nullptr) {
pNode = pNode->m_parent;
}

View File

@@ -129,7 +129,7 @@ public:
/* start at n.m_key.m_tile / n.m_key.m_td and walk to the end of segment */
TileIndex tile = n.m_key.m_tile;
Trackdir trackdir = n.m_key.m_td;
int parent_cost = (n.m_parent != NULL) ? n.m_parent->m_cost : 0;
int parent_cost = (n.m_parent != nullptr) ? n.m_parent->m_cost : 0;
for (;;) {
/* base tile cost depending on distance between edges */
@@ -393,13 +393,13 @@ public:
/* if path not found - return INVALID_TRACKDIR */
Trackdir next_trackdir = INVALID_TRACKDIR;
Node *pNode = Yapf().GetBestNode();
if (pNode != NULL) {
if (pNode != nullptr) {
uint steps = 0;
for (Node *n = pNode; n->m_parent != NULL; n = n->m_parent) steps++;
for (Node *n = pNode; n->m_parent != nullptr; n = n->m_parent) steps++;
/* path was found or at least suggested
* walk through the path back to its origin */
while (pNode->m_parent != NULL) {
while (pNode->m_parent != nullptr) {
steps--;
if (pNode->GetIsChoice() && steps < YAPF_ROADVEH_PATH_CACHE_SEGMENTS) {
TrackdirByte td;
@@ -448,7 +448,7 @@ public:
if (!Yapf().FindPath(v)) return dist;
Node *pNode = Yapf().GetBestNode();
if (pNode != NULL) {
if (pNode != nullptr) {
/* path was found
* get the path cost estimate */
dist = pNode->GetCostEstimate();

View File

@@ -87,13 +87,13 @@ public:
Trackdir next_trackdir = INVALID_TRACKDIR; // this would mean "path not found"
Node *pNode = pf.GetBestNode();
if (pNode != NULL) {
if (pNode != nullptr) {
uint steps = 0;
for (Node *n = pNode; n->m_parent != NULL; n = n->m_parent) steps++;
for (Node *n = pNode; n->m_parent != nullptr; n = n->m_parent) steps++;
/* walk through the path back to the origin */
Node *pPrevNode = NULL;
while (pNode->m_parent != NULL) {
Node *pPrevNode = nullptr;
while (pNode->m_parent != nullptr) {
steps--;
if (steps > 0 && steps < YAPF_SHIP_PATH_CACHE_LENGTH) {
TrackdirByte td;
@@ -133,11 +133,11 @@ public:
if (!pf.FindPath(v)) return false;
Node *pNode = pf.GetBestNode();
if (pNode == NULL) return false;
if (pNode == nullptr) return false;
/* path was found
* walk through the path back to the origin */
while (pNode->m_parent != NULL) {
while (pNode->m_parent != nullptr) {
pNode = pNode->m_parent;
}