From 3fdfdf680f89a7c9df888f24e14ea21c740b00fa Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 8 Apr 2013 22:39:52 +0200 Subject: fix possible bug with fading in paths after a map switch --- src/koopatlas/pathmanager.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 579934a..b555b41 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -504,9 +504,15 @@ void dWMPathManager_c::unlockPaths() { newlyAvailablePaths = 0; newlyAvailableNodes = 0; - if (oldPathAvData) { + dScKoopatlas_c *wm = dScKoopatlas_c::instance; + bool forceFlag = (wm->isAfter8Castle || wm->isAfterKamekCutscene); + + if (oldPathAvData || forceFlag) { for (int i = 0; i < pathLayer->pathCount; i++) { - if ((PathAvailabilityData[i] > 0) && (oldPathAvData[i] == 0)) { + if ((PathAvailabilityData[i] > 0) && (forceFlag || oldPathAvData[i] == 0)) { + if (forceFlag && PathAvailabilityData[i] == dKPPath_s::ALWAYS_AVAILABLE) + continue; + dKPPath_s *path = pathLayer->paths[i]; path->isAvailable = dKPPath_s::NEWLY_AVAILABLE; newlyAvailablePaths++; @@ -515,17 +521,20 @@ void dWMPathManager_c::unlockPaths() { path->setLayerAlpha(0); } } - delete[] oldPathAvData; // check nodes too for (int i = 0; i < pathLayer->nodeCount; i++) { - if ((NodeAvailabilityData[i] > 0) && (oldNodeAvData[i] == 0)) { + if ((NodeAvailabilityData[i] > 0) && (forceFlag || oldNodeAvData[i] == 0)) { dKPNode_s *node = pathLayer->nodes[i]; node->isNew = true; newlyAvailableNodes++; } } - delete[] oldNodeAvData; + + if (oldPathAvData) { + delete[] oldPathAvData; + delete[] oldNodeAvData; + } } // now set all node alphas -- cgit v1.2.3