1
0
forked from mirrors/0ad

Fix 4 small gamesetup issues

- Random lanscape option now works properly.
- Non-host clients now see the game attributes correctly in the loading
screen, including in particular the map name.
- AI bots are again translated.
- 'Cheat' setting is persisted correctly in MP gamesetup.

Reported by: myself, Freagarach, nwtour
Differential Revision: https://code.wildfiregames.com/D3841
This was SVN commit r25257.
This commit is contained in:
wraitii
2021-04-14 07:30:26 +00:00
parent 0308c2390a
commit fde66f5134
4 changed files with 7 additions and 4 deletions
@@ -66,7 +66,7 @@ GameSettings.prototype.Attributes.Landscape = class Landscape extends GameSettin
items = subgroup.Items.map(x => x.Id);
}
else
items = this.data.map(x => x.Items.map(item => item.Id));
items = this.data.map(x => x.Items.map(item => item.Id)).flat();
this.value = pickRandom(items);
return true;
@@ -73,6 +73,8 @@ GameSettings.prototype.Attributes.PlayerName = class PlayerName extends GameSett
// Pick one of the available botnames for the chosen civ
// Determine botnames
let chosenName = pickRandom(this.settings.civData[civ].AINames);
if (!this.settings.isNetworked)
chosenName = translate(chosenName);
// Count how many players use the chosenName
let usedName = this.values.filter(oName => oName && oName.indexOf(chosenName) !== -1).length;
@@ -264,10 +264,10 @@ class GameSettingsController
this.switchToLoadingPage();
}
switchToLoadingPage()
switchToLoadingPage(attributes)
{
Engine.SwitchGuiPage("page_loading.xml", {
"attribs": g_GameSettings.toInitAttributes(),
"attribs": attributes?.initAttributes || g_GameSettings.toInitAttributes(),
"playerAssignments": g_PlayerAssignments
});
}
@@ -13,7 +13,8 @@ GameSettingControls.Cheats = class Cheats extends GameSettingControlCheckbox
onLoad()
{
g_GameSettings.cheats.setEnabled(!g_IsNetworked);
if (!g_IsNetworked)
g_GameSettings.cheats.setEnabled(true);
this.render();
}