@@ -7430,7 +7430,7 @@ void Pathfinder::processHierarchicalCell( const ICoord2D &scanCell, const ICoord
7430
7430
}
7431
7431
7432
7432
newCell->allocateInfo (scanCell);
7433
- if (!newCell->getClosed () && !newCell->getOpen ()) {
7433
+ if (newCell-> hasInfo () && !newCell->getClosed () && !newCell->getOpen ()) {
7434
7434
m_closedList = newCell->putOnClosedList (m_closedList);
7435
7435
}
7436
7436
@@ -7588,7 +7588,11 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7588
7588
// Close parent cell;
7589
7589
m_openList = parentCell->removeFromOpenList (m_openList);
7590
7590
m_closedList = parentCell->putOnClosedList (m_closedList);
7591
- startCell->allocateInfo (ndx);
7591
+ if (!startCell->allocateInfo (ndx)) {
7592
+ cleanOpenAndClosedLists ();
7593
+ goalCell->releaseInfo ();
7594
+ return NULL ;
7595
+ }
7592
7596
startCell->setParentCellHierarchical (parentCell);
7593
7597
cellCount++;
7594
7598
Int curCost = startCell->costToHierGoal (parentCell);
@@ -7600,7 +7604,11 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7600
7604
m_openList = startCell->putOnSortedOpenList ( m_openList );
7601
7605
7602
7606
cellCount++;
7603
- cell->allocateInfo (toNdx);
7607
+ if (!cell->allocateInfo (toNdx)) {
7608
+ cleanOpenAndClosedLists ();
7609
+ goalCell->releaseInfo ();
7610
+ return NULL ;
7611
+ }
7604
7612
curCost = cell->costToHierGoal (parentCell);
7605
7613
remCost = cell->costToHierGoal (goalCell);
7606
7614
cell->setCostSoFar (curCost);
@@ -7684,13 +7692,21 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7684
7692
PathfindCell *startCell = getCell (LAYER_GROUND, ndx.x , ndx.y );
7685
7693
if (startCell==NULL ) continue ;
7686
7694
if (startCell != parentCell) {
7687
- startCell->allocateInfo (ndx);
7695
+ if (!startCell->allocateInfo (ndx)) {
7696
+ cleanOpenAndClosedLists ();
7697
+ goalCell->releaseInfo ();
7698
+ return NULL ;
7699
+ }
7688
7700
startCell->setParentCellHierarchical (parentCell);
7689
7701
if (!startCell->getClosed () && !startCell->getOpen ()) {
7690
7702
m_closedList = startCell->putOnClosedList (m_closedList);
7691
7703
}
7692
7704
}
7693
- cell->allocateInfo (toNdx);
7705
+ if (!cell->allocateInfo (toNdx)) {
7706
+ cleanOpenAndClosedLists ();
7707
+ goalCell->releaseInfo ();
7708
+ return NULL ;
7709
+ }
7694
7710
cell->setParentCellHierarchical (startCell);
7695
7711
7696
7712
cellCount++;
0 commit comments