1
0
forked from 0ad/0ad

Let StartingCamera react upon change in number of players

fixes an issue in 071fddd598

Reviewed By: marder
Comments By: nwtour
Differential Revision: D4498
fixes #6435

This was SVN commit r26464.
This commit is contained in:
bb 2022-02-22 16:34:02 +00:00
parent da41470c2d
commit a350ec2a74

View File

@ -9,6 +9,7 @@ GameSettings.prototype.Attributes.StartingCamera = class StartingCamera extends
{
this.values = [];
this.settings.map.watch(() => this.onMapChange(), ["map"]);
this.settings.playerCount.watch(() => this.maybeUpdate(), ["nbPlayers"]);
}
toInitAttributes(attribs)
@ -52,4 +53,12 @@ GameSettings.prototype.Attributes.StartingCamera = class StartingCamera extends
for (let i in pData)
this.values[i] = pData?.[i]?.StartingCamera;
}
maybeUpdate()
{
if (this.values.length === this.settings.playerCount.nbPlayers)
return;
this._resize(this.settings.playerCount.nbPlayers);
this.trigger("values");
}
};