From d0f004954ff136acc04bd5a2314d71f21b123bc7 Mon Sep 17 00:00:00 2001 From: KJeff01 Date: Tue, 28 Nov 2023 00:09:55 -0600 Subject: [PATCH] Find a home for initNoGoAreas() No longer will LZ No Go zones persist across missions blocking stuff from being built. --- src/init.cpp | 3 +++ src/mission.cpp | 18 ++++-------------- src/wzapi.cpp | 2 -- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index a407a7c2d72..b7b7a31b68c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1891,11 +1891,14 @@ bool stageThreeInitialise() } else { + initNoGoAreas(); + const DebugInputManager& dbgInputManager = gInputManager.debugManager(); if (dbgInputManager.debugMappingsAllowed()) { triggerEventCheatMode(true); } + triggerEvent(TRIGGER_GAME_INIT); playerBuiltHQ = structureExists(selectedPlayer, REF_HQ, true, false); } diff --git a/src/mission.cpp b/src/mission.cpp index 4def3d952a1..18e975d083f 100644 --- a/src/mission.cpp +++ b/src/mission.cpp @@ -263,10 +263,7 @@ void initMission() } //init all the landing zones - for (auto &inc : sLandingZone) - { - inc.x1 = inc.y1 = inc.x2 = inc.y2 = 0; - } + initNoGoAreas(); bDroidsToSafety = false; setPlayCountDown(true); @@ -2659,19 +2656,12 @@ LANDING_ZONE *getLandingZone(SDWORD i) return &sLandingZone[i]; } -/*Initialises all the nogo areas to 0 - DOESN'T INIT THE LIMBO AREA because we -have to set this up in the mission BEFORE*/ +//Initialises all the nogo areas to 0 void initNoGoAreas() { - UBYTE i; - - for (i = 0; i < MAX_NOGO_AREAS; i++) + for (unsigned int i = 0; i < MAX_NOGO_AREAS; ++i) { - if (i != LIMBO_LANDING) - { - sLandingZone[i].x1 = sLandingZone[i].y1 = sLandingZone[i].x2 = - sLandingZone[i].y2 = 0; - } + sLandingZone[i].x1 = sLandingZone[i].y1 = sLandingZone[i].x2 = sLandingZone[i].y2 = 0; } } diff --git a/src/wzapi.cpp b/src/wzapi.cpp index 66b8f4d26fb..ea114261296 100644 --- a/src/wzapi.cpp +++ b/src/wzapi.cpp @@ -3209,8 +3209,6 @@ bool wzapi::donatePower(WZAPI_PARAMS(int amount, int player)) //-- then landing lights are placed. If playerFilter is ```ALL_PLAYERS```, then a limbo landing zone //-- is created and limbo droids placed. //-- -// FIXME: missing a way to call initNoGoAreas(); check if we can call this in -// every level start instead of through scripts wzapi::no_return_value wzapi::setNoGoArea(WZAPI_PARAMS(int x1, int y1, int x2, int y2, int playerFilter)) { SCRIPT_ASSERT({}, context, x1 >= 0, "Minimum scroll x value %d is less than zero - ", x1);