From 5de94db9df56a3301935c26ebcf2542fa51929e3 Mon Sep 17 00:00:00 2001 From: Darkvater Date: Sat, 18 Mar 2006 16:00:02 +0000 Subject: [PATCH] (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 | 1 - tunnelbridge_cmd.c | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rail_cmd.c b/rail_cmd.c index 842ace82d9..ab6ca5a59d 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -451,7 +451,6 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2) _m[tile].m5 = m5; SetTileOwner(tile, _m[tile].m3); - _m[tile].m2 = 0; break; case MP_RAILWAY: diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index fe6dae18d8..613710aeda 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -803,6 +803,8 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags) 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 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags) 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);