~widelands-dev/widelands/trunk

« back to all changes in this revision

Viewing changes to src/ai/defaultai.h

  • Committer: The Widelands Bunnybot
  • Date: 2025-06-04 18:30:52 UTC
  • Revision ID: bunnybot@widelands.org-20250604183052-i2cqg7m4v2kfbqhg
Implement AI response to trade extension proposals (CB #5103 / GH #6743)

Co-authored-by: Tóth András <txa-dev@posteo.hu>
Co-authored-by: Widelands Bunnybot <bunnybot@widelands.org>
Co-committed-by: Tóth András <txa-dev@posteo.hu>

(by bunnybot)
f6723664328de290bcca0aa4008d0aec5d50b7a7

Show diffs side-by-side

added added

removed removed

Lines of Context:
246
246
        void collect_nearflags(std::map<uint32_t, NearFlag>&, const Widelands::Flag&, uint16_t);
247
247
        // calculating distances from local warehouse to flags
248
248
        void check_flag_distances(const Time&);
 
249
        FlagWarehouseDistances flag_warehouse_distance;
 
250
 
249
251
        void diplomacy_actions(const Time&);
250
252
        void trading_actions(const Time&);
251
 
        FlagWarehouseDistances flag_warehouse_distance;
 
253
 
 
254
        // returns true if the trade offer or extension is advantageous
 
255
        // targets and stock levels are taken from `economy`
 
256
        // `batches` should be 0 for trade offers, or the new number of remaining batches if the
 
257
        // extension proposal is accepted
 
258
        bool evaluate_trade(const Widelands::TradeInstance& offer,
 
259
                            const Widelands::Economy* economy,
 
260
                            int32_t batches);
 
261
 
 
262
        int32_t trade_preciousness(Widelands::DescriptionIndex ware_id,
 
263
                                   int32_t amount,
 
264
                                   const Widelands::Economy* economy,
 
265
                                   bool receive);
252
266
 
253
267
        bool check_economies();
254
268
        bool check_productionsites(const Time&);