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

Proposed by Benedikt Straub
Status: Merged
Merged at revision: 9161
Proposed branch: lp:~widelands-dev/widelands/constructionsite_options
Merge into: lp:widelands
Diff against target: 550 lines (+126/-69)
9 files modified
src/logic/game.cc (+6/-4)
src/logic/game.h (+4/-2)
src/logic/map_objects/tribes/building_settings.cc (+1/-11)
src/logic/map_objects/tribes/building_settings.h (+29/-0)
src/logic/player.cc (+7/-3)
src/logic/playercommand.cc (+50/-34)
src/logic/playercommand.h (+6/-2)
src/wui/constructionsitewindow.cc (+7/-7)
src/wui/inputqueuedisplay.cc (+16/-6)
To merge this branch: bzr merge lp:~widelands-dev/widelands/constructionsite_options
Reviewer Review Type Date Requested Status
Benedikt Straub Needs Resubmitting
GunChleoc Approve
Review via email: mp+369210@code.launchpad.net

Commit message

Fixes for some errors in constructionsite settings

Description of the change

As happens so often, new bugs are found directly after the feature that causes them has been merged :)

– Fix two errors with ware priorities and max fills (we need to distinguish between the constructionsite´s real input queues and those for the settings)
– Minimum allowed capacity for milsites is 1, not 0
– Fix initial priority view in inputqueuedisplay
– Fix a bug in saveloading trainingsite-constructionsite-settings

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

1 small nit.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

Replied to the diff comment.
Also found and fixed another flaw in the inputqueuedisplay.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Yep, that makes sense. Code LGTM, not tested yet.

review: Approve
Revision history for this message
Benedikt Straub (nordfriese) wrote :

Just found another issue in trainingsite-constructionsite saveloading which I´d like to fix with this branch

Revision history for this message
GunChleoc (gunchleoc) wrote :

Changes look good :)

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 5231. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/549597607.
Appveyor build 5010. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_constructionsite_options-5010.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I did some testing, looks good.

I noticed that the heroes/rookies buttons order is reversed in comparison to the finished military buildings. Do you want to swap them before we merge this branch?

Revision history for this message
Benedikt Straub (nordfriese) wrote :

Repositioned the buttons.
I also pushed a revision that should fix the memory leak you found (not tested).

review: Needs Resubmitting
Revision history for this message
GunChleoc (gunchleoc) wrote :

The hero/rookie buttons now oscillate their state, so that needs fixing.

The memory leak seems to be gone.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

Should be fixed now. I´m unable to compile and test at the moment though.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Yes, that fixed it :)

@bunnybot merge

Revision history for this message
bunnybot (widelandsofficial) wrote :

Refusing to merge, since Travis is not green. Use @bunnybot merge force for merging anyways.

Travis build 5246. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/550167492.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

