← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~nha/widelands/bug1125539 into lp:widelands

 

Nicolai Hähnle has proposed merging lp:~nha/widelands/bug1125539 into lp:widelands.

Commit message:
Fix for bug #1125539: Always render the road overlay, even when the player sees all

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1125539 in widelands: "Roads not rendered in road building mode"
  https://bugs.launchpad.net/widelands/+bug/1125539

For more details, see:
https://code.launchpad.net/~nha/widelands/bug1125539/+merge/149272
-- 
https://code.launchpad.net/~nha/widelands/bug1125539/+merge/149272
Your team Widelands Developers is requested to review the proposed merge of lp:~nha/widelands/bug1125539 into lp:widelands.
=== modified file 'src/graphic/render/gamerenderer_gl.cc'
--- src/graphic/render/gamerenderer_gl.cc	2013-02-11 18:01:26 +0000
+++ src/graphic/render/gamerenderer_gl.cc	2013-02-19 13:25:32 +0000
@@ -501,13 +501,16 @@
 
 uint8_t GameRendererGL::field_roads(const FCoords & coords) const
 {
+	uint8_t roads;
+	const Map & map = m_egbase->map();
 	if (m_player && !m_player->see_all()) {
-		const Map & map = m_egbase->map();
 		const Player::Field & pf = m_player->fields()[Map::get_index(coords, map.get_width())];
-		return pf.roads | map.overlay_manager().get_road_overlay(coords);
+		roads = pf.roads | map.overlay_manager().get_road_overlay(coords);
 	} else {
-		return coords.field->get_roads();
+		roads = coords.field->get_roads();
 	}
+	roads |= map.overlay_manager().get_road_overlay(coords);
+	return roads;
 }
 
 void GameRendererGL::prepare_roads()

=== modified file 'src/graphic/render/gamerenderer_sdl.cc'
--- src/graphic/render/gamerenderer_sdl.cc	2013-02-10 16:41:12 +0000
+++ src/graphic/render/gamerenderer_sdl.cc	2013-02-19 13:25:32 +0000
@@ -151,7 +151,7 @@
 				f_d_texture = get_terrain_texture(f_pf.terrains.d);
 				tr_d_texture = get_terrain_texture(tr_pf.terrains.d);
 
-				roads = f_pf.roads | map.overlay_manager().get_road_overlay(f);
+				roads = f_pf.roads;
 
 				f_brightness = node_brightness
 				 	(gametime, f_pf.time_node_last_unseen,
@@ -177,6 +177,7 @@
 				bl_brightness = bl.field->get_brightness();
 				br_brightness = br.field->get_brightness();
 			}
+			roads |= map.overlay_manager().get_road_overlay(f);
 
 			Vertex f_vert
 				(f_posx, posy - f.field->get_height() * HEIGHT_FACTOR,