Notabilis has proposed merging 
lp:~widelands-dev/widelands/bug-1691336-random-window-opens into lp:widelands.

Commit message:
Only store window for reopening when the construction site has been finished.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1691336 in widelands: "Building window suddenly appears after 
construction has finished"
  https://bugs.launchpad.net/widelands/+bug/1691336

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1691336-random-window-opens/+merge/345199

Fixes a bug with the transition between a construction site and the finished 
building: Whether a window should be displayed for the new building is stored 
based on the coordinates of the construction site. When the construction site 
is done (either by destroying it or because its finished) the coordinates are 
stored so the window is opened later on.

So when a construction is started and then aborted, the coordinates are stored. 
When later on a new construction is started on the same place the coordinates 
are still stored and the window will be opened when finished even when the 
window for the new construction site has never been opened.

This sequence of events can happen quite easily by "oops, placed wrong 
building" and aborting the construction, followed by placing the correct 
building.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1691336-random-window-opens into lp:widelands.
=== modified file 'src/logic/map_objects/map_object.h'
--- src/logic/map_objects/map_object.h	2018-04-07 16:59:00 +0000
+++ src/logic/map_objects/map_object.h	2018-05-07 19:32:08 +0000
@@ -263,7 +263,7 @@
 
 	/**
 	 * Is called right before the object will be removed from
-	 * the game. No conncetion is handled in this class.
+	 * the game. No connection is handled in this class.
 	 *
 	 * param serial : the object serial (cannot use param comment as this is a callback)
 	 */

=== modified file 'src/logic/map_objects/tribes/constructionsite.cc'
--- src/logic/map_objects/tribes/constructionsite.cc	2018-04-07 16:59:00 +0000
+++ src/logic/map_objects/tribes/constructionsite.cc	2018-05-07 19:32:08 +0000
@@ -181,8 +181,11 @@
 ===============
 */
 void ConstructionSite::cleanup(EditorGameBase& egbase) {
-	// Register whether the window was open
-	Notifications::publish(NoteBuilding(serial(), NoteBuilding::Action::kStartWarp));
+	if (work_steps_ <= work_completed_) {
+		// If the building is finished, register whether the window was open
+		Notifications::publish(NoteBuilding(serial(), NoteBuilding::Action::kStartWarp));
+	}
+
 	PartiallyFinishedBuilding::cleanup(egbase);
 
 	if (work_steps_ <= work_completed_) {

_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to     : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to