Skip to content

Commit

Permalink
Find a home for initNoGoAreas()
Browse files Browse the repository at this point in the history
No longer will LZ No Go zones persist across missions blocking stuff from being built.
  • Loading branch information
KJeff01 committed Jan 16, 2024
1 parent f04a2bd commit d0f0049
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
3 changes: 3 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
18 changes: 4 additions & 14 deletions src/mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/wzapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d0f0049

Please sign in to comment.