117
117
METHOD(LuaPlayer, get_produced_wares_count),
118
118
METHOD(LuaPlayer, set_attack_forbidden),
119
119
METHOD(LuaPlayer, is_attack_forbidden),
120
METHOD(LuaPlayer, cancel_trade),
121
METHOD(LuaPlayer, reject_trade),
122
METHOD(LuaPlayer, retract_trade),
123
120
{nullptr, nullptr},
125
122
const PropertyType<LuaPlayer> LuaPlayer::Properties[] = {
1179
.. method:: cancel_trade(id)
1181
.. versionadded:: 1.3
1183
Cancel the trade agreement with the provided ID.
1185
Only active trade agreements can be cancelled.
1186
Either of the two players between whom the agreement exists may cancel it at any time.
1188
:arg id: Unique ID of the trade to cancel.
1189
:type id: :class:`integer`
1191
:see also: :attr:`wl.Game.trades`
1193
int LuaPlayer::cancel_trade(lua_State* L) {
1194
Widelands::Game& game = get_game(L);
1195
game.cancel_trade(luaL_checkinteger(L, 2), false, &get(L, game));
1200
.. method:: reject_trade(id)
1202
.. versionadded:: 1.3
1204
Reject the proposed trade with the provided ID.
1206
Only proposed trade offers can be rejected.
1207
Only the recipient of the offer may reject it.
1209
:arg id: Unique ID of the trade to reject.
1210
:type id: :class:`integer`
1212
:see also: :attr:`wl.Game.trades`
1214
int LuaPlayer::reject_trade(lua_State* L) {
1215
get_game(L).reject_trade(luaL_checkinteger(L, 2));
1220
.. method:: retract_trade(id)
1222
.. versionadded:: 1.3
1224
Retract the proposed trade with the provided ID.
1226
Only proposed trade offers can be retracted.
1227
Only the player who initiated the offer may retract it.
1229
:arg id: Unique ID of the trade to retract.
1230
:type id: :class:`integer`
1232
:see also: :attr:`wl.Game.trades`
1234
int LuaPlayer::retract_trade(lua_State* L) {
1235
get_game(L).retract_trade(luaL_checkinteger(L, 2));
1240
1176
==========================================================