From 094c2edbde0717ed9e1412982718be2f4ed38eaf Mon Sep 17 00:00:00 2001 From: rftr Date: Thu, 31 Mar 2022 05:08:49 +0000 Subject: [PATCH] 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 --- Strategic/Strategic Pathing.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Strategic/Strategic Pathing.cpp b/Strategic/Strategic Pathing.cpp index 91ab160f..657d11fa 100644 --- a/Strategic/Strategic Pathing.cpp +++ b/Strategic/Strategic Pathing.cpp @@ -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 }