mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-11-08 21:26:42 +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:
1 parent
eafa7fc005
commit
8e26bd0446
3 files changed
+12
No files matched your search
@@ -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