@@ -6646,6 +6646,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe
6646
6646
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), from, goalCell, centerInCell, false );
6647
6647
parentCell->releaseInfo ();
6648
6648
cleanOpenAndClosedLists ();
6649
+ goalCell->releaseInfo ();
6649
6650
return path;
6650
6651
}
6651
6652
@@ -6722,8 +6723,9 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe
6722
6723
#endif
6723
6724
6724
6725
m_isTunneling = false ;
6725
- goalCell ->releaseInfo ();
6726
+ parentCell ->releaseInfo ();
6726
6727
cleanOpenAndClosedLists ();
6728
+ goalCell->releaseInfo ();
6727
6729
return NULL ;
6728
6730
}
6729
6731
@@ -7158,6 +7160,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from,
7158
7160
Path *path = buildGroundPath (crusher, from, goalCell, centerInCell, pathDiameter );
7159
7161
parentCell->releaseInfo ();
7160
7162
cleanOpenAndClosedLists ();
7163
+ goalCell->releaseInfo ();
7161
7164
return path;
7162
7165
}
7163
7166
@@ -7352,8 +7355,9 @@ Path *Pathfinder::findGroundPath( const Coord3D *from,
7352
7355
TheGameLogic->incrementOverallFailedPathfinds ();
7353
7356
#endif
7354
7357
m_isTunneling = false ;
7355
- goalCell ->releaseInfo ();
7358
+ parentCell ->releaseInfo ();
7356
7359
cleanOpenAndClosedLists ();
7360
+ goalCell->releaseInfo ();
7357
7361
return NULL ;
7358
7362
}
7359
7363
@@ -7731,11 +7735,9 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7731
7735
#endif
7732
7736
}
7733
7737
#endif
7734
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
7735
- goalCell->releaseInfo ();
7736
- }
7737
7738
parentCell->releaseInfo ();
7738
7739
cleanOpenAndClosedLists ();
7740
+ goalCell->releaseInfo ();
7739
7741
return path;
7740
7742
}
7741
7743
@@ -7932,10 +7934,9 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7932
7934
}
7933
7935
#endif
7934
7936
#endif
7935
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
7936
- goalCell->releaseInfo ();
7937
- }
7937
+ parentCell->releaseInfo ();
7938
7938
cleanOpenAndClosedLists ();
7939
+ goalCell->releaseInfo ();
7939
7940
return path;
7940
7941
}
7941
7942
@@ -7982,8 +7983,9 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7982
7983
TheGameLogic->incrementOverallFailedPathfinds ();
7983
7984
#endif
7984
7985
m_isTunneling = false ;
7985
- goalCell ->releaseInfo ();
7986
+ parentCell ->releaseInfo ();
7986
7987
cleanOpenAndClosedLists ();
7988
+ goalCell->releaseInfo ();
7987
7989
return NULL ;
7988
7990
}
7989
7991
@@ -8418,6 +8420,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet
8418
8420
}
8419
8421
#endif
8420
8422
m_isTunneling = false ;
8423
+ parentCell->releaseInfo ();
8421
8424
cleanOpenAndClosedLists ();
8422
8425
goalCell->releaseInfo ();
8423
8426
return false ;
@@ -8551,7 +8554,9 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con
8551
8554
if (parentCell==goalCell) {
8552
8555
Int cost = parentCell->getTotalCost ();
8553
8556
m_isTunneling = false ;
8557
+ parentCell->releaseInfo ();
8554
8558
cleanOpenAndClosedLists ();
8559
+ goalCell->releaseInfo ();
8555
8560
return cost;
8556
8561
}
8557
8562
@@ -8663,10 +8668,9 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con
8663
8668
}
8664
8669
8665
8670
m_isTunneling = false ;
8666
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
8667
- goalCell->releaseInfo ();
8668
- }
8671
+ parentCell->releaseInfo ();
8669
8672
cleanOpenAndClosedLists ();
8673
+ goalCell->releaseInfo ();
8670
8674
return MAX_COST;
8671
8675
}
8672
8676
@@ -8869,8 +8873,8 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
8869
8873
// construct and return path
8870
8874
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), from, goalCell, centerInCell, blocked);
8871
8875
parentCell->releaseInfo ();
8872
- goalCell->releaseInfo ();
8873
8876
cleanOpenAndClosedLists ();
8877
+ goalCell->releaseInfo ();
8874
8878
return path;
8875
8879
}
8876
8880
// put parent cell onto closed list - its evaluation is finished
@@ -8950,8 +8954,9 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
8950
8954
rawTo->y = closesetCell->getYIndex ()*PATHFIND_CELL_SIZE_F + PATHFIND_CELL_SIZE_F/2 .0f ;
8951
8955
// construct and return path
8952
8956
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), from, closesetCell, centerInCell, blocked );
8953
- goalCell ->releaseInfo ();
8957
+ parentCell ->releaseInfo ();
8954
8958
cleanOpenAndClosedLists ();
8959
+ goalCell->releaseInfo ();
8955
8960
return path;
8956
8961
}
8957
8962
@@ -8972,8 +8977,9 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
8972
8977
TheGameLogic->incrementOverallFailedPathfinds ();
8973
8978
#endif
8974
8979
m_isTunneling = false ;
8975
- goalCell ->releaseInfo ();
8980
+ parentCell ->releaseInfo ();
8976
8981
cleanOpenAndClosedLists ();
8982
+ goalCell->releaseInfo ();
8977
8983
return NULL ;
8978
8984
}
8979
8985
@@ -9095,12 +9101,16 @@ void Pathfinder::prependCells( Path *path, const Coord3D *fromPos,
9095
9101
}
9096
9102
prevCell = cell;
9097
9103
}
9098
- m_zoneManager.setPassable (cell->getXIndex (), cell->getYIndex (), true );
9099
- if (goalCellNull) {
9100
- // Very short path.
9101
- adjustCoordToCell (cell->getXIndex (), cell->getYIndex (), center, pos, cell->getLayer ());
9102
- path->prependNode ( &pos, cell->getLayer () );
9104
+
9105
+ if (cell->hasInfo ()) {
9106
+ m_zoneManager.setPassable (cell->getXIndex (), cell->getYIndex (), true );
9107
+ if (goalCellNull) {
9108
+ // Very short path.
9109
+ adjustCoordToCell (cell->getXIndex (), cell->getYIndex (), center, pos, cell->getLayer ());
9110
+ path->prependNode ( &pos, cell->getLayer () );
9111
+ }
9103
9112
}
9113
+
9104
9114
// put actual start position as first node on the path, so it begins right at the unit's feet
9105
9115
if (fromPos->x != path->getFirstNode ()->getPosition ()->x || fromPos->y != path->getFirstNode ()->getPosition ()->y ) {
9106
9116
path->prependNode ( fromPos, cell->getLayer () );
@@ -10381,6 +10391,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj,
10381
10391
DEBUG_LOG ((" Unit '%s', time %f\n " , obj->getTemplate ()->getName ().str (), (::GetTickCount ()-startTimeMS)/1000 .0f ));
10382
10392
10383
10393
m_isTunneling = false ;
10394
+ parentCell->releaseInfo ();
10384
10395
cleanOpenAndClosedLists ();
10385
10396
return NULL ;
10386
10397
}
@@ -10497,6 +10508,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet
10497
10508
10498
10509
}
10499
10510
if (startNode == originalPath->getLastNode ()) {
10511
+ parentCell->releaseInfo ();
10500
10512
cleanOpenAndClosedLists ();
10501
10513
return NULL ; // no open nodes.
10502
10514
}
@@ -10565,12 +10577,9 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet
10565
10577
}
10566
10578
#endif
10567
10579
m_isTunneling = false ;
10568
- if (!candidateGoal->getOpen () && !candidateGoal->getClosed ())
10569
- {
10570
- // Not on one of the lists
10571
- candidateGoal->releaseInfo ();
10572
- }
10580
+ parentCell->releaseInfo ();
10573
10581
cleanOpenAndClosedLists ();
10582
+ candidateGoal->releaseInfo ();
10574
10583
return NULL ;
10575
10584
}
10576
10585
@@ -10863,10 +10872,9 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
10863
10872
}
10864
10873
}
10865
10874
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), obj->getPosition (), parentCell, centerInCell, false );
10866
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
10867
- goalCell->releaseInfo ();
10868
- }
10875
+ parentCell->releaseInfo ();
10869
10876
cleanOpenAndClosedLists ();
10877
+ goalCell->releaseInfo ();
10870
10878
return path;
10871
10879
}
10872
10880
}
@@ -10923,10 +10931,9 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
10923
10931
TheGameLogic->incrementOverallFailedPathfinds ();
10924
10932
#endif
10925
10933
m_isTunneling = false ;
10926
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
10927
- goalCell->releaseInfo ();
10928
- }
10934
+ parentCell->releaseInfo ();
10929
10935
cleanOpenAndClosedLists ();
10936
+ goalCell->releaseInfo ();
10930
10937
return NULL ;
10931
10938
}
10932
10939
@@ -11084,6 +11091,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor
11084
11091
TheGameLogic->incrementOverallFailedPathfinds ();
11085
11092
#endif
11086
11093
m_isTunneling = false ;
11094
+ parentCell->releaseInfo ();
11087
11095
cleanOpenAndClosedLists ();
11088
11096
return NULL ;
11089
11097
}
0 commit comments