← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~ab-tools/widelands/minimap into lp:widelands

 

Andreas Breitschopp has proposed merging lp:~ab-tools/widelands/minimap into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  #594507 Dotted rectangle with visible screen area in map
  https://bugs.launchpad.net/bugs/594507


I've did a small improvement regarding the frame border again:
before that the frame border was always one pixel different when clicking arround (due to the mod 2 calculation), this is fixed now. Nothing important, but it just looks better now. ;-)

Additionally I've added a note in the change log. Because it's a visible change for a user, I think it's worth to be mentioned.

Please merge that again into trunk.
-- 
https://code.launchpad.net/~ab-tools/widelands/minimap/+merge/38618
Your team Widelands Developers is requested to review the proposed merge of lp:~ab-tools/widelands/minimap into lp:widelands.
=== modified file 'ChangeLog'
--- ChangeLog	2010-10-04 09:10:35 +0000
+++ ChangeLog	2010-10-16 10:22:47 +0000
@@ -2,6 +2,7 @@
 - Changed the way compressed files are generated (maps, savegames) and read.
   Now it is possible to rename maps and savegames but it is not possible
   to load maps from version after this change with versions before this change
+- Added a dotted frame border to the mini map.
 - Improved and added a lot new animations for workers!
 - Implemented teamview for allied players
 - Implemented shared kingdom mode, where two or more players play the same

=== modified file 'src/graphic/render/gameview.cc'
--- src/graphic/render/gameview.cc	2010-10-09 13:43:47 +0000
+++ src/graphic/render/gameview.cc	2010-10-16 10:22:47 +0000
@@ -1096,31 +1096,33 @@
 	 Point							     const ptopleft,
 	 Point							     const pbottomright,
 	 uint32_t                            const mapwidth,
-	 uint32_t                            const mapheight)
+	 uint32_t                            const mapheight,
+	 uint32_t                            const modx,
+	 uint32_t                            const mody)
 {
 	bool isframepixel = false;
 
 	if (ptopleft.x <= pbottomright.x) {
 		if (f.x >= ptopleft.x && f.x <= pbottomright.x
 			&& (f.y == ptopleft.y || f.y == pbottomright.y)
-			&& f.x % 2 == 0)
+			&& f.x % 2 == modx)
 			isframepixel = true;
 	} else {
 		if ((f.x >= ptopleft.x && f.x <= mapwidth || f.x >= 0 && f.x <= pbottomright.x)
 			&& (f.y == ptopleft.y || f.y == pbottomright.y)
-			&& f.x % 2 == 0)
+			&& f.x % 2 == modx)
 			isframepixel = true;
 	}
 
 	if (ptopleft.y <= pbottomright.y) {
 		if (f.y >= ptopleft.y && f.y <= pbottomright.y
 			&& (f.x == ptopleft.x || f.x == pbottomright.x)
-			&& f.y % 2 == 0)
+			&& f.y % 2 == mody)
 			isframepixel = true;
 	} else {
 		if ((f.y >= ptopleft.y && f.y <= mapheight || f.y >= 0 && f.y <= pbottomright.y)
 			&& (f.x == ptopleft.x || f.x == pbottomright.x)
-			&& f.y % 2 == 0)
+			&& f.y % 2 == mody)
 			isframepixel = true;
 	}
 
@@ -1164,6 +1166,9 @@
 	pbottomright.y = viewpoint.y + mapheight / 2 + ysize;
 	if (pbottomright.y >= mapheight) pbottomright.y -= mapheight;
 
+	uint32_t modx = pbottomright.x % 2;
+	uint32_t mody = pbottomright.y % 2;
+
 	if (not player or player->see_all()) for (uint32_t y = 0; y < rc.h; ++y) {
 		Uint8 * pix = pixels + (rc.y + y) * pitch + rc.x * sizeof(T);
 		Widelands::FCoords f
@@ -1177,7 +1182,7 @@
 				move_r(mapwidth, f, i);
 
 			if (draw_minimap_frameborder<T>
-					(f, ptopleft, pbottomright, mapwidth, mapheight)) {
+					(f, ptopleft, pbottomright, mapwidth, mapheight, modx, mody)) {
 				*reinterpret_cast<T *>(pix) = static_cast<T>
 					(SDL_MapRGB(&const_cast<SDL_PixelFormat &>(format), 255, 0, 0));
 			} else {
@@ -1201,7 +1206,7 @@
 					move_r(mapwidth, f, i);
 
 				if (draw_minimap_frameborder<T>
-					(f, ptopleft, pbottomright, mapwidth, mapheight)) {
+					(f, ptopleft, pbottomright, mapwidth, mapheight, modx, mody)) {
 					*reinterpret_cast<T *>(pix) = static_cast<T>
 						(SDL_MapRGB(&const_cast<SDL_PixelFormat &>(format), 255, 0, 0));
 				} else {


Follow ups