Revert 2b7ba4ff0b by adding a way to specify globally disabled templates.

Refs #3174

This was SVN commit r16632.
This commit is contained in:
Nicolas Auvray 2015-05-06 20:43:49 +00:00
parent 8e44687ae3
commit 3aad4d8e30
5 changed files with 13 additions and 16 deletions

View File

@ -3,13 +3,13 @@
"Name" : "Belgian Uplands",
"Script" : "belgian_uplands.js",
"Description" : "An experimental map with its heightmap generated by erosion to look more natural. Not all seeds will be fair though! Tiny maps with 8 players may take a while to generate.",
"DisabledTemplates": [
"structures/ptol_lighthouse"
],
"CircularMap" : false,
"BaseTerrain" : ["temp_grass", "temp_grass_b", "temp_grass_c", "temp_grass_d", "temp_grass_long_b", "temp_grass_clovers_2", "temp_grass_mossy", "temp_grass_plants"],
"BaseHeight" : 0,
"Preview" : "belgian_uplands.png",
"TriggerScripts": [
"scripts/disable_ptol_lighthouse.js"
],
"XXXXXX" : "Optionally define other things here, like we would for a scenario"
}
}

Binary file not shown.

View File

@ -1,8 +0,0 @@
let cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager);
for (let i = 1; i < cmpPlayerManager.GetNumPlayers(); ++i)
{
let cmpPlayer = Engine.QueryInterface(cmpPlayerManager.GetPlayerByID(i), IID_Player);
if (cmpPlayer)
cmpPlayer.AddDisabledTemplate("structures/ptol_lighthouse");
}

Binary file not shown.

View File

@ -115,8 +115,13 @@ function LoadPlayerSettings(settings, newPlayers)
if (getSetting(playerData, playerDefaults, i, "DisabledTechnologies") !== undefined)
cmpPlayer.SetDisabledTechnologies(getSetting(playerData, playerDefaults, i, "DisabledTechnologies"));
let disabledTemplates = [];
if (settings.DisabledTemplates !== undefined)
disabledTemplates = settings.DisabledTemplates;
if (getSetting(playerData, playerDefaults, i, "DisabledTemplates") !== undefined)
cmpPlayer.SetDisabledTemplates(getSetting(playerData, playerDefaults, i, "DisabledTemplates"));
disabledTemplates = disabledTemplates.concat(getSetting(playerData, playerDefaults, i, "DisabledTemplates"));
if (disabledTemplates.length)
cmpPlayer.SetDisabledTemplates(disabledTemplates);
// If diplomacy explicitly defined, use that; otherwise use teams
if (getSetting(playerData, playerDefaults, i, "Diplomacy") !== undefined)