1
0
forked from 0ad/0ad

Fix black buttons as observer on a GAIA market.

Reported by: langbart
Reviewed By: bb
Fixes #6219

Differential Revision: https://code.wildfiregames.com/D4164
This was SVN commit r25927.
This commit is contained in:
wraitii 2021-09-17 17:01:50 +00:00
parent dfeb29b82c
commit b12e282277
2 changed files with 10 additions and 4 deletions

View File

@ -49,6 +49,13 @@ class BarterButton
*/
update(viewedPlayer)
{
if (viewedPlayer < 1)
{
this.buyButton.hidden = true;
this.sellButton.hidden = true;
return;
}
this.amountToSell = this.BarterResourceSellQuantity;
if (Engine.HotkeyIsPressed("session.massbarter"))

View File

@ -34,16 +34,15 @@ class BarterButtonManager
getSelectedButton()
{
for (let button of this.buttons)
for (const button of this.buttons)
if (!this.selectedResource || this.selectedResource == button.resourceCode)
return button;
}
update()
{
if (this.viewedPlayer >= 1)
for (let button of this.buttons)
button.update(this.viewedPlayer);
for (const button of this.buttons)
button.update(this.viewedPlayer);
}
}