(svn r3967) - Fix: Properly set back the owner of a crossing/road-under bridge after removing it. For crossings we can always use .m2 because it is already 0 when not owned by a town. Backport of r3876, r3893 from trunk 0.4.5
authorDarkvater
Sat, 18 Mar 2006 16:00:02 +0000
branch0.4.5
changeset 9936 53d4d464b85c
parent 9935 ec400e72db76
child 9937 0486510e8431
(svn r3967) - Fix: Properly set back the owner of a crossing/road-under bridge after removing it. For crossings we can always use .m2 because it is already 0 when not owned by a town. Backport of r3876, r3893 from trunk
rail_cmd.c
tunnelbridge_cmd.c
--- a/rail_cmd.c	Sat Mar 18 15:51:04 2006 +0000
+++ b/rail_cmd.c	Sat Mar 18 16:00:02 2006 +0000
@@ -451,7 +451,6 @@
 
 			_m[tile].m5 = m5;
 			SetTileOwner(tile, _m[tile].m3);
-			_m[tile].m2 = 0;
 			break;
 
 		case MP_RAILWAY:
--- a/tunnelbridge_cmd.c	Sat Mar 18 15:51:04 2006 +0000
+++ b/tunnelbridge_cmd.c	Sat Mar 18 16:00:02 2006 +0000
@@ -803,6 +803,8 @@
 			m5 = _m[c].m5;
 
 			if (m5 & 0x40) {
+				uint town = IsTileOwner(c, OWNER_TOWN) ? ClosestTownFromTile(c, (uint)-1)->index : 0;
+
 				if (m5 & 0x20) {
 					static const uint16 _new_data_table[] = {0x1002, 0x1001, 0x2005, 0x200A, 0, 0, 0, 0};
 					new_data = _new_data_table[((m5 & 0x18) >> 2) | (m5 & 1)];
@@ -813,7 +815,7 @@
 
 				SetTileType(c, new_data >> 12);
 				_m[c].m5 = (byte)new_data;
-				_m[c].m2 = 0;
+				_m[c].m2 = town;
 				_m[c].m4 &= 0x0F;
 
 				MarkTileDirtyByTile(c);