← Back to team overview

widelands-dev team mailing list archive

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

 

Benedikt Straub has proposed merging lp:~widelands-dev/widelands/constructionsite_options into lp:widelands.

Commit message:
Set emptied input queues to max fill when enhancing a building

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1597310 in widelands: "Possibility to set building options when building is under construction"
  https://bugs.launchpad.net/widelands/+bug/1597310
  Bug #1834078 in widelands: "Construction site windows leak memory"
  https://bugs.launchpad.net/widelands/+bug/1834078
  Bug #1834151 in widelands: "Crash in player command"
  https://bugs.launchpad.net/widelands/+bug/1834151
  Bug #1839740 in widelands: "Enhanced production sites retain ware settings"
  https://bugs.launchpad.net/widelands/+bug/1839740

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/constructionsite_options/+merge/371170
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/constructionsite_options into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
--- src/logic/map_objects/tribes/productionsite.cc	2019-06-23 12:45:29 +0000
+++ src/logic/map_objects/tribes/productionsite.cc	2019-08-11 16:00:35 +0000
@@ -1049,6 +1049,11 @@
 		for (const auto& queue : input_queues_) {
 			if (queue->get_type() == wwWARE && queue->get_index() == pair.first) {
 				pair.second.desired_fill = std::min(pair.second.max_fill, queue->get_max_fill());
+				if (pair.second.desired_fill == 0) {
+					// Players may set slots to 0 before enhancing a building to retrieve precious wares –
+					// we assume they want the slot to be fully filled in the upgraded building
+					pair.second.desired_fill = pair.second.max_fill;
+				}
 				break;
 			}
 		}
@@ -1058,6 +1063,9 @@
 		for (const auto& queue : input_queues_) {
 			if (queue->get_type() == wwWORKER && queue->get_index() == pair.first) {
 				pair.second.desired_fill = std::min(pair.second.max_fill, queue->get_max_fill());
+				if (pair.second.desired_fill == 0) {
+					pair.second.desired_fill = pair.second.max_fill;
+				}
 				break;
 			}
 		}


Follow ups