mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-22 05:26:47 +00:00
Fix bug with map-dependent random settings
Settings like Landscape, Daytime & team placement are map dependent. If "random" map is chosen, we first must select the map before selecting these. This wasn't done correctly and so starting "random" map that picked e.g. Unknown could fail. Biomes were already correctly handled. Reported by: langbart Fixes #6227 Differential Revision: https://code.wildfiregames.com/D4173 This was SVN commit r25800.
This commit is contained in:
@@ -46,6 +46,10 @@ GameSettings.prototype.Attributes.Daytime = class Daytime extends GameSetting
|
||||
|
||||
pickRandomItems()
|
||||
{
|
||||
// If the map is random, we need to wait until it is selected.
|
||||
if (this.settings.map.map === "random")
|
||||
return true;
|
||||
|
||||
if (this.value !== "random")
|
||||
return false;
|
||||
this.value = pickRandom(this.data).Id;
|
||||
|
||||
@@ -56,6 +56,10 @@ GameSettings.prototype.Attributes.Landscape = class Landscape extends GameSettin
|
||||
|
||||
pickRandomItems()
|
||||
{
|
||||
// If the map is random, we need to wait until it is selected.
|
||||
if (this.settings.map.map === "random")
|
||||
return true;
|
||||
|
||||
if (!this.value || !this.value.startsWith("random"))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -39,6 +39,10 @@ GameSettings.prototype.Attributes.TeamPlacement = class TeamPlacement extends Ga
|
||||
|
||||
pickRandomItems()
|
||||
{
|
||||
// If the map is random, we need to wait until it is selected.
|
||||
if (this.settings.map.map === "random")
|
||||
return true;
|
||||
|
||||
if (this.value !== "random")
|
||||
return false;
|
||||
this.value = pickRandom(this.available).Id;
|
||||
|
||||
Reference in New Issue
Block a user