Merge lp:~widelands-dev/widelands/const_portdock_fleet_and_ship_functions into lp:widelands

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
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 :

Continuous integration builds have changed state:

Travis build 3899. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/424681733.
Appveyor build 3697. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_const_portdock_fleet_and_ship_functions-3697.

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
=== modified file 'src/ai/defaultai_seafaring.cc'
--- src/ai/defaultai_seafaring.cc 2018-08-16 16:10:43 +0000
+++ src/ai/defaultai_seafaring.cc 2018-09-05 07:39:19 +0000
@@ -126,7 +126,7 @@
126 for (const WarehouseSiteObserver& wh_obs : warehousesites) {126 for (const WarehouseSiteObserver& wh_obs : warehousesites) {
127 if (wh_obs.bo->is(BuildingAttribute::kPort)) {127 if (wh_obs.bo->is(BuildingAttribute::kPort)) {
128 ports_count += 1;128 ports_count += 1;
129 if (Widelands::PortDock* pd = wh_obs.site->get_portdock()) {129 if (const Widelands::PortDock* pd = wh_obs.site->get_portdock()) {
130 if (pd->expedition_started()) {130 if (pd->expedition_started()) {
131 expeditions_in_prep += 1;131 expeditions_in_prep += 1;
132 }132 }
133133
=== modified file 'src/economy/flag.cc'
--- src/economy/flag.cc 2018-08-09 11:11:15 +0000
+++ src/economy/flag.cc 2018-09-05 07:39:19 +0000
@@ -967,7 +967,7 @@
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");
968}968}
969969
970void Flag::log_general_info(const Widelands::EditorGameBase& egbase) {970void Flag::log_general_info(const Widelands::EditorGameBase& egbase) const {
971 molog("Flag at %i,%i\n", position_.x, position_.y);971 molog("Flag at %i,%i\n", position_.x, position_.y);
972972
973 Widelands::PlayerImmovable::log_general_info(egbase);973 Widelands::PlayerImmovable::log_general_info(egbase);
974974
=== modified file 'src/economy/flag.h'
--- src/economy/flag.h 2018-08-09 11:11:15 +0000
+++ src/economy/flag.h 2018-09-05 07:39:19 +0000
@@ -163,7 +163,7 @@
163163
164 void add_flag_job(Game&, DescriptionIndex workerware, const std::string& programname);164 void add_flag_job(Game&, DescriptionIndex workerware, const std::string& programname);
165165
166 void log_general_info(const EditorGameBase&) override;166 void log_general_info(const EditorGameBase&) const override;
167167
168protected:168protected:
169 bool init(EditorGameBase&) override;169 bool init(EditorGameBase&) override;
170170
=== modified file 'src/economy/fleet.cc'
--- src/economy/fleet.cc 2018-04-07 16:59:00 +0000
+++ src/economy/fleet.cc 2018-09-05 07:39:19 +0000
@@ -324,11 +324,11 @@
324 return true;324 return true;
325}325}
326326
327uint32_t Fleet::count_ships() {327uint32_t Fleet::count_ships() const {
328 return ships_.size();328 return ships_.size();
329}329}
330330
331uint32_t Fleet::count_ships_heading_here(EditorGameBase& egbase, PortDock* port) {331uint32_t Fleet::count_ships_heading_here(EditorGameBase& egbase, PortDock* port) const {
332 uint32_t ships_on_way = 0;332 uint32_t ships_on_way = 0;
333 for (uint16_t s = 0; s < ships_.size(); s += 1) {333 for (uint16_t s = 0; s < ships_.size(); s += 1) {
334 if (ships_[s]->get_destination(egbase) == port) {334 if (ships_[s]->get_destination(egbase) == port) {
@@ -339,10 +339,10 @@
339 return ships_on_way;339 return ships_on_way;
340}340}
341341
342uint32_t Fleet::count_ports() {342uint32_t Fleet::count_ports() const {
343 return ports_.size();343 return ports_.size();
344}344}
345bool Fleet::get_act_pending() {345bool Fleet::get_act_pending() const {
346 return act_pending_;346 return act_pending_;
347}347}
348348
@@ -568,7 +568,7 @@
568 }568 }
569}569}
570570
571bool Fleet::has_ports() {571bool Fleet::has_ports() const {
572 return !ports_.empty();572 return !ports_.empty();
573}573}
574574
@@ -863,7 +863,7 @@
863 }863 }
864}864}
865865
866void Fleet::log_general_info(const EditorGameBase& egbase) {866void Fleet::log_general_info(const EditorGameBase& egbase) const {
867 MapObject::log_general_info(egbase);867 MapObject::log_general_info(egbase);
868868
869 molog("%" PRIuS " ships and %" PRIuS " ports\n", ships_.size(), ports_.size());869 molog("%" PRIuS " ships and %" PRIuS " ports\n", ships_.size(), ports_.size());
870870
=== modified file 'src/economy/fleet.h'
--- src/economy/fleet.h 2018-04-16 07:03:12 +0000
+++ src/economy/fleet.h 2018-09-05 07:39:19 +0000
@@ -92,17 +92,17 @@
92 void remove_ship(EditorGameBase& egbase, Ship* ship);92 void remove_ship(EditorGameBase& egbase, Ship* ship);
93 void add_port(EditorGameBase& egbase, PortDock* port);93 void add_port(EditorGameBase& egbase, PortDock* port);
94 void remove_port(EditorGameBase& egbase, PortDock* port);94 void remove_port(EditorGameBase& egbase, PortDock* port);
95 bool has_ports();95 bool has_ports() const;
9696
97 void log_general_info(const EditorGameBase&) override;97 void log_general_info(const EditorGameBase&) const override;
9898
99 bool get_path(PortDock& start, PortDock& end, Path& path);99 bool get_path(PortDock& start, PortDock& end, Path& path);
100 void add_neighbours(PortDock& pd, std::vector<RoutingNodeNeighbour>& neighbours);100 void add_neighbours(PortDock& pd, std::vector<RoutingNodeNeighbour>& neighbours);
101101
102 uint32_t count_ships();102 uint32_t count_ships() const;
103 uint32_t count_ships_heading_here(EditorGameBase& egbase, PortDock* port);103 uint32_t count_ships_heading_here(EditorGameBase& egbase, PortDock* port) const;
104 uint32_t count_ports();104 uint32_t count_ports() const;
105 bool get_act_pending();105 bool get_act_pending() const;
106106
107protected:107protected:
108 void act(Game&, uint32_t data) override;108 void act(Game&, uint32_t data) override;
109109
=== modified file 'src/economy/portdock.cc'
--- src/economy/portdock.cc 2018-04-16 07:03:12 +0000
+++ src/economy/portdock.cc 2018-09-05 07:39:19 +0000
@@ -384,10 +384,10 @@
384/**384/**
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.
386 */386 */
387uint32_t PortDock::count_waiting(WareWorker waretype, DescriptionIndex wareindex) {387uint32_t PortDock::count_waiting(WareWorker waretype, DescriptionIndex wareindex) const {
388 uint32_t count = 0;388 uint32_t count = 0;
389389
390 for (ShippingItem& shipping_item : waiting_) {390 for (const ShippingItem& shipping_item : waiting_) {
391 WareInstance* ware;391 WareInstance* ware;
392 Worker* worker;392 Worker* worker;
393 shipping_item.get(owner().egbase(), &ware, &worker);393 shipping_item.get(owner().egbase(), &ware, &worker);
@@ -407,12 +407,12 @@
407/**407/**
408 * Return the number of wares or workers waiting at the dock.408 * Return the number of wares or workers waiting at the dock.
409 */409 */
410uint32_t PortDock::count_waiting() {410uint32_t PortDock::count_waiting() const {
411 return waiting_.size();411 return waiting_.size();
412}412}
413413
414/// \returns whether an expedition was started or is even ready414/// \returns whether an expedition was started or is even ready
415bool PortDock::expedition_started() {415bool PortDock::expedition_started() const {
416 return (expedition_bootstrap_ != nullptr) || expedition_ready_;416 return (expedition_bootstrap_ != nullptr) || expedition_ready_;
417}417}
418418
@@ -423,7 +423,7 @@
423 expedition_bootstrap_->start();423 expedition_bootstrap_->start();
424}424}
425425
426ExpeditionBootstrap* PortDock::expedition_bootstrap() {426ExpeditionBootstrap* PortDock::expedition_bootstrap() const {
427 return expedition_bootstrap_.get();427 return expedition_bootstrap_.get();
428}428}
429429
@@ -440,7 +440,7 @@
440 expedition_bootstrap_.reset(nullptr);440 expedition_bootstrap_.reset(nullptr);
441}441}
442442
443void PortDock::log_general_info(const EditorGameBase& egbase) {443void PortDock::log_general_info(const EditorGameBase& egbase) const {
444 PlayerImmovable::log_general_info(egbase);444 PlayerImmovable::log_general_info(egbase);
445445
446 if (warehouse_) {446 if (warehouse_) {
@@ -454,7 +454,7 @@
454 fleet_ ? fleet_->serial() : 0, need_ship_ ? "true" : "false", waiting_.size());454 fleet_ ? fleet_->serial() : 0, need_ship_ ? "true" : "false", waiting_.size());
455 }455 }
456456
457 for (ShippingItem& shipping_item : waiting_) {457 for (const ShippingItem& shipping_item : waiting_) {
458 molog(" IT %u, destination %u\n", shipping_item.object_.serial(),458 molog(" IT %u, destination %u\n", shipping_item.object_.serial(),
459 shipping_item.destination_dock_.serial());459 shipping_item.destination_dock_.serial());
460 }460 }
461461
=== modified file 'src/economy/portdock.h'
--- src/economy/portdock.h 2018-04-07 16:59:00 +0000
+++ src/economy/portdock.h 2018-09-05 07:39:19 +0000
@@ -115,13 +115,13 @@
115115
116 void ship_arrived(Game&, Ship&);116 void ship_arrived(Game&, Ship&);
117117
118 void log_general_info(const EditorGameBase&) override;118 void log_general_info(const EditorGameBase&) const override;
119119
120 uint32_t count_waiting(WareWorker waretype, DescriptionIndex wareindex);120 uint32_t count_waiting(WareWorker waretype, DescriptionIndex wareindex) const;
121 uint32_t count_waiting();121 uint32_t count_waiting() const;
122122
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.
124 bool expedition_started();124 bool expedition_started() const;
125125
126 // Called when the button in the warehouse window is pressed.126 // Called when the button in the warehouse window is pressed.
127 void start_expedition();127 void start_expedition();
@@ -129,7 +129,7 @@
129129
130 // May return nullptr when there is no expedition ongoing or if the130 // May return nullptr when there is no expedition ongoing or if the
131 // expedition ship is already underway.131 // expedition ship is already underway.
132 ExpeditionBootstrap* expedition_bootstrap();132 ExpeditionBootstrap* expedition_bootstrap() const;
133133
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.
135 void expedition_bootstrap_complete(Game& game);135 void expedition_bootstrap_complete(Game& game);
136136
=== modified file 'src/economy/road.cc'
--- src/economy/road.cc 2018-07-12 06:02:15 +0000
+++ src/economy/road.cc 2018-09-05 07:39:19 +0000
@@ -632,7 +632,7 @@
632 // Don't bother with checks here, since the next ware will cause them anyway632 // Don't bother with checks here, since the next ware will cause them anyway
633}633}
634634
635void Road::log_general_info(const EditorGameBase& egbase) {635void Road::log_general_info(const EditorGameBase& egbase) const {
636 PlayerImmovable::log_general_info(egbase);636 PlayerImmovable::log_general_info(egbase);
637 molog("wallet: %i\n", wallet_);637 molog("wallet: %i\n", wallet_);
638}638}
639639
=== modified file 'src/economy/road.h'
--- src/economy/road.h 2018-07-12 06:02:15 +0000
+++ src/economy/road.h 2018-09-05 07:39:19 +0000
@@ -124,7 +124,7 @@
124 void remove_worker(Worker&) override;124 void remove_worker(Worker&) override;
125 void assign_carrier(Carrier&, uint8_t);125 void assign_carrier(Carrier&, uint8_t);
126126
127 void log_general_info(const EditorGameBase&) override;127 void log_general_info(const EditorGameBase&) const override;
128128
129protected:129protected:
130 bool init(EditorGameBase&) override;130 bool init(EditorGameBase&) override;
131131
=== modified file 'src/economy/ware_instance.cc'
--- src/economy/ware_instance.cc 2018-04-07 16:59:00 +0000
+++ src/economy/ware_instance.cc 2018-09-05 07:39:19 +0000
@@ -502,7 +502,7 @@
502 return transfer_ ? dynamic_cast<PlayerImmovable*>(transfer_nextstep_.get(game)) : nullptr;502 return transfer_ ? dynamic_cast<PlayerImmovable*>(transfer_nextstep_.get(game)) : nullptr;
503}503}
504504
505void WareInstance::log_general_info(const EditorGameBase& egbase) {505void WareInstance::log_general_info(const EditorGameBase& egbase) const {
506 MapObject::log_general_info(egbase);506 MapObject::log_general_info(egbase);
507507
508 molog("Ware: %s\n", descr().name().c_str());508 molog("Ware: %s\n", descr().name().c_str());
509509
=== modified file 'src/economy/ware_instance.h'
--- src/economy/ware_instance.h 2018-04-07 16:59:00 +0000
+++ src/economy/ware_instance.h 2018-09-05 07:39:19 +0000
@@ -93,7 +93,7 @@
93 return transfer_;93 return transfer_;
94 }94 }
9595
96 void log_general_info(const EditorGameBase& egbase) override;96 void log_general_info(const EditorGameBase& egbase) const override;
9797
98private:98private:
99 ObjectPointer location_;99 ObjectPointer location_;
100100
=== modified file 'src/logic/map_objects/bob.cc'
--- src/logic/map_objects/bob.cc 2018-04-27 06:11:05 +0000
+++ src/logic/map_objects/bob.cc 2018-09-05 07:39:19 +0000
@@ -902,7 +902,7 @@
902}902}
903903
904/// Give debug information.904/// Give debug information.
905void Bob::log_general_info(const EditorGameBase& egbase) {905void Bob::log_general_info(const EditorGameBase& egbase) const {
906 FORMAT_WARNINGS_OFF;906 FORMAT_WARNINGS_OFF;
907 molog("Owner: %p\n", owner_);907 molog("Owner: %p\n", owner_);
908 FORMAT_WARNINGS_ON;908 FORMAT_WARNINGS_ON;
909909
=== modified file 'src/logic/map_objects/bob.h'
--- src/logic/map_objects/bob.h 2018-04-07 16:59:00 +0000
+++ src/logic/map_objects/bob.h 2018-09-05 07:39:19 +0000
@@ -270,7 +270,7 @@
270 RenderTarget* dst) const;270 RenderTarget* dst) const;
271271
272 // For debug272 // For debug
273 void log_general_info(const EditorGameBase&) override;273 void log_general_info(const EditorGameBase&) const override;
274274
275 // default tasks275 // default tasks
276 void reset_tasks(Game&);276 void reset_tasks(Game&);
277277
=== modified file 'src/logic/map_objects/immovable.cc'
--- src/logic/map_objects/immovable.cc 2018-07-13 07:46:36 +0000
+++ src/logic/map_objects/immovable.cc 2018-09-05 07:39:19 +0000
@@ -1332,7 +1332,7 @@
1332/**1332/**
1333 * Dump general information1333 * Dump general information
1334 */1334 */
1335void PlayerImmovable::log_general_info(const EditorGameBase& egbase) {1335void PlayerImmovable::log_general_info(const EditorGameBase& egbase) const {
1336 BaseImmovable::log_general_info(egbase);1336 BaseImmovable::log_general_info(egbase);
13371337
1338 FORMAT_WARNINGS_OFF;1338 FORMAT_WARNINGS_OFF;
13391339
=== modified file 'src/logic/map_objects/immovable.h'
--- src/logic/map_objects/immovable.h 2018-07-08 16:10:50 +0000
+++ src/logic/map_objects/immovable.h 2018-09-05 07:39:19 +0000
@@ -357,7 +357,7 @@
357 return workers_;357 return workers_;
358 }358 }
359359
360 void log_general_info(const EditorGameBase&) override;360 void log_general_info(const EditorGameBase&) const override;
361361
362 /**362 /**
363 * These functions are called when a ware or worker arrives at363 * These functions are called when a ware or worker arrives at
364364
=== modified file 'src/logic/map_objects/map_object.cc'
--- src/logic/map_objects/map_object.cc 2018-07-23 09:04:47 +0000
+++ src/logic/map_objects/map_object.cc 2018-09-05 07:39:19 +0000
@@ -543,7 +543,7 @@
543 logsink_ = sink;543 logsink_ = sink;
544}544}
545545
546void MapObject::log_general_info(const EditorGameBase&) {546void MapObject::log_general_info(const EditorGameBase&) const {
547}547}
548548
549/**549/**
550550
=== modified file 'src/logic/map_objects/map_object.h'
--- src/logic/map_objects/map_object.h 2018-05-12 04:18:21 +0000
+++ src/logic/map_objects/map_object.h 2018-09-05 07:39:19 +0000
@@ -302,7 +302,7 @@
302 void set_logsink(LogSink*);302 void set_logsink(LogSink*);
303303
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.
305 virtual void log_general_info(const EditorGameBase&);305 virtual void log_general_info(const EditorGameBase&) const;
306306
307 Player* get_owner() const {307 Player* get_owner() const {
308 return owner_;308 return owner_;
309309
=== modified file 'src/logic/map_objects/tribes/building.cc'
--- src/logic/map_objects/tribes/building.cc 2018-04-27 06:11:05 +0000
+++ src/logic/map_objects/tribes/building.cc 2018-09-05 07:39:19 +0000
@@ -669,7 +669,7 @@
669 }669 }
670}670}
671671
672void Building::log_general_info(const EditorGameBase& egbase) {672void Building::log_general_info(const EditorGameBase& egbase) const {
673 PlayerImmovable::log_general_info(egbase);673 PlayerImmovable::log_general_info(egbase);
674674
675 molog("position: (%i, %i)\n", position_.x, position_.y);675 molog("position: (%i, %i)\n", position_.x, position_.y);
676676
=== modified file 'src/logic/map_objects/tribes/building.h'
--- src/logic/map_objects/tribes/building.h 2018-05-24 10:19:21 +0000
+++ src/logic/map_objects/tribes/building.h 2018-09-05 07:39:19 +0000
@@ -282,7 +282,7 @@
282 return old_buildings_;282 return old_buildings_;
283 }283 }
284284
285 void log_general_info(const EditorGameBase&) override;285 void log_general_info(const EditorGameBase&) const override;
286286
287 // Use on training sites only.287 // Use on training sites only.
288 virtual void change_train_priority(uint32_t, int32_t) {288 virtual void change_train_priority(uint32_t, int32_t) {
289289
=== modified file 'src/logic/map_objects/tribes/carrier.cc'
--- src/logic/map_objects/tribes/carrier.cc 2018-08-13 05:50:58 +0000
+++ src/logic/map_objects/tribes/carrier.cc 2018-09-05 07:39:19 +0000
@@ -406,7 +406,7 @@
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()));
407}407}
408408
409void Carrier::log_general_info(const Widelands::EditorGameBase& egbase) {409void Carrier::log_general_info(const Widelands::EditorGameBase& egbase) const {
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);
411411
412 Worker::log_general_info(egbase);412 Worker::log_general_info(egbase);
413413
=== modified file 'src/logic/map_objects/tribes/carrier.h'
--- src/logic/map_objects/tribes/carrier.h 2018-08-09 11:11:15 +0000
+++ src/logic/map_objects/tribes/carrier.h 2018-09-05 07:39:19 +0000
@@ -62,7 +62,7 @@
62 void start_task_transport(Game&, int32_t fromflag);62 void start_task_transport(Game&, int32_t fromflag);
63 bool start_task_walktoflag(Game&, int32_t flag, bool offset = false);63 bool start_task_walktoflag(Game&, int32_t flag, bool offset = false);
6464
65 void log_general_info(const EditorGameBase&) override;65 void log_general_info(const EditorGameBase&) const override;
6666
67 static Task const taskRoad;67 static Task const taskRoad;
6868
6969
=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
--- src/logic/map_objects/tribes/productionsite.cc 2018-06-19 08:52:49 +0000
+++ src/logic/map_objects/tribes/productionsite.cc 2018-09-05 07:39:19 +0000
@@ -739,7 +739,7 @@
739 return true;739 return true;
740}740}
741741
742void ProductionSite::log_general_info(const EditorGameBase& egbase) {742void ProductionSite::log_general_info(const EditorGameBase& egbase) const {
743 Building::log_general_info(egbase);743 Building::log_general_info(egbase);
744744
745 molog("is_stopped: %u\n", is_stopped_);745 molog("is_stopped: %u\n", is_stopped_);
746746
=== modified file 'src/logic/map_objects/tribes/productionsite.h'
--- src/logic/map_objects/tribes/productionsite.h 2018-07-08 16:10:50 +0000
+++ src/logic/map_objects/tribes/productionsite.h 2018-09-05 07:39:19 +0000
@@ -165,7 +165,7 @@
165 explicit ProductionSite(const ProductionSiteDescr& descr);165 explicit ProductionSite(const ProductionSiteDescr& descr);
166 ~ProductionSite() override;166 ~ProductionSite() override;
167167
168 void log_general_info(const EditorGameBase&) override;168 void log_general_info(const EditorGameBase&) const override;
169169
170 bool is_stopped() const {170 bool is_stopped() const {
171 return is_stopped_;171 return is_stopped_;
172172
=== modified file 'src/logic/map_objects/tribes/ship.cc'
--- src/logic/map_objects/tribes/ship.cc 2018-07-08 15:16:16 +0000
+++ src/logic/map_objects/tribes/ship.cc 2018-09-05 07:39:19 +0000
@@ -1027,7 +1027,7 @@
1027 scale, dst);1027 scale, dst);
1028}1028}
10291029
1030void Ship::log_general_info(const EditorGameBase& egbase) {1030void Ship::log_general_info(const EditorGameBase& egbase) const {
1031 Bob::log_general_info(egbase);1031 Bob::log_general_info(egbase);
10321032
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",
10341034
=== modified file 'src/logic/map_objects/tribes/ship.h'
--- src/logic/map_objects/tribes/ship.h 2018-07-12 05:44:15 +0000
+++ src/logic/map_objects/tribes/ship.h 2018-09-05 07:39:19 +0000
@@ -117,7 +117,7 @@
117117
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;
119119
120 void log_general_info(const EditorGameBase&) override;120 void log_general_info(const EditorGameBase&) const override;
121121
122 uint32_t get_nritems() const {122 uint32_t get_nritems() const {
123 return items_.size();123 return items_.size();
@@ -196,7 +196,7 @@
196 }196 }
197197
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)
199 bool is_exploring_island() {199 bool is_exploring_island() const {
200 return expedition_->island_exploration;200 return expedition_->island_exploration;
201 }201 }
202202
203203
=== modified file 'src/logic/map_objects/tribes/soldier.cc'
--- src/logic/map_objects/tribes/soldier.cc 2018-07-13 10:35:16 +0000
+++ src/logic/map_objects/tribes/soldier.cc 2018-09-05 07:39:19 +0000
@@ -1546,7 +1546,7 @@
1546 }1546 }
1547}1547}
15481548
1549void Soldier::log_general_info(const EditorGameBase& egbase) {1549void Soldier::log_general_info(const EditorGameBase& egbase) const {
1550 Worker::log_general_info(egbase);1550 Worker::log_general_info(egbase);
1551 molog("[Soldier]\n");1551 molog("[Soldier]\n");
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_);
15531553
=== modified file 'src/logic/map_objects/tribes/soldier.h'
--- src/logic/map_objects/tribes/soldier.h 2018-04-07 16:59:00 +0000
+++ src/logic/map_objects/tribes/soldier.h 2018-09-05 07:39:19 +0000
@@ -258,7 +258,7 @@
258 void heal(uint32_t);258 void heal(uint32_t);
259 void damage(uint32_t); /// Damage quantity of health points259 void damage(uint32_t); /// Damage quantity of health points
260260
261 void log_general_info(const EditorGameBase&) override;261 void log_general_info(const EditorGameBase&) const override;
262262
263 bool is_on_battlefield();263 bool is_on_battlefield();
264 bool is_attacking_player(Game&, Player&);264 bool is_attacking_player(Game&, Player&);
265265
=== modified file 'src/logic/map_objects/tribes/warehouse.cc'
--- src/logic/map_objects/tribes/warehouse.cc 2018-04-07 16:59:00 +0000
+++ src/logic/map_objects/tribes/warehouse.cc 2018-09-05 07:39:19 +0000
@@ -1337,17 +1337,16 @@
1337 return portdock_->expedition_bootstrap()->inputqueue(index, type);1337 return portdock_->expedition_bootstrap()->inputqueue(index, type);
1338}1338}
13391339
1340void Warehouse::log_general_info(const EditorGameBase& egbase) {1340void Warehouse::log_general_info(const EditorGameBase& egbase) const {
1341 Building::log_general_info(egbase);1341 Building::log_general_info(egbase);
13421342
1343 if (descr().get_isport()) {1343 if (descr().get_isport()) {
1344 PortDock* pd_tmp = portdock_;1344 if (portdock_) {
1345 if (pd_tmp) {1345 molog("Port dock: %u\n", portdock_->serial());
1346 molog("Port dock: %u\n", pd_tmp->serial());1346 molog("port needs ship: %s\n", (portdock_->get_need_ship()) ? "true" : "false");
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());
1348 molog("wares and workers waiting: %u\n", pd_tmp->count_waiting());1348 molog("exped. in progr.: %s\n", (portdock_->expedition_started()) ? "true" : "false");
1349 molog("exped. in progr.: %s\n", (pd_tmp->expedition_started()) ? "true" : "false");1349 Fleet* fleet = portdock_->get_fleet();
1350 Fleet* fleet = pd_tmp->get_fleet();
1351 if (fleet) {1350 if (fleet) {
1352 molog("* fleet: %u\n", fleet->serial());1351 molog("* fleet: %u\n", fleet->serial());
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());
13541353
=== modified file 'src/logic/map_objects/tribes/warehouse.h'
--- src/logic/map_objects/tribes/warehouse.h 2018-04-07 16:59:00 +0000
+++ src/logic/map_objects/tribes/warehouse.h 2018-09-05 07:39:19 +0000
@@ -214,7 +214,7 @@
214 // Will throw an exception otherwise.214 // Will throw an exception otherwise.
215 InputQueue& inputqueue(DescriptionIndex, WareWorker) override;215 InputQueue& inputqueue(DescriptionIndex, WareWorker) override;
216216
217 void log_general_info(const EditorGameBase&) override;217 void log_general_info(const EditorGameBase&) const override;
218218
219private:219private:
220 class SoldierControl : public Widelands::SoldierControl {220 class SoldierControl : public Widelands::SoldierControl {
221221
=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc 2018-08-09 11:11:15 +0000
+++ src/logic/map_objects/tribes/worker.cc 2018-09-05 07:39:19 +0000
@@ -1051,7 +1051,7 @@
1051}1051}
10521052
1053/// Log basic information.1053/// Log basic information.
1054void Worker::log_general_info(const EditorGameBase& egbase) {1054void Worker::log_general_info(const EditorGameBase& egbase) const {
1055 Bob::log_general_info(egbase);1055 Bob::log_general_info(egbase);
10561056
1057 if (upcast(PlayerImmovable, loc, location_.get(egbase))) {1057 if (upcast(PlayerImmovable, loc, location_.get(egbase))) {
10581058
=== modified file 'src/logic/map_objects/tribes/worker.h'
--- src/logic/map_objects/tribes/worker.h 2018-07-26 11:28:05 +0000
+++ src/logic/map_objects/tribes/worker.h 2018-09-05 07:39:19 +0000
@@ -138,7 +138,7 @@
138 }138 }
139139
140 // debug140 // debug
141 void log_general_info(const EditorGameBase&) override;141 void log_general_info(const EditorGameBase&) const override;
142142
143 // worker-specific tasks143 // worker-specific tasks
144 void start_task_transfer(Game&, Transfer*);144 void start_task_transfer(Game&, Transfer*);
145145
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2018-07-11 08:32:54 +0000
+++ src/scripting/lua_map.cc 2018-09-05 07:39:19 +0000
@@ -4569,7 +4569,7 @@
4569 EditorGameBase& egbase = get_egbase(L);4569 EditorGameBase& egbase = get_egbase(L);
45704570
4571 if (is_a(Game, &egbase)) {4571 if (is_a(Game, &egbase)) {
4572 PortDock* pd = get(L, egbase)->get_portdock();4572 const PortDock* pd = get(L, egbase)->get_portdock();
4573 if (pd) {4573 if (pd) {
4574 if (pd->expedition_started()) {4574 if (pd->expedition_started()) {
4575 return 1;4575 return 1;
@@ -4932,7 +4932,7 @@
4932 }4932 }
49334933
4934 if (upcast(Game, game, &egbase)) {4934 if (upcast(Game, game, &egbase)) {
4935 PortDock* pd = wh->get_portdock();4935 const PortDock* pd = wh->get_portdock();
4936 if (!pd) {4936 if (!pd) {
4937 return 0;4937 return 0;
4938 }4938 }
@@ -4963,7 +4963,7 @@
4963 }4963 }
49644964
4965 if (upcast(Game, game, &egbase)) {4965 if (upcast(Game, game, &egbase)) {
4966 PortDock* pd = wh->get_portdock();4966 const PortDock* pd = wh->get_portdock();
4967 if (!pd) {4967 if (!pd) {
4968 return 0;4968 return 0;
4969 }4969 }
49704970
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc 2018-09-01 08:36:08 +0000
+++ src/wui/buildingwindow.cc 2018-09-05 07:39:19 +0000
@@ -204,7 +204,7 @@
204 if (can_act) {204 if (can_act) {
205 // Check if this is a port building and if yes show expedition button205 // Check if this is a port building and if yes show expedition button
206 if (upcast(Widelands::Warehouse const, warehouse, building)) {206 if (upcast(Widelands::Warehouse const, warehouse, building)) {
207 if (Widelands::PortDock* pd = warehouse->get_portdock()) {207 if (const Widelands::PortDock* pd = warehouse->get_portdock()) {
208 expeditionbtn_ = new UI::Button(208 expeditionbtn_ = new UI::Button(
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,
210 g_gr->images().get("images/wui/buildings/start_expedition.png"));210 g_gr->images().get("images/wui/buildings/start_expedition.png"));
@@ -537,7 +537,7 @@
537537
538void BuildingWindow::create_input_queue_panel(UI::Box* const box,538void BuildingWindow::create_input_queue_panel(UI::Box* const box,
539 Widelands::Building& b,539 Widelands::Building& b,
540 Widelands::InputQueue* const iq,540 const Widelands::InputQueue& iq,
541 bool show_only) {541 bool show_only) {
542 // The *max* width should be larger than the default width542 // The *max* width should be larger than the default width
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));
544544
=== modified file 'src/wui/buildingwindow.h'
--- src/wui/buildingwindow.h 2018-08-10 07:42:57 +0000
+++ src/wui/buildingwindow.h 2018-09-05 07:39:19 +0000
@@ -89,7 +89,7 @@
89 void clicked_goto();89 void clicked_goto();
9090
91 void91 void
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);
9393
94 bool is_dying_;94 bool is_dying_;
9595
9696
=== modified file 'src/wui/constructionsitewindow.cc'
--- src/wui/constructionsitewindow.cc 2018-08-14 13:40:46 +0000
+++ src/wui/constructionsitewindow.cc 2018-09-05 07:39:19 +0000
@@ -55,7 +55,7 @@
55 // Add the wares queue55 // Add the wares queue
56 for (uint32_t i = 0; i < construction_site->get_nrwaresqueues(); ++i)56 for (uint32_t i = 0; i < construction_site->get_nrwaresqueues(); ++i)
57 box.add(new InputQueueDisplay(57 box.add(new InputQueueDisplay(
58 &box, 0, 0, *igbase(), *construction_site, construction_site->get_waresqueue(i)));58 &box, 0, 0, *igbase(), *construction_site, *construction_site->get_waresqueue(i)));
5959
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"));
6161
6262
=== modified file 'src/wui/dismantlesitewindow.cc'
--- src/wui/dismantlesitewindow.cc 2018-07-14 11:22:51 +0000
+++ src/wui/dismantlesitewindow.cc 2018-09-05 07:39:19 +0000
@@ -49,7 +49,7 @@
49 // Add the wares queue49 // Add the wares queue
50 for (uint32_t i = 0; i < dismantle_site->get_nrwaresqueues(); ++i)50 for (uint32_t i = 0; i < dismantle_site->get_nrwaresqueues(); ++i)
51 BuildingWindow::create_input_queue_panel(51 BuildingWindow::create_input_queue_panel(
52 &box, *dismantle_site, dismantle_site->get_waresqueue(i), true);52 &box, *dismantle_site, *dismantle_site->get_waresqueue(i), true);
5353
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"));
55 think();55 think();
5656
=== modified file 'src/wui/inputqueuedisplay.cc'
--- src/wui/inputqueuedisplay.cc 2018-07-23 01:18:36 +0000
+++ src/wui/inputqueuedisplay.cc 2018-09-05 07:39:19 +0000
@@ -38,7 +38,7 @@
38 int32_t const y,38 int32_t const y,
39 InteractiveGameBase& igb,39 InteractiveGameBase& igb,
40 Widelands::Building& building,40 Widelands::Building& building,
41 Widelands::InputQueue* const queue,41 const Widelands::InputQueue& queue,
42 bool show_only)42 bool show_only)
43 : UI::Panel(parent, x, y, 0, 28),43 : UI::Panel(parent, x, y, 0, 28),
44 igb_(igb),44 igb_(igb),
@@ -47,21 +47,21 @@
47 priority_radiogroup_(nullptr),47 priority_radiogroup_(nullptr),
48 increase_max_fill_(nullptr),48 increase_max_fill_(nullptr),
49 decrease_max_fill_(nullptr),49 decrease_max_fill_(nullptr),
50 index_(queue->get_index()),50 index_(queue.get_index()),
51 type_(queue->get_type()),51 type_(queue.get_type()),
52 max_fill_indicator_(g_gr->images().get(pic_max_fill_indicator)),52 max_fill_indicator_(g_gr->images().get(pic_max_fill_indicator)),
53 cache_size_(queue->get_max_size()),53 cache_size_(queue.get_max_size()),
54 cache_max_fill_(queue->get_max_fill()),54 cache_max_fill_(queue.get_max_fill()),
55 total_height_(0),55 total_height_(0),
56 show_only_(show_only) {56 show_only_(show_only) {
57 if (type_ == Widelands::wwWARE) {57 if (type_ == Widelands::wwWARE) {
58 const Widelands::WareDescr& ware =58 const Widelands::WareDescr& ware =
59 *queue->owner().tribe().get_ware_descr(queue_->get_index());59 *queue.owner().tribe().get_ware_descr(queue_.get_index());
60 set_tooltip(ware.descname().c_str());60 set_tooltip(ware.descname().c_str());
61 icon_ = ware.icon();61 icon_ = ware.icon();
62 } else {62 } else {
63 const Widelands::WorkerDescr& worker =63 const Widelands::WorkerDescr& worker =
64 *queue->owner().tribe().get_worker_descr(queue_->get_index());64 *queue.owner().tribe().get_worker_descr(queue_.get_index());
65 set_tooltip(worker.descname().c_str());65 set_tooltip(worker.descname().c_str());
66 icon_ = worker.icon();66 icon_ = worker.icon();
67 }67 }
@@ -92,7 +92,7 @@
92 uint32_t pbs = show_only_ ? 0 : PriorityButtonSize;92 uint32_t pbs = show_only_ ? 0 : PriorityButtonSize;
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;
9494
95 cache_size_ = queue_->get_max_size();95 cache_size_ = queue_.get_max_size();
9696
97 update_priority_buttons();97 update_priority_buttons();
98 update_max_fill_buttons();98 update_max_fill_buttons();
@@ -109,12 +109,12 @@
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.
110 */110 */
111void InputQueueDisplay::think() {111void InputQueueDisplay::think() {
112 if (static_cast<uint32_t>(queue_->get_max_size()) != cache_size_)112 if (static_cast<uint32_t>(queue_.get_max_size()) != cache_size_)
113 max_size_changed();113 max_size_changed();
114114
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.
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_) {
117 cache_max_fill_ = queue_->get_max_fill();117 cache_max_fill_ = queue_.get_max_fill();
118 compute_max_fill_buttons_enabled_state();118 compute_max_fill_buttons_enabled_state();
119 }119 }
120}120}
@@ -126,11 +126,11 @@
126 if (!cache_size_)126 if (!cache_size_)
127 return;127 return;
128128
129 cache_max_fill_ = queue_->get_max_fill();129 cache_max_fill_ = queue_.get_max_fill();
130130
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_);
132 uint32_t nr_missing_to_draw =132 uint32_t nr_missing_to_draw =
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_;
134 if (nr_inputs_to_draw > cache_max_fill_) {134 if (nr_inputs_to_draw > cache_max_fill_) {
135 nr_missing_to_draw -= nr_inputs_to_draw - cache_max_fill_;135 nr_missing_to_draw -= nr_inputs_to_draw - cache_max_fill_;
136 }136 }
@@ -160,7 +160,7 @@
160 uint16_t pw = max_fill_indicator_->width();160 uint16_t pw = max_fill_indicator_->width();
161 point.y = Border;161 point.y = Border;
162 point.x = Border + CellWidth + CellSpacing +162 point.x = Border + CellWidth + CellSpacing +
163 (queue_->get_max_fill() * (CellWidth + CellSpacing)) - CellSpacing / 2 - pw / 2;163 (queue_.get_max_fill() * (CellWidth + CellSpacing)) - CellSpacing / 2 - pw / 2;
164 dst.blit(point, max_fill_indicator_);164 dst.blit(point, max_fill_indicator_);
165 }165 }
166}166}
@@ -349,7 +349,7 @@
349}349}
350350
351void InputQueueDisplay::increase_max_fill_clicked() {351void InputQueueDisplay::increase_max_fill_clicked() {
352 assert(cache_max_fill_ < queue_->get_max_size());352 assert(cache_max_fill_ < queue_.get_max_size());
353 if (!igb_.can_act(building_.owner().player_number())) {353 if (!igb_.can_act(building_.owner().player_number())) {
354 return;354 return;
355 }355 }
@@ -370,6 +370,6 @@
370 if (decrease_max_fill_)370 if (decrease_max_fill_)
371 decrease_max_fill_->set_enabled(cache_max_fill_ > 0);371 decrease_max_fill_->set_enabled(cache_max_fill_ > 0);
372 if (increase_max_fill_)372 if (increase_max_fill_)
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());
374 }374 }
375}375}
376376
=== modified file 'src/wui/inputqueuedisplay.h'
--- src/wui/inputqueuedisplay.h 2018-04-07 16:59:00 +0000
+++ src/wui/inputqueuedisplay.h 2018-09-05 07:39:19 +0000
@@ -56,7 +56,7 @@
56 int32_t y,56 int32_t y,
57 InteractiveGameBase& igb,57 InteractiveGameBase& igb,
58 Widelands::Building& building,58 Widelands::Building& building,
59 Widelands::InputQueue* queue,59 const Widelands::InputQueue& queue,
60 bool = false);60 bool = false);
61 ~InputQueueDisplay() override;61 ~InputQueueDisplay() override;
6262
@@ -66,7 +66,7 @@
66private:66private:
67 InteractiveGameBase& igb_;67 InteractiveGameBase& igb_;
68 Widelands::Building& building_;68 Widelands::Building& building_;
69 Widelands::InputQueue* queue_;69 const Widelands::InputQueue& queue_;
70 UI::Radiogroup* priority_radiogroup_;70 UI::Radiogroup* priority_radiogroup_;
71 UI::Button* increase_max_fill_;71 UI::Button* increase_max_fill_;
72 UI::Button* decrease_max_fill_;72 UI::Button* decrease_max_fill_;
7373
=== modified file 'src/wui/portdockwaresdisplay.cc'
--- src/wui/portdockwaresdisplay.cc 2018-04-07 16:59:00 +0000
+++ src/wui/portdockwaresdisplay.cc 2018-09-05 07:39:19 +0000
@@ -36,24 +36,24 @@
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.
37 */37 */
38struct PortDockWaresDisplay : AbstractWaresDisplay {38struct PortDockWaresDisplay : AbstractWaresDisplay {
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);
4040
41 std::string info_for_ware(Widelands::DescriptionIndex ware) override;41 std::string info_for_ware(Widelands::DescriptionIndex ware) override;
4242
43private:43private:
44 PortDock& portdock_;44 const PortDock& portdock_;
45};45};
4646
47PortDockWaresDisplay::PortDockWaresDisplay(Panel* parent,47PortDockWaresDisplay::PortDockWaresDisplay(Panel* parent,
48 uint32_t width,48 uint32_t width,
49 PortDock& pd,49 const Widelands::PortDock& pd,
50 Widelands::WareWorker type)50 Widelands::WareWorker type)
51 : AbstractWaresDisplay(parent, 0, 0, pd.owner().tribe(), type, false), portdock_(pd) {51 : AbstractWaresDisplay(parent, 0, 0, pd.owner().tribe(), type, false), portdock_(pd) {
52 set_inner_size(width, 0);52 set_inner_size(width, 0);
53}53}
5454
55std::string PortDockWaresDisplay::info_for_ware(Widelands::DescriptionIndex ware) {55std::string PortDockWaresDisplay::info_for_ware(Widelands::DescriptionIndex ware) {
56 uint32_t count = portdock_.count_waiting(get_type(), ware);56 const uint32_t count = portdock_.count_waiting(get_type(), ware);
57 return boost::lexical_cast<std::string>(count);57 return boost::lexical_cast<std::string>(count);
58}58}
5959
@@ -64,7 +64,7 @@
64 */64 */
65AbstractWaresDisplay* create_portdock_wares_display(UI::Panel* parent,65AbstractWaresDisplay* create_portdock_wares_display(UI::Panel* parent,
66 uint32_t width,66 uint32_t width,
67 PortDock& pd,67 const PortDock& pd,
68 Widelands::WareWorker type) {68 Widelands::WareWorker type) {
69 return new PortDockWaresDisplay(parent, width, pd, type);69 return new PortDockWaresDisplay(parent, width, pd, type);
70}70}
@@ -75,8 +75,8 @@
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);
7676
77 // Add the input queues.77 // Add the input queues.
78 for (InputQueue* wq : wh.get_portdock()->expedition_bootstrap()->queues()) {78 for (const InputQueue* wq : wh.get_portdock()->expedition_bootstrap()->queues()) {
79 box.add(new InputQueueDisplay(&box, 0, 0, igb, wh, wq, true));79 box.add(new InputQueueDisplay(&box, 0, 0, igb, wh, *wq, true));
80 }80 }
8181
82 return &box;82 return &box;
8383
=== modified file 'src/wui/portdockwaresdisplay.h'
--- src/wui/portdockwaresdisplay.h 2018-04-07 16:59:00 +0000
+++ src/wui/portdockwaresdisplay.h 2018-09-05 07:39:19 +0000
@@ -30,7 +30,7 @@
3030
31AbstractWaresDisplay* create_portdock_wares_display(UI::Panel* parent,31AbstractWaresDisplay* create_portdock_wares_display(UI::Panel* parent,
32 uint32_t width,32 uint32_t width,
33 Widelands::PortDock& pd,33 const Widelands::PortDock& pd,
34 Widelands::WareWorker type);34 Widelands::WareWorker type);
3535
36UI::Box* create_portdock_expedition_display(UI::Panel* parent,36UI::Box* create_portdock_expedition_display(UI::Panel* parent,
3737
=== modified file 'src/wui/productionsitewindow.cc'
--- src/wui/productionsitewindow.cc 2018-08-14 13:40:46 +0000
+++ src/wui/productionsitewindow.cc 2018-09-05 07:39:19 +0000
@@ -82,7 +82,7 @@
8282
83 for (uint32_t i = 0; i < inputqueues.size(); ++i) {83 for (uint32_t i = 0; i < inputqueues.size(); ++i) {
84 prod_box->add(84 prod_box->add(
85 new InputQueueDisplay(prod_box, 0, 0, *igbase(), *production_site, inputqueues[i]));85 new InputQueueDisplay(prod_box, 0, 0, *igbase(), *production_site, *inputqueues[i]));
86 }86 }
8787
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"));
8989
=== modified file 'src/wui/warehousewindow.cc'
--- src/wui/warehousewindow.cc 2018-08-14 13:40:46 +0000
+++ src/wui/warehousewindow.cc 2018-09-05 07:39:19 +0000
@@ -193,7 +193,7 @@
193 new WarehouseWaresPanel(get_tabs(), Width, *igbase(), *warehouse, Widelands::wwWORKER),193 new WarehouseWaresPanel(get_tabs(), Width, *igbase(), *warehouse, Widelands::wwWORKER),
194 _("Workers"));194 _("Workers"));
195195
196 if (Widelands::PortDock* pd = warehouse->get_portdock()) {196 if (const Widelands::PortDock* pd = warehouse->get_portdock()) {
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),
198 create_portdock_wares_display(get_tabs(), Width, *pd, Widelands::wwWARE),198 create_portdock_wares_display(get_tabs(), Width, *pd, Widelands::wwWARE),
199 _("Wares waiting to be shipped"));199 _("Wares waiting to be shipped"));

Subscribers

People subscribed via source and target branches

to status/vote changes: