Fix: incorrect path rebuilding in RebuildWayPointsForGroupPath() (by sun_alf)

Additional correction to RebuildWayPointsForGroupPath(): we should not skip "next" sector if we are between sectors. (Original comment stated opposite which was confusing)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9353 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
rftr
2022-03-31 05:08:49 +00:00
parent 3577ffa91a
commit 094c2edbde
+1 -7
View File
@@ -1712,7 +1712,6 @@ void RebuildWayPointsForGroupPath( PathStPtr pHeadOfPath, INT16 sMvtGroup )
UINT32 uiCurrentSectorId = CALCULATE_STRATEGIC_INDEX(pGroup->ubSectorX, pGroup->ubSectorY);
UINT32 uiTargetSectorId = pGroup->fBetweenSectors ? CALCULATE_STRATEGIC_INDEX(pGroup->ubNextX, pGroup->ubNextY) : INVALID_STRATEGIC_INDEX;
UINT32 uiPrevNodeSectorId = INVALID_STRATEGIC_INDEX; // relates to path node, not to the group we work with
// build a brand new list of waypoints, one for initial direction, and another for every "direction change" thereafter
@@ -1721,12 +1720,7 @@ void RebuildWayPointsForGroupPath( PathStPtr pHeadOfPath, INT16 sMvtGroup )
Assert(uiPrevNodeSectorId != pNode->uiSectorId);
uiPrevNodeSectorId = pNode->uiSectorId;
// if we are between sectors, we have to skip the first waypoint to the place we are already going to.
if (pGroup->fBetweenSectors && pNode->uiSectorId == uiTargetSectorId)
{
uiTargetSectorId = INVALID_STRATEGIC_INDEX; // reset to invalid so that it won't enter this branch anymore
}
else if (pNode->uiSectorId == uiCurrentSectorId) // also skip this first waypoint as we are already in
if (pNode->uiSectorId == uiCurrentSectorId) // skip this first waypoint as we are already in
{
uiCurrentSectorId = INVALID_STRATEGIC_INDEX; // reset to invalid so that it won't enter this branch anymore
}