@@ -6650,6 +6650,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe
6650
6650
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), from, goalCell, centerInCell, false );
6651
6651
parentCell->releaseInfo ();
6652
6652
cleanOpenAndClosedLists ();
6653
+ goalCell->releaseInfo ();
6653
6654
return path;
6654
6655
}
6655
6656
@@ -6726,8 +6727,9 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe
6726
6727
#endif
6727
6728
6728
6729
m_isTunneling = false ;
6729
- goalCell ->releaseInfo ();
6730
+ parentCell ->releaseInfo ();
6730
6731
cleanOpenAndClosedLists ();
6732
+ goalCell->releaseInfo ();
6731
6733
return NULL ;
6732
6734
}
6733
6735
@@ -7167,6 +7169,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from,
7167
7169
Path *path = buildGroundPath (crusher, from, goalCell, centerInCell, pathDiameter );
7168
7170
parentCell->releaseInfo ();
7169
7171
cleanOpenAndClosedLists ();
7172
+ goalCell->releaseInfo ();
7170
7173
return path;
7171
7174
}
7172
7175
@@ -7371,8 +7374,9 @@ Path *Pathfinder::findGroundPath( const Coord3D *from,
7371
7374
TheGameLogic->incrementOverallFailedPathfinds ();
7372
7375
#endif
7373
7376
m_isTunneling = false ;
7374
- goalCell ->releaseInfo ();
7377
+ parentCell ->releaseInfo ();
7375
7378
cleanOpenAndClosedLists ();
7379
+ goalCell->releaseInfo ();
7376
7380
return NULL ;
7377
7381
}
7378
7382
@@ -7750,11 +7754,9 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7750
7754
#endif
7751
7755
}
7752
7756
#endif
7753
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
7754
- goalCell->releaseInfo ();
7755
- }
7756
7757
parentCell->releaseInfo ();
7757
7758
cleanOpenAndClosedLists ();
7759
+ goalCell->releaseInfo ();
7758
7760
return path;
7759
7761
}
7760
7762
@@ -7951,10 +7953,9 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7951
7953
}
7952
7954
#endif
7953
7955
#endif
7954
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
7955
- goalCell->releaseInfo ();
7956
- }
7956
+ parentCell->releaseInfo ();
7957
7957
cleanOpenAndClosedLists ();
7958
+ goalCell->releaseInfo ();
7958
7959
return path;
7959
7960
}
7960
7961
@@ -8001,8 +8002,9 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
8001
8002
TheGameLogic->incrementOverallFailedPathfinds ();
8002
8003
#endif
8003
8004
m_isTunneling = false ;
8004
- goalCell ->releaseInfo ();
8005
+ parentCell ->releaseInfo ();
8005
8006
cleanOpenAndClosedLists ();
8007
+ goalCell->releaseInfo ();
8006
8008
return NULL ;
8007
8009
}
8008
8010
@@ -8437,6 +8439,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet
8437
8439
}
8438
8440
#endif
8439
8441
m_isTunneling = false ;
8442
+ parentCell->releaseInfo ();
8440
8443
cleanOpenAndClosedLists ();
8441
8444
goalCell->releaseInfo ();
8442
8445
return false ;
@@ -8570,7 +8573,9 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con
8570
8573
if (parentCell==goalCell) {
8571
8574
Int cost = parentCell->getTotalCost ();
8572
8575
m_isTunneling = false ;
8576
+ parentCell->releaseInfo ();
8573
8577
cleanOpenAndClosedLists ();
8578
+ goalCell->releaseInfo ();
8574
8579
return cost;
8575
8580
}
8576
8581
@@ -8682,10 +8687,9 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con
8682
8687
}
8683
8688
8684
8689
m_isTunneling = false ;
8685
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
8686
- goalCell->releaseInfo ();
8687
- }
8690
+ parentCell->releaseInfo ();
8688
8691
cleanOpenAndClosedLists ();
8692
+ goalCell->releaseInfo ();
8689
8693
return MAX_COST;
8690
8694
}
8691
8695
@@ -8888,8 +8892,8 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
8888
8892
// construct and return path
8889
8893
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), from, goalCell, centerInCell, blocked);
8890
8894
parentCell->releaseInfo ();
8891
- goalCell->releaseInfo ();
8892
8895
cleanOpenAndClosedLists ();
8896
+ goalCell->releaseInfo ();
8893
8897
return path;
8894
8898
}
8895
8899
// put parent cell onto closed list - its evaluation is finished
@@ -8969,8 +8973,9 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
8969
8973
rawTo->y = closesetCell->getYIndex ()*PATHFIND_CELL_SIZE_F + PATHFIND_CELL_SIZE_F/2 .0f ;
8970
8974
// construct and return path
8971
8975
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), from, closesetCell, centerInCell, blocked );
8972
- goalCell ->releaseInfo ();
8976
+ parentCell ->releaseInfo ();
8973
8977
cleanOpenAndClosedLists ();
8978
+ goalCell->releaseInfo ();
8974
8979
return path;
8975
8980
}
8976
8981
@@ -8991,8 +8996,9 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
8991
8996
TheGameLogic->incrementOverallFailedPathfinds ();
8992
8997
#endif
8993
8998
m_isTunneling = false ;
8994
- goalCell ->releaseInfo ();
8999
+ parentCell ->releaseInfo ();
8995
9000
cleanOpenAndClosedLists ();
9001
+ goalCell->releaseInfo ();
8996
9002
return NULL ;
8997
9003
}
8998
9004
@@ -9114,12 +9120,16 @@ void Pathfinder::prependCells( Path *path, const Coord3D *fromPos,
9114
9120
}
9115
9121
prevCell = cell;
9116
9122
}
9117
- m_zoneManager.setPassable (cell->getXIndex (), cell->getYIndex (), true );
9118
- if (goalCellNull) {
9119
- // Very short path.
9120
- adjustCoordToCell (cell->getXIndex (), cell->getYIndex (), center, pos, cell->getLayer ());
9121
- path->prependNode ( &pos, cell->getLayer () );
9123
+
9124
+ if (cell->hasInfo ()) {
9125
+ m_zoneManager.setPassable (cell->getXIndex (), cell->getYIndex (), true );
9126
+ if (goalCellNull) {
9127
+ // Very short path.
9128
+ adjustCoordToCell (cell->getXIndex (), cell->getYIndex (), center, pos, cell->getLayer ());
9129
+ path->prependNode ( &pos, cell->getLayer () );
9130
+ }
9122
9131
}
9132
+
9123
9133
// put actual start position as first node on the path, so it begins right at the unit's feet
9124
9134
if (fromPos->x != path->getFirstNode ()->getPosition ()->x || fromPos->y != path->getFirstNode ()->getPosition ()->y ) {
9125
9135
path->prependNode ( fromPos, cell->getLayer () );
@@ -10400,6 +10410,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj,
10400
10410
DEBUG_LOG ((" Unit '%s', time %f\n " , obj->getTemplate ()->getName ().str (), (::GetTickCount ()-startTimeMS)/1000 .0f ));
10401
10411
10402
10412
m_isTunneling = false ;
10413
+ parentCell->releaseInfo ();
10403
10414
cleanOpenAndClosedLists ();
10404
10415
return NULL ;
10405
10416
}
@@ -10516,6 +10527,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet
10516
10527
10517
10528
}
10518
10529
if (startNode == originalPath->getLastNode ()) {
10530
+ parentCell->releaseInfo ();
10519
10531
cleanOpenAndClosedLists ();
10520
10532
return NULL ; // no open nodes.
10521
10533
}
@@ -10584,12 +10596,9 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet
10584
10596
}
10585
10597
#endif
10586
10598
m_isTunneling = false ;
10587
- if (!candidateGoal->getOpen () && !candidateGoal->getClosed ())
10588
- {
10589
- // Not on one of the lists
10590
- candidateGoal->releaseInfo ();
10591
- }
10599
+ parentCell->releaseInfo ();
10592
10600
cleanOpenAndClosedLists ();
10601
+ candidateGoal->releaseInfo ();
10593
10602
return NULL ;
10594
10603
}
10595
10604
@@ -10882,10 +10891,9 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
10882
10891
}
10883
10892
}
10884
10893
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), obj->getPosition (), parentCell, centerInCell, false );
10885
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
10886
- goalCell->releaseInfo ();
10887
- }
10894
+ parentCell->releaseInfo ();
10888
10895
cleanOpenAndClosedLists ();
10896
+ goalCell->releaseInfo ();
10889
10897
return path;
10890
10898
}
10891
10899
}
@@ -10942,10 +10950,9 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
10942
10950
TheGameLogic->incrementOverallFailedPathfinds ();
10943
10951
#endif
10944
10952
m_isTunneling = false ;
10945
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
10946
- goalCell->releaseInfo ();
10947
- }
10953
+ parentCell->releaseInfo ();
10948
10954
cleanOpenAndClosedLists ();
10955
+ goalCell->releaseInfo ();
10949
10956
return NULL ;
10950
10957
}
10951
10958
@@ -11103,6 +11110,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor
11103
11110
TheGameLogic->incrementOverallFailedPathfinds ();
11104
11111
#endif
11105
11112
m_isTunneling = false ;
11113
+ parentCell->releaseInfo ();
11106
11114
cleanOpenAndClosedLists ();
11107
11115
return NULL ;
11108
11116
}
0 commit comments