openttd.c
changeset 3367 3f82c99d42af
parent 3355 a653b8e47f27
child 3431 0d7fa19d0b4a
equal deleted inserted replaced
3366:f182d594964b 3367:3f82c99d42af
    11 #include "tile.h"
    11 #include "tile.h"
    12 #include "void_map.h"
    12 #include "void_map.h"
    13 
    13 
    14 #define VARDEF
    14 #define VARDEF
    15 #include "openttd.h"
    15 #include "openttd.h"
       
    16 #include "bridge_map.h"
    16 #include "functions.h"
    17 #include "functions.h"
    17 #include "mixer.h"
    18 #include "mixer.h"
    18 #include "spritecache.h"
    19 #include "spritecache.h"
    19 #include "gfx.h"
    20 #include "gfx.h"
    20 #include "gfxinit.h"
    21 #include "gfxinit.h"
    21 #include "gui.h"
    22 #include "gui.h"
    22 #include "station.h"
    23 #include "station.h"
       
    24 #include "station_map.h"
       
    25 #include "tunnel_map.h"
    23 #include "vehicle.h"
    26 #include "vehicle.h"
    24 #include "viewport.h"
    27 #include "viewport.h"
    25 #include "window.h"
    28 #include "window.h"
    26 #include "player.h"
    29 #include "player.h"
    27 #include "command.h"
    30 #include "command.h"
  1272 				case MP_STREET:
  1275 				case MP_STREET:
  1273 					if (IsLevelCrossing(t) && (GetRailTypeCrossing(t) > RAILTYPE_RAIL || make_elrail)) AB(_m[t].m4, 0, 4, 1);
  1276 					if (IsLevelCrossing(t) && (GetRailTypeCrossing(t) > RAILTYPE_RAIL || make_elrail)) AB(_m[t].m4, 0, 4, 1);
  1274 					break;
  1277 					break;
  1275 
  1278 
  1276 				case MP_STATION:
  1279 				case MP_STATION:
  1277 					if (_m[t].m5 < 8 && (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail)) AB(_m[t].m3, 0, 4, 1);
  1280 					if (IsRailwayStation(t) && (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail)) AB(_m[t].m3, 0, 4, 1);
  1278 					break;
  1281 					break;
  1279 
  1282 
  1280 				case MP_TUNNELBRIDGE:
  1283 				case MP_TUNNELBRIDGE:
  1281 					if (GB(_m[t].m5, 4, 4) == 0) { // tunnel?
  1284 					if (IsTunnel(t)) {
  1282 						if (GB(_m[t].m5, 2, 2) == 0) { // railway tunnel?
  1285 						if (GetTunnelTransportType(t) == TRANSPORT_RAIL) {
  1283 							if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1286 							if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1284 						}
  1287 						}
  1285 					} else {
  1288 					} else {
  1286 						if (GB(_m[t].m5, 1, 2) == 0) { // railway bridge?
  1289 						if (GetBridgeTransportType(t) == TRANSPORT_RAIL) {
  1287 							if (GB(_m[t].m5, 6, 1) == 0) { // bridge ending?
  1290 							if (IsBridgeRamp(t)) {
  1288 								if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1291 								if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1289 							} else {
  1292 							} else {
  1290 								if (GB(_m[t].m3, 4, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 4, 4, 1);
  1293 								if (GB(_m[t].m3, 4, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 4, 4, 1);
  1291 							}
  1294 							}
  1292 						}
  1295 						}
  1293 						if ((_m[t].m5 & 0xF8) == 0xE0) { // bridge middle part with rails below?
  1296 						if (IsBridgeMiddle(t) &&
       
  1297 								IsTransportUnderBridge(t) &&
       
  1298 								GetTransportTypeUnderBridge(t) == TRANSPORT_RAIL) {
  1294 							if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1299 							if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
  1295 						}
  1300 						}
  1296 					}
  1301 					}
  1297 					break;
  1302 					break;
  1298 
  1303