~widelands-dev/widelands/trunk

« back to all changes in this revision

Viewing changes to src/logic/trade_agreement.h

  • Committer: The Widelands Bunnybot
  • Date: 2025-06-03 10:08:25 UTC
  • Revision ID: bunnybot@widelands.org-20250603100825-154ypyg1m77dtv9d
Sanity-check trade batch counts and batch sizes (CB #5129 / GH #6769)

Co-authored-by: Benedikt Straub <benedikt-straub@web.de>
Co-authored-by: Widelands Bunnybot <bunnybot@widelands.org>
Co-authored-by: Benedikt Straub <nordfriese@noreply.codeberg.org>
Co-committed-by: Benedikt Straub <nordfriese@noreply.codeberg.org>

(by bunnybot)
24ab248a2b11aaa396d89c6791ac5c385be67bc6

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
constexpr int32_t kInfiniteTrade = -1;
36
36
 
 
37
constexpr int32_t kMaxBatches = 100;
 
38
constexpr int32_t kMaxWaresPerBatch = 100;
 
39
 
37
40
struct TradeInstance {
38
41
        enum class State : uint8_t {
39
42
                kProposed = 0,
52
55
        BillOfMaterials items_to_receive;
53
56
        int32_t num_batches{0};
54
57
 
 
58
        [[nodiscard]] std::string check_illegal() const;
 
59
 
55
60
        [[nodiscard]] std::string format_richtext(TradeID id,
56
61
                                                  const EditorGameBase& egbase,
57
62
                                                  PlayerNumber iplayer,