(svn r8014) -Codechange (r7573): When a tile is cleared, empty the general purpose bits in
authormaedhros
Tue, 09 Jan 2007 21:43:32 +0000
changeset 5577 1e6089c02fd0
parent 5576 b19c640dfc37
child 5578 5f898d0bfebd
(svn r8014) -Codechange (r7573): When a tile is cleared, empty the general purpose bits in
extra as well, unless they are (or could be) used for bridges. This means these
bits don't have to be cleared seperately when non-bridgeable tiles are removed.
src/clear_map.h
src/terraform_gui.c
src/tree_cmd.c
--- a/src/clear_map.h	Tue Jan 09 21:25:13 2007 +0000
+++ b/src/clear_map.h	Tue Jan 09 21:43:32 2007 +0000
@@ -5,6 +5,7 @@
 
 #include "macros.h"
 #include "tile.h"
+#include "bridge_map.h"
 
 /* ground type, m5 bits 2...4
  * valid densities (bits 0...1) in comments after the enum
@@ -123,12 +124,17 @@
 
 static inline void MakeClear(TileIndex t, ClearGround g, uint density)
 {
+	/* If this is a non-bridgeable tile, clear the bridge bits while the rest
+	 * of the tile information is still here. */
+	if (!MayHaveBridgeAbove(t)) SB(_m[t].extra, 6, 2, 0);
+
 	SetTileType(t, MP_CLEAR);
 	SetTileOwner(t, OWNER_NONE);
 	_m[t].m2 = 0;
 	_m[t].m3 = 0;
 	_m[t].m4 = 0 << 5 | 0 << 2;
 	SetClearGroundDensity(t, g, density);
+	SB(_m[t].extra, 2, 4, 0);
 }
 
 
--- a/src/terraform_gui.c	Tue Jan 09 21:25:13 2007 +0000
+++ b/src/terraform_gui.c	Tue Jan 09 21:43:32 2007 +0000
@@ -76,12 +76,8 @@
 	BEGIN_TILE_LOOP(tile, size_x, size_y, TileXY(sx, sy)) {
 		switch (GetTileType(tile)) {
 			case MP_CLEAR:
-				MakeClear(tile, CLEAR_ROCKS, 3);
-				break;
-
 			case MP_TREES:
 				MakeClear(tile, CLEAR_ROCKS, 3);
-				ClearBridgeMiddle(tile);
 				break;
 
 			default: continue;
--- a/src/tree_cmd.c	Tue Jan 09 21:25:13 2007 +0000
+++ b/src/tree_cmd.c	Tue Jan 09 21:43:32 2007 +0000
@@ -587,7 +587,6 @@
 					case TREE_GROUND_ROUGH: MakeClear(tile, CLEAR_ROUGH, 3); break;
 					default: MakeClear(tile, CLEAR_SNOW, GetTreeDensity(tile)); break;
 				}
-				ClearBridgeMiddle(tile);
 			}
 			break;