Merge lp:~widelands-dev/widelands/const_portdock_fleet_and_ship_functions into lp:widelands
- const_portdock_fleet_and_ship_functions
- Merge into trunk
Proposed by
GunChleoc
Status: | Merged |
---|---|
Merged at revision: | 8818 |
Proposed branch: | lp:~widelands-dev/widelands/const_portdock_fleet_and_ship_functions |
Merge into: | lp:widelands |
Diff against target: |
855 lines (+95/-96) 42 files modified
src/ai/defaultai_seafaring.cc (+1/-1) src/economy/flag.cc (+1/-1) src/economy/flag.h (+1/-1) src/economy/fleet.cc (+6/-6) src/economy/fleet.h (+6/-6) src/economy/portdock.cc (+7/-7) src/economy/portdock.h (+5/-5) src/economy/road.cc (+1/-1) src/economy/road.h (+1/-1) src/economy/ware_instance.cc (+1/-1) src/economy/ware_instance.h (+1/-1) src/logic/map_objects/bob.cc (+1/-1) src/logic/map_objects/bob.h (+1/-1) src/logic/map_objects/immovable.cc (+1/-1) src/logic/map_objects/immovable.h (+1/-1) src/logic/map_objects/map_object.cc (+1/-1) src/logic/map_objects/map_object.h (+1/-1) src/logic/map_objects/tribes/building.cc (+1/-1) src/logic/map_objects/tribes/building.h (+1/-1) src/logic/map_objects/tribes/carrier.cc (+1/-1) src/logic/map_objects/tribes/carrier.h (+1/-1) src/logic/map_objects/tribes/productionsite.cc (+1/-1) src/logic/map_objects/tribes/productionsite.h (+1/-1) src/logic/map_objects/tribes/ship.cc (+1/-1) src/logic/map_objects/tribes/ship.h (+2/-2) src/logic/map_objects/tribes/soldier.cc (+1/-1) src/logic/map_objects/tribes/soldier.h (+1/-1) src/logic/map_objects/tribes/warehouse.cc (+7/-8) src/logic/map_objects/tribes/warehouse.h (+1/-1) src/logic/map_objects/tribes/worker.cc (+1/-1) src/logic/map_objects/tribes/worker.h (+1/-1) src/scripting/lua_map.cc (+3/-3) src/wui/buildingwindow.cc (+2/-2) src/wui/buildingwindow.h (+1/-1) src/wui/constructionsitewindow.cc (+1/-1) src/wui/dismantlesitewindow.cc (+1/-1) src/wui/inputqueuedisplay.cc (+17/-17) src/wui/inputqueuedisplay.h (+2/-2) src/wui/portdockwaresdisplay.cc (+7/-7) src/wui/portdockwaresdisplay.h (+1/-1) src/wui/productionsitewindow.cc (+1/-1) src/wui/warehousewindow.cc (+1/-1) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/const_portdock_fleet_and_ship_functions |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Notabilis | diff | Approve | |
Review via email: mp+354301@code.launchpad.net |
Commit message
Made as many functions as possible const in portdock, fleet and ship and followed the snowball effect
Description of the change
const functions give the compiler more room for optimization.
To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote : | # |
Revision history for this message
Notabilis (notabilis27) wrote : | # |
Diff is looking good.
I haven't bothered compiling or testing myself, but Travis seems to be fine.
review:
Approve
(diff)
Revision history for this message
GunChleoc (gunchleoc) wrote : | # |
Thanks! Change is trivial, so that should be sufficient.
@bunnybot merge
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/ai/defaultai_seafaring.cc' | |||
2 | --- src/ai/defaultai_seafaring.cc 2018-08-16 16:10:43 +0000 | |||
3 | +++ src/ai/defaultai_seafaring.cc 2018-09-05 07:39:19 +0000 | |||
4 | @@ -126,7 +126,7 @@ | |||
5 | 126 | for (const WarehouseSiteObserver& wh_obs : warehousesites) { | 126 | for (const WarehouseSiteObserver& wh_obs : warehousesites) { |
6 | 127 | if (wh_obs.bo->is(BuildingAttribute::kPort)) { | 127 | if (wh_obs.bo->is(BuildingAttribute::kPort)) { |
7 | 128 | ports_count += 1; | 128 | ports_count += 1; |
9 | 129 | if (Widelands::PortDock* pd = wh_obs.site->get_portdock()) { | 129 | if (const Widelands::PortDock* pd = wh_obs.site->get_portdock()) { |
10 | 130 | if (pd->expedition_started()) { | 130 | if (pd->expedition_started()) { |
11 | 131 | expeditions_in_prep += 1; | 131 | expeditions_in_prep += 1; |
12 | 132 | } | 132 | } |
13 | 133 | 133 | ||
14 | === modified file 'src/economy/flag.cc' | |||
15 | --- src/economy/flag.cc 2018-08-09 11:11:15 +0000 | |||
16 | +++ src/economy/flag.cc 2018-09-05 07:39:19 +0000 | |||
17 | @@ -967,7 +967,7 @@ | |||
18 | 967 | flag.molog("BUG: flag_job_request_callback: worker not found in list\n"); | 967 | flag.molog("BUG: flag_job_request_callback: worker not found in list\n"); |
19 | 968 | } | 968 | } |
20 | 969 | 969 | ||
22 | 970 | void Flag::log_general_info(const Widelands::EditorGameBase& egbase) { | 970 | void Flag::log_general_info(const Widelands::EditorGameBase& egbase) const { |
23 | 971 | molog("Flag at %i,%i\n", position_.x, position_.y); | 971 | molog("Flag at %i,%i\n", position_.x, position_.y); |
24 | 972 | 972 | ||
25 | 973 | Widelands::PlayerImmovable::log_general_info(egbase); | 973 | Widelands::PlayerImmovable::log_general_info(egbase); |
26 | 974 | 974 | ||
27 | === modified file 'src/economy/flag.h' | |||
28 | --- src/economy/flag.h 2018-08-09 11:11:15 +0000 | |||
29 | +++ src/economy/flag.h 2018-09-05 07:39:19 +0000 | |||
30 | @@ -163,7 +163,7 @@ | |||
31 | 163 | 163 | ||
32 | 164 | void add_flag_job(Game&, DescriptionIndex workerware, const std::string& programname); | 164 | void add_flag_job(Game&, DescriptionIndex workerware, const std::string& programname); |
33 | 165 | 165 | ||
35 | 166 | void log_general_info(const EditorGameBase&) override; | 166 | void log_general_info(const EditorGameBase&) const override; |
36 | 167 | 167 | ||
37 | 168 | protected: | 168 | protected: |
38 | 169 | bool init(EditorGameBase&) override; | 169 | bool init(EditorGameBase&) override; |
39 | 170 | 170 | ||
40 | === modified file 'src/economy/fleet.cc' | |||
41 | --- src/economy/fleet.cc 2018-04-07 16:59:00 +0000 | |||
42 | +++ src/economy/fleet.cc 2018-09-05 07:39:19 +0000 | |||
43 | @@ -324,11 +324,11 @@ | |||
44 | 324 | return true; | 324 | return true; |
45 | 325 | } | 325 | } |
46 | 326 | 326 | ||
48 | 327 | uint32_t Fleet::count_ships() { | 327 | uint32_t Fleet::count_ships() const { |
49 | 328 | return ships_.size(); | 328 | return ships_.size(); |
50 | 329 | } | 329 | } |
51 | 330 | 330 | ||
53 | 331 | uint32_t Fleet::count_ships_heading_here(EditorGameBase& egbase, PortDock* port) { | 331 | uint32_t Fleet::count_ships_heading_here(EditorGameBase& egbase, PortDock* port) const { |
54 | 332 | uint32_t ships_on_way = 0; | 332 | uint32_t ships_on_way = 0; |
55 | 333 | for (uint16_t s = 0; s < ships_.size(); s += 1) { | 333 | for (uint16_t s = 0; s < ships_.size(); s += 1) { |
56 | 334 | if (ships_[s]->get_destination(egbase) == port) { | 334 | if (ships_[s]->get_destination(egbase) == port) { |
57 | @@ -339,10 +339,10 @@ | |||
58 | 339 | return ships_on_way; | 339 | return ships_on_way; |
59 | 340 | } | 340 | } |
60 | 341 | 341 | ||
62 | 342 | uint32_t Fleet::count_ports() { | 342 | uint32_t Fleet::count_ports() const { |
63 | 343 | return ports_.size(); | 343 | return ports_.size(); |
64 | 344 | } | 344 | } |
66 | 345 | bool Fleet::get_act_pending() { | 345 | bool Fleet::get_act_pending() const { |
67 | 346 | return act_pending_; | 346 | return act_pending_; |
68 | 347 | } | 347 | } |
69 | 348 | 348 | ||
70 | @@ -568,7 +568,7 @@ | |||
71 | 568 | } | 568 | } |
72 | 569 | } | 569 | } |
73 | 570 | 570 | ||
75 | 571 | bool Fleet::has_ports() { | 571 | bool Fleet::has_ports() const { |
76 | 572 | return !ports_.empty(); | 572 | return !ports_.empty(); |
77 | 573 | } | 573 | } |
78 | 574 | 574 | ||
79 | @@ -863,7 +863,7 @@ | |||
80 | 863 | } | 863 | } |
81 | 864 | } | 864 | } |
82 | 865 | 865 | ||
84 | 866 | void Fleet::log_general_info(const EditorGameBase& egbase) { | 866 | void Fleet::log_general_info(const EditorGameBase& egbase) const { |
85 | 867 | MapObject::log_general_info(egbase); | 867 | MapObject::log_general_info(egbase); |
86 | 868 | 868 | ||
87 | 869 | molog("%" PRIuS " ships and %" PRIuS " ports\n", ships_.size(), ports_.size()); | 869 | molog("%" PRIuS " ships and %" PRIuS " ports\n", ships_.size(), ports_.size()); |
88 | 870 | 870 | ||
89 | === modified file 'src/economy/fleet.h' | |||
90 | --- src/economy/fleet.h 2018-04-16 07:03:12 +0000 | |||
91 | +++ src/economy/fleet.h 2018-09-05 07:39:19 +0000 | |||
92 | @@ -92,17 +92,17 @@ | |||
93 | 92 | void remove_ship(EditorGameBase& egbase, Ship* ship); | 92 | void remove_ship(EditorGameBase& egbase, Ship* ship); |
94 | 93 | void add_port(EditorGameBase& egbase, PortDock* port); | 93 | void add_port(EditorGameBase& egbase, PortDock* port); |
95 | 94 | void remove_port(EditorGameBase& egbase, PortDock* port); | 94 | void remove_port(EditorGameBase& egbase, PortDock* port); |
97 | 95 | bool has_ports(); | 95 | bool has_ports() const; |
98 | 96 | 96 | ||
100 | 97 | void log_general_info(const EditorGameBase&) override; | 97 | void log_general_info(const EditorGameBase&) const override; |
101 | 98 | 98 | ||
102 | 99 | bool get_path(PortDock& start, PortDock& end, Path& path); | 99 | bool get_path(PortDock& start, PortDock& end, Path& path); |
103 | 100 | void add_neighbours(PortDock& pd, std::vector<RoutingNodeNeighbour>& neighbours); | 100 | void add_neighbours(PortDock& pd, std::vector<RoutingNodeNeighbour>& neighbours); |
104 | 101 | 101 | ||
109 | 102 | uint32_t count_ships(); | 102 | uint32_t count_ships() const; |
110 | 103 | uint32_t count_ships_heading_here(EditorGameBase& egbase, PortDock* port); | 103 | uint32_t count_ships_heading_here(EditorGameBase& egbase, PortDock* port) const; |
111 | 104 | uint32_t count_ports(); | 104 | uint32_t count_ports() const; |
112 | 105 | bool get_act_pending(); | 105 | bool get_act_pending() const; |
113 | 106 | 106 | ||
114 | 107 | protected: | 107 | protected: |
115 | 108 | void act(Game&, uint32_t data) override; | 108 | void act(Game&, uint32_t data) override; |
116 | 109 | 109 | ||
117 | === modified file 'src/economy/portdock.cc' | |||
118 | --- src/economy/portdock.cc 2018-04-16 07:03:12 +0000 | |||
119 | +++ src/economy/portdock.cc 2018-09-05 07:39:19 +0000 | |||
120 | @@ -384,10 +384,10 @@ | |||
121 | 384 | /** | 384 | /** |
122 | 385 | * Return the number of wares or workers of the given type that are waiting at the dock. | 385 | * Return the number of wares or workers of the given type that are waiting at the dock. |
123 | 386 | */ | 386 | */ |
125 | 387 | uint32_t PortDock::count_waiting(WareWorker waretype, DescriptionIndex wareindex) { | 387 | uint32_t PortDock::count_waiting(WareWorker waretype, DescriptionIndex wareindex) const { |
126 | 388 | uint32_t count = 0; | 388 | uint32_t count = 0; |
127 | 389 | 389 | ||
129 | 390 | for (ShippingItem& shipping_item : waiting_) { | 390 | for (const ShippingItem& shipping_item : waiting_) { |
130 | 391 | WareInstance* ware; | 391 | WareInstance* ware; |
131 | 392 | Worker* worker; | 392 | Worker* worker; |
132 | 393 | shipping_item.get(owner().egbase(), &ware, &worker); | 393 | shipping_item.get(owner().egbase(), &ware, &worker); |
133 | @@ -407,12 +407,12 @@ | |||
134 | 407 | /** | 407 | /** |
135 | 408 | * Return the number of wares or workers waiting at the dock. | 408 | * Return the number of wares or workers waiting at the dock. |
136 | 409 | */ | 409 | */ |
138 | 410 | uint32_t PortDock::count_waiting() { | 410 | uint32_t PortDock::count_waiting() const { |
139 | 411 | return waiting_.size(); | 411 | return waiting_.size(); |
140 | 412 | } | 412 | } |
141 | 413 | 413 | ||
142 | 414 | /// \returns whether an expedition was started or is even ready | 414 | /// \returns whether an expedition was started or is even ready |
144 | 415 | bool PortDock::expedition_started() { | 415 | bool PortDock::expedition_started() const { |
145 | 416 | return (expedition_bootstrap_ != nullptr) || expedition_ready_; | 416 | return (expedition_bootstrap_ != nullptr) || expedition_ready_; |
146 | 417 | } | 417 | } |
147 | 418 | 418 | ||
148 | @@ -423,7 +423,7 @@ | |||
149 | 423 | expedition_bootstrap_->start(); | 423 | expedition_bootstrap_->start(); |
150 | 424 | } | 424 | } |
151 | 425 | 425 | ||
153 | 426 | ExpeditionBootstrap* PortDock::expedition_bootstrap() { | 426 | ExpeditionBootstrap* PortDock::expedition_bootstrap() const { |
154 | 427 | return expedition_bootstrap_.get(); | 427 | return expedition_bootstrap_.get(); |
155 | 428 | } | 428 | } |
156 | 429 | 429 | ||
157 | @@ -440,7 +440,7 @@ | |||
158 | 440 | expedition_bootstrap_.reset(nullptr); | 440 | expedition_bootstrap_.reset(nullptr); |
159 | 441 | } | 441 | } |
160 | 442 | 442 | ||
162 | 443 | void PortDock::log_general_info(const EditorGameBase& egbase) { | 443 | void PortDock::log_general_info(const EditorGameBase& egbase) const { |
163 | 444 | PlayerImmovable::log_general_info(egbase); | 444 | PlayerImmovable::log_general_info(egbase); |
164 | 445 | 445 | ||
165 | 446 | if (warehouse_) { | 446 | if (warehouse_) { |
166 | @@ -454,7 +454,7 @@ | |||
167 | 454 | fleet_ ? fleet_->serial() : 0, need_ship_ ? "true" : "false", waiting_.size()); | 454 | fleet_ ? fleet_->serial() : 0, need_ship_ ? "true" : "false", waiting_.size()); |
168 | 455 | } | 455 | } |
169 | 456 | 456 | ||
171 | 457 | for (ShippingItem& shipping_item : waiting_) { | 457 | for (const ShippingItem& shipping_item : waiting_) { |
172 | 458 | molog(" IT %u, destination %u\n", shipping_item.object_.serial(), | 458 | molog(" IT %u, destination %u\n", shipping_item.object_.serial(), |
173 | 459 | shipping_item.destination_dock_.serial()); | 459 | shipping_item.destination_dock_.serial()); |
174 | 460 | } | 460 | } |
175 | 461 | 461 | ||
176 | === modified file 'src/economy/portdock.h' | |||
177 | --- src/economy/portdock.h 2018-04-07 16:59:00 +0000 | |||
178 | +++ src/economy/portdock.h 2018-09-05 07:39:19 +0000 | |||
179 | @@ -115,13 +115,13 @@ | |||
180 | 115 | 115 | ||
181 | 116 | void ship_arrived(Game&, Ship&); | 116 | void ship_arrived(Game&, Ship&); |
182 | 117 | 117 | ||
184 | 118 | void log_general_info(const EditorGameBase&) override; | 118 | void log_general_info(const EditorGameBase&) const override; |
185 | 119 | 119 | ||
188 | 120 | uint32_t count_waiting(WareWorker waretype, DescriptionIndex wareindex); | 120 | uint32_t count_waiting(WareWorker waretype, DescriptionIndex wareindex) const; |
189 | 121 | uint32_t count_waiting(); | 121 | uint32_t count_waiting() const; |
190 | 122 | 122 | ||
191 | 123 | // Returns true if a expedition is started or ready to be send out. | 123 | // Returns true if a expedition is started or ready to be send out. |
193 | 124 | bool expedition_started(); | 124 | bool expedition_started() const; |
194 | 125 | 125 | ||
195 | 126 | // Called when the button in the warehouse window is pressed. | 126 | // Called when the button in the warehouse window is pressed. |
196 | 127 | void start_expedition(); | 127 | void start_expedition(); |
197 | @@ -129,7 +129,7 @@ | |||
198 | 129 | 129 | ||
199 | 130 | // May return nullptr when there is no expedition ongoing or if the | 130 | // May return nullptr when there is no expedition ongoing or if the |
200 | 131 | // expedition ship is already underway. | 131 | // expedition ship is already underway. |
202 | 132 | ExpeditionBootstrap* expedition_bootstrap(); | 132 | ExpeditionBootstrap* expedition_bootstrap() const; |
203 | 133 | 133 | ||
204 | 134 | // Gets called by the ExpeditionBootstrap as soon as all wares and workers are available. | 134 | // Gets called by the ExpeditionBootstrap as soon as all wares and workers are available. |
205 | 135 | void expedition_bootstrap_complete(Game& game); | 135 | void expedition_bootstrap_complete(Game& game); |
206 | 136 | 136 | ||
207 | === modified file 'src/economy/road.cc' | |||
208 | --- src/economy/road.cc 2018-07-12 06:02:15 +0000 | |||
209 | +++ src/economy/road.cc 2018-09-05 07:39:19 +0000 | |||
210 | @@ -632,7 +632,7 @@ | |||
211 | 632 | // Don't bother with checks here, since the next ware will cause them anyway | 632 | // Don't bother with checks here, since the next ware will cause them anyway |
212 | 633 | } | 633 | } |
213 | 634 | 634 | ||
215 | 635 | void Road::log_general_info(const EditorGameBase& egbase) { | 635 | void Road::log_general_info(const EditorGameBase& egbase) const { |
216 | 636 | PlayerImmovable::log_general_info(egbase); | 636 | PlayerImmovable::log_general_info(egbase); |
217 | 637 | molog("wallet: %i\n", wallet_); | 637 | molog("wallet: %i\n", wallet_); |
218 | 638 | } | 638 | } |
219 | 639 | 639 | ||
220 | === modified file 'src/economy/road.h' | |||
221 | --- src/economy/road.h 2018-07-12 06:02:15 +0000 | |||
222 | +++ src/economy/road.h 2018-09-05 07:39:19 +0000 | |||
223 | @@ -124,7 +124,7 @@ | |||
224 | 124 | void remove_worker(Worker&) override; | 124 | void remove_worker(Worker&) override; |
225 | 125 | void assign_carrier(Carrier&, uint8_t); | 125 | void assign_carrier(Carrier&, uint8_t); |
226 | 126 | 126 | ||
228 | 127 | void log_general_info(const EditorGameBase&) override; | 127 | void log_general_info(const EditorGameBase&) const override; |
229 | 128 | 128 | ||
230 | 129 | protected: | 129 | protected: |
231 | 130 | bool init(EditorGameBase&) override; | 130 | bool init(EditorGameBase&) override; |
232 | 131 | 131 | ||
233 | === modified file 'src/economy/ware_instance.cc' | |||
234 | --- src/economy/ware_instance.cc 2018-04-07 16:59:00 +0000 | |||
235 | +++ src/economy/ware_instance.cc 2018-09-05 07:39:19 +0000 | |||
236 | @@ -502,7 +502,7 @@ | |||
237 | 502 | return transfer_ ? dynamic_cast<PlayerImmovable*>(transfer_nextstep_.get(game)) : nullptr; | 502 | return transfer_ ? dynamic_cast<PlayerImmovable*>(transfer_nextstep_.get(game)) : nullptr; |
238 | 503 | } | 503 | } |
239 | 504 | 504 | ||
241 | 505 | void WareInstance::log_general_info(const EditorGameBase& egbase) { | 505 | void WareInstance::log_general_info(const EditorGameBase& egbase) const { |
242 | 506 | MapObject::log_general_info(egbase); | 506 | MapObject::log_general_info(egbase); |
243 | 507 | 507 | ||
244 | 508 | molog("Ware: %s\n", descr().name().c_str()); | 508 | molog("Ware: %s\n", descr().name().c_str()); |
245 | 509 | 509 | ||
246 | === modified file 'src/economy/ware_instance.h' | |||
247 | --- src/economy/ware_instance.h 2018-04-07 16:59:00 +0000 | |||
248 | +++ src/economy/ware_instance.h 2018-09-05 07:39:19 +0000 | |||
249 | @@ -93,7 +93,7 @@ | |||
250 | 93 | return transfer_; | 93 | return transfer_; |
251 | 94 | } | 94 | } |
252 | 95 | 95 | ||
254 | 96 | void log_general_info(const EditorGameBase& egbase) override; | 96 | void log_general_info(const EditorGameBase& egbase) const override; |
255 | 97 | 97 | ||
256 | 98 | private: | 98 | private: |
257 | 99 | ObjectPointer location_; | 99 | ObjectPointer location_; |
258 | 100 | 100 | ||
259 | === modified file 'src/logic/map_objects/bob.cc' | |||
260 | --- src/logic/map_objects/bob.cc 2018-04-27 06:11:05 +0000 | |||
261 | +++ src/logic/map_objects/bob.cc 2018-09-05 07:39:19 +0000 | |||
262 | @@ -902,7 +902,7 @@ | |||
263 | 902 | } | 902 | } |
264 | 903 | 903 | ||
265 | 904 | /// Give debug information. | 904 | /// Give debug information. |
267 | 905 | void Bob::log_general_info(const EditorGameBase& egbase) { | 905 | void Bob::log_general_info(const EditorGameBase& egbase) const { |
268 | 906 | FORMAT_WARNINGS_OFF; | 906 | FORMAT_WARNINGS_OFF; |
269 | 907 | molog("Owner: %p\n", owner_); | 907 | molog("Owner: %p\n", owner_); |
270 | 908 | FORMAT_WARNINGS_ON; | 908 | FORMAT_WARNINGS_ON; |
271 | 909 | 909 | ||
272 | === modified file 'src/logic/map_objects/bob.h' | |||
273 | --- src/logic/map_objects/bob.h 2018-04-07 16:59:00 +0000 | |||
274 | +++ src/logic/map_objects/bob.h 2018-09-05 07:39:19 +0000 | |||
275 | @@ -270,7 +270,7 @@ | |||
276 | 270 | RenderTarget* dst) const; | 270 | RenderTarget* dst) const; |
277 | 271 | 271 | ||
278 | 272 | // For debug | 272 | // For debug |
280 | 273 | void log_general_info(const EditorGameBase&) override; | 273 | void log_general_info(const EditorGameBase&) const override; |
281 | 274 | 274 | ||
282 | 275 | // default tasks | 275 | // default tasks |
283 | 276 | void reset_tasks(Game&); | 276 | void reset_tasks(Game&); |
284 | 277 | 277 | ||
285 | === modified file 'src/logic/map_objects/immovable.cc' | |||
286 | --- src/logic/map_objects/immovable.cc 2018-07-13 07:46:36 +0000 | |||
287 | +++ src/logic/map_objects/immovable.cc 2018-09-05 07:39:19 +0000 | |||
288 | @@ -1332,7 +1332,7 @@ | |||
289 | 1332 | /** | 1332 | /** |
290 | 1333 | * Dump general information | 1333 | * Dump general information |
291 | 1334 | */ | 1334 | */ |
293 | 1335 | void PlayerImmovable::log_general_info(const EditorGameBase& egbase) { | 1335 | void PlayerImmovable::log_general_info(const EditorGameBase& egbase) const { |
294 | 1336 | BaseImmovable::log_general_info(egbase); | 1336 | BaseImmovable::log_general_info(egbase); |
295 | 1337 | 1337 | ||
296 | 1338 | FORMAT_WARNINGS_OFF; | 1338 | FORMAT_WARNINGS_OFF; |
297 | 1339 | 1339 | ||
298 | === modified file 'src/logic/map_objects/immovable.h' | |||
299 | --- src/logic/map_objects/immovable.h 2018-07-08 16:10:50 +0000 | |||
300 | +++ src/logic/map_objects/immovable.h 2018-09-05 07:39:19 +0000 | |||
301 | @@ -357,7 +357,7 @@ | |||
302 | 357 | return workers_; | 357 | return workers_; |
303 | 358 | } | 358 | } |
304 | 359 | 359 | ||
306 | 360 | void log_general_info(const EditorGameBase&) override; | 360 | void log_general_info(const EditorGameBase&) const override; |
307 | 361 | 361 | ||
308 | 362 | /** | 362 | /** |
309 | 363 | * These functions are called when a ware or worker arrives at | 363 | * These functions are called when a ware or worker arrives at |
310 | 364 | 364 | ||
311 | === modified file 'src/logic/map_objects/map_object.cc' | |||
312 | --- src/logic/map_objects/map_object.cc 2018-07-23 09:04:47 +0000 | |||
313 | +++ src/logic/map_objects/map_object.cc 2018-09-05 07:39:19 +0000 | |||
314 | @@ -543,7 +543,7 @@ | |||
315 | 543 | logsink_ = sink; | 543 | logsink_ = sink; |
316 | 544 | } | 544 | } |
317 | 545 | 545 | ||
319 | 546 | void MapObject::log_general_info(const EditorGameBase&) { | 546 | void MapObject::log_general_info(const EditorGameBase&) const { |
320 | 547 | } | 547 | } |
321 | 548 | 548 | ||
322 | 549 | /** | 549 | /** |
323 | 550 | 550 | ||
324 | === modified file 'src/logic/map_objects/map_object.h' | |||
325 | --- src/logic/map_objects/map_object.h 2018-05-12 04:18:21 +0000 | |||
326 | +++ src/logic/map_objects/map_object.h 2018-09-05 07:39:19 +0000 | |||
327 | @@ -302,7 +302,7 @@ | |||
328 | 302 | void set_logsink(LogSink*); | 302 | void set_logsink(LogSink*); |
329 | 303 | 303 | ||
330 | 304 | /// Called when a new logsink is set. Used to give general information. | 304 | /// Called when a new logsink is set. Used to give general information. |
332 | 305 | virtual void log_general_info(const EditorGameBase&); | 305 | virtual void log_general_info(const EditorGameBase&) const; |
333 | 306 | 306 | ||
334 | 307 | Player* get_owner() const { | 307 | Player* get_owner() const { |
335 | 308 | return owner_; | 308 | return owner_; |
336 | 309 | 309 | ||
337 | === modified file 'src/logic/map_objects/tribes/building.cc' | |||
338 | --- src/logic/map_objects/tribes/building.cc 2018-04-27 06:11:05 +0000 | |||
339 | +++ src/logic/map_objects/tribes/building.cc 2018-09-05 07:39:19 +0000 | |||
340 | @@ -669,7 +669,7 @@ | |||
341 | 669 | } | 669 | } |
342 | 670 | } | 670 | } |
343 | 671 | 671 | ||
345 | 672 | void Building::log_general_info(const EditorGameBase& egbase) { | 672 | void Building::log_general_info(const EditorGameBase& egbase) const { |
346 | 673 | PlayerImmovable::log_general_info(egbase); | 673 | PlayerImmovable::log_general_info(egbase); |
347 | 674 | 674 | ||
348 | 675 | molog("position: (%i, %i)\n", position_.x, position_.y); | 675 | molog("position: (%i, %i)\n", position_.x, position_.y); |
349 | 676 | 676 | ||
350 | === modified file 'src/logic/map_objects/tribes/building.h' | |||
351 | --- src/logic/map_objects/tribes/building.h 2018-05-24 10:19:21 +0000 | |||
352 | +++ src/logic/map_objects/tribes/building.h 2018-09-05 07:39:19 +0000 | |||
353 | @@ -282,7 +282,7 @@ | |||
354 | 282 | return old_buildings_; | 282 | return old_buildings_; |
355 | 283 | } | 283 | } |
356 | 284 | 284 | ||
358 | 285 | void log_general_info(const EditorGameBase&) override; | 285 | void log_general_info(const EditorGameBase&) const override; |
359 | 286 | 286 | ||
360 | 287 | // Use on training sites only. | 287 | // Use on training sites only. |
361 | 288 | virtual void change_train_priority(uint32_t, int32_t) { | 288 | virtual void change_train_priority(uint32_t, int32_t) { |
362 | 289 | 289 | ||
363 | === modified file 'src/logic/map_objects/tribes/carrier.cc' | |||
364 | --- src/logic/map_objects/tribes/carrier.cc 2018-08-13 05:50:58 +0000 | |||
365 | +++ src/logic/map_objects/tribes/carrier.cc 2018-09-05 07:39:19 +0000 | |||
366 | @@ -406,7 +406,7 @@ | |||
367 | 406 | return start_task_movepath(game, path, idx, descr().get_right_walk_anims(does_carry_ware())); | 406 | return start_task_movepath(game, path, idx, descr().get_right_walk_anims(does_carry_ware())); |
368 | 407 | } | 407 | } |
369 | 408 | 408 | ||
371 | 409 | void Carrier::log_general_info(const Widelands::EditorGameBase& egbase) { | 409 | void Carrier::log_general_info(const Widelands::EditorGameBase& egbase) const { |
372 | 410 | molog("Carrier at %i,%i\n", get_position().x, get_position().y); | 410 | molog("Carrier at %i,%i\n", get_position().x, get_position().y); |
373 | 411 | 411 | ||
374 | 412 | Worker::log_general_info(egbase); | 412 | Worker::log_general_info(egbase); |
375 | 413 | 413 | ||
376 | === modified file 'src/logic/map_objects/tribes/carrier.h' | |||
377 | --- src/logic/map_objects/tribes/carrier.h 2018-08-09 11:11:15 +0000 | |||
378 | +++ src/logic/map_objects/tribes/carrier.h 2018-09-05 07:39:19 +0000 | |||
379 | @@ -62,7 +62,7 @@ | |||
380 | 62 | void start_task_transport(Game&, int32_t fromflag); | 62 | void start_task_transport(Game&, int32_t fromflag); |
381 | 63 | bool start_task_walktoflag(Game&, int32_t flag, bool offset = false); | 63 | bool start_task_walktoflag(Game&, int32_t flag, bool offset = false); |
382 | 64 | 64 | ||
384 | 65 | void log_general_info(const EditorGameBase&) override; | 65 | void log_general_info(const EditorGameBase&) const override; |
385 | 66 | 66 | ||
386 | 67 | static Task const taskRoad; | 67 | static Task const taskRoad; |
387 | 68 | 68 | ||
388 | 69 | 69 | ||
389 | === modified file 'src/logic/map_objects/tribes/productionsite.cc' | |||
390 | --- src/logic/map_objects/tribes/productionsite.cc 2018-06-19 08:52:49 +0000 | |||
391 | +++ src/logic/map_objects/tribes/productionsite.cc 2018-09-05 07:39:19 +0000 | |||
392 | @@ -739,7 +739,7 @@ | |||
393 | 739 | return true; | 739 | return true; |
394 | 740 | } | 740 | } |
395 | 741 | 741 | ||
397 | 742 | void ProductionSite::log_general_info(const EditorGameBase& egbase) { | 742 | void ProductionSite::log_general_info(const EditorGameBase& egbase) const { |
398 | 743 | Building::log_general_info(egbase); | 743 | Building::log_general_info(egbase); |
399 | 744 | 744 | ||
400 | 745 | molog("is_stopped: %u\n", is_stopped_); | 745 | molog("is_stopped: %u\n", is_stopped_); |
401 | 746 | 746 | ||
402 | === modified file 'src/logic/map_objects/tribes/productionsite.h' | |||
403 | --- src/logic/map_objects/tribes/productionsite.h 2018-07-08 16:10:50 +0000 | |||
404 | +++ src/logic/map_objects/tribes/productionsite.h 2018-09-05 07:39:19 +0000 | |||
405 | @@ -165,7 +165,7 @@ | |||
406 | 165 | explicit ProductionSite(const ProductionSiteDescr& descr); | 165 | explicit ProductionSite(const ProductionSiteDescr& descr); |
407 | 166 | ~ProductionSite() override; | 166 | ~ProductionSite() override; |
408 | 167 | 167 | ||
410 | 168 | void log_general_info(const EditorGameBase&) override; | 168 | void log_general_info(const EditorGameBase&) const override; |
411 | 169 | 169 | ||
412 | 170 | bool is_stopped() const { | 170 | bool is_stopped() const { |
413 | 171 | return is_stopped_; | 171 | return is_stopped_; |
414 | 172 | 172 | ||
415 | === modified file 'src/logic/map_objects/tribes/ship.cc' | |||
416 | --- src/logic/map_objects/tribes/ship.cc 2018-07-08 15:16:16 +0000 | |||
417 | +++ src/logic/map_objects/tribes/ship.cc 2018-09-05 07:39:19 +0000 | |||
418 | @@ -1027,7 +1027,7 @@ | |||
419 | 1027 | scale, dst); | 1027 | scale, dst); |
420 | 1028 | } | 1028 | } |
421 | 1029 | 1029 | ||
423 | 1030 | void Ship::log_general_info(const EditorGameBase& egbase) { | 1030 | void Ship::log_general_info(const EditorGameBase& egbase) const { |
424 | 1031 | Bob::log_general_info(egbase); | 1031 | Bob::log_general_info(egbase); |
425 | 1032 | 1032 | ||
426 | 1033 | molog("Ship belongs to fleet: %u\n destination: %s\n lastdock: %s\n", | 1033 | molog("Ship belongs to fleet: %u\n destination: %s\n lastdock: %s\n", |
427 | 1034 | 1034 | ||
428 | === modified file 'src/logic/map_objects/tribes/ship.h' | |||
429 | --- src/logic/map_objects/tribes/ship.h 2018-07-12 05:44:15 +0000 | |||
430 | +++ src/logic/map_objects/tribes/ship.h 2018-09-05 07:39:19 +0000 | |||
431 | @@ -117,7 +117,7 @@ | |||
432 | 117 | 117 | ||
433 | 118 | uint32_t calculate_sea_route(Game& game, PortDock& pd, Path* finalpath = nullptr) const; | 118 | uint32_t calculate_sea_route(Game& game, PortDock& pd, Path* finalpath = nullptr) const; |
434 | 119 | 119 | ||
436 | 120 | void log_general_info(const EditorGameBase&) override; | 120 | void log_general_info(const EditorGameBase&) const override; |
437 | 121 | 121 | ||
438 | 122 | uint32_t get_nritems() const { | 122 | uint32_t get_nritems() const { |
439 | 123 | return items_.size(); | 123 | return items_.size(); |
440 | @@ -196,7 +196,7 @@ | |||
441 | 196 | } | 196 | } |
442 | 197 | 197 | ||
443 | 198 | // whether the ship's expedition is in state "island-exploration" (circular movement) | 198 | // whether the ship's expedition is in state "island-exploration" (circular movement) |
445 | 199 | bool is_exploring_island() { | 199 | bool is_exploring_island() const { |
446 | 200 | return expedition_->island_exploration; | 200 | return expedition_->island_exploration; |
447 | 201 | } | 201 | } |
448 | 202 | 202 | ||
449 | 203 | 203 | ||
450 | === modified file 'src/logic/map_objects/tribes/soldier.cc' | |||
451 | --- src/logic/map_objects/tribes/soldier.cc 2018-07-13 10:35:16 +0000 | |||
452 | +++ src/logic/map_objects/tribes/soldier.cc 2018-09-05 07:39:19 +0000 | |||
453 | @@ -1546,7 +1546,7 @@ | |||
454 | 1546 | } | 1546 | } |
455 | 1547 | } | 1547 | } |
456 | 1548 | 1548 | ||
458 | 1549 | void Soldier::log_general_info(const EditorGameBase& egbase) { | 1549 | void Soldier::log_general_info(const EditorGameBase& egbase) const { |
459 | 1550 | Worker::log_general_info(egbase); | 1550 | Worker::log_general_info(egbase); |
460 | 1551 | molog("[Soldier]\n"); | 1551 | molog("[Soldier]\n"); |
461 | 1552 | molog("Levels: %d/%d/%d/%d\n", health_level_, attack_level_, defense_level_, evade_level_); | 1552 | molog("Levels: %d/%d/%d/%d\n", health_level_, attack_level_, defense_level_, evade_level_); |
462 | 1553 | 1553 | ||
463 | === modified file 'src/logic/map_objects/tribes/soldier.h' | |||
464 | --- src/logic/map_objects/tribes/soldier.h 2018-04-07 16:59:00 +0000 | |||
465 | +++ src/logic/map_objects/tribes/soldier.h 2018-09-05 07:39:19 +0000 | |||
466 | @@ -258,7 +258,7 @@ | |||
467 | 258 | void heal(uint32_t); | 258 | void heal(uint32_t); |
468 | 259 | void damage(uint32_t); /// Damage quantity of health points | 259 | void damage(uint32_t); /// Damage quantity of health points |
469 | 260 | 260 | ||
471 | 261 | void log_general_info(const EditorGameBase&) override; | 261 | void log_general_info(const EditorGameBase&) const override; |
472 | 262 | 262 | ||
473 | 263 | bool is_on_battlefield(); | 263 | bool is_on_battlefield(); |
474 | 264 | bool is_attacking_player(Game&, Player&); | 264 | bool is_attacking_player(Game&, Player&); |
475 | 265 | 265 | ||
476 | === modified file 'src/logic/map_objects/tribes/warehouse.cc' | |||
477 | --- src/logic/map_objects/tribes/warehouse.cc 2018-04-07 16:59:00 +0000 | |||
478 | +++ src/logic/map_objects/tribes/warehouse.cc 2018-09-05 07:39:19 +0000 | |||
479 | @@ -1337,17 +1337,16 @@ | |||
480 | 1337 | return portdock_->expedition_bootstrap()->inputqueue(index, type); | 1337 | return portdock_->expedition_bootstrap()->inputqueue(index, type); |
481 | 1338 | } | 1338 | } |
482 | 1339 | 1339 | ||
484 | 1340 | void Warehouse::log_general_info(const EditorGameBase& egbase) { | 1340 | void Warehouse::log_general_info(const EditorGameBase& egbase) const { |
485 | 1341 | Building::log_general_info(egbase); | 1341 | Building::log_general_info(egbase); |
486 | 1342 | 1342 | ||
487 | 1343 | if (descr().get_isport()) { | 1343 | if (descr().get_isport()) { |
495 | 1344 | PortDock* pd_tmp = portdock_; | 1344 | if (portdock_) { |
496 | 1345 | if (pd_tmp) { | 1345 | molog("Port dock: %u\n", portdock_->serial()); |
497 | 1346 | molog("Port dock: %u\n", pd_tmp->serial()); | 1346 | molog("port needs ship: %s\n", (portdock_->get_need_ship()) ? "true" : "false"); |
498 | 1347 | molog("port needs ship: %s\n", (pd_tmp->get_need_ship()) ? "true" : "false"); | 1347 | molog("wares and workers waiting: %u\n", portdock_->count_waiting()); |
499 | 1348 | molog("wares and workers waiting: %u\n", pd_tmp->count_waiting()); | 1348 | molog("exped. in progr.: %s\n", (portdock_->expedition_started()) ? "true" : "false"); |
500 | 1349 | molog("exped. in progr.: %s\n", (pd_tmp->expedition_started()) ? "true" : "false"); | 1349 | Fleet* fleet = portdock_->get_fleet(); |
494 | 1350 | Fleet* fleet = pd_tmp->get_fleet(); | ||
501 | 1351 | if (fleet) { | 1350 | if (fleet) { |
502 | 1352 | molog("* fleet: %u\n", fleet->serial()); | 1351 | molog("* fleet: %u\n", fleet->serial()); |
503 | 1353 | molog(" ships: %u, ports: %u\n", fleet->count_ships(), fleet->count_ports()); | 1352 | molog(" ships: %u, ports: %u\n", fleet->count_ships(), fleet->count_ports()); |
504 | 1354 | 1353 | ||
505 | === modified file 'src/logic/map_objects/tribes/warehouse.h' | |||
506 | --- src/logic/map_objects/tribes/warehouse.h 2018-04-07 16:59:00 +0000 | |||
507 | +++ src/logic/map_objects/tribes/warehouse.h 2018-09-05 07:39:19 +0000 | |||
508 | @@ -214,7 +214,7 @@ | |||
509 | 214 | // Will throw an exception otherwise. | 214 | // Will throw an exception otherwise. |
510 | 215 | InputQueue& inputqueue(DescriptionIndex, WareWorker) override; | 215 | InputQueue& inputqueue(DescriptionIndex, WareWorker) override; |
511 | 216 | 216 | ||
513 | 217 | void log_general_info(const EditorGameBase&) override; | 217 | void log_general_info(const EditorGameBase&) const override; |
514 | 218 | 218 | ||
515 | 219 | private: | 219 | private: |
516 | 220 | class SoldierControl : public Widelands::SoldierControl { | 220 | class SoldierControl : public Widelands::SoldierControl { |
517 | 221 | 221 | ||
518 | === modified file 'src/logic/map_objects/tribes/worker.cc' | |||
519 | --- src/logic/map_objects/tribes/worker.cc 2018-08-09 11:11:15 +0000 | |||
520 | +++ src/logic/map_objects/tribes/worker.cc 2018-09-05 07:39:19 +0000 | |||
521 | @@ -1051,7 +1051,7 @@ | |||
522 | 1051 | } | 1051 | } |
523 | 1052 | 1052 | ||
524 | 1053 | /// Log basic information. | 1053 | /// Log basic information. |
526 | 1054 | void Worker::log_general_info(const EditorGameBase& egbase) { | 1054 | void Worker::log_general_info(const EditorGameBase& egbase) const { |
527 | 1055 | Bob::log_general_info(egbase); | 1055 | Bob::log_general_info(egbase); |
528 | 1056 | 1056 | ||
529 | 1057 | if (upcast(PlayerImmovable, loc, location_.get(egbase))) { | 1057 | if (upcast(PlayerImmovable, loc, location_.get(egbase))) { |
530 | 1058 | 1058 | ||
531 | === modified file 'src/logic/map_objects/tribes/worker.h' | |||
532 | --- src/logic/map_objects/tribes/worker.h 2018-07-26 11:28:05 +0000 | |||
533 | +++ src/logic/map_objects/tribes/worker.h 2018-09-05 07:39:19 +0000 | |||
534 | @@ -138,7 +138,7 @@ | |||
535 | 138 | } | 138 | } |
536 | 139 | 139 | ||
537 | 140 | // debug | 140 | // debug |
539 | 141 | void log_general_info(const EditorGameBase&) override; | 141 | void log_general_info(const EditorGameBase&) const override; |
540 | 142 | 142 | ||
541 | 143 | // worker-specific tasks | 143 | // worker-specific tasks |
542 | 144 | void start_task_transfer(Game&, Transfer*); | 144 | void start_task_transfer(Game&, Transfer*); |
543 | 145 | 145 | ||
544 | === modified file 'src/scripting/lua_map.cc' | |||
545 | --- src/scripting/lua_map.cc 2018-07-11 08:32:54 +0000 | |||
546 | +++ src/scripting/lua_map.cc 2018-09-05 07:39:19 +0000 | |||
547 | @@ -4569,7 +4569,7 @@ | |||
548 | 4569 | EditorGameBase& egbase = get_egbase(L); | 4569 | EditorGameBase& egbase = get_egbase(L); |
549 | 4570 | 4570 | ||
550 | 4571 | if (is_a(Game, &egbase)) { | 4571 | if (is_a(Game, &egbase)) { |
552 | 4572 | PortDock* pd = get(L, egbase)->get_portdock(); | 4572 | const PortDock* pd = get(L, egbase)->get_portdock(); |
553 | 4573 | if (pd) { | 4573 | if (pd) { |
554 | 4574 | if (pd->expedition_started()) { | 4574 | if (pd->expedition_started()) { |
555 | 4575 | return 1; | 4575 | return 1; |
556 | @@ -4932,7 +4932,7 @@ | |||
557 | 4932 | } | 4932 | } |
558 | 4933 | 4933 | ||
559 | 4934 | if (upcast(Game, game, &egbase)) { | 4934 | if (upcast(Game, game, &egbase)) { |
561 | 4935 | PortDock* pd = wh->get_portdock(); | 4935 | const PortDock* pd = wh->get_portdock(); |
562 | 4936 | if (!pd) { | 4936 | if (!pd) { |
563 | 4937 | return 0; | 4937 | return 0; |
564 | 4938 | } | 4938 | } |
565 | @@ -4963,7 +4963,7 @@ | |||
566 | 4963 | } | 4963 | } |
567 | 4964 | 4964 | ||
568 | 4965 | if (upcast(Game, game, &egbase)) { | 4965 | if (upcast(Game, game, &egbase)) { |
570 | 4966 | PortDock* pd = wh->get_portdock(); | 4966 | const PortDock* pd = wh->get_portdock(); |
571 | 4967 | if (!pd) { | 4967 | if (!pd) { |
572 | 4968 | return 0; | 4968 | return 0; |
573 | 4969 | } | 4969 | } |
574 | 4970 | 4970 | ||
575 | === modified file 'src/wui/buildingwindow.cc' | |||
576 | --- src/wui/buildingwindow.cc 2018-09-01 08:36:08 +0000 | |||
577 | +++ src/wui/buildingwindow.cc 2018-09-05 07:39:19 +0000 | |||
578 | @@ -204,7 +204,7 @@ | |||
579 | 204 | if (can_act) { | 204 | if (can_act) { |
580 | 205 | // Check if this is a port building and if yes show expedition button | 205 | // Check if this is a port building and if yes show expedition button |
581 | 206 | if (upcast(Widelands::Warehouse const, warehouse, building)) { | 206 | if (upcast(Widelands::Warehouse const, warehouse, building)) { |
583 | 207 | if (Widelands::PortDock* pd = warehouse->get_portdock()) { | 207 | if (const Widelands::PortDock* pd = warehouse->get_portdock()) { |
584 | 208 | expeditionbtn_ = new UI::Button( | 208 | expeditionbtn_ = new UI::Button( |
585 | 209 | capsbuttons, "start_or_cancel_expedition", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu, | 209 | capsbuttons, "start_or_cancel_expedition", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu, |
586 | 210 | g_gr->images().get("images/wui/buildings/start_expedition.png")); | 210 | g_gr->images().get("images/wui/buildings/start_expedition.png")); |
587 | @@ -537,7 +537,7 @@ | |||
588 | 537 | 537 | ||
589 | 538 | void BuildingWindow::create_input_queue_panel(UI::Box* const box, | 538 | void BuildingWindow::create_input_queue_panel(UI::Box* const box, |
590 | 539 | Widelands::Building& b, | 539 | Widelands::Building& b, |
592 | 540 | Widelands::InputQueue* const iq, | 540 | const Widelands::InputQueue& iq, |
593 | 541 | bool show_only) { | 541 | bool show_only) { |
594 | 542 | // The *max* width should be larger than the default width | 542 | // The *max* width should be larger than the default width |
595 | 543 | box->add(new InputQueueDisplay(box, 0, 0, *igbase(), b, iq, show_only)); | 543 | box->add(new InputQueueDisplay(box, 0, 0, *igbase(), b, iq, show_only)); |
596 | 544 | 544 | ||
597 | === modified file 'src/wui/buildingwindow.h' | |||
598 | --- src/wui/buildingwindow.h 2018-08-10 07:42:57 +0000 | |||
599 | +++ src/wui/buildingwindow.h 2018-09-05 07:39:19 +0000 | |||
600 | @@ -89,7 +89,7 @@ | |||
601 | 89 | void clicked_goto(); | 89 | void clicked_goto(); |
602 | 90 | 90 | ||
603 | 91 | void | 91 | void |
605 | 92 | create_input_queue_panel(UI::Box*, Widelands::Building&, Widelands::InputQueue*, bool = false); | 92 | create_input_queue_panel(UI::Box*, Widelands::Building&, const Widelands::InputQueue&, bool = false); |
606 | 93 | 93 | ||
607 | 94 | bool is_dying_; | 94 | bool is_dying_; |
608 | 95 | 95 | ||
609 | 96 | 96 | ||
610 | === modified file 'src/wui/constructionsitewindow.cc' | |||
611 | --- src/wui/constructionsitewindow.cc 2018-08-14 13:40:46 +0000 | |||
612 | +++ src/wui/constructionsitewindow.cc 2018-09-05 07:39:19 +0000 | |||
613 | @@ -55,7 +55,7 @@ | |||
614 | 55 | // Add the wares queue | 55 | // Add the wares queue |
615 | 56 | for (uint32_t i = 0; i < construction_site->get_nrwaresqueues(); ++i) | 56 | for (uint32_t i = 0; i < construction_site->get_nrwaresqueues(); ++i) |
616 | 57 | box.add(new InputQueueDisplay( | 57 | box.add(new InputQueueDisplay( |
618 | 58 | &box, 0, 0, *igbase(), *construction_site, construction_site->get_waresqueue(i))); | 58 | &box, 0, 0, *igbase(), *construction_site, *construction_site->get_waresqueue(i))); |
619 | 59 | 59 | ||
620 | 60 | get_tabs()->add("wares", g_gr->images().get(pic_tab_wares), &box, _("Building materials")); | 60 | get_tabs()->add("wares", g_gr->images().get(pic_tab_wares), &box, _("Building materials")); |
621 | 61 | 61 | ||
622 | 62 | 62 | ||
623 | === modified file 'src/wui/dismantlesitewindow.cc' | |||
624 | --- src/wui/dismantlesitewindow.cc 2018-07-14 11:22:51 +0000 | |||
625 | +++ src/wui/dismantlesitewindow.cc 2018-09-05 07:39:19 +0000 | |||
626 | @@ -49,7 +49,7 @@ | |||
627 | 49 | // Add the wares queue | 49 | // Add the wares queue |
628 | 50 | for (uint32_t i = 0; i < dismantle_site->get_nrwaresqueues(); ++i) | 50 | for (uint32_t i = 0; i < dismantle_site->get_nrwaresqueues(); ++i) |
629 | 51 | BuildingWindow::create_input_queue_panel( | 51 | BuildingWindow::create_input_queue_panel( |
631 | 52 | &box, *dismantle_site, dismantle_site->get_waresqueue(i), true); | 52 | &box, *dismantle_site, *dismantle_site->get_waresqueue(i), true); |
632 | 53 | 53 | ||
633 | 54 | get_tabs()->add("wares", g_gr->images().get(pic_tab_wares), &box, _("Building materials")); | 54 | get_tabs()->add("wares", g_gr->images().get(pic_tab_wares), &box, _("Building materials")); |
634 | 55 | think(); | 55 | think(); |
635 | 56 | 56 | ||
636 | === modified file 'src/wui/inputqueuedisplay.cc' | |||
637 | --- src/wui/inputqueuedisplay.cc 2018-07-23 01:18:36 +0000 | |||
638 | +++ src/wui/inputqueuedisplay.cc 2018-09-05 07:39:19 +0000 | |||
639 | @@ -38,7 +38,7 @@ | |||
640 | 38 | int32_t const y, | 38 | int32_t const y, |
641 | 39 | InteractiveGameBase& igb, | 39 | InteractiveGameBase& igb, |
642 | 40 | Widelands::Building& building, | 40 | Widelands::Building& building, |
644 | 41 | Widelands::InputQueue* const queue, | 41 | const Widelands::InputQueue& queue, |
645 | 42 | bool show_only) | 42 | bool show_only) |
646 | 43 | : UI::Panel(parent, x, y, 0, 28), | 43 | : UI::Panel(parent, x, y, 0, 28), |
647 | 44 | igb_(igb), | 44 | igb_(igb), |
648 | @@ -47,21 +47,21 @@ | |||
649 | 47 | priority_radiogroup_(nullptr), | 47 | priority_radiogroup_(nullptr), |
650 | 48 | increase_max_fill_(nullptr), | 48 | increase_max_fill_(nullptr), |
651 | 49 | decrease_max_fill_(nullptr), | 49 | decrease_max_fill_(nullptr), |
654 | 50 | index_(queue->get_index()), | 50 | index_(queue.get_index()), |
655 | 51 | type_(queue->get_type()), | 51 | type_(queue.get_type()), |
656 | 52 | max_fill_indicator_(g_gr->images().get(pic_max_fill_indicator)), | 52 | max_fill_indicator_(g_gr->images().get(pic_max_fill_indicator)), |
659 | 53 | cache_size_(queue->get_max_size()), | 53 | cache_size_(queue.get_max_size()), |
660 | 54 | cache_max_fill_(queue->get_max_fill()), | 54 | cache_max_fill_(queue.get_max_fill()), |
661 | 55 | total_height_(0), | 55 | total_height_(0), |
662 | 56 | show_only_(show_only) { | 56 | show_only_(show_only) { |
663 | 57 | if (type_ == Widelands::wwWARE) { | 57 | if (type_ == Widelands::wwWARE) { |
664 | 58 | const Widelands::WareDescr& ware = | 58 | const Widelands::WareDescr& ware = |
666 | 59 | *queue->owner().tribe().get_ware_descr(queue_->get_index()); | 59 | *queue.owner().tribe().get_ware_descr(queue_.get_index()); |
667 | 60 | set_tooltip(ware.descname().c_str()); | 60 | set_tooltip(ware.descname().c_str()); |
668 | 61 | icon_ = ware.icon(); | 61 | icon_ = ware.icon(); |
669 | 62 | } else { | 62 | } else { |
670 | 63 | const Widelands::WorkerDescr& worker = | 63 | const Widelands::WorkerDescr& worker = |
672 | 64 | *queue->owner().tribe().get_worker_descr(queue_->get_index()); | 64 | *queue.owner().tribe().get_worker_descr(queue_.get_index()); |
673 | 65 | set_tooltip(worker.descname().c_str()); | 65 | set_tooltip(worker.descname().c_str()); |
674 | 66 | icon_ = worker.icon(); | 66 | icon_ = worker.icon(); |
675 | 67 | } | 67 | } |
676 | @@ -92,7 +92,7 @@ | |||
677 | 92 | uint32_t pbs = show_only_ ? 0 : PriorityButtonSize; | 92 | uint32_t pbs = show_only_ ? 0 : PriorityButtonSize; |
678 | 93 | uint32_t ctrl_b_size = show_only_ ? 0 : 2 * WARE_MENU_PIC_WIDTH; | 93 | uint32_t ctrl_b_size = show_only_ ? 0 : 2 * WARE_MENU_PIC_WIDTH; |
679 | 94 | 94 | ||
681 | 95 | cache_size_ = queue_->get_max_size(); | 95 | cache_size_ = queue_.get_max_size(); |
682 | 96 | 96 | ||
683 | 97 | update_priority_buttons(); | 97 | update_priority_buttons(); |
684 | 98 | update_max_fill_buttons(); | 98 | update_max_fill_buttons(); |
685 | @@ -109,12 +109,12 @@ | |||
686 | 109 | * Compare the current InputQueue state with the cached state; update if necessary. | 109 | * Compare the current InputQueue state with the cached state; update if necessary. |
687 | 110 | */ | 110 | */ |
688 | 111 | void InputQueueDisplay::think() { | 111 | void InputQueueDisplay::think() { |
690 | 112 | if (static_cast<uint32_t>(queue_->get_max_size()) != cache_size_) | 112 | if (static_cast<uint32_t>(queue_.get_max_size()) != cache_size_) |
691 | 113 | max_size_changed(); | 113 | max_size_changed(); |
692 | 114 | 114 | ||
693 | 115 | // TODO(sirver): It seems cache_max_fill_ is not really useful for anything. | 115 | // TODO(sirver): It seems cache_max_fill_ is not really useful for anything. |
696 | 116 | if (static_cast<uint32_t>(queue_->get_max_fill()) != cache_max_fill_) { | 116 | if (static_cast<uint32_t>(queue_.get_max_fill()) != cache_max_fill_) { |
697 | 117 | cache_max_fill_ = queue_->get_max_fill(); | 117 | cache_max_fill_ = queue_.get_max_fill(); |
698 | 118 | compute_max_fill_buttons_enabled_state(); | 118 | compute_max_fill_buttons_enabled_state(); |
699 | 119 | } | 119 | } |
700 | 120 | } | 120 | } |
701 | @@ -126,11 +126,11 @@ | |||
702 | 126 | if (!cache_size_) | 126 | if (!cache_size_) |
703 | 127 | return; | 127 | return; |
704 | 128 | 128 | ||
706 | 129 | cache_max_fill_ = queue_->get_max_fill(); | 129 | cache_max_fill_ = queue_.get_max_fill(); |
707 | 130 | 130 | ||
709 | 131 | uint32_t nr_inputs_to_draw = std::min(queue_->get_filled(), cache_size_); | 131 | uint32_t nr_inputs_to_draw = std::min(queue_.get_filled(), cache_size_); |
710 | 132 | uint32_t nr_missing_to_draw = | 132 | uint32_t nr_missing_to_draw = |
712 | 133 | std::min(queue_->get_missing(), cache_max_fill_) + cache_size_ - cache_max_fill_; | 133 | std::min(queue_.get_missing(), cache_max_fill_) + cache_size_ - cache_max_fill_; |
713 | 134 | if (nr_inputs_to_draw > cache_max_fill_) { | 134 | if (nr_inputs_to_draw > cache_max_fill_) { |
714 | 135 | nr_missing_to_draw -= nr_inputs_to_draw - cache_max_fill_; | 135 | nr_missing_to_draw -= nr_inputs_to_draw - cache_max_fill_; |
715 | 136 | } | 136 | } |
716 | @@ -160,7 +160,7 @@ | |||
717 | 160 | uint16_t pw = max_fill_indicator_->width(); | 160 | uint16_t pw = max_fill_indicator_->width(); |
718 | 161 | point.y = Border; | 161 | point.y = Border; |
719 | 162 | point.x = Border + CellWidth + CellSpacing + | 162 | point.x = Border + CellWidth + CellSpacing + |
721 | 163 | (queue_->get_max_fill() * (CellWidth + CellSpacing)) - CellSpacing / 2 - pw / 2; | 163 | (queue_.get_max_fill() * (CellWidth + CellSpacing)) - CellSpacing / 2 - pw / 2; |
722 | 164 | dst.blit(point, max_fill_indicator_); | 164 | dst.blit(point, max_fill_indicator_); |
723 | 165 | } | 165 | } |
724 | 166 | } | 166 | } |
725 | @@ -349,7 +349,7 @@ | |||
726 | 349 | } | 349 | } |
727 | 350 | 350 | ||
728 | 351 | void InputQueueDisplay::increase_max_fill_clicked() { | 351 | void InputQueueDisplay::increase_max_fill_clicked() { |
730 | 352 | assert(cache_max_fill_ < queue_->get_max_size()); | 352 | assert(cache_max_fill_ < queue_.get_max_size()); |
731 | 353 | if (!igb_.can_act(building_.owner().player_number())) { | 353 | if (!igb_.can_act(building_.owner().player_number())) { |
732 | 354 | return; | 354 | return; |
733 | 355 | } | 355 | } |
734 | @@ -370,6 +370,6 @@ | |||
735 | 370 | if (decrease_max_fill_) | 370 | if (decrease_max_fill_) |
736 | 371 | decrease_max_fill_->set_enabled(cache_max_fill_ > 0); | 371 | decrease_max_fill_->set_enabled(cache_max_fill_ > 0); |
737 | 372 | if (increase_max_fill_) | 372 | if (increase_max_fill_) |
739 | 373 | increase_max_fill_->set_enabled(cache_max_fill_ < queue_->get_max_size()); | 373 | increase_max_fill_->set_enabled(cache_max_fill_ < queue_.get_max_size()); |
740 | 374 | } | 374 | } |
741 | 375 | } | 375 | } |
742 | 376 | 376 | ||
743 | === modified file 'src/wui/inputqueuedisplay.h' | |||
744 | --- src/wui/inputqueuedisplay.h 2018-04-07 16:59:00 +0000 | |||
745 | +++ src/wui/inputqueuedisplay.h 2018-09-05 07:39:19 +0000 | |||
746 | @@ -56,7 +56,7 @@ | |||
747 | 56 | int32_t y, | 56 | int32_t y, |
748 | 57 | InteractiveGameBase& igb, | 57 | InteractiveGameBase& igb, |
749 | 58 | Widelands::Building& building, | 58 | Widelands::Building& building, |
751 | 59 | Widelands::InputQueue* queue, | 59 | const Widelands::InputQueue& queue, |
752 | 60 | bool = false); | 60 | bool = false); |
753 | 61 | ~InputQueueDisplay() override; | 61 | ~InputQueueDisplay() override; |
754 | 62 | 62 | ||
755 | @@ -66,7 +66,7 @@ | |||
756 | 66 | private: | 66 | private: |
757 | 67 | InteractiveGameBase& igb_; | 67 | InteractiveGameBase& igb_; |
758 | 68 | Widelands::Building& building_; | 68 | Widelands::Building& building_; |
760 | 69 | Widelands::InputQueue* queue_; | 69 | const Widelands::InputQueue& queue_; |
761 | 70 | UI::Radiogroup* priority_radiogroup_; | 70 | UI::Radiogroup* priority_radiogroup_; |
762 | 71 | UI::Button* increase_max_fill_; | 71 | UI::Button* increase_max_fill_; |
763 | 72 | UI::Button* decrease_max_fill_; | 72 | UI::Button* decrease_max_fill_; |
764 | 73 | 73 | ||
765 | === modified file 'src/wui/portdockwaresdisplay.cc' | |||
766 | --- src/wui/portdockwaresdisplay.cc 2018-04-07 16:59:00 +0000 | |||
767 | +++ src/wui/portdockwaresdisplay.cc 2018-09-05 07:39:19 +0000 | |||
768 | @@ -36,24 +36,24 @@ | |||
769 | 36 | * Display wares or workers that are waiting to be shipped from a port. | 36 | * Display wares or workers that are waiting to be shipped from a port. |
770 | 37 | */ | 37 | */ |
771 | 38 | struct PortDockWaresDisplay : AbstractWaresDisplay { | 38 | struct PortDockWaresDisplay : AbstractWaresDisplay { |
773 | 39 | PortDockWaresDisplay(Panel* parent, uint32_t width, PortDock& pd, Widelands::WareWorker type); | 39 | PortDockWaresDisplay(Panel* parent, uint32_t width, const PortDock& pd, Widelands::WareWorker type); |
774 | 40 | 40 | ||
775 | 41 | std::string info_for_ware(Widelands::DescriptionIndex ware) override; | 41 | std::string info_for_ware(Widelands::DescriptionIndex ware) override; |
776 | 42 | 42 | ||
777 | 43 | private: | 43 | private: |
779 | 44 | PortDock& portdock_; | 44 | const PortDock& portdock_; |
780 | 45 | }; | 45 | }; |
781 | 46 | 46 | ||
782 | 47 | PortDockWaresDisplay::PortDockWaresDisplay(Panel* parent, | 47 | PortDockWaresDisplay::PortDockWaresDisplay(Panel* parent, |
783 | 48 | uint32_t width, | 48 | uint32_t width, |
785 | 49 | PortDock& pd, | 49 | const Widelands::PortDock& pd, |
786 | 50 | Widelands::WareWorker type) | 50 | Widelands::WareWorker type) |
787 | 51 | : AbstractWaresDisplay(parent, 0, 0, pd.owner().tribe(), type, false), portdock_(pd) { | 51 | : AbstractWaresDisplay(parent, 0, 0, pd.owner().tribe(), type, false), portdock_(pd) { |
788 | 52 | set_inner_size(width, 0); | 52 | set_inner_size(width, 0); |
789 | 53 | } | 53 | } |
790 | 54 | 54 | ||
791 | 55 | std::string PortDockWaresDisplay::info_for_ware(Widelands::DescriptionIndex ware) { | 55 | std::string PortDockWaresDisplay::info_for_ware(Widelands::DescriptionIndex ware) { |
793 | 56 | uint32_t count = portdock_.count_waiting(get_type(), ware); | 56 | const uint32_t count = portdock_.count_waiting(get_type(), ware); |
794 | 57 | return boost::lexical_cast<std::string>(count); | 57 | return boost::lexical_cast<std::string>(count); |
795 | 58 | } | 58 | } |
796 | 59 | 59 | ||
797 | @@ -64,7 +64,7 @@ | |||
798 | 64 | */ | 64 | */ |
799 | 65 | AbstractWaresDisplay* create_portdock_wares_display(UI::Panel* parent, | 65 | AbstractWaresDisplay* create_portdock_wares_display(UI::Panel* parent, |
800 | 66 | uint32_t width, | 66 | uint32_t width, |
802 | 67 | PortDock& pd, | 67 | const PortDock& pd, |
803 | 68 | Widelands::WareWorker type) { | 68 | Widelands::WareWorker type) { |
804 | 69 | return new PortDockWaresDisplay(parent, width, pd, type); | 69 | return new PortDockWaresDisplay(parent, width, pd, type); |
805 | 70 | } | 70 | } |
806 | @@ -75,8 +75,8 @@ | |||
807 | 75 | UI::Box& box = *new UI::Box(parent, 0, 0, UI::Box::Vertical); | 75 | UI::Box& box = *new UI::Box(parent, 0, 0, UI::Box::Vertical); |
808 | 76 | 76 | ||
809 | 77 | // Add the input queues. | 77 | // Add the input queues. |
812 | 78 | for (InputQueue* wq : wh.get_portdock()->expedition_bootstrap()->queues()) { | 78 | for (const InputQueue* wq : wh.get_portdock()->expedition_bootstrap()->queues()) { |
813 | 79 | box.add(new InputQueueDisplay(&box, 0, 0, igb, wh, wq, true)); | 79 | box.add(new InputQueueDisplay(&box, 0, 0, igb, wh, *wq, true)); |
814 | 80 | } | 80 | } |
815 | 81 | 81 | ||
816 | 82 | return &box; | 82 | return &box; |
817 | 83 | 83 | ||
818 | === modified file 'src/wui/portdockwaresdisplay.h' | |||
819 | --- src/wui/portdockwaresdisplay.h 2018-04-07 16:59:00 +0000 | |||
820 | +++ src/wui/portdockwaresdisplay.h 2018-09-05 07:39:19 +0000 | |||
821 | @@ -30,7 +30,7 @@ | |||
822 | 30 | 30 | ||
823 | 31 | AbstractWaresDisplay* create_portdock_wares_display(UI::Panel* parent, | 31 | AbstractWaresDisplay* create_portdock_wares_display(UI::Panel* parent, |
824 | 32 | uint32_t width, | 32 | uint32_t width, |
826 | 33 | Widelands::PortDock& pd, | 33 | const Widelands::PortDock& pd, |
827 | 34 | Widelands::WareWorker type); | 34 | Widelands::WareWorker type); |
828 | 35 | 35 | ||
829 | 36 | UI::Box* create_portdock_expedition_display(UI::Panel* parent, | 36 | UI::Box* create_portdock_expedition_display(UI::Panel* parent, |
830 | 37 | 37 | ||
831 | === modified file 'src/wui/productionsitewindow.cc' | |||
832 | --- src/wui/productionsitewindow.cc 2018-08-14 13:40:46 +0000 | |||
833 | +++ src/wui/productionsitewindow.cc 2018-09-05 07:39:19 +0000 | |||
834 | @@ -82,7 +82,7 @@ | |||
835 | 82 | 82 | ||
836 | 83 | for (uint32_t i = 0; i < inputqueues.size(); ++i) { | 83 | for (uint32_t i = 0; i < inputqueues.size(); ++i) { |
837 | 84 | prod_box->add( | 84 | prod_box->add( |
839 | 85 | new InputQueueDisplay(prod_box, 0, 0, *igbase(), *production_site, inputqueues[i])); | 85 | new InputQueueDisplay(prod_box, 0, 0, *igbase(), *production_site, *inputqueues[i])); |
840 | 86 | } | 86 | } |
841 | 87 | 87 | ||
842 | 88 | get_tabs()->add("wares", g_gr->images().get(pic_tab_wares), prod_box, _("Wares")); | 88 | get_tabs()->add("wares", g_gr->images().get(pic_tab_wares), prod_box, _("Wares")); |
843 | 89 | 89 | ||
844 | === modified file 'src/wui/warehousewindow.cc' | |||
845 | --- src/wui/warehousewindow.cc 2018-08-14 13:40:46 +0000 | |||
846 | +++ src/wui/warehousewindow.cc 2018-09-05 07:39:19 +0000 | |||
847 | @@ -193,7 +193,7 @@ | |||
848 | 193 | new WarehouseWaresPanel(get_tabs(), Width, *igbase(), *warehouse, Widelands::wwWORKER), | 193 | new WarehouseWaresPanel(get_tabs(), Width, *igbase(), *warehouse, Widelands::wwWORKER), |
849 | 194 | _("Workers")); | 194 | _("Workers")); |
850 | 195 | 195 | ||
852 | 196 | if (Widelands::PortDock* pd = warehouse->get_portdock()) { | 196 | if (const Widelands::PortDock* pd = warehouse->get_portdock()) { |
853 | 197 | get_tabs()->add("dock_wares", g_gr->images().get(pic_tab_dock_wares), | 197 | get_tabs()->add("dock_wares", g_gr->images().get(pic_tab_dock_wares), |
854 | 198 | create_portdock_wares_display(get_tabs(), Width, *pd, Widelands::wwWARE), | 198 | create_portdock_wares_display(get_tabs(), Width, *pd, Widelands::wwWARE), |
855 | 199 | _("Wares waiting to be shipped")); | 199 | _("Wares waiting to be shipped")); |
Continuous integration builds have changed state:
Travis build 3899. State: passed. Details: https:/ /travis- ci.org/ widelands/ widelands/ builds/ 424681733. /ci.appveyor. com/project/ widelands- dev/widelands/ build/_ widelands_ dev_widelands_ const_portdock_ fleet_and_ ship_functions- 3697.
Appveyor build 3697. State: failed. Details: https:/