Skip to content

Commit

Permalink
Do not initialize danger maps for campaign.
Browse files Browse the repository at this point in the history
Since maps are loaded in funny, inconsistent ways
in campaign, doing the danger maps with campaign was
too risky, so not enabled. However, we still did the
initializations, which is also not sane, since map
dimensions could change on off-world missions.

Fixes ticket:4633 hopefully
  • Loading branch information
perim committed Dec 20, 2017
1 parent 76ac44c commit 9f25071
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
18 changes: 8 additions & 10 deletions src/map.cpp
Expand Up @@ -1961,19 +1961,17 @@ void mapInit()
lastDangerUpdate = 0;
lastDangerPlayer = -1;

// Initialize danger maps
for (player = 0; player < MAX_PLAYERS; player++)
{
auxMapStore(player, AUX_DANGERMAP);
threatUpdate(player);
dangerFloodFill(player);
auxMapRestore(player, AUX_DANGERMAP, AUXBITS_DANGER | AUXBITS_THREAT | AUXBITS_AATHREAT);
}

// Start thread
// Start danger thread (not used for campaign for now - mission map swaps too icky)
ASSERT(dangerSemaphore == nullptr && dangerThread == nullptr, "Map data not cleaned up before starting!");
if (game.type == SKIRMISH)
{
for (player = 0; player < MAX_PLAYERS; player++)
{
auxMapStore(player, AUX_DANGERMAP);
threatUpdate(player);
dangerFloodFill(player);
auxMapRestore(player, AUX_DANGERMAP, AUXBITS_DANGER | AUXBITS_THREAT | AUXBITS_AATHREAT);
}
lastDangerPlayer = 0;
dangerSemaphore = wzSemaphoreCreate(0);
dangerDoneSemaphore = wzSemaphoreCreate(0);
Expand Down
3 changes: 2 additions & 1 deletion src/qtscriptfuncs.cpp
Expand Up @@ -3467,7 +3467,8 @@ static QScriptValue js_donatePower(QScriptContext *context, QScriptEngine *engin
}

//-- \subsection{safeDest(player, x, y)} Returns true if given player is safe from hostile fire at
//-- the given location, to the best of that player's map knowledge.
//-- the given location, to the best of that player's map knowledge. Does not work in campaign at
//-- the moment.
static QScriptValue js_safeDest(QScriptContext *context, QScriptEngine *engine)
{
int player = context->argument(0).toInt32();
Expand Down

0 comments on commit 9f25071

Please sign in to comment.