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:
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
+2
-1
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user