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

Proposed by Benedikt Straub on 2019-08-11
Status: Merged
Merged at revision: 9177
Proposed branch: lp:~widelands-dev/widelands/constructionsite_options
Merge into: lp:widelands
Diff against target: 25 lines (+8/-0)
1 file modified
src/logic/map_objects/tribes/productionsite.cc (+8/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/constructionsite_options
Reviewer Review Type Date Requested Status
Widelands Developers 2019-08-11 Pending
Review via email: mp+371170@code.launchpad.net

Commit message

Set emptied input queues to max fill when enhancing a building

To post a comment you must log in.
Klaus Halfmann (klaus-halfmann) wrote :

+1 one for this. While playtesting on trunk I always was hit by this.

Code looks straigforward, no time for a complete review by now.

bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 5313. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/570516864.
Appveyor build 5086. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_constructionsite_options-5086.

GunChleoc (gunchleoc) wrote :

Code LGTM :)

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
2--- src/logic/map_objects/tribes/productionsite.cc 2019-06-23 12:45:29 +0000
3+++ src/logic/map_objects/tribes/productionsite.cc 2019-08-11 16:00:35 +0000
4@@ -1049,6 +1049,11 @@
5 for (const auto& queue : input_queues_) {
6 if (queue->get_type() == wwWARE && queue->get_index() == pair.first) {
7 pair.second.desired_fill = std::min(pair.second.max_fill, queue->get_max_fill());
8+ if (pair.second.desired_fill == 0) {
9+ // Players may set slots to 0 before enhancing a building to retrieve precious wares –
10+ // we assume they want the slot to be fully filled in the upgraded building
11+ pair.second.desired_fill = pair.second.max_fill;
12+ }
13 break;
14 }
15 }
16@@ -1058,6 +1063,9 @@
17 for (const auto& queue : input_queues_) {
18 if (queue->get_type() == wwWORKER && queue->get_index() == pair.first) {
19 pair.second.desired_fill = std::min(pair.second.max_fill, queue->get_max_fill());
20+ if (pair.second.desired_fill == 0) {
21+ pair.second.desired_fill = pair.second.max_fill;
22+ }
23 break;
24 }
25 }