← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1512151-load-small-map into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1512151-load-small-map into lp:widelands.

Commit message:
Set main view and selection to (0,0) when loading a new map in the editor. This fixes a crash when current coordinates were outside of the new maps's size.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1512151 in widelands: ""Assertion `c.x < width' failed" when loading smaller map in editor"
  https://bugs.launchpad.net/widelands/+bug/1512151

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1512151-load-small-map/+merge/290802

To reproduce the bug, load a big map in the editor and scroll the view left and up. Then open a small map.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1512151-load-small-map into lp:widelands.
=== modified file 'src/editor/editorinteractive.cc'
--- src/editor/editorinteractive.cc	2016-04-02 07:33:57 +0000
+++ src/editor/editorinteractive.cc	2016-04-02 18:40:59 +0000
@@ -692,6 +692,14 @@
 					child->die();
 				}
 			}
+
+			// Make sure that we will start at coordinates (0,0).
+			mainview_move(0, 0);
+			set_sel_pos
+				(Widelands::NodeAndTriangle<>
+					(Widelands::Coords(0, 0),
+					 Widelands::TCoords<>
+						(Widelands::Coords(0, 0), Widelands::TCoords<>::D)));
 			break;
 
 		case MapWas::kGloballyMutated:


Follow ups