~widelands-dev/widelands/trunk

« back to all changes in this revision

Viewing changes to src/scripting/lua_game.cc

  • Committer: The Widelands Bunnybot
  • Date: 2025-02-05 18:23:09 UTC
  • Revision ID: bunnybot@widelands.org-20250205182309-2g424fbzhfwykt6y
install-dependencies.sh: Don't error on MacOS when all dependencies already installed. (CB #4983 / GH #6623)

Co-authored-by: Malte Dostal <malte.dostal@gmail.com>

(by bunnybot)
d4c9023cc7b76bdc01bb80fddee5f8fd407496eb

Show diffs side-by-side

added added

removed removed

Lines of Context:
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},
124
121
};
125
122
const PropertyType<LuaPlayer> LuaPlayer::Properties[] = {
1175
1172
        return 0;
1176
1173
}
1177
1174
 
1178
 
/* RST
1179
 
   .. method:: cancel_trade(id)
1180
 
 
1181
 
      .. versionadded:: 1.3
1182
 
 
1183
 
      Cancel the trade agreement with the provided ID.
1184
 
 
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.
1187
 
 
1188
 
      :arg id: Unique ID of the trade to cancel.
1189
 
      :type id: :class:`integer`
1190
 
 
1191
 
      :see also: :attr:`wl.Game.trades`
1192
 
*/
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));
1196
 
        return 0;
1197
 
}
1198
 
 
1199
 
/* RST
1200
 
   .. method:: reject_trade(id)
1201
 
 
1202
 
      .. versionadded:: 1.3
1203
 
 
1204
 
      Reject the proposed trade with the provided ID.
1205
 
 
1206
 
      Only proposed trade offers can be rejected.
1207
 
      Only the recipient of the offer may reject it.
1208
 
 
1209
 
      :arg id: Unique ID of the trade to reject.
1210
 
      :type id: :class:`integer`
1211
 
 
1212
 
      :see also: :attr:`wl.Game.trades`
1213
 
*/
1214
 
int LuaPlayer::reject_trade(lua_State* L) {
1215
 
        get_game(L).reject_trade(luaL_checkinteger(L, 2));
1216
 
        return 0;
1217
 
}
1218
 
 
1219
 
/* RST
1220
 
   .. method:: retract_trade(id)
1221
 
 
1222
 
      .. versionadded:: 1.3
1223
 
 
1224
 
      Retract the proposed trade with the provided ID.
1225
 
 
1226
 
      Only proposed trade offers can be retracted.
1227
 
      Only the player who initiated the offer may retract it.
1228
 
 
1229
 
      :arg id: Unique ID of the trade to retract.
1230
 
      :type id: :class:`integer`
1231
 
 
1232
 
      :see also: :attr:`wl.Game.trades`
1233
 
*/
1234
 
int LuaPlayer::retract_trade(lua_State* L) {
1235
 
        get_game(L).retract_trade(luaL_checkinteger(L, 2));
1236
 
        return 0;
1237
 
}
1238
 
 
1239
1175
/*
1240
1176
 ==========================================================
1241
1177
 C METHODS