~widelands-dev/widelands/remove-savegame-compatibility-after-economy-change

« back to all changes in this revision

Viewing changes to src/economy/road.h

Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
        DISALLOW_COPY_AND_ASSIGN(RoadDescr);
44
44
};
45
45
 
 
46
// C++11 allows static constexpr members in the compiler, but the linker can't handle it.
 
47
// So, we don't have these in the class.
 
48
// https://stackoverflow.com/questions/40690260/undefined-reference-error-for-static-constexpr-member
 
49
constexpr int32_t kRoadAnimalPrice = 600;
 
50
constexpr int32_t kRoadMaxWallet = static_cast<int32_t>(2.5 * kRoadAnimalPrice);
 
51
 
46
52
/**
47
53
 * Road is a special object which connects two flags.
48
54
 * The Road itself is never rendered; however, the appropriate Field::roads are
108
114
        void postsplit(Game&, Flag&);
109
115
 
110
116
        bool notify_ware(Game& game, FlagId flagid);
 
117
        void update_wallet_chargetime(Game& game);
 
118
        void charge_wallet(Game& game);
 
119
        int32_t wallet() const;
 
120
        void add_to_wallet(int32_t sum);
 
121
        void pay_for_road(Game& game, uint8_t wares_count);
 
122
        void pay_for_building();
111
123
 
112
124
        void remove_worker(Worker&) override;
113
125
        void assign_carrier(Carrier&, uint8_t);
136
148
        static void
137
149
        request_carrier_callback(Game&, Request&, DescriptionIndex, Worker*, PlayerImmovable&);
138
150
 
 
151
        uint8_t carriers_count() const;
 
152
 
139
153
private:
140
154
        /// Counter that is incremented when a ware does not get a carrier for this
141
155
        /// road immediately and decremented over time.
142
 
        uint32_t busyness_;
 
156
        int32_t wallet_;
143
157
 
144
 
        /// holds the gametime when busyness_ was last updated
145
 
        uint32_t busyness_last_update_;
 
158
        /// holds the gametime when wallet_ was last charged
 
159
        uint32_t last_wallet_charge_;
146
160
 
147
161
        uint8_t type_;        ///< RoadType, 2 bits used
148
162
        Flag* flags_[2];      ///< start and end flag