@@ -7445,7 +7445,7 @@ void Pathfinder::processHierarchicalCell( const ICoord2D &scanCell, const ICoord
7445
7445
}
7446
7446
7447
7447
newCell->allocateInfo (scanCell);
7448
- if (!newCell->getClosed () && !newCell->getOpen ()) {
7448
+ if (newCell-> hasInfo () && !newCell->getClosed () && !newCell->getOpen ()) {
7449
7449
m_closedList = newCell->putOnClosedList (m_closedList);
7450
7450
}
7451
7451
@@ -7603,7 +7603,11 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7603
7603
// Close parent cell;
7604
7604
m_openList = parentCell->removeFromOpenList (m_openList);
7605
7605
m_closedList = parentCell->putOnClosedList (m_closedList);
7606
- startCell->allocateInfo (ndx);
7606
+ if (!startCell->allocateInfo (ndx)) {
7607
+ cleanOpenAndClosedLists ();
7608
+ goalCell->releaseInfo ();
7609
+ return NULL ;
7610
+ }
7607
7611
startCell->setParentCellHierarchical (parentCell);
7608
7612
cellCount++;
7609
7613
Int curCost = startCell->costToHierGoal (parentCell);
@@ -7615,7 +7619,11 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7615
7619
m_openList = startCell->putOnSortedOpenList ( m_openList );
7616
7620
7617
7621
cellCount++;
7618
- cell->allocateInfo (toNdx);
7622
+ if (!cell->allocateInfo (toNdx)) {
7623
+ cleanOpenAndClosedLists ();
7624
+ goalCell->releaseInfo ();
7625
+ return NULL ;
7626
+ }
7619
7627
curCost = cell->costToHierGoal (parentCell);
7620
7628
remCost = cell->costToHierGoal (goalCell);
7621
7629
cell->setCostSoFar (curCost);
@@ -7699,13 +7707,21 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7699
7707
PathfindCell *startCell = getCell (LAYER_GROUND, ndx.x , ndx.y );
7700
7708
if (startCell==NULL ) continue ;
7701
7709
if (startCell != parentCell) {
7702
- startCell->allocateInfo (ndx);
7710
+ if (!startCell->allocateInfo (ndx)) {
7711
+ cleanOpenAndClosedLists ();
7712
+ goalCell->releaseInfo ();
7713
+ return NULL ;
7714
+ }
7703
7715
startCell->setParentCellHierarchical (parentCell);
7704
7716
if (!startCell->getClosed () && !startCell->getOpen ()) {
7705
7717
m_closedList = startCell->putOnClosedList (m_closedList);
7706
7718
}
7707
7719
}
7708
- cell->allocateInfo (toNdx);
7720
+ if (!cell->allocateInfo (toNdx)) {
7721
+ cleanOpenAndClosedLists ();
7722
+ goalCell->releaseInfo ();
7723
+ return NULL ;
7724
+ }
7709
7725
cell->setParentCellHierarchical (startCell);
7710
7726
7711
7727
cellCount++;
0 commit comments