openttd.c
changeset 3558 9a3e12615b1c
parent 3431 e3b4bc9c4375
child 3580 14bf6e7715c8
equal deleted inserted replaced
3557:1e9867319bce 3558:9a3e12615b1c
    20 #include "gfx.h"
    20 #include "gfx.h"
    21 #include "gfxinit.h"
    21 #include "gfxinit.h"
    22 #include "gui.h"
    22 #include "gui.h"
    23 #include "station.h"
    23 #include "station.h"
    24 #include "station_map.h"
    24 #include "station_map.h"
       
    25 #include "town_map.h"
    25 #include "tunnel_map.h"
    26 #include "tunnel_map.h"
    26 #include "vehicle.h"
    27 #include "vehicle.h"
    27 #include "viewport.h"
    28 #include "viewport.h"
    28 #include "window.h"
    29 #include "window.h"
    29 #include "player.h"
    30 #include "player.h"
  1008 		if (IsTileType(tile, MP_STREET)) {
  1009 		if (IsTileType(tile, MP_STREET)) {
  1009 			if (IsLevelCrossing(tile) && GetCrossingRoadOwner(tile) & 0x80) {
  1010 			if (IsLevelCrossing(tile) && GetCrossingRoadOwner(tile) & 0x80) {
  1010 				SetCrossingRoadOwner(tile, OWNER_TOWN);
  1011 				SetCrossingRoadOwner(tile, OWNER_TOWN);
  1011 			}
  1012 			}
  1012 
  1013 
  1013 			if (_m[tile].m1 & 0x80) SetTileOwner(tile, OWNER_TOWN);
  1014 			if (GetTileOwner(tile) & 0x80) SetTileOwner(tile, OWNER_TOWN);
  1014 		} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
  1015 		} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
  1015 			if (_m[tile].m1 & 0x80) SetTileOwner(tile, OWNER_TOWN);
  1016 			if (GetTileOwner(tile) & 0x80) SetTileOwner(tile, OWNER_TOWN);
  1016 		}
  1017 		}
  1017 	}
  1018 	}
  1018 }
  1019 }
  1019 
  1020 
  1020 // before savegame version 4, the name of the company determined if it existed
  1021 // before savegame version 4, the name of the company determined if it existed
  1207 				if (IsTileOwner(tile, OWNER_TOWN)) {
  1208 				if (IsTileOwner(tile, OWNER_TOWN)) {
  1208 					SetTileType(tile, MP_VOID);
  1209 					SetTileType(tile, MP_VOID);
  1209 					_m[tile].m2 = ClosestTownFromTile(tile,(uint)-1)->index;
  1210 					_m[tile].m2 = ClosestTownFromTile(tile,(uint)-1)->index;
  1210 					SetTileType(tile, MP_STREET);
  1211 					SetTileType(tile, MP_STREET);
  1211 				} else {
  1212 				} else {
  1212 					_m[tile].m2 = 0;
  1213 					SetTownIndex(tile, 0);
  1213 				}
  1214 				}
  1214 			}
  1215 			}
  1215 		} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
  1216 		} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
  1216 	}
  1217 	}
  1217 
  1218 
  1275 				case MP_STREET:
  1276 				case MP_STREET:
  1276 					if (IsLevelCrossing(t) && (GetRailTypeCrossing(t) > RAILTYPE_RAIL || make_elrail)) AB(_m[t].m4, 0, 4, 1);
  1277 					if (IsLevelCrossing(t) && (GetRailTypeCrossing(t) > RAILTYPE_RAIL || make_elrail)) AB(_m[t].m4, 0, 4, 1);
  1277 					break;
  1278 					break;
  1278 
  1279 
  1279 				case MP_STATION:
  1280 				case MP_STATION:
  1280 					if (IsRailwayStation(t) && (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail)) AB(_m[t].m3, 0, 4, 1);
  1281 					if (IsRailwayStation(t) && (GetRailType(t) > RAILTYPE_RAIL || make_elrail)) AB(_m[t].m3, 0, 4, 1);
  1281 					break;
  1282 					break;
  1282 
  1283 
  1283 				case MP_TUNNELBRIDGE:
  1284 				case MP_TUNNELBRIDGE:
  1284 					if (IsTunnel(t)) {
  1285 					if (IsTunnel(t)) {
  1285 						if (GetTunnelTransportType(t) == TRANSPORT_RAIL) {
  1286 						if (GetTunnelTransportType(t) == TRANSPORT_RAIL) {
  1286 							if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1287 							if (GetRailType(t) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1287 						}
  1288 						}
  1288 					} else {
  1289 					} else {
  1289 						if (GetBridgeTransportType(t) == TRANSPORT_RAIL) {
  1290 						if (GetBridgeTransportType(t) == TRANSPORT_RAIL) {
  1290 							if (IsBridgeRamp(t)) {
  1291 							if (IsBridgeRamp(t)) {
  1291 								if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1292 								if (GetRailType(t) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1292 							} else {
  1293 							} else {
  1293 								if (GB(_m[t].m3, 4, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 4, 4, 1);
  1294 								if (GetRailTypeOnBridge(t) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 4, 4, 1);
  1294 							}
  1295 							}
  1295 						}
  1296 						}
  1296 						if (IsBridgeMiddle(t) &&
  1297 						if (IsBridgeMiddle(t) &&
  1297 								IsTransportUnderBridge(t) &&
  1298 								IsTransportUnderBridge(t) &&
  1298 								GetTransportTypeUnderBridge(t) == TRANSPORT_RAIL) {
  1299 								GetTransportTypeUnderBridge(t) == TRANSPORT_RAIL) {
  1299 							if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1300 							if (GetRailType(t) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1300 						}
  1301 						}
  1301 					}
  1302 					}
  1302 					break;
  1303 					break;
  1303 
  1304 
  1304 				default:
  1305 				default: