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);
|
nt.setItem(nti);
|
||||||
}
|
}
|
||||||
TradeBuyAction tba = getGUI().getBuyChoice(unit, is,
|
TradeBuyAction tba = getGUI().getBuyChoice(unit, is,
|
||||||
nti.getGoods(), nti.getPrice(), true);
|
nti.getGoods(), nti.getPrice(),
|
||||||
|
unit.getOwner().checkGold(nti.getPrice()));
|
||||||
if (tba == TradeBuyAction.BUY) {
|
if (tba == TradeBuyAction.BUY) {
|
||||||
askServer().nativeTrade(NativeTradeAction.BUY, nt);
|
askServer().nativeTrade(NativeTradeAction.BUY, nt);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -3118,6 +3118,9 @@ public final class InGameController extends Controller {
|
||||||
item.goodsMatcher()) == null) {
|
item.goodsMatcher()) == null) {
|
||||||
return serverPlayer.clientError("Item missing for "
|
return serverPlayer.clientError("Item missing for "
|
||||||
+ action + ": " + nt);
|
+ action + ": " + nt);
|
||||||
|
} else if (!serverPlayer.checkGold(item.getPrice())) {
|
||||||
|
return serverPlayer.clientError("Player can not afford item: "
|
||||||
|
+ nt);
|
||||||
}
|
}
|
||||||
nt.setItem(item);
|
nt.setItem(item);
|
||||||
cs.add(See.only(otherPlayer),
|
cs.add(See.only(otherPlayer),
|
||||||
|
|
Loading…
Reference in New Issue