openttd.c
changeset 2049 ad0d49c916d4
parent 2033 1eb15b79b6f3
child 2051 44b6b091beb3
equal deleted inserted replaced
2048:430522aa954c 2049:ad0d49c916d4
  1200 {
  1200 {
  1201 	TileIndex tile;
  1201 	TileIndex tile;
  1202 
  1202 
  1203 	for (tile = 0; tile != MapSize(); tile++) {
  1203 	for (tile = 0; tile != MapSize(); tile++) {
  1204 		if (IsTileType(tile, MP_STREET)) {
  1204 		if (IsTileType(tile, MP_STREET)) {
  1205 			if (IsLevelCrossing(tile) && _map3_lo[tile] & 0x80)
  1205 			if (IsLevelCrossing(tile) && _m[tile].m3 & 0x80)
  1206 				_map3_lo[tile] = OWNER_TOWN;
  1206 				_m[tile].m3 = OWNER_TOWN;
  1207 
  1207 
  1208 			if (_map_owner[tile] & 0x80) SetTileOwner(tile, OWNER_TOWN);
  1208 			if (_m[tile].owner & 0x80) SetTileOwner(tile, OWNER_TOWN);
  1209 		} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
  1209 		} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
  1210 			if (_map_owner[tile] & 0x80) SetTileOwner(tile, OWNER_TOWN);
  1210 			if (_m[tile].owner & 0x80) SetTileOwner(tile, OWNER_TOWN);
  1211 		}
  1211 		}
  1212 	}
  1212 	}
  1213 }
  1213 }
  1214 
  1214 
  1215 // before savegame version 4, the name of the company determined if it existed
  1215 // before savegame version 4, the name of the company determined if it existed
  1399 	}
  1399 	}
  1400 
  1400 
  1401 	if (version <= 0x600) {
  1401 	if (version <= 0x600) {
  1402 		BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) {
  1402 		BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) {
  1403 			if (IsTileType(tile, MP_HOUSE)) {
  1403 			if (IsTileType(tile, MP_HOUSE)) {
  1404 				_map3_hi[tile] = _map2[tile];
  1404 				_m[tile].m4 = _m[tile].m2;
  1405 				//XXX magic
  1405 				//XXX magic
  1406 				SetTileType(tile, MP_VOID);
  1406 				SetTileType(tile, MP_VOID);
  1407 				_map2[tile] = ClosestTownFromTile(tile,(uint)-1)->index;
  1407 				_m[tile].m2 = ClosestTownFromTile(tile,(uint)-1)->index;
  1408 				SetTileType(tile, MP_HOUSE);
  1408 				SetTileType(tile, MP_HOUSE);
  1409 			} else if (IsTileType(tile, MP_STREET)) {
  1409 			} else if (IsTileType(tile, MP_STREET)) {
  1410 				//XXX magic
  1410 				//XXX magic
  1411 				_map3_hi[tile] |= (_map2[tile] << 4);
  1411 				_m[tile].m4 |= (_m[tile].m2 << 4);
  1412 				if (IsTileOwner(tile, OWNER_TOWN)) {
  1412 				if (IsTileOwner(tile, OWNER_TOWN)) {
  1413 					SetTileType(tile, MP_VOID);
  1413 					SetTileType(tile, MP_VOID);
  1414 					_map2[tile] = ClosestTownFromTile(tile,(uint)-1)->index;
  1414 					_m[tile].m2 = ClosestTownFromTile(tile,(uint)-1)->index;
  1415 					SetTileType(tile, MP_STREET);
  1415 					SetTileType(tile, MP_STREET);
  1416 				} else {
  1416 				} else {
  1417 					_map2[tile] = 0;
  1417 					_m[tile].m2 = 0;
  1418 				}
  1418 				}
  1419 			}
  1419 			}
  1420 		} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
  1420 		} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
  1421 	}
  1421 	}
  1422 
  1422 
  1427 		}
  1427 		}
  1428 	}
  1428 	}
  1429 
  1429 
  1430 	if (version < 0xF00) {
  1430 	if (version < 0xF00) {
  1431 		BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) {
  1431 		BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) {
  1432 			if (IsTileType(tile, MP_RAILWAY) && HasSignals(tile) && HASBIT(_map3_hi[tile], 2)) {
  1432 			if (IsTileType(tile, MP_RAILWAY) && HasSignals(tile) && HASBIT(_m[tile].m4, 2)) {
  1433 				CLRBIT(_map3_hi[tile], 2);
  1433 				CLRBIT(_m[tile].m4, 2);
  1434 				SETBIT(_map3_hi[tile], 3);
  1434 				SETBIT(_m[tile].m4, 3);
  1435 			}
  1435 			}
  1436 		} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
  1436 		} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
  1437 	}
  1437 	}
  1438 
  1438 
  1439 	return true;
  1439 	return true;