~widelands-dev/widelands/trunk

« back to all changes in this revision

Viewing changes to src/logic/warehouse.h

  • Committer: fios at foramnagaidhlig
  • Date: 2015-11-11 09:52:55 UTC
  • mto: This revision was merged to the branch mainline in revision 7621.
  • Revision ID: fios@foramnagaidhlig.net-20151111095255-i2zzpgjv5qw3yart
Renamed WareIndex to DescriptionIndex.

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
         */
149
149
        Workers get_incorporated_workers();
150
150
 
151
 
        void insert_wares  (WareIndex, uint32_t count);
152
 
        void remove_wares  (WareIndex, uint32_t count);
153
 
        void insert_workers(WareIndex, uint32_t count);
154
 
        void remove_workers(WareIndex, uint32_t count);
 
151
        void insert_wares  (DescriptionIndex, uint32_t count);
 
152
        void remove_wares  (DescriptionIndex, uint32_t count);
 
153
        void insert_workers(DescriptionIndex, uint32_t count);
 
154
        void remove_workers(DescriptionIndex, uint32_t count);
155
155
 
156
156
        /* SoldierControl implementation */
157
157
        std::vector<Soldier *> present_soldiers() const override;
172
172
 
173
173
        bool fetch_from_flag(Game &) override;
174
174
 
175
 
        uint32_t count_workers(const Game &, WareIndex, const Requirements &);
176
 
        Worker & launch_worker(Game &, WareIndex, const Requirements &);
 
175
        uint32_t count_workers(const Game &, DescriptionIndex, const Requirements &);
 
176
        Worker & launch_worker(Game &, DescriptionIndex, const Requirements &);
177
177
 
178
178
        // Adds the worker to the inventory. Takes ownership and might delete
179
179
        // 'worker'.
180
180
        void incorporate_worker(EditorGameBase&, Worker* worker);
181
181
 
182
 
        WareInstance & launch_ware(Game &, WareIndex);
 
182
        WareInstance & launch_ware(Game &, DescriptionIndex);
183
183
        bool do_launch_ware(Game &, WareInstance &);
184
184
 
185
185
        // Adds the ware to our inventory. Takes ownership and might delete 'ware'.
186
186
        void incorporate_ware(EditorGameBase&, WareInstance* ware);
187
187
 
188
 
        bool can_create_worker(Game &, WareIndex) const;
189
 
        void     create_worker(Game &, WareIndex);
 
188
        bool can_create_worker(Game &, DescriptionIndex) const;
 
189
        void     create_worker(Game &, DescriptionIndex);
190
190
 
191
 
        uint32_t get_planned_workers(Game &, WareIndex index) const;
192
 
        void plan_workers(Game &, WareIndex index, uint32_t amount);
 
191
        uint32_t get_planned_workers(Game &, DescriptionIndex index) const;
 
192
        void plan_workers(Game &, DescriptionIndex index, uint32_t amount);
193
193
        std::vector<uint32_t> calc_available_for_worker
194
 
                (Game &, WareIndex index) const;
 
194
                (Game &, DescriptionIndex index) const;
195
195
 
196
196
        void enable_spawn(Game &, uint8_t worker_types_without_cost_index);
197
197
        void disable_spawn(uint8_t worker_types_without_cost_index);
203
203
        bool attack   (Soldier &) override;
204
204
        // End Attackable implementation
205
205
 
206
 
        void receive_ware(Game &, WareIndex ware) override;
 
206
        void receive_ware(Game &, DescriptionIndex ware) override;
207
207
        void receive_worker(Game &, Worker & worker) override;
208
208
 
209
 
        StockPolicy get_ware_policy(WareIndex ware) const;
210
 
        StockPolicy get_worker_policy(WareIndex ware) const;
211
 
        StockPolicy get_stock_policy(WareWorker waretype, WareIndex wareindex) const;
212
 
        void set_ware_policy(WareIndex ware, StockPolicy policy);
213
 
        void set_worker_policy(WareIndex ware, StockPolicy policy);
 
209
        StockPolicy get_ware_policy(DescriptionIndex ware) const;
 
210
        StockPolicy get_worker_policy(DescriptionIndex ware) const;
 
211
        StockPolicy get_stock_policy(WareWorker waretype, DescriptionIndex wareindex) const;
 
212
        void set_ware_policy(DescriptionIndex ware, StockPolicy policy);
 
213
        void set_worker_policy(DescriptionIndex ware, StockPolicy policy);
214
214
 
215
215
        // Get the portdock if this is a port.
216
216
        PortDock * get_portdock() const {return m_portdock;}
217
217
 
218
218
        // Returns the waresqueue of the expedition if this is a port. Will
219
219
        // assert(false) otherwise.
220
 
        WaresQueue& waresqueue(WareIndex) override;
 
220
        WaresQueue& waresqueue(DescriptionIndex) override;
221
221
 
222
222
        void log_general_info(const EditorGameBase &) override;
223
223
 
238
238
         */
239
239
        struct PlannedWorkers {
240
240
                /// Index of the worker type we plan to create
241
 
                WareIndex index;
 
241
                DescriptionIndex index;
242
242
 
243
243
                /// How many workers of this type are we supposed to create?
244
244
                uint32_t amount;
250
250
        };
251
251
 
252
252
        static void request_cb
253
 
                (Game &, Request &, WareIndex, Worker *, PlayerImmovable &);
 
253
                (Game &, Request &, DescriptionIndex, Worker *, PlayerImmovable &);
254
254
        void check_remove_stock(Game &);
255
255
 
256
256
        bool _load_finish_planned_worker(PlannedWorkers & pw);
264
264
 
265
265
        // Workers who live here at the moment
266
266
        using WorkerList = std::vector<Worker *>;
267
 
        using IncorporatedWorkers = std::map<WareIndex, WorkerList>;
 
267
        using IncorporatedWorkers = std::map<DescriptionIndex, WorkerList>;
268
268
        IncorporatedWorkers        m_incorporated_workers;
269
269
        std::vector<Time>          m_next_worker_without_cost_spawn;
270
270
        Time                       m_next_military_act;