Changeset - r10167:afb06a5f5595
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2008-09-18 15:32:20
rubidium@openttd.org
(svn r14359) -Fix [FS#2311]: the ownership of roadtiles was not properly set for very old savegames (including TTD's) making it impossible to remove some pieces of road.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/openttd.cpp
Show inline comments
 
@@ -1178,14 +1178,14 @@ void GameLoop()
 

	
 
static void ConvertTownOwner()
 
{
 
	for (TileIndex tile = 0; tile != MapSize(); tile++) {
 
		switch (GetTileType(tile)) {
 
			case MP_ROAD:
 
				if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HasBit(_m[tile].m4, 7)) {
 
					_m[tile].m4 = OWNER_TOWN;
 
				if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HasBit(_m[tile].m3, 7)) {
 
					_m[tile].m3 = OWNER_TOWN;
 
				}
 
				/* FALLTHROUGH */
 

	
 
			case MP_TUNNELBRIDGE:
 
				if (GetTileOwner(tile) & 0x80) SetTileOwner(tile, OWNER_TOWN);
 
				break;
 
@@ -1562,13 +1562,13 @@ bool AfterLoadGame()
 
					_m[t].m4 = _m[t].m2;
 
					SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
 
					break;
 

	
 
				case MP_ROAD:
 
					_m[t].m4 |= (_m[t].m2 << 4);
 
					if (IsTileOwner(t, OWNER_TOWN)) {
 
					if ((GB(_m[t].m5, 4, 2) == ROAD_TILE_CROSSING ? (Owner)_m[t].m3 : GetTileOwner(t)) == OWNER_TOWN) {
 
						SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
 
					} else {
 
						SetTownIndex(t, 0);
 
					}
 
					break;
 

	
0 comments (0 inline, 0 general)