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