@bunnybot merge

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 5250. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/551743880.
Appveyor build 5029. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_constructionsite_options-5029.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/game.cc'
2--- src/logic/game.cc 2019-06-23 11:41:17 +0000
3+++ src/logic/game.cc 2019-06-28 11:20:31 +0000
4@@ -789,17 +789,19 @@
5 void Game::send_player_set_ware_priority(PlayerImmovable& imm,
6 int32_t const type,
7 DescriptionIndex const index,
8- int32_t const prio) {
9+ int32_t const prio,
10+ bool cs) {
11 send_player_command(
12- new CmdSetWarePriority(get_gametime(), imm.owner().player_number(), imm, type, index, prio));
13+ new CmdSetWarePriority(get_gametime(), imm.owner().player_number(), imm, type, index, prio, cs));
14 }
15
16 void Game::send_player_set_input_max_fill(PlayerImmovable& imm,
17 DescriptionIndex const index,
18 WareWorker type,
19- uint32_t const max_fill) {
20+ uint32_t const max_fill,
21+ bool cs) {
22 send_player_command(new CmdSetInputMaxFill(
23- get_gametime(), imm.owner().player_number(), imm, index, type, max_fill));
24+ get_gametime(), imm.owner().player_number(), imm, index, type, max_fill, cs));
25 }
26
27 void Game::send_player_change_training_options(TrainingSite& ts,
28
29=== modified file 'src/logic/game.h'
30--- src/logic/game.h 2019-06-09 10:33:51 +0000
31+++ src/logic/game.h 2019-06-28 11:20:31 +0000
32@@ -268,11 +268,13 @@
33 void send_player_set_ware_priority(PlayerImmovable&,
34 int32_t type,
35 DescriptionIndex index,
36- int32_t prio);
37+ int32_t prio,
38+ bool is_cs = false);
39 void send_player_set_input_max_fill(PlayerImmovable&,
40 DescriptionIndex index,
41 WareWorker type,
42- uint32_t);
43+ uint32_t,
44+ bool is_cs = false);
45 void send_player_change_training_options(TrainingSite&, TrainingAttribute, int32_t);
46 void send_player_drop_soldier(Building&, int32_t);
47 void send_player_change_soldier_capacity(Building&, int32_t);
48
49=== modified file 'src/logic/map_objects/tribes/building_settings.cc'
50--- src/logic/map_objects/tribes/building_settings.cc 2019-06-23 11:41:17 +0000
51+++ src/logic/map_objects/tribes/building_settings.cc 2019-06-28 11:20:31 +0000
52@@ -138,13 +138,6 @@
53 constexpr uint8_t kCurrentPacketVersionTrainingsite = 1;
54 constexpr uint8_t kCurrentPacketVersionWarehouse = 1;
55
56-enum class BuildingType : uint8_t {
57- kWarehouse = 1,
58- kProductionsite = 2,
59- kTrainingsite = 3,
60- kMilitarysite = 4,
61-};
62-
63 // static
64 BuildingSettings* BuildingSettings::load(const Game& game, const TribeDescr& tribe, FileRead& fr) {
65 try {
66@@ -200,6 +193,7 @@
67 void BuildingSettings::save(const Game&, FileWrite& fw) const {
68 fw.unsigned_8(kCurrentPacketVersion);
69 fw.c_string(descr_.c_str());
70+ fw.unsigned_8(static_cast<uint8_t>(type()));
71 }
72
73 void MilitarysiteSettings::read(const Game& game, FileRead& fr) {
74@@ -220,7 +214,6 @@
75
76 void MilitarysiteSettings::save(const Game& game, FileWrite& fw) const {
77 BuildingSettings::save(game, fw);
78- fw.unsigned_8(static_cast<uint8_t>(BuildingType::kMilitarysite));
79 fw.unsigned_8(kCurrentPacketVersionMilitarysite);
80
81 fw.unsigned_32(desired_capacity);
82@@ -262,7 +255,6 @@
83
84 void ProductionsiteSettings::save(const Game& game, FileWrite& fw) const {
85 BuildingSettings::save(game, fw);
86- fw.unsigned_8(static_cast<uint8_t>(BuildingType::kProductionsite));
87 fw.unsigned_8(kCurrentPacketVersionProductionsite);
88
89 fw.unsigned_8(stopped ? 1 : 0);
90@@ -297,7 +289,6 @@
91
92 void TrainingsiteSettings::save(const Game& game, FileWrite& fw) const {
93 ProductionsiteSettings::save(game, fw);
94- fw.unsigned_8(static_cast<uint8_t>(BuildingType::kTrainingsite));
95 fw.unsigned_8(kCurrentPacketVersionTrainingsite);
96 fw.unsigned_32(desired_capacity);
97 }
98@@ -331,7 +322,6 @@
99
100 void WarehouseSettings::save(const Game& game, FileWrite& fw) const {
101 BuildingSettings::save(game, fw);
102- fw.unsigned_8(static_cast<uint8_t>(BuildingType::kWarehouse));
103 fw.unsigned_8(kCurrentPacketVersionWarehouse);
104
105 fw.unsigned_8(launch_expedition ? 1 : 0);
106
107=== modified file 'src/logic/map_objects/tribes/building_settings.h'
108--- src/logic/map_objects/tribes/building_settings.h 2019-05-15 09:20:22 +0000
109+++ src/logic/map_objects/tribes/building_settings.h 2019-06-28 11:20:31 +0000
110@@ -53,6 +53,15 @@
111 virtual void apply(const BuildingSettings&) {
112 }
113
114+protected:
115+ enum class BuildingType : uint8_t {
116+ kWarehouse = 1,
117+ kProductionsite = 2,
118+ kTrainingsite = 3,
119+ kMilitarysite = 4,
120+ };
121+ virtual BuildingType type() const = 0;
122+
123 private:
124 const std::string descr_;
125 };
126@@ -74,6 +83,11 @@
127 std::vector<std::pair<DescriptionIndex, InputQueueSetting>> ware_queues;
128 std::vector<std::pair<DescriptionIndex, InputQueueSetting>> worker_queues;
129 bool stopped;
130+
131+protected:
132+ BuildingType type() const override {
133+ return BuildingType::kProductionsite;
134+ }
135 };
136
137 struct MilitarysiteSettings : public BuildingSettings {
138@@ -88,6 +102,11 @@
139 const uint32_t max_capacity;
140 uint32_t desired_capacity;
141 bool prefer_heroes;
142+
143+protected:
144+ BuildingType type() const override {
145+ return BuildingType::kMilitarysite;
146+ }
147 };
148
149 struct TrainingsiteSettings : public ProductionsiteSettings {
150@@ -101,6 +120,11 @@
151
152 const uint32_t max_capacity;
153 uint32_t desired_capacity;
154+
155+protected:
156+ BuildingType type() const override {
157+ return BuildingType::kTrainingsite;
158+ }
159 };
160
161 struct WarehouseSettings : public BuildingSettings {
162@@ -116,6 +140,11 @@
163 std::map<DescriptionIndex, StockPolicy> worker_preferences;
164 const bool launch_expedition_allowed;
165 bool launch_expedition;
166+
167+protected:
168+ BuildingType type() const override {
169+ return BuildingType::kWarehouse;
170+ }
171 };
172
173 } // namespace Widelands
174
175=== modified file 'src/logic/player.cc'
176--- src/logic/player.cc 2019-05-28 11:45:38 +0000
177+++ src/logic/player.cc 2019-06-28 11:20:31 +0000
178@@ -760,20 +760,24 @@
179 } else {
180 workers = building->get_workers();
181 }
182- const BuildingSettings* settings = building->create_building_settings();
183
184+ const BuildingSettings* settings = nullptr;
185 if (index_of_new_building != INVALID_INDEX) {
186+ settings = building->create_building_settings();
187 // For enhancing, register whether the window was open
188 Notifications::publish(NoteBuilding(building->serial(), NoteBuilding::Action::kStartWarp));
189 }
190+
191 building->remove(egbase()); // no fire or stuff
192 // Hereafter the old building does not exist and building is a dangling
193 // pointer.
194- if (index_of_new_building != INVALID_INDEX)
195+
196+ if (index_of_new_building != INVALID_INDEX) {
197 building = &egbase().warp_constructionsite(
198 position, player_number_, index_of_new_building, false, former_buildings, settings);
199- else
200+ } else {
201 building = &egbase().warp_dismantlesite(position, player_number_, false, former_buildings);
202+ }
203
204 // Open the new building window if needed
205 Notifications::publish(NoteBuilding(building->serial(), NoteBuilding::Action::kFinishWarp));
206
207=== modified file 'src/logic/playercommand.cc'
208--- src/logic/playercommand.cc 2019-06-23 11:41:17 +0000
209+++ src/logic/playercommand.cc 2019-06-28 11:20:31 +0000
210@@ -1049,25 +1049,29 @@
211 PlayerImmovable& imm,
212 const int32_t init_type,
213 const DescriptionIndex i,
214- const int32_t init_priority)
215+ const int32_t init_priority,
216+ bool cs_setting)
217 : PlayerCommand(init_duetime, init_sender),
218 serial_(imm.serial()),
219 type_(init_type),
220 index_(i),
221- priority_(init_priority) {
222+ priority_(init_priority),
223+ is_constructionsite_setting_(cs_setting) {
224 }
225
226 void CmdSetWarePriority::execute(Game& game) {
227 MapObject* mo = game.objects().get_object(serial_);
228- if (upcast(ConstructionSite, cs, mo)) {
229- if (upcast(ProductionsiteSettings, s, cs->get_settings())) {
230- for (auto& pair : s->ware_queues) {
231- if (pair.first == index_) {
232- pair.second.priority = priority_;
233- return;
234+ if (is_constructionsite_setting_) {
235+ if (upcast(ConstructionSite, cs, mo)) {
236+ if (upcast(ProductionsiteSettings, s, cs->get_settings())) {
237+ for (auto& pair : s->ware_queues) {
238+ if (pair.first == index_) {
239+ pair.second.priority = priority_;
240+ return;
241+ }
242 }
243+ NEVER_HERE();
244 }
245- NEVER_HERE();
246 }
247 } else if (upcast(Building, psite, mo)) {
248 if (psite->owner().player_number() == sender()) {
249@@ -1076,7 +1080,7 @@
250 }
251 }
252
253-constexpr uint16_t kCurrentPacketVersionCmdSetWarePriority = 1;
254+constexpr uint16_t kCurrentPacketVersionCmdSetWarePriority = 2;
255
256 void CmdSetWarePriority::write(FileWrite& fw, EditorGameBase& egbase, MapObjectSaver& mos) {
257 fw.unsigned_16(kCurrentPacketVersionCmdSetWarePriority);
258@@ -1087,6 +1091,7 @@
259 fw.unsigned_8(type_);
260 fw.signed_32(index_);
261 fw.signed_32(priority_);
262+ fw.unsigned_8(is_constructionsite_setting_ ? 1 : 0);
263 }
264
265 void CmdSetWarePriority::read(FileRead& fr, EditorGameBase& egbase, MapObjectLoader& mol) {
266@@ -1098,6 +1103,7 @@
267 type_ = fr.unsigned_8();
268 index_ = fr.signed_32();
269 priority_ = fr.signed_32();
270+ is_constructionsite_setting_ = fr.unsigned_8();
271 } else {
272 throw UnhandledVersionError(
273 "CmdSetWarePriority", packet_version, kCurrentPacketVersionCmdSetWarePriority);
274@@ -1113,7 +1119,8 @@
275 serial_(des.unsigned_32()),
276 type_(des.unsigned_8()),
277 index_(des.signed_32()),
278- priority_(des.signed_32()) {
279+ priority_(des.signed_32()),
280+ is_constructionsite_setting_(des.unsigned_8()) {
281 }
282
283 void CmdSetWarePriority::serialize(StreamWrite& ser) {
284@@ -1123,6 +1130,7 @@
285 ser.unsigned_8(type_);
286 ser.signed_32(index_);
287 ser.signed_32(priority_);
288+ ser.unsigned_8(is_constructionsite_setting_ ? 1 : 0);
289 }
290
291 /*** class Cmd_SetWareMaxFill ***/
292@@ -1131,39 +1139,43 @@
293 PlayerImmovable& imm,
294 const DescriptionIndex index,
295 const WareWorker type,
296- const uint32_t max_fill)
297+ const uint32_t max_fill,
298+ bool cs_setting)
299 : PlayerCommand(init_duetime, init_sender),
300 serial_(imm.serial()),
301 index_(index),
302 type_(type),
303- max_fill_(max_fill) {
304+ max_fill_(max_fill),
305+ is_constructionsite_setting_(cs_setting) {
306 }
307
308 void CmdSetInputMaxFill::execute(Game& game) {
309 MapObject* mo = game.objects().get_object(serial_);
310- if (upcast(ConstructionSite, cs, mo)) {
311- if (upcast(ProductionsiteSettings, s, cs->get_settings())) {
312- switch (type_) {
313- case wwWARE:
314- for (auto& pair : s->ware_queues) {
315- if (pair.first == index_) {
316- assert(pair.second.max_fill >= max_fill_);
317- pair.second.desired_fill = max_fill_;
318- return;
319- }
320- }
321- NEVER_HERE();
322- case wwWORKER:
323- for (auto& pair : s->worker_queues) {
324- if (pair.first == index_) {
325- assert(pair.second.max_fill >= max_fill_);
326- pair.second.desired_fill = max_fill_;
327- return;
328- }
329+ if (is_constructionsite_setting_) {
330+ if (upcast(ConstructionSite, cs, mo)) {
331+ if (upcast(ProductionsiteSettings, s, cs->get_settings())) {
332+ switch (type_) {
333+ case wwWARE:
334+ for (auto& pair : s->ware_queues) {
335+ if (pair.first == index_) {
336+ assert(pair.second.max_fill >= max_fill_);
337+ pair.second.desired_fill = max_fill_;
338+ return;
339+ }
340+ }
341+ NEVER_HERE();
342+ case wwWORKER:
343+ for (auto& pair : s->worker_queues) {
344+ if (pair.first == index_) {
345+ assert(pair.second.max_fill >= max_fill_);
346+ pair.second.desired_fill = max_fill_;
347+ return;
348+ }
349+ }
350+ NEVER_HERE();
351 }
352 NEVER_HERE();
353 }
354- NEVER_HERE();
355 }
356 } else if (upcast(Building, b, mo)) {
357 if (b->owner().player_number() == sender()) {
358@@ -1172,7 +1184,7 @@
359 }
360 }
361
362-constexpr uint16_t kCurrentPacketVersionCmdSetInputMaxFill = 2;
363+constexpr uint16_t kCurrentPacketVersionCmdSetInputMaxFill = 3;
364
365 void CmdSetInputMaxFill::write(FileWrite& fw, EditorGameBase& egbase, MapObjectSaver& mos) {
366 fw.unsigned_16(kCurrentPacketVersionCmdSetInputMaxFill);
367@@ -1187,6 +1199,7 @@
368 fw.unsigned_8(1);
369 }
370 fw.unsigned_32(max_fill_);
371+ fw.unsigned_8(is_constructionsite_setting_ ? 1 : 0);
372 }
373
374 void CmdSetInputMaxFill::read(FileRead& fr, EditorGameBase& egbase, MapObjectLoader& mol) {
375@@ -1202,6 +1215,7 @@
376 type_ = wwWORKER;
377 }
378 max_fill_ = fr.unsigned_32();
379+ is_constructionsite_setting_ = fr.unsigned_8();
380 } else {
381 throw UnhandledVersionError(
382 "CmdSetInputMaxFill", packet_version, kCurrentPacketVersionCmdSetInputMaxFill);
383@@ -1220,6 +1234,7 @@
384 type_ = wwWORKER;
385 }
386 max_fill_ = des.unsigned_32();
387+ is_constructionsite_setting_ = des.unsigned_8();
388 }
389
390 void CmdSetInputMaxFill::serialize(StreamWrite& ser) {
391@@ -1233,6 +1248,7 @@
392 ser.unsigned_8(1);
393 }
394 ser.unsigned_32(max_fill_);
395+ ser.unsigned_8(is_constructionsite_setting_ ? 1 : 0);
396 }
397
398 CmdChangeTargetQuantity::CmdChangeTargetQuantity(const uint32_t init_duetime,
399
400=== modified file 'src/logic/playercommand.h'
401--- src/logic/playercommand.h 2019-06-19 07:34:19 +0000
402+++ src/logic/playercommand.h 2019-06-28 11:20:31 +0000
403@@ -475,7 +475,8 @@
404 PlayerImmovable&,
405 int32_t type,
406 DescriptionIndex index,
407- int32_t priority);
408+ int32_t priority,
409+ bool cs);
410
411 // Write these commands to a file (for savegames)
412 void write(FileWrite&, EditorGameBase&, MapObjectSaver&) override;
413@@ -495,6 +496,7 @@
414 int32_t type_; ///< this is always WARE right now
415 DescriptionIndex index_;
416 int32_t priority_;
417+ bool is_constructionsite_setting_;
418 };
419
420 struct CmdSetInputMaxFill : public PlayerCommand {
421@@ -505,7 +507,8 @@
422 PlayerImmovable&,
423 DescriptionIndex,
424 WareWorker,
425- uint32_t maxfill);
426+ uint32_t maxfill,
427+ bool cs);
428
429 // Write these commands to a file (for savegames)
430 void write(FileWrite&, EditorGameBase&, MapObjectSaver&) override;
431@@ -525,6 +528,7 @@
432 DescriptionIndex index_;
433 WareWorker type_;
434 uint32_t max_fill_;
435+ bool is_constructionsite_setting_;
436 };
437
438 struct CmdChangeTargetQuantity : public PlayerCommand {
439
440=== modified file 'src/wui/constructionsitewindow.cc'
441--- src/wui/constructionsitewindow.cc 2019-06-23 11:41:17 +0000
442+++ src/wui/constructionsitewindow.cc 2019-06-28 11:20:31 +0000
443@@ -219,7 +219,7 @@
444 cs_soldier_capacity_decrease_->sigclicked.connect([this, ms]() {
445 igbase()->game().send_player_change_soldier_capacity(
446 *construction_site_.get(igbase()->egbase()),
447- SDL_GetModState() & KMOD_CTRL ? 0 : ms->desired_capacity - 1);
448+ SDL_GetModState() & KMOD_CTRL ? 1 : ms->desired_capacity - 1);
449 });
450 cs_soldier_capacity_increase_->sigclicked.connect([this, ms]() {
451 igbase()->game().send_player_change_soldier_capacity(
452@@ -242,16 +242,16 @@
453 cs_prefer_heroes_rookies_.reset(new UI::Radiogroup());
454 cs_prefer_heroes_rookies_->add_button(
455 &soldier_preference_panel, Vector2i::zero(),
456+ g_gr->images().get("images/wui/buildings/prefer_heroes.png"), _("Prefer heroes"));
457+ cs_prefer_heroes_rookies_->add_button(
458+ &soldier_preference_panel, Vector2i(32, 0),
459 g_gr->images().get("images/wui/buildings/prefer_rookies.png"), _("Prefer rookies"));
460- cs_prefer_heroes_rookies_->add_button(
461- &soldier_preference_panel, Vector2i(32, 0),
462- g_gr->images().get("images/wui/buildings/prefer_heroes.png"), _("Prefer heroes"));
463 if (can_act) {
464 cs_prefer_heroes_rookies_->changedto.connect([this](int32_t state) {
465 igbase()->game().send_player_militarysite_set_soldier_preference(
466 *construction_site_.get(igbase()->egbase()),
467- state ? Widelands::SoldierPreference::kHeroes :
468- Widelands::SoldierPreference::kRookies);
469+ state ? Widelands::SoldierPreference::kRookies :
470+ Widelands::SoldierPreference::kHeroes);
471 });
472 }
473 settings_box.add_space(8);
474@@ -434,7 +434,7 @@
475 cs_soldier_capacity_decrease_->set_enabled(can_act && ms->desired_capacity > 1);
476 cs_soldier_capacity_increase_->set_enabled(can_act &&
477 ms->desired_capacity < ms->max_capacity);
478- cs_prefer_heroes_rookies_->set_state(ms->prefer_heroes ? 1 : 0);
479+ cs_prefer_heroes_rookies_->set_state(ms->prefer_heroes ? 0 : 1);
480 } else if (upcast(Widelands::WarehouseSettings, ws, construction_site->get_settings())) {
481 if (cs_launch_expedition_) {
482 cs_launch_expedition_->set_state(ws->launch_expedition);
483
484=== modified file 'src/wui/inputqueuedisplay.cc'
485--- src/wui/inputqueuedisplay.cc 2019-06-23 11:41:17 +0000
486+++ src/wui/inputqueuedisplay.cc 2019-06-28 11:20:31 +0000
487@@ -281,7 +281,17 @@
488 this, pos, g_gr->images().get(pic_priority_low), _("Lowest priority"));
489 }
490
491- int32_t priority = building_.get_priority(type_, index_, false);
492+ int32_t priority = -1;
493+ if (settings_) {
494+ for (const auto& pair : settings_->ware_queues) {
495+ if (pair.first == index_) {
496+ priority = pair.second.priority;
497+ break;
498+ }
499+ }
500+ } else {
501+ priority = building_.get_priority(type_, index_, false);
502+ }
503 switch (priority) {
504 case Widelands::kPriorityHigh:
505 priority_radiogroup_->set_state(0);
506@@ -293,7 +303,7 @@
507 priority_radiogroup_->set_state(2);
508 break;
509 default:
510- break;
511+ NEVER_HERE();
512 }
513
514 priority_radiogroup_->changedto.connect(
515@@ -405,7 +415,7 @@
516 if (SDL_GetModState() & KMOD_CTRL) {
517 update_siblings_priority(state);
518 }
519- igb_.game().send_player_set_ware_priority(building_, type_, index_, priority);
520+ igb_.game().send_player_set_ware_priority(building_, type_, index_, priority, settings_ != nullptr);
521 }
522
523 void InputQueueDisplay::radiogroup_clicked() {
524@@ -465,7 +475,7 @@
525 // Update the value of this queue if required
526 if (cache_max_fill_ > 0) {
527 igb_.game().send_player_set_input_max_fill(
528- building_, index_, type_, ((SDL_GetModState() & KMOD_CTRL) ? 0 : cache_max_fill_ - 1));
529+ building_, index_, type_, ((SDL_GetModState() & KMOD_CTRL) ? 0 : cache_max_fill_ - 1), settings_ != nullptr);
530 }
531
532 // Update other queues of this building
533@@ -484,7 +494,7 @@
534 if (cache_max_fill_ < cache_size_) {
535 igb_.game().send_player_set_input_max_fill(
536 building_, index_, type_,
537- ((SDL_GetModState() & KMOD_CTRL) ? cache_size_ : cache_max_fill_ + 1));
538+ ((SDL_GetModState() & KMOD_CTRL) ? cache_size_ : cache_max_fill_ + 1), settings_ != nullptr);
539 }
540
541 if (SDL_GetModState() & KMOD_SHIFT) {
542@@ -512,7 +522,7 @@
543 display->cache_size_));
544 if (new_fill != display->cache_max_fill_) {
545 igb_.game().send_player_set_input_max_fill(
546- building_, display->index_, display->type_, new_fill);
547+ building_, display->index_, display->type_, new_fill, settings_ != nullptr);
548 }
549 } while ((sibling = sibling->get_next_sibling()));
550 }

Subscribers

People subscribed via source and target branches

to status/vote changes: