mirror of https://github.com/FreeCol/freecol.git
Check gold before buying from natives.
This commit is contained in:
parent
a9e4b55a7c
commit
666809041a
|
@ -3987,7 +3987,8 @@ public final class InGameController extends FreeColClientHolder {
|
|||
nt.setItem(nti);
|
||||
}
|
||||
TradeBuyAction tba = getGUI().getBuyChoice(unit, is,
|
||||
nti.getGoods(), nti.getPrice(), true);
|
||||
nti.getGoods(), nti.getPrice(),
|
||||
unit.getOwner().checkGold(nti.getPrice()));
|
||||
if (tba == TradeBuyAction.BUY) {
|
||||
askServer().nativeTrade(NativeTradeAction.BUY, nt);
|
||||
return;
|
||||
|
|
|
@ -3118,6 +3118,9 @@ public final class InGameController extends Controller {
|
|||
item.goodsMatcher()) == null) {
|
||||
return serverPlayer.clientError("Item missing for "
|
||||
+ action + ": " + nt);
|
||||
} else if (!serverPlayer.checkGold(item.getPrice())) {
|
||||
return serverPlayer.clientError("Player can not afford item: "
|
||||
+ nt);
|
||||
}
|
||||
nt.setItem(item);
|
||||
cs.add(See.only(otherPlayer),
|
||||
|
|
Loading…
Reference in New Issue