mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Rename GameAttributes to InitAttributes
The initial settings for a game, used to create the map in RM & tosetup the simulation, are named InitAttributes in the C++, but generally referred to as GameAttributes in the JS GUI. This renames the latter to the former to avoid confusion, since these settings are immutable once the map starts, so InitAttributes is more accurate. Differential Revision: https://code.wildfiregames.com/D3705 This was SVN commit r25083.
This commit is contained in:
@@ -179,14 +179,11 @@ function formatPlayerInfo(playerDataArray, playerStates)
|
||||
* Sets an additional map label, map preview image and describes the chosen game settings more closely.
|
||||
*
|
||||
* Requires g_VictoryConditions.
|
||||
*
|
||||
* @param gameSettings - Serialised-format/JSON game settings.
|
||||
* (this takes serialised data to avoid loadings the gamesettings in the session GUI page)
|
||||
*/
|
||||
function getGameDescription(gameSettings, mapCache)
|
||||
function getGameDescription(initAttributes, mapCache)
|
||||
{
|
||||
let titles = [];
|
||||
if (!gameSettings.settings.VictoryConditions.length)
|
||||
if (!initAttributes.settings.VictoryConditions.length)
|
||||
titles.push({
|
||||
"label": translateWithContext("victory condition", "Endless Game"),
|
||||
"value": translate("No winner will be determined, even if everyone is defeated.")
|
||||
@@ -194,13 +191,13 @@ function getGameDescription(gameSettings, mapCache)
|
||||
|
||||
for (let victoryCondition of g_VictoryConditions)
|
||||
{
|
||||
if (gameSettings.settings.VictoryConditions.indexOf(victoryCondition.Name) == -1)
|
||||
if (initAttributes.settings.VictoryConditions.indexOf(victoryCondition.Name) == -1)
|
||||
continue;
|
||||
|
||||
let title = translateVictoryCondition(victoryCondition.Name);
|
||||
if (victoryCondition.Name == "wonder")
|
||||
{
|
||||
let wonderDuration = Math.round(gameSettings.settings.WonderDuration);
|
||||
let wonderDuration = Math.round(initAttributes.settings.WonderDuration);
|
||||
title = sprintf(
|
||||
translatePluralWithContext(
|
||||
"victory condition",
|
||||
@@ -214,7 +211,7 @@ function getGameDescription(gameSettings, mapCache)
|
||||
let isCaptureTheRelic = victoryCondition.Name == "capture_the_relic";
|
||||
if (isCaptureTheRelic)
|
||||
{
|
||||
let relicDuration = Math.round(gameSettings.settings.RelicDuration);
|
||||
let relicDuration = Math.round(initAttributes.settings.RelicDuration);
|
||||
title = sprintf(
|
||||
translatePluralWithContext(
|
||||
"victory condition",
|
||||
@@ -233,11 +230,11 @@ function getGameDescription(gameSettings, mapCache)
|
||||
if (isCaptureTheRelic)
|
||||
titles.push({
|
||||
"label": translate("Relic Count"),
|
||||
"value": Math.round(gameSettings.settings.RelicCount)
|
||||
"value": Math.round(initAttributes.settings.RelicCount)
|
||||
});
|
||||
|
||||
if (victoryCondition.Name == "regicide")
|
||||
if (gameSettings.settings.RegicideGarrison)
|
||||
if (initAttributes.settings.RegicideGarrison)
|
||||
titles.push({
|
||||
"label": translate("Hero Garrison"),
|
||||
"value": translate("Heroes can be garrisoned.")
|
||||
@@ -249,14 +246,14 @@ function getGameDescription(gameSettings, mapCache)
|
||||
});
|
||||
}
|
||||
|
||||
if (gameSettings.settings.RatingEnabled &&
|
||||
gameSettings.settings.PlayerData.length == 2)
|
||||
if (initAttributes.settings.RatingEnabled &&
|
||||
initAttributes.settings.PlayerData.length == 2)
|
||||
titles.push({
|
||||
"label": translate("Rated game"),
|
||||
"value": translate("When the winner of this match is determined, the lobby score will be adapted.")
|
||||
});
|
||||
|
||||
if (gameSettings.settings.LockTeams)
|
||||
if (initAttributes.settings.LockTeams)
|
||||
titles.push({
|
||||
"label": translate("Locked Teams"),
|
||||
"value": translate("Players can't change the initial teams.")
|
||||
@@ -267,7 +264,7 @@ function getGameDescription(gameSettings, mapCache)
|
||||
"value": translate("Players can make alliances and declare war on allies.")
|
||||
});
|
||||
|
||||
if (gameSettings.settings.LastManStanding)
|
||||
if (initAttributes.settings.LastManStanding)
|
||||
titles.push({
|
||||
"label": translate("Last Man Standing"),
|
||||
"value": translate("Only one player can win the game. If the remaining players are allies, the game continues until only one remains.")
|
||||
@@ -278,7 +275,7 @@ function getGameDescription(gameSettings, mapCache)
|
||||
"value": translate("If one player wins, his or her allies win too. If one group of allies remains, they win.")
|
||||
});
|
||||
|
||||
let ceasefire = Math.round(gameSettings.settings.Ceasefire);
|
||||
let ceasefire = Math.round(initAttributes.settings.Ceasefire);
|
||||
titles.push({
|
||||
"label": translate("Ceasefire"),
|
||||
"value":
|
||||
@@ -291,7 +288,7 @@ function getGameDescription(gameSettings, mapCache)
|
||||
{ "min": ceasefire })
|
||||
});
|
||||
|
||||
if (gameSettings.map == "random")
|
||||
if (initAttributes.map == "random")
|
||||
titles.push({
|
||||
"label": translateWithContext("Map Selection", "Random Map"),
|
||||
"value": translate("Randomly select a map from the list.")
|
||||
@@ -301,23 +298,23 @@ function getGameDescription(gameSettings, mapCache)
|
||||
titles.push({
|
||||
"label": translate("Map Name"),
|
||||
"value": mapCache.translateMapName(
|
||||
mapCache.getTranslatableMapName(gameSettings.mapType, gameSettings.map, gameSettings))
|
||||
mapCache.getTranslatableMapName(initAttributes.mapType, initAttributes.map, initAttributes))
|
||||
});
|
||||
|
||||
titles.push({
|
||||
"label": translate("Map Description"),
|
||||
"value": mapCache.getTranslatedMapDescription(gameSettings.mapType, gameSettings.map)
|
||||
"value": mapCache.getTranslatedMapDescription(initAttributes.mapType, initAttributes.map)
|
||||
});
|
||||
}
|
||||
|
||||
titles.push({
|
||||
"label": translate("Map Type"),
|
||||
"value": g_MapTypes.Title[g_MapTypes.Name.indexOf(gameSettings.mapType)]
|
||||
"value": g_MapTypes.Title[g_MapTypes.Name.indexOf(initAttributes.mapType)]
|
||||
});
|
||||
|
||||
if (gameSettings.mapType == "random")
|
||||
if (initAttributes.mapType == "random")
|
||||
{
|
||||
let mapSize = g_MapSizes.Name[g_MapSizes.Tiles.indexOf(gameSettings.settings.Size)];
|
||||
let mapSize = g_MapSizes.Name[g_MapSizes.Tiles.indexOf(initAttributes.settings.Size)];
|
||||
if (mapSize)
|
||||
titles.push({
|
||||
"label": translate("Map Size"),
|
||||
@@ -325,90 +322,90 @@ function getGameDescription(gameSettings, mapCache)
|
||||
});
|
||||
}
|
||||
|
||||
if (gameSettings.settings.Biome)
|
||||
if (initAttributes.settings.Biome)
|
||||
{
|
||||
let biome = g_Settings.Biomes.find(b => b.Id == gameSettings.settings.Biome);
|
||||
let biome = g_Settings.Biomes.find(b => b.Id == initAttributes.settings.Biome);
|
||||
titles.push({
|
||||
"label": biome ? biome.Title : translateWithContext("biome", "Random Biome"),
|
||||
"value": biome ? biome.Description : translate("Randomly select a biome from the list.")
|
||||
});
|
||||
}
|
||||
|
||||
if (gameSettings.settings.TriggerDifficulty !== undefined)
|
||||
if (initAttributes.settings.TriggerDifficulty !== undefined)
|
||||
{
|
||||
let triggerDifficulty = g_Settings.TriggerDifficulties.find(difficulty => difficulty.Difficulty == gameSettings.settings.TriggerDifficulty);
|
||||
let triggerDifficulty = g_Settings.TriggerDifficulties.find(difficulty => difficulty.Difficulty == initAttributes.settings.TriggerDifficulty);
|
||||
titles.push({
|
||||
"label": triggerDifficulty.Title,
|
||||
"value": triggerDifficulty.Tooltip
|
||||
});
|
||||
}
|
||||
|
||||
if (gameSettings.settings.Nomad !== undefined)
|
||||
if (initAttributes.settings.Nomad !== undefined)
|
||||
titles.push({
|
||||
"label": gameSettings.settings.Nomad ? translate("Nomad Mode") : translate("Civic Centers"),
|
||||
"label": initAttributes.settings.Nomad ? translate("Nomad Mode") : translate("Civic Centers"),
|
||||
"value":
|
||||
gameSettings.settings.Nomad ?
|
||||
initAttributes.settings.Nomad ?
|
||||
translate("Players start with only few units and have to find a suitable place to build their city.") :
|
||||
translate("Players start with a Civic Center.")
|
||||
});
|
||||
|
||||
if (gameSettings.settings.StartingResources !== undefined)
|
||||
if (initAttributes.settings.StartingResources !== undefined)
|
||||
titles.push({
|
||||
"label": translate("Starting Resources"),
|
||||
"value":
|
||||
gameSettings.settings.PlayerData &&
|
||||
gameSettings.settings.PlayerData.some(pData => pData && pData.Resources !== undefined) ?
|
||||
initAttributes.settings.PlayerData &&
|
||||
initAttributes.settings.PlayerData.some(pData => pData && pData.Resources !== undefined) ?
|
||||
translateWithContext("starting resources", "Per Player") :
|
||||
sprintf(translate("%(startingResourcesTitle)s (%(amount)s)"), {
|
||||
"startingResourcesTitle":
|
||||
g_StartingResources.Title[
|
||||
g_StartingResources.Resources.indexOf(
|
||||
gameSettings.settings.StartingResources)],
|
||||
"amount": gameSettings.settings.StartingResources
|
||||
initAttributes.settings.StartingResources)],
|
||||
"amount": initAttributes.settings.StartingResources
|
||||
})
|
||||
});
|
||||
|
||||
if (gameSettings.settings.PopulationCap !== undefined)
|
||||
if (initAttributes.settings.PopulationCap !== undefined)
|
||||
titles.push({
|
||||
"label": translate("Population Limit"),
|
||||
"value":
|
||||
gameSettings.settings.PlayerData &&
|
||||
gameSettings.settings.PlayerData.some(pData => pData && pData.PopulationLimit !== undefined) ?
|
||||
initAttributes.settings.PlayerData &&
|
||||
initAttributes.settings.PlayerData.some(pData => pData && pData.PopulationLimit !== undefined) ?
|
||||
translateWithContext("population limit", "Per Player") :
|
||||
g_PopulationCapacities.Title[
|
||||
g_PopulationCapacities.Population.indexOf(
|
||||
gameSettings.settings.PopulationCap)]
|
||||
initAttributes.settings.PopulationCap)]
|
||||
});
|
||||
|
||||
if (gameSettings.settings.WorldPopulationCap !== undefined)
|
||||
if (initAttributes.settings.WorldPopulationCap !== undefined)
|
||||
titles.push({
|
||||
"label": translate("World Population Cap"),
|
||||
"value":
|
||||
g_WorldPopulationCapacities.Title[
|
||||
g_WorldPopulationCapacities.Population.indexOf(
|
||||
gameSettings.settings.WorldPopulationCap)]
|
||||
initAttributes.settings.WorldPopulationCap)]
|
||||
});
|
||||
|
||||
titles.push({
|
||||
"label": translate("Treasures"),
|
||||
"value": gameSettings.settings.DisableTreasures ?
|
||||
"value": initAttributes.settings.DisableTreasures ?
|
||||
translateWithContext("treasures", "Disabled") :
|
||||
translateWithContext("treasures", "As defined by the map.")
|
||||
});
|
||||
|
||||
titles.push({
|
||||
"label": translate("Revealed Map"),
|
||||
"value": gameSettings.settings.RevealMap
|
||||
"value": initAttributes.settings.RevealMap
|
||||
});
|
||||
|
||||
titles.push({
|
||||
"label": translate("Explored Map"),
|
||||
"value": gameSettings.settings.ExploreMap
|
||||
"value": initAttributes.settings.ExploreMap
|
||||
});
|
||||
|
||||
titles.push({
|
||||
"label": translate("Cheats"),
|
||||
"value": gameSettings.settings.CheatsEnabled
|
||||
"value": initAttributes.settings.CheatsEnabled
|
||||
});
|
||||
|
||||
return titles.map(title => sprintf(translate("%(label)s %(details)s"), {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This is intended as a helper to create the settings object for a game.
|
||||
* This object is referred to as:
|
||||
* - g_GameAttributes in the GUI session context
|
||||
* - g_InitAttributes in the GUI session context
|
||||
* - InitAttributes in the JS simulation context
|
||||
* - Either InitAttributes or MapSettings in the C++ simulation.
|
||||
* Settings can depend on each other, and the map provides many.
|
||||
@@ -89,10 +89,10 @@ class GameSettings
|
||||
/**
|
||||
* Send the game settings to the server.
|
||||
*/
|
||||
setNetworkGameAttributes()
|
||||
setNetworkInitAttributes()
|
||||
{
|
||||
if (this.isNetworked && this.isController)
|
||||
Engine.SetNetworkGameAttributes(this.toInitAttributes());
|
||||
Engine.SetNetworkInitAttributes(this.toInitAttributes());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,7 +128,7 @@ class GameSettings
|
||||
this.pickRandomItems();
|
||||
|
||||
Engine.SetRankedGame(this.rating.enabled);
|
||||
this.setNetworkGameAttributes();
|
||||
this.setNetworkInitAttributes();
|
||||
|
||||
// Replace player names with the real players.
|
||||
for (let guid in playerAssignments)
|
||||
|
||||
@@ -42,7 +42,7 @@ class GameSettingsControl
|
||||
onLoad(initData, hotloadData)
|
||||
{
|
||||
if (hotloadData)
|
||||
this.parseSettings(hotloadData.gameAttributes);
|
||||
this.parseSettings(hotloadData.initAttributes);
|
||||
else if (g_IsController && this.gameSettingsFile.enabled)
|
||||
{
|
||||
let settings = this.gameSettingsFile.loadFile();
|
||||
@@ -51,7 +51,7 @@ class GameSettingsControl
|
||||
}
|
||||
|
||||
this.updateLayout();
|
||||
this.setNetworkGameAttributes();
|
||||
this.setNetworkInitAttributes();
|
||||
}
|
||||
|
||||
onClose()
|
||||
@@ -61,7 +61,7 @@ class GameSettingsControl
|
||||
|
||||
onGetHotloadData(object)
|
||||
{
|
||||
object.gameAttributes = this.getSettings();
|
||||
object.initAttributes = this.getSettings();
|
||||
}
|
||||
|
||||
onGamesetupMessage(message)
|
||||
@@ -122,23 +122,23 @@ class GameSettingsControl
|
||||
* This is run on a timer to avoid flooding the network with messages,
|
||||
* e.g. when modifying a slider.
|
||||
*/
|
||||
setNetworkGameAttributes()
|
||||
setNetworkInitAttributes()
|
||||
{
|
||||
for (let handler of this.settingsChangeHandlers)
|
||||
handler();
|
||||
|
||||
if (g_IsNetworked && this.timer === undefined)
|
||||
this.timer = setTimeout(this.setNetworkGameAttributesImmediately.bind(this), this.Timeout);
|
||||
this.timer = setTimeout(this.setNetworkInitAttributesImmediately.bind(this), this.Timeout);
|
||||
}
|
||||
|
||||
setNetworkGameAttributesImmediately()
|
||||
setNetworkInitAttributesImmediately()
|
||||
{
|
||||
if (this.timer)
|
||||
{
|
||||
clearTimeout(this.timer);
|
||||
delete this.timer;
|
||||
}
|
||||
g_GameSettings.setNetworkGameAttributes();
|
||||
g_GameSettings.setNetworkInitAttributes();
|
||||
}
|
||||
|
||||
onLaunchGame()
|
||||
|
||||
@@ -6,8 +6,8 @@ class GameSettingsFile
|
||||
constructor(GameSettingsControl)
|
||||
{
|
||||
this.filename = g_IsNetworked ?
|
||||
this.GameAttributesFileMultiplayer :
|
||||
this.GameAttributesFileSingleplayer;
|
||||
this.PersistedSettingsFileMultiplayer :
|
||||
this.PersistedSettingsFileSingleplayer;
|
||||
|
||||
this.gameSettingsControl = GameSettingsControl;
|
||||
|
||||
@@ -25,16 +25,12 @@ class GameSettingsFile
|
||||
Engine.FileExists(this.filename) &&
|
||||
Engine.ReadJSONFile(this.filename);
|
||||
|
||||
let gameAttributes =
|
||||
data &&
|
||||
data.attributes &&
|
||||
data.engine_info &&
|
||||
data.engine_info.engine_version == this.engineInfo.engine_version &&
|
||||
hasSameMods(data.engine_info.mods, this.engineInfo.mods) &&
|
||||
let persistedSettings = data?.engine_info?.engine_version == this.engineInfo.engine_version &&
|
||||
hasSameMods(data?.engine_info?.mods, this.engineInfo.mods) &&
|
||||
data.attributes || {};
|
||||
|
||||
Engine.ProfileStop();
|
||||
return gameAttributes;
|
||||
return persistedSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,8 +53,8 @@ class GameSettingsFile
|
||||
GameSettingsFile.prototype.ConfigName =
|
||||
"persistmatchsettings";
|
||||
|
||||
GameSettingsFile.prototype.GameAttributesFileSingleplayer =
|
||||
GameSettingsFile.prototype.PersistedSettingsFileSingleplayer =
|
||||
"config/matchsettings.json";
|
||||
|
||||
GameSettingsFile.prototype.GameAttributesFileMultiplayer =
|
||||
GameSettingsFile.prototype.PersistedSettingsFileMultiplayer =
|
||||
"config/matchsettings.mp.json";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* 1. Ensure that the host cannot start the game unless all clients agreed on the game settings using the ready system.
|
||||
*
|
||||
* TODO:
|
||||
* 2. Ensure that the host cannot start the game with GameAttributes different from the agreed ones.
|
||||
* 2. Ensure that the host cannot start the game with InitAttributes different from the agreed ones.
|
||||
* This may be achieved by:
|
||||
* - Determining the seed collectively.
|
||||
* - passing the agreed game settings to the engine when starting the game instance
|
||||
|
||||
@@ -21,7 +21,7 @@ AIGameSettingControls.AIBehavior = class extends AIGameSettingControlDropdown
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.playerAI.setBehavior(this.playerIndex, this.dropdown.list_data[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ AIGameSettingControls.AIDifficulty = class extends AIGameSettingControlDropdown
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.playerAI.setDifficulty(this.playerIndex, this.dropdown.list_data[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ AIGameSettingControls.AISelection = class extends AIGameSettingControlDropdown
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.playerAI.setAI(this.playerIndex, this.dropdown.list_data[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+3
-3
@@ -193,7 +193,7 @@ PlayerSettingControls.PlayerAssignment.prototype.ConfigAssignPlayers =
|
||||
}
|
||||
|
||||
playerAssignmentsControl.assignPlayer(guidToAssign, playerIndex);
|
||||
gameSettingsControl.setNetworkGameAttributes();
|
||||
gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
|
||||
isSelected(pData, guid, value)
|
||||
@@ -233,7 +233,7 @@ PlayerSettingControls.PlayerAssignment.prototype.ConfigAssignPlayers =
|
||||
"behavior": Engine.ConfigDB_GetValue("user", "gui.gamesetup.aibehavior"),
|
||||
});
|
||||
|
||||
gameSettingsControl.setNetworkGameAttributes();
|
||||
gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
|
||||
isSelected(pData, guid, value)
|
||||
@@ -268,7 +268,7 @@ PlayerSettingControls.PlayerAssignment.prototype.ConfigAssignPlayers =
|
||||
|
||||
g_GameSettings.playerAI.setAI(playerIndex, undefined);
|
||||
|
||||
gameSettingsControl.setNetworkGameAttributes();
|
||||
gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
|
||||
isSelected(pData, guid, value)
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ PlayerSettingControls.PlayerCiv = class PlayerCiv extends GameSettingControlDrop
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.playerCiv.setValue(this.playerIndex, this.values.civ[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ PlayerSettingControls.PlayerColor = class PlayerColor extends GameSettingControl
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.playerColor.setColor(this.playerIndex, this.values[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ PlayerSettingControls.PlayerTeam = class PlayerTeam extends GameSettingControlDr
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.playerTeam.setValue(this.playerIndex, itemIdx - 1);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ GameSettingControls.Cheats = class Cheats extends GameSettingControlCheckbox
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.cheats.setEnabled(!g_IsNetworked || checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ GameSettingControls.ExploredMap = class ExploredMap extends GameSettingControlCh
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.mapExploration.setExplored(checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ GameSettingControls.LastManStanding = class LastManStanding extends GameSettingC
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.lastManStanding.setEnabled(checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ GameSettingControls.LockedTeams = class LockedTeams extends GameSettingControlCh
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.lockedTeams.setEnabled(checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ GameSettingControls.Nomad = class Nomad extends GameSettingControlCheckbox
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.nomad.setEnabled(checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ GameSettingControls.Rating = class Rating extends GameSettingControlCheckbox
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.rating.setEnabled(checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ GameSettingControls.RegicideGarrison = class RegicideGarrison extends GameSettin
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.regicideGarrison.setEnabled(checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ GameSettingControls.RevealedMap = class RevealedMap extends GameSettingControlCh
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.mapExploration.setRevealed(checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ GameSettingControls.Spies = class Spies extends GameSettingControlCheckbox
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.disableSpies.setEnabled(checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ GameSettingControls.Treasures = class Treasures extends GameSettingControlCheckb
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.disableTreasures.setEnabled(checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ GameSettingControls.WorldPopulation = class WorldPopulation extends GameSettingC
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.population.setPopCap(checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ GameSettingControls.Biome = class Biome extends GameSettingControlDropdown
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.biome.setBiome(this.dropdown.list_data[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ GameSettingControls.Daytime = class Daytime extends GameSettingControlDropdown
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.daytime.setValue(this.values.Id[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ GameSettingControls.GameSpeed = class GameSpeed extends GameSettingControlDropdo
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.gameSpeed.setSpeed(this.dropdown.list_data[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ GameSettingControls.Landscape = class Landscape extends GameSettingControlDropdo
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.landscape.setValue(this.values.Id[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ GameSettingControls.MapFilter = class MapFilter extends GameSettingControlDropdo
|
||||
if (this.values && this.values.Name.indexOf(this.gameSettingsControl.guiData.mapFilter.filter) === -1)
|
||||
{
|
||||
this.gameSettingsControl.guiData.mapFilter.filter = this.values.Name[this.values.Default];
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
// Index may have changed, reset.
|
||||
this.setSelectedValue(this.gameSettingsControl.guiData.mapFilter.filter);
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ GameSettingControls.MapSelection = class MapSelection extends GameSettingControl
|
||||
if (this.values.file.indexOf(g_GameSettings.map.map) === -1)
|
||||
{
|
||||
g_GameSettings.map.selectMap(this.values.file[this.values.Default]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
// The index may have changed: reset.
|
||||
this.setSelectedValue(g_GameSettings.map.map);
|
||||
@@ -87,7 +87,7 @@ GameSettingControls.MapSelection = class MapSelection extends GameSettingControl
|
||||
return;
|
||||
this.reRenderTimeout = setTimeout(() => {
|
||||
g_GameSettings.map.selectMap(this.values.file[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
delete this.reRenderTimeout;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ GameSettingControls.MapSize = class MapSize extends GameSettingControlDropdown
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.mapSize.setSize(g_MapSizes.Tiles[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ GameSettingControls.MapType = class MapType extends GameSettingControlDropdown
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.map.setType(g_MapTypes.Name[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ GameSettingControls.PlayerCount = class PlayerCount extends GameSettingControlDr
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.playerCount.setNb(this.values[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ GameSettingControls.PopulationCap = class PopulationCap extends GameSettingContr
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.population.setPopCap(false, g_PopulationCapacities.Population[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ GameSettingControls.StartingResources = class StartingResources extends GameSett
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.startingResources.setResources(g_StartingResources.Resources[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ GameSettingControls.TeamPlacement = class TeamPlacement extends GameSettingContr
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.teamPlacement.setValue(this.values.Id[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ GameSettingControls.TriggerDifficulty = class TriggerDifficulty extends GameSett
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.triggerDifficulty.setValue(this.values.Difficulty[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ GameSettingControls.WorldPopulationCap = class WorldPopulationCap extends GameSe
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
g_GameSettings.population.setPopCap(true, g_WorldPopulationCapacities.Population[itemIdx]);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ GameSettingControls.Ceasefire = class Ceasefire extends GameSettingControlSlider
|
||||
onValueChange(value)
|
||||
{
|
||||
g_GameSettings.ceasefire.setValue(value);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ GameSettingControls.RelicCount = class RelicCount extends GameSettingControlSlid
|
||||
onValueChange(value)
|
||||
{
|
||||
g_GameSettings.relic.setCount(value);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ GameSettingControls.RelicDuration = class RelicDuration extends GameSettingContr
|
||||
onValueChange(value)
|
||||
{
|
||||
g_GameSettings.relic.setDuration(value);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ GameSettingControls.SeaLevelRiseTime = class SeaLevelRiseTime extends GameSettin
|
||||
onValueChange(value)
|
||||
{
|
||||
g_GameSettings.seaLevelRise.setValue(value);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ GameSettingControls.WonderDuration = class WonderDuration extends GameSettingCon
|
||||
onValueChange(value)
|
||||
{
|
||||
g_GameSettings.wonder.setDuration(value);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -26,6 +26,6 @@ class VictoryConditionCheckbox extends GameSettingControlCheckbox
|
||||
onPress(checked)
|
||||
{
|
||||
g_GameSettings.victoryConditions.setEnabled(this.victoryCondition, checked);
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ class ResetCivsButton
|
||||
for (let i = 0; i < g_GameSettings.playerCount.nbPlayers; ++i)
|
||||
g_GameSettings.playerCiv.setValue(i, "random");
|
||||
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ class ResetTeamsButton
|
||||
for (let i = 0; i < g_GameSettings.playerCount.nbPlayers; ++i)
|
||||
g_GameSettings.playerTeam.setValue(i, -1);
|
||||
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ SetupWindowPages.MapBrowserPage = class extends MapBrowser
|
||||
if (map)
|
||||
g_GameSettings.map.selectMap(map);
|
||||
|
||||
this.gameSettingsControl.setNetworkGameAttributes();
|
||||
this.gameSettingsControl.setNetworkInitAttributes();
|
||||
}
|
||||
|
||||
openPage()
|
||||
|
||||
@@ -21,7 +21,7 @@ var g_ServerHasPassword = false;
|
||||
var g_ServerId;
|
||||
|
||||
var g_IsRejoining = false;
|
||||
var g_GameAttributes; // used when rejoining
|
||||
var g_InitAttributes; // used when rejoining
|
||||
var g_PlayerAssignments; // used when rejoining
|
||||
var g_UserRating;
|
||||
|
||||
@@ -227,7 +227,7 @@ function pollAndHandleNetworkClient()
|
||||
break;
|
||||
|
||||
case "gamesetup":
|
||||
g_GameAttributes = message.data;
|
||||
g_InitAttributes = message.data;
|
||||
break;
|
||||
|
||||
case "players":
|
||||
@@ -240,11 +240,11 @@ function pollAndHandleNetworkClient()
|
||||
{
|
||||
let player = g_PlayerAssignments[guid];
|
||||
if (player.player > 0) // not observer or GAIA
|
||||
g_GameAttributes.settings.PlayerData[player.player - 1].Name = player.name;
|
||||
g_InitAttributes.settings.PlayerData[player.player - 1].Name = player.name;
|
||||
}
|
||||
|
||||
Engine.SwitchGuiPage("page_loading.xml", {
|
||||
"attribs": g_GameAttributes,
|
||||
"attribs": g_InitAttributes,
|
||||
"isRejoining": g_IsRejoining,
|
||||
"playerAssignments": g_PlayerAssignments
|
||||
});
|
||||
|
||||
@@ -103,7 +103,7 @@ function loadReplays(replaySelectionData, compareFiles)
|
||||
// Check replay for compatibility
|
||||
replay.isCompatible = isReplayCompatible(replay);
|
||||
|
||||
sanitizeGameAttributes(replay.attribs);
|
||||
sanitizeInitAttributes(replay.attribs);
|
||||
|
||||
// Extract map names
|
||||
if (g_MapNames.indexOf(replay.attribs.settings.Name) == -1 && replay.attribs.settings.Name != "")
|
||||
@@ -158,7 +158,7 @@ function loadReplays(replaySelectionData, compareFiles)
|
||||
/**
|
||||
* We may encounter malformed replays.
|
||||
*/
|
||||
function sanitizeGameAttributes(attribs)
|
||||
function sanitizeInitAttributes(attribs)
|
||||
{
|
||||
if (!attribs.settings)
|
||||
attribs.settings = {};
|
||||
|
||||
@@ -76,7 +76,7 @@ MenuButtons.prototype.Summary = class
|
||||
this.button = button;
|
||||
this.button.caption = translate("Summary");
|
||||
this.button.hotkey = "summary";
|
||||
// TODO: Atlas should pass g_GameAttributes.settings
|
||||
// TODO: Atlas should pass g_InitAttributes.settings
|
||||
this.button.enabled = !Engine.IsAtlasRunning();
|
||||
|
||||
this.pauseControl = pauseControl;
|
||||
@@ -106,7 +106,7 @@ MenuButtons.prototype.Summary = class
|
||||
"page_summary.xml",
|
||||
{
|
||||
"sim": {
|
||||
"mapSettings": g_GameAttributes.settings,
|
||||
"mapSettings": g_InitAttributes.settings,
|
||||
"playerStates": simState.players.filter((state, player) =>
|
||||
g_IsObserver || g_ViewedPlayer == 0 || player == 0 || player == g_ViewedPlayer ||
|
||||
simState.players[g_ViewedPlayer].hasSharedLos && g_Players[player].isMutualAlly[g_ViewedPlayer]),
|
||||
|
||||
@@ -164,7 +164,7 @@ ChatMessageFormatSimulation.tribute = class
|
||||
else if (msg.sourcePlayer == Engine.GetPlayerID())
|
||||
message = translate("You have sent %(player2)s %(amounts)s.");
|
||||
else if (Engine.ConfigDB_GetValue("user", "gui.session.notifications.tribute") == "true" &&
|
||||
(g_IsObserver || g_GameAttributes.settings.LockTeams &&
|
||||
(g_IsObserver || g_InitAttributes.settings.LockTeams &&
|
||||
g_Players[msg.sourcePlayer].isMutualAlly[Engine.GetPlayerID()] &&
|
||||
g_Players[msg.targetPlayer].isMutualAlly[Engine.GetPlayerID()]))
|
||||
message = translate("%(player)s has sent %(player2)s %(amounts)s.");
|
||||
|
||||
@@ -27,7 +27,7 @@ class DeveloperOverlay
|
||||
|
||||
toggle()
|
||||
{
|
||||
if (g_IsNetworked && !g_GameAttributes.settings.CheatsEnabled)
|
||||
if (g_IsNetworked && !g_InitAttributes.settings.CheatsEnabled)
|
||||
return;
|
||||
|
||||
this.devCommandsOverlay.hidden = !this.devCommandsOverlay.hidden;
|
||||
|
||||
+1
-1
@@ -237,7 +237,7 @@ DeveloperOverlayCheckboxes.prototype.ActivateRejoinTest = class
|
||||
|
||||
enabled()
|
||||
{
|
||||
return !this.disabled && g_GameAttributes.mapType != "random";
|
||||
return !this.disabled && g_InitAttributes.mapType != "random";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ DiplomacyDialogPlayerControl.prototype.DiplomacyPlayerText = class
|
||||
return;
|
||||
|
||||
this.diplomacyPlayerCiv.caption = g_CivData[g_Players[this.playerID].civ].Name;
|
||||
this.diplomacyPlayerName.tooltip = translateAISettings(g_GameAttributes.settings.PlayerData[this.playerID]);
|
||||
this.diplomacyPlayerName.tooltip = translateAISettings(g_InitAttributes.settings.PlayerData[this.playerID]);
|
||||
|
||||
// Apply offset
|
||||
let rowSize = DiplomacyDialogPlayerControl.prototype.DiplomacyPlayerText.getRowHeight();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Send the current list of players, teams, AIs, observers and defeated/won and offline states to the lobby.
|
||||
* This report excludes the matchsettings, since they do not change during the match.
|
||||
*
|
||||
* The playerData format from g_GameAttributes is kept to reuse the GUI function presenting the data,
|
||||
* The playerData format from g_InitAttributes is kept to reuse the GUI function presenting the data,
|
||||
* but the payload size is minimized by only extracting properties relevant for display.
|
||||
*/
|
||||
class LobbyGamelistReporter
|
||||
@@ -30,16 +30,16 @@ class LobbyGamelistReporter
|
||||
let players = [];
|
||||
|
||||
// Skip gaia
|
||||
for (let playerID = 1; playerID < g_GameAttributes.settings.PlayerData.length; ++playerID)
|
||||
for (let playerID = 1; playerID < g_InitAttributes.settings.PlayerData.length; ++playerID)
|
||||
{
|
||||
let pData = g_GameAttributes.settings.PlayerData[playerID];
|
||||
let pData = g_InitAttributes.settings.PlayerData[playerID];
|
||||
|
||||
let player = {
|
||||
"Name": pData.Name,
|
||||
"Civ": pData.Civ
|
||||
};
|
||||
|
||||
if (g_GameAttributes.settings.LockTeams)
|
||||
if (g_InitAttributes.settings.LockTeams)
|
||||
player.Team = pData.Team;
|
||||
|
||||
if (pData.AI)
|
||||
|
||||
@@ -29,8 +29,8 @@ class LobbyRatingReporter
|
||||
|
||||
let report = {
|
||||
"playerID": Engine.GetPlayerID(),
|
||||
"matchID": g_GameAttributes.matchID,
|
||||
"mapName": g_GameAttributes.settings.Name,
|
||||
"matchID": g_InitAttributes.matchID,
|
||||
"mapName": g_InitAttributes.settings.Name,
|
||||
"timeElapsed": extendedSimState.timeElapsed,
|
||||
};
|
||||
|
||||
@@ -52,6 +52,6 @@ LobbyRatingReporter.Available = function()
|
||||
return Engine.HasXmppClient() &&
|
||||
!g_IsReplay &&
|
||||
Engine.GetPlayerID() != -1 &&
|
||||
g_GameAttributes.settings.RatingEnabled &&
|
||||
g_GameAttributes.settings.PlayerData.length == 3;
|
||||
g_InitAttributes.settings.RatingEnabled &&
|
||||
g_InitAttributes.settings.PlayerData.length == 3;
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ class OutOfSyncNetwork extends SessionMessageBox
|
||||
""
|
||||
];
|
||||
|
||||
if (msg.turn > 1 && g_GameAttributes.settings.PlayerData.some(pData => pData && pData.AI))
|
||||
if (msg.turn > 1 && g_InitAttributes.settings.PlayerData.some(pData => pData && pData.AI))
|
||||
txt.push(translateWithContext("Out-Of-Sync", "Rejoining Multiplayer games with AIs is not supported yet!"));
|
||||
else
|
||||
txt.push(
|
||||
|
||||
@@ -37,7 +37,7 @@ class QuitConfirmationDefeat extends QuitConfirmation
|
||||
let askExit = !Engine.HasNetServer() || g_Players.every((player, i) =>
|
||||
i == 0 ||
|
||||
player.state != "active" ||
|
||||
g_GameAttributes.settings.PlayerData[i].AI != "");
|
||||
g_InitAttributes.settings.PlayerData[i].AI != "");
|
||||
|
||||
this.Title = won ? this.TitleVictory : this.TitleDefeated;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class ObjectivesDialog
|
||||
|
||||
// TODO: atlas should support this
|
||||
if (!Engine.IsAtlasRunning())
|
||||
Engine.GetGUIObjectByName("gameDescriptionText").caption = getGameDescription(g_GameAttributes, mapCache);
|
||||
Engine.GetGUIObjectByName("gameDescriptionText").caption = getGameDescription(g_InitAttributes, mapCache);
|
||||
|
||||
Engine.GetGUIObjectByName("closeObjectives").onPress = this.close.bind(this);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ var g_TradeDialog;
|
||||
/**
|
||||
* Map, player and match settings set in game setup.
|
||||
*/
|
||||
const g_GameAttributes = deepfreeze(Engine.GuiInterfaceCall("GetInitAttributes"));
|
||||
const g_InitAttributes = deepfreeze(Engine.GuiInterfaceCall("GetInitAttributes"));
|
||||
|
||||
/**
|
||||
* True if this is a multiplayer game.
|
||||
@@ -266,8 +266,8 @@ function init(initData, hotloadData)
|
||||
restoreSavedGameData(initData.savedGUIData);
|
||||
}
|
||||
|
||||
if (g_GameAttributes.campaignData)
|
||||
g_CampaignSession = new CampaignSession(g_GameAttributes.campaignData);
|
||||
if (g_InitAttributes.campaignData)
|
||||
g_CampaignSession = new CampaignSession(g_InitAttributes.campaignData);
|
||||
|
||||
let mapCache = new MapCache();
|
||||
g_Cheats = new Cheats();
|
||||
@@ -539,15 +539,15 @@ function endGame()
|
||||
}
|
||||
};
|
||||
|
||||
if (g_GameAttributes.campaignData)
|
||||
if (g_InitAttributes.campaignData)
|
||||
{
|
||||
let menu = g_CampaignSession.getMenu();
|
||||
if (g_GameAttributes.campaignData.skipSummary)
|
||||
if (g_InitAttributes.campaignData.skipSummary)
|
||||
{
|
||||
Engine.SwitchGuiPage(menu);
|
||||
return;
|
||||
}
|
||||
summaryData.campaignData = { "filename": g_GameAttributes.campaignData.run };
|
||||
summaryData.campaignData = { "filename": g_InitAttributes.campaignData.run };
|
||||
summaryData.nextPage = menu;
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ JS::Value PollNetworkClient(const ScriptInterface& scriptInterface)
|
||||
return scriptInterface.CloneValueFromOtherCompartment(g_NetClient->GetScriptInterface(), pollNet);
|
||||
}
|
||||
|
||||
void SetNetworkGameAttributes(const ScriptInterface& scriptInterface, JS::HandleValue attribs1)
|
||||
void SetNetworkInitAttributes(const ScriptInterface& scriptInterface, JS::HandleValue attribs1)
|
||||
{
|
||||
ENSURE(g_NetClient);
|
||||
|
||||
@@ -293,7 +293,7 @@ void RegisterScriptFunctions(const ScriptRequest& rq)
|
||||
ScriptFunction::Register<&DisconnectNetworkGame>(rq, "DisconnectNetworkGame");
|
||||
ScriptFunction::Register<&GetPlayerGUID>(rq, "GetPlayerGUID");
|
||||
ScriptFunction::Register<&PollNetworkClient>(rq, "PollNetworkClient");
|
||||
ScriptFunction::Register<&SetNetworkGameAttributes>(rq, "SetNetworkGameAttributes");
|
||||
ScriptFunction::Register<&SetNetworkInitAttributes>(rq, "SetNetworkInitAttributes");
|
||||
ScriptFunction::Register<&AssignNetworkPlayer>(rq, "AssignNetworkPlayer");
|
||||
ScriptFunction::Register<&KickPlayer>(rq, "KickPlayer");
|
||||
ScriptFunction::Register<&SendNetworkChat>(rq, "SendNetworkChat");
|
||||
|
||||
Reference in New Issue
Block a user