mirror of https://github.com/OpenTTD/OpenTTD
(svn r4432) Make use of map access functions
parent
3e8423f5d8
commit
be4293098a
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "openttd.h"
|
#include "openttd.h"
|
||||||
|
#include "station_map.h"
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
@ -359,7 +360,7 @@ static void FixOldStations(void)
|
||||||
|
|
||||||
FOR_ALL_STATIONS(st) {
|
FOR_ALL_STATIONS(st) {
|
||||||
/* Check if we need to swap width and height for the station */
|
/* Check if we need to swap width and height for the station */
|
||||||
if (st->train_tile != 0 && _m[st->train_tile].m5 & 1) {
|
if (st->train_tile != 0 && GetRailStationAxis(st->train_tile) != AXIS_X) {
|
||||||
swap_byte(&st->trainst_w, &st->trainst_h);
|
swap_byte(&st->trainst_w, &st->trainst_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
17
openttd.c
17
openttd.c
|
@ -22,6 +22,7 @@
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "station.h"
|
#include "station.h"
|
||||||
#include "station_map.h"
|
#include "station_map.h"
|
||||||
|
#include "town_map.h"
|
||||||
#include "tunnel_map.h"
|
#include "tunnel_map.h"
|
||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
#include "viewport.h"
|
#include "viewport.h"
|
||||||
|
@ -1010,9 +1011,9 @@ static void ConvertTownOwner(void)
|
||||||
SetCrossingRoadOwner(tile, OWNER_TOWN);
|
SetCrossingRoadOwner(tile, OWNER_TOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_m[tile].m1 & 0x80) SetTileOwner(tile, OWNER_TOWN);
|
if (GetTileOwner(tile) & 0x80) SetTileOwner(tile, OWNER_TOWN);
|
||||||
} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
|
} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
|
||||||
if (_m[tile].m1 & 0x80) SetTileOwner(tile, OWNER_TOWN);
|
if (GetTileOwner(tile) & 0x80) SetTileOwner(tile, OWNER_TOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1209,7 +1210,7 @@ bool AfterLoadGame(void)
|
||||||
_m[tile].m2 = ClosestTownFromTile(tile,(uint)-1)->index;
|
_m[tile].m2 = ClosestTownFromTile(tile,(uint)-1)->index;
|
||||||
SetTileType(tile, MP_STREET);
|
SetTileType(tile, MP_STREET);
|
||||||
} else {
|
} else {
|
||||||
_m[tile].m2 = 0;
|
SetTownIndex(tile, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
|
} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
|
||||||
|
@ -1277,26 +1278,26 @@ bool AfterLoadGame(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STATION:
|
case MP_STATION:
|
||||||
if (IsRailwayStation(t) && (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail)) AB(_m[t].m3, 0, 4, 1);
|
if (IsRailwayStation(t) && (GetRailType(t) > RAILTYPE_RAIL || make_elrail)) AB(_m[t].m3, 0, 4, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
if (IsTunnel(t)) {
|
if (IsTunnel(t)) {
|
||||||
if (GetTunnelTransportType(t) == TRANSPORT_RAIL) {
|
if (GetTunnelTransportType(t) == TRANSPORT_RAIL) {
|
||||||
if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
|
if (GetRailType(t) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (GetBridgeTransportType(t) == TRANSPORT_RAIL) {
|
if (GetBridgeTransportType(t) == TRANSPORT_RAIL) {
|
||||||
if (IsBridgeRamp(t)) {
|
if (IsBridgeRamp(t)) {
|
||||||
if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
|
if (GetRailType(t) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
|
||||||
} else {
|
} else {
|
||||||
if (GB(_m[t].m3, 4, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 4, 4, 1);
|
if (GetRailTypeOnBridge(t) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 4, 4, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (IsBridgeMiddle(t) &&
|
if (IsBridgeMiddle(t) &&
|
||||||
IsTransportUnderBridge(t) &&
|
IsTransportUnderBridge(t) &&
|
||||||
GetTransportTypeUnderBridge(t) == TRANSPORT_RAIL) {
|
GetTransportTypeUnderBridge(t) == TRANSPORT_RAIL) {
|
||||||
if (GB(_m[t].m3, 0, 4) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
|
if (GetRailType(t) > RAILTYPE_RAIL || make_elrail) AB(_m[t].m3, 0, 4, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue