@@ -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
@@ -7163,6 +7165,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from,
7163
7165
Path *path = buildGroundPath (crusher, from, goalCell, centerInCell, pathDiameter );
7164
7166
parentCell->releaseInfo ();
7165
7167
cleanOpenAndClosedLists ();
7168
+ goalCell->releaseInfo ();
7166
7169
return path;
7167
7170
}
7168
7171
@@ -7367,8 +7370,9 @@ Path *Pathfinder::findGroundPath( const Coord3D *from,
7367
7370
TheGameLogic->incrementOverallFailedPathfinds ();
7368
7371
#endif
7369
7372
m_isTunneling = false ;
7370
- goalCell ->releaseInfo ();
7373
+ parentCell ->releaseInfo ();
7371
7374
cleanOpenAndClosedLists ();
7375
+ goalCell->releaseInfo ();
7372
7376
return NULL ;
7373
7377
}
7374
7378
@@ -7746,11 +7750,9 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7746
7750
#endif
7747
7751
}
7748
7752
#endif
7749
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
7750
- goalCell->releaseInfo ();
7751
- }
7752
7753
parentCell->releaseInfo ();
7753
7754
cleanOpenAndClosedLists ();
7755
+ goalCell->releaseInfo ();
7754
7756
return path;
7755
7757
}
7756
7758
@@ -7947,10 +7949,9 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7947
7949
}
7948
7950
#endif
7949
7951
#endif
7950
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
7951
- goalCell->releaseInfo ();
7952
- }
7952
+ parentCell->releaseInfo ();
7953
7953
cleanOpenAndClosedLists ();
7954
+ goalCell->releaseInfo ();
7954
7955
return path;
7955
7956
}
7956
7957
@@ -7997,8 +7998,9 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
7997
7998
TheGameLogic->incrementOverallFailedPathfinds ();
7998
7999
#endif
7999
8000
m_isTunneling = false ;
8000
- goalCell ->releaseInfo ();
8001
+ parentCell ->releaseInfo ();
8001
8002
cleanOpenAndClosedLists ();
8003
+ goalCell->releaseInfo ();
8002
8004
return NULL ;
8003
8005
}
8004
8006
@@ -8433,6 +8435,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet
8433
8435
}
8434
8436
#endif
8435
8437
m_isTunneling = false ;
8438
+ parentCell->releaseInfo ();
8436
8439
cleanOpenAndClosedLists ();
8437
8440
goalCell->releaseInfo ();
8438
8441
return false ;
@@ -8566,7 +8569,9 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con
8566
8569
if (parentCell==goalCell) {
8567
8570
Int cost = parentCell->getTotalCost ();
8568
8571
m_isTunneling = false ;
8572
+ parentCell->releaseInfo ();
8569
8573
cleanOpenAndClosedLists ();
8574
+ goalCell->releaseInfo ();
8570
8575
return cost;
8571
8576
}
8572
8577
@@ -8678,10 +8683,9 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con
8678
8683
}
8679
8684
8680
8685
m_isTunneling = false ;
8681
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
8682
- goalCell->releaseInfo ();
8683
- }
8686
+ parentCell->releaseInfo ();
8684
8687
cleanOpenAndClosedLists ();
8688
+ goalCell->releaseInfo ();
8685
8689
return MAX_COST;
8686
8690
}
8687
8691
@@ -8884,8 +8888,8 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
8884
8888
// construct and return path
8885
8889
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), from, goalCell, centerInCell, blocked);
8886
8890
parentCell->releaseInfo ();
8887
- goalCell->releaseInfo ();
8888
8891
cleanOpenAndClosedLists ();
8892
+ goalCell->releaseInfo ();
8889
8893
return path;
8890
8894
}
8891
8895
// put parent cell onto closed list - its evaluation is finished
@@ -8965,8 +8969,9 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
8965
8969
rawTo->y = closesetCell->getYIndex ()*PATHFIND_CELL_SIZE_F + PATHFIND_CELL_SIZE_F/2 .0f ;
8966
8970
// construct and return path
8967
8971
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), from, closesetCell, centerInCell, blocked );
8968
- goalCell ->releaseInfo ();
8972
+ parentCell ->releaseInfo ();
8969
8973
cleanOpenAndClosedLists ();
8974
+ goalCell->releaseInfo ();
8970
8975
return path;
8971
8976
}
8972
8977
@@ -8987,8 +8992,9 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
8987
8992
TheGameLogic->incrementOverallFailedPathfinds ();
8988
8993
#endif
8989
8994
m_isTunneling = false ;
8990
- goalCell ->releaseInfo ();
8995
+ parentCell ->releaseInfo ();
8991
8996
cleanOpenAndClosedLists ();
8997
+ goalCell->releaseInfo ();
8992
8998
return NULL ;
8993
8999
}
8994
9000
@@ -9110,12 +9116,16 @@ void Pathfinder::prependCells( Path *path, const Coord3D *fromPos,
9110
9116
}
9111
9117
prevCell = cell;
9112
9118
}
9113
- m_zoneManager.setPassable (cell->getXIndex (), cell->getYIndex (), true );
9114
- if (goalCellNull) {
9115
- // Very short path.
9116
- adjustCoordToCell (cell->getXIndex (), cell->getYIndex (), center, pos, cell->getLayer ());
9117
- path->prependNode ( &pos, cell->getLayer () );
9119
+
9120
+ if (cell->hasInfo ()) {
9121
+ m_zoneManager.setPassable (cell->getXIndex (), cell->getYIndex (), true );
9122
+ if (goalCellNull) {
9123
+ // Very short path.
9124
+ adjustCoordToCell (cell->getXIndex (), cell->getYIndex (), center, pos, cell->getLayer ());
9125
+ path->prependNode ( &pos, cell->getLayer () );
9126
+ }
9118
9127
}
9128
+
9119
9129
// put actual start position as first node on the path, so it begins right at the unit's feet
9120
9130
if (fromPos->x != path->getFirstNode ()->getPosition ()->x || fromPos->y != path->getFirstNode ()->getPosition ()->y ) {
9121
9131
path->prependNode ( fromPos, cell->getLayer () );
@@ -10396,6 +10406,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj,
10396
10406
DEBUG_LOG ((" Unit '%s', time %f\n " , obj->getTemplate ()->getName ().str (), (::GetTickCount ()-startTimeMS)/1000 .0f ));
10397
10407
10398
10408
m_isTunneling = false ;
10409
+ parentCell->releaseInfo ();
10399
10410
cleanOpenAndClosedLists ();
10400
10411
return NULL ;
10401
10412
}
@@ -10512,6 +10523,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet
10512
10523
10513
10524
}
10514
10525
if (startNode == originalPath->getLastNode ()) {
10526
+ parentCell->releaseInfo ();
10515
10527
cleanOpenAndClosedLists ();
10516
10528
return NULL ; // no open nodes.
10517
10529
}
@@ -10580,12 +10592,9 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet
10580
10592
}
10581
10593
#endif
10582
10594
m_isTunneling = false ;
10583
- if (!candidateGoal->getOpen () && !candidateGoal->getClosed ())
10584
- {
10585
- // Not on one of the lists
10586
- candidateGoal->releaseInfo ();
10587
- }
10595
+ parentCell->releaseInfo ();
10588
10596
cleanOpenAndClosedLists ();
10597
+ candidateGoal->releaseInfo ();
10589
10598
return NULL ;
10590
10599
}
10591
10600
@@ -10878,10 +10887,9 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
10878
10887
}
10879
10888
}
10880
10889
Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), obj->getPosition (), parentCell, centerInCell, false );
10881
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
10882
- goalCell->releaseInfo ();
10883
- }
10890
+ parentCell->releaseInfo ();
10884
10891
cleanOpenAndClosedLists ();
10892
+ goalCell->releaseInfo ();
10885
10893
return path;
10886
10894
}
10887
10895
}
@@ -10938,10 +10946,9 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
10938
10946
TheGameLogic->incrementOverallFailedPathfinds ();
10939
10947
#endif
10940
10948
m_isTunneling = false ;
10941
- if (goalCell->hasInfo () && !goalCell->getClosed () && !goalCell->getOpen ()) {
10942
- goalCell->releaseInfo ();
10943
- }
10949
+ parentCell->releaseInfo ();
10944
10950
cleanOpenAndClosedLists ();
10951
+ goalCell->releaseInfo ();
10945
10952
return NULL ;
10946
10953
}
10947
10954
@@ -11099,6 +11106,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor
11099
11106
TheGameLogic->incrementOverallFailedPathfinds ();
11100
11107
#endif
11101
11108
m_isTunneling = false ;
11109
+ parentCell->releaseInfo ();
11102
11110
cleanOpenAndClosedLists ();
11103
11111
return NULL ;
11104
11112
}
0 commit comments