(svn r3893) - 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.
This commit is contained in:
		@@ -427,7 +427,6 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case MP_STREET: {
 | 
							case MP_STREET: {
 | 
				
			||||||
			uint town;
 | 
					 | 
				
			||||||
			if (!IsLevelCrossing(tile)) return CMD_ERROR;
 | 
								if (!IsLevelCrossing(tile)) return CMD_ERROR;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* This is a crossing, let's check if the direction is correct */
 | 
								/* This is a crossing, let's check if the direction is correct */
 | 
				
			||||||
@@ -436,8 +435,7 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
				
			|||||||
			if (!(flags & DC_EXEC))
 | 
								if (!(flags & DC_EXEC))
 | 
				
			||||||
				return _price.remove_rail;
 | 
									return _price.remove_rail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			town = (_m[tile].m3 == OWNER_TOWN) ? _m[tile].m2 : 0;
 | 
								MakeRoadNormal(tile, _m[tile].m3, GetCrossingRoadBits(tile), _m[tile].m2);
 | 
				
			||||||
			MakeRoadNormal(tile, _m[tile].m3, GetCrossingRoadBits(tile), town);
 | 
					 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -714,7 +714,8 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags)
 | 
				
			|||||||
				if (GB(_m[c].m5, 3, 2) == TRANSPORT_RAIL) {
 | 
									if (GB(_m[c].m5, 3, 2) == TRANSPORT_RAIL) {
 | 
				
			||||||
					MakeRailNormal(c, GetTileOwner(c), _m[c].m5 & 1 ? TRACK_BIT_X : TRACK_BIT_Y, GB(_m[c].m3, 0, 3));
 | 
										MakeRailNormal(c, GetTileOwner(c), _m[c].m5 & 1 ? TRACK_BIT_X : TRACK_BIT_Y, GB(_m[c].m3, 0, 3));
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					MakeRoadNormal(c, GetTileOwner(c), _m[c].m5 & 1 ? ROAD_X : ROAD_Y, 0); // XXX Determine town, missing till now
 | 
										uint town = IsTileOwner(c, OWNER_TOWN) ? ClosestTownFromTile(c, (uint)-1)->index : 0;
 | 
				
			||||||
 | 
										MakeRoadNormal(c, GetTileOwner(c), _m[c].m5 & 1 ? ROAD_X : ROAD_Y, town);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				MarkTileDirtyByTile(c);
 | 
									MarkTileDirtyByTile(c);
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user