station_map.h
author tron
Sun, 21 May 2006 13:51:36 +0000
changeset 3884 793081f80381
parent 3882 c2e3e12e71d6
child 3900 2c84ed52709d
permissions -rw-r--r--
(svn r4940) Remove the dubious feature of remembering the last built depot. It serves no real purpose except causing confusion
3315
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
     1
/* $Id$ */
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
     2
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
     3
#ifndef STATION_MAP_H
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
     4
#define STATION_MAP_H
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
     5
3315
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
     6
#include "station.h"
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
     7
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
     8
typedef byte StationGfx;
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
     9
3315
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
    10
static inline StationID GetStationIndex(TileIndex t)
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
    11
{
3369
cab209754317 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3360
diff changeset
    12
	assert(IsTileType(t, MP_STATION));
3315
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
    13
	return (StationID)_m[t].m2;
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
    14
}
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
    15
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
    16
static inline Station* GetStationByTile(TileIndex t)
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
    17
{
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
    18
	return GetStation(GetStationIndex(t));
c9d989783c55 (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
diff changeset
    19
}
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    20
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    21
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    22
enum {
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    23
	GFX_RAILWAY_BASE              =   0,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    24
	GFX_AIRPORT_BASE              =   8,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    25
	GFX_RADAR_LARGE_FIRST         =  39,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    26
	GFX_RADAR_LARGE_LAST          =  50,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    27
	GFX_WINDSACK_FIRST            =  58,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    28
	GFX_WINDSACK_LAST             =  61,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    29
	GFX_TRUCK_BASE                =  67,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    30
	GFX_BUS_BASE                  =  71,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    31
	GFX_OILRIG_BASE               =  75,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    32
	GFX_DOCK_BASE                 =  76,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    33
	GFX_DOCK_BASE_WATER_PART      =  80,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    34
	GFX_BUOY_BASE                 =  82,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    35
	GFX_AIRPORT_BASE_EXTENDED     =  83,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    36
	GFX_RADAR_INTERNATIONAL_FIRST =  90,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    37
	GFX_RADAR_INTERNATIONAL_LAST  = 101,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    38
	GFX_RADAR_METROPOLITAN_FIRST  = 102,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    39
	GFX_RADAR_METROPOLITAN_LAST   = 113,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    40
	GFX_BASE_END                  = 155
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    41
};
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    42
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    43
enum {
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    44
	RAILWAY_SIZE = GFX_AIRPORT_BASE - GFX_RAILWAY_BASE,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    45
	AIRPORT_SIZE = GFX_TRUCK_BASE - GFX_AIRPORT_BASE,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    46
	TRUCK_SIZE = GFX_BUS_BASE - GFX_TRUCK_BASE,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    47
	BUS_SIZE = GFX_OILRIG_BASE - GFX_BUS_BASE,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    48
	DOCK_SIZE_TOTAL = GFX_BUOY_BASE - GFX_DOCK_BASE,
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    49
	AIRPORT_SIZE_EXTENDED = GFX_BASE_END - GFX_AIRPORT_BASE_EXTENDED
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    50
};
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    51
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    52
typedef enum HangarTiles {
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    53
	HANGAR_TILE_0 = 32,
3337
3a9b086c6369 (svn r4119) There's one more possible hangar tile. Check for this in IsHangar(), too
tron
parents: 3334
diff changeset
    54
	HANGAR_TILE_1 = 65,
3a9b086c6369 (svn r4119) There's one more possible hangar tile. Check for this in IsHangar(), too
tron
parents: 3334
diff changeset
    55
	HANGAR_TILE_2 = 86
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    56
} HangarTiles;
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    57
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    58
typedef enum StationType {
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    59
	STATION_RAIL,
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    60
	STATION_AIRPORT,
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    61
	STATION_TRUCK,
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    62
	STATION_BUS,
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    63
	STATION_OILRIG,
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    64
	STATION_DOCK,
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    65
	STATION_BUOY
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    66
} StationType;
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    67
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    68
StationType GetStationType(TileIndex);
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    69
3360
4fddbd48d36c (svn r4155) -Changed GetRoadStopByTile to use GetStationType and moved it. TODO: unify RS_TRUCK and STATION_TRUCK (same for bus)
celestar
parents: 3353
diff changeset
    70
static inline RoadStopType GetRoadStopType(TileIndex t)
4fddbd48d36c (svn r4155) -Changed GetRoadStopByTile to use GetStationType and moved it. TODO: unify RS_TRUCK and STATION_TRUCK (same for bus)
celestar
parents: 3353
diff changeset
    71
{
4fddbd48d36c (svn r4155) -Changed GetRoadStopByTile to use GetStationType and moved it. TODO: unify RS_TRUCK and STATION_TRUCK (same for bus)
celestar
parents: 3353
diff changeset
    72
	assert(GetStationType(t) == STATION_TRUCK || GetStationType(t) == STATION_BUS);
4fddbd48d36c (svn r4155) -Changed GetRoadStopByTile to use GetStationType and moved it. TODO: unify RS_TRUCK and STATION_TRUCK (same for bus)
celestar
parents: 3353
diff changeset
    73
	return GetStationType(t) == STATION_TRUCK ? RS_TRUCK : RS_BUS;
4fddbd48d36c (svn r4155) -Changed GetRoadStopByTile to use GetStationType and moved it. TODO: unify RS_TRUCK and STATION_TRUCK (same for bus)
celestar
parents: 3353
diff changeset
    74
}
4fddbd48d36c (svn r4155) -Changed GetRoadStopByTile to use GetStationType and moved it. TODO: unify RS_TRUCK and STATION_TRUCK (same for bus)
celestar
parents: 3353
diff changeset
    75
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    76
static inline StationGfx GetStationGfx(TileIndex t)
3540
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
    77
{
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
    78
	assert(IsTileType(t, MP_STATION));
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
    79
	return _m[t].m5;
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
    80
}
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
    81
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    82
static inline void SetStationGfx(TileIndex t, StationGfx gfx)
3540
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
    83
{
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
    84
	assert(IsTileType(t, MP_STATION));
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
    85
	_m[t].m5 = gfx;
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
    86
}
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
    87
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    88
static inline bool IsRailwayStation(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    89
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
    90
	return GetStationGfx(t) < GFX_RAILWAY_BASE + RAILWAY_SIZE;
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    91
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    92
3442
41d828e2d5ab (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
celestar
parents: 3404
diff changeset
    93
static inline bool IsRailwayStationTile(TileIndex t)
41d828e2d5ab (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
celestar
parents: 3404
diff changeset
    94
{
41d828e2d5ab (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
celestar
parents: 3404
diff changeset
    95
	return IsTileType(t, MP_STATION) && IsRailwayStation(t);
41d828e2d5ab (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
celestar
parents: 3404
diff changeset
    96
}
41d828e2d5ab (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
celestar
parents: 3404
diff changeset
    97
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    98
static inline bool IsHangar(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
    99
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   100
	StationGfx gfx = GetStationGfx(t);
3337
3a9b086c6369 (svn r4119) There's one more possible hangar tile. Check for this in IsHangar(), too
tron
parents: 3334
diff changeset
   101
	return
3540
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
   102
		gfx == HANGAR_TILE_0 ||
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
   103
		gfx == HANGAR_TILE_1 ||
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
   104
		gfx == HANGAR_TILE_2;
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   105
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   106
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   107
static inline bool IsAirport(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   108
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   109
	StationGfx gfx = GetStationGfx(t);
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   110
	return
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   111
		(IS_BYTE_INSIDE(gfx, GFX_AIRPORT_BASE, GFX_AIRPORT_BASE + AIRPORT_SIZE)) ||
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   112
		(IS_BYTE_INSIDE(gfx, GFX_AIRPORT_BASE_EXTENDED, GFX_AIRPORT_BASE_EXTENDED + AIRPORT_SIZE_EXTENDED));
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   113
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   114
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   115
static inline bool IsTruckStop(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   116
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   117
	return IS_BYTE_INSIDE(GetStationGfx(t), GFX_TRUCK_BASE, GFX_TRUCK_BASE + TRUCK_SIZE);
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   118
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   119
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   120
static inline bool IsBusStop(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   121
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   122
	return IS_BYTE_INSIDE(GetStationGfx(t), GFX_BUS_BASE, GFX_BUS_BASE + BUS_SIZE);
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   123
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   124
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   125
static inline bool IsRoadStop(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   126
{
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   127
	return IsTruckStop(t) || IsBusStop(t);
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   128
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   129
3404
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   130
static inline bool IsRoadStopTile(TileIndex t)
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   131
{
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   132
	return IsTileType(t, MP_STATION) && IsRoadStop(t);
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   133
}
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   134
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   135
/**
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   136
 * Gets the direction the road stop entrance points towards.
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   137
 */
3540
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
   138
static inline DiagDirection GetRoadStopDir(TileIndex t)
3404
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   139
{
3540
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
   140
	assert(IsRoadStopTile(t));
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   141
	return (GetStationGfx(t) - GFX_TRUCK_BASE) & 3;
3404
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   142
}
eb8ebfe5df67 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents: 3371
diff changeset
   143
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   144
static inline bool IsOilRig(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   145
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   146
	return GetStationGfx(t) == GFX_OILRIG_BASE;
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   147
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   148
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   149
static inline bool IsDock(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   150
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   151
	return IS_BYTE_INSIDE(GetStationGfx(t), GFX_DOCK_BASE, GFX_DOCK_BASE + DOCK_SIZE_TOTAL);
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   152
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   153
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   154
static inline bool IsBuoy_(TileIndex t) // XXX _ due to naming conflict
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   155
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   156
	return GetStationGfx(t) == GFX_BUOY_BASE;
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   157
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   158
3442
41d828e2d5ab (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
celestar
parents: 3404
diff changeset
   159
static inline bool IsBuoyTile(TileIndex t)
41d828e2d5ab (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
celestar
parents: 3404
diff changeset
   160
{
41d828e2d5ab (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
celestar
parents: 3404
diff changeset
   161
	return IsTileType(t, MP_STATION) && IsBuoy_(t);
41d828e2d5ab (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
celestar
parents: 3404
diff changeset
   162
}
41d828e2d5ab (svn r4272) -Codechange: Moved the map-accessing stuff from station.h into station_map.h
celestar
parents: 3404
diff changeset
   163
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   164
3338
7cff208f0446 (svn r4120) Use the new station functions where appropriate
tron
parents: 3337
diff changeset
   165
static inline bool IsHangarTile(TileIndex t)
7cff208f0446 (svn r4120) Use the new station functions where appropriate
tron
parents: 3337
diff changeset
   166
{
7cff208f0446 (svn r4120) Use the new station functions where appropriate
tron
parents: 3337
diff changeset
   167
	return IsTileType(t, MP_STATION) && IsHangar(t);
7cff208f0446 (svn r4120) Use the new station functions where appropriate
tron
parents: 3337
diff changeset
   168
}
7cff208f0446 (svn r4120) Use the new station functions where appropriate
tron
parents: 3337
diff changeset
   169
7cff208f0446 (svn r4120) Use the new station functions where appropriate
tron
parents: 3337
diff changeset
   170
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   171
static inline Axis GetRailStationAxis(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   172
{
3541
de660582cff4 (svn r4404) Reverted part of r4403. GetRailStationAxis need assertion on IsRailwayStation. Thanks glx for spotting it
belugas
parents: 3540
diff changeset
   173
	assert(IsRailwayStation(t));
3540
3bcf5348842b (svn r4403) CodeChange : Add GetStationGfx and make use of [G|S]etStationGfx accessors. Also, use GetStationGfx instead of directly accessing the map for functions in station_map.h
belugas
parents: 3474
diff changeset
   174
	return HASBIT(GetStationGfx(t), 0) ? AXIS_Y : AXIS_X;
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   175
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   176
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   177
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   178
static inline Track GetRailStationTrack(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   179
{
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   180
	return GetRailStationAxis(t) == AXIS_X ? TRACK_X : TRACK_Y;
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   181
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   182
3444
80cfd2f70922 (svn r4275) -Codechange: Use of map accessor functions inside station_map.h when possible
celestar
parents: 3443
diff changeset
   183
static inline bool IsCompatibleTrainStationTile(TileIndex t1, TileIndex t2)
80cfd2f70922 (svn r4275) -Codechange: Use of map accessor functions inside station_map.h when possible
celestar
parents: 3443
diff changeset
   184
{
80cfd2f70922 (svn r4275) -Codechange: Use of map accessor functions inside station_map.h when possible
celestar
parents: 3443
diff changeset
   185
	assert(IsRailwayStationTile(t2));
80cfd2f70922 (svn r4275) -Codechange: Use of map accessor functions inside station_map.h when possible
celestar
parents: 3443
diff changeset
   186
	return
80cfd2f70922 (svn r4275) -Codechange: Use of map accessor functions inside station_map.h when possible
celestar
parents: 3443
diff changeset
   187
		IsRailwayStationTile(t1) &&
80cfd2f70922 (svn r4275) -Codechange: Use of map accessor functions inside station_map.h when possible
celestar
parents: 3443
diff changeset
   188
		IsCompatibleRail(GetRailType(t1), GetRailType(t2)) &&
3766
fc2dea6ef369 (svn r4758) - Newstations: add support for 'blocked' station tiles, which no train can pass.
peter1138
parents: 3742
diff changeset
   189
		GetRailStationAxis(t1) == GetRailStationAxis(t2) &&
fc2dea6ef369 (svn r4758) - Newstations: add support for 'blocked' station tiles, which no train can pass.
peter1138
parents: 3742
diff changeset
   190
		!IsStationTileBlocked(t1);
3444
80cfd2f70922 (svn r4275) -Codechange: Use of map accessor functions inside station_map.h when possible
celestar
parents: 3443
diff changeset
   191
}
80cfd2f70922 (svn r4275) -Codechange: Use of map accessor functions inside station_map.h when possible
celestar
parents: 3443
diff changeset
   192
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   193
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   194
static inline DiagDirection GetDockDirection(TileIndex t)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   195
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   196
	StationGfx gfx = GetStationGfx(t);
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   197
	assert(gfx < GFX_DOCK_BASE_WATER_PART);
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   198
	return (DiagDirection)(gfx - GFX_DOCK_BASE);
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   199
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   200
3472
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   201
static inline TileIndexDiffC GetDockOffset(TileIndex t)
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   202
{
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   203
	static const TileIndexDiffC buoy_offset = {0, 0};
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   204
	static const TileIndexDiffC oilrig_offset = {2, 0};
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   205
	static const TileIndexDiffC dock_offset[DIAGDIR_END] = {
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   206
		{-2,  0},
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   207
		{ 0,  2},
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   208
		{ 2,  0},
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   209
		{ 0, -2},
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   210
	};
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   211
	assert(IsTileType(t, MP_STATION));
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   212
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   213
	if (IsBuoy_(t)) return buoy_offset;
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   214
	if (IsOilRig(t)) return oilrig_offset;
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   215
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   216
	assert(IsDock(t));
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   217
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   218
	return dock_offset[GetDockDirection(t)];
04173b5ed0d2 (svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
celestar
parents: 3444
diff changeset
   219
}
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   220
3568
c60d7aceed1a (svn r4450) - NewStations, rename *CustomStationSprite() to *CustomStationSpecIndex() to reflect their use, and alter the test for determining if a station has customised graphics.
peter1138
parents: 3545
diff changeset
   221
static inline bool IsCustomStationSpecIndex(TileIndex t)
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   222
{
3369
cab209754317 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3360
diff changeset
   223
	assert(IsTileType(t, MP_STATION));
3568
c60d7aceed1a (svn r4450) - NewStations, rename *CustomStationSprite() to *CustomStationSpecIndex() to reflect their use, and alter the test for determining if a station has customised graphics.
peter1138
parents: 3545
diff changeset
   224
	return _m[t].m4 != 0;
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   225
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   226
3568
c60d7aceed1a (svn r4450) - NewStations, rename *CustomStationSprite() to *CustomStationSpecIndex() to reflect their use, and alter the test for determining if a station has customised graphics.
peter1138
parents: 3545
diff changeset
   227
static inline void SetCustomStationSpecIndex(TileIndex t, byte specindex)
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   228
{
3369
cab209754317 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3360
diff changeset
   229
	assert(IsTileType(t, MP_STATION));
3568
c60d7aceed1a (svn r4450) - NewStations, rename *CustomStationSprite() to *CustomStationSpecIndex() to reflect their use, and alter the test for determining if a station has customised graphics.
peter1138
parents: 3545
diff changeset
   230
	_m[t].m4 = specindex;
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   231
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   232
3568
c60d7aceed1a (svn r4450) - NewStations, rename *CustomStationSprite() to *CustomStationSpecIndex() to reflect their use, and alter the test for determining if a station has customised graphics.
peter1138
parents: 3545
diff changeset
   233
static inline uint GetCustomStationSpecIndex(TileIndex t)
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   234
{
3369
cab209754317 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3360
diff changeset
   235
	assert(IsTileType(t, MP_STATION));
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   236
	return _m[t].m4;
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   237
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   238
3742
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   239
static inline void SetStationTileRandomBits(TileIndex t, byte random_bits)
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   240
{
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   241
	assert(IsTileType(t, MP_STATION));
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   242
	SB(_m[t].m3, 4, 4, random_bits);
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   243
}
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   244
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   245
static inline byte GetStationTileRandomBits(TileIndex t)
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   246
{
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   247
	assert(IsTileType(t, MP_STATION));
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   248
	return GB(_m[t].m3, 4, 4);
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   249
}
c5ef7a92daa5 (svn r4724) - Newstations: Add per-tile random data for station tiles.
peter1138
parents: 3568
diff changeset
   250
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   251
static inline void MakeStation(TileIndex t, Owner o, StationID sid, byte m5)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   252
{
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   253
	SetTileType(t, MP_STATION);
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   254
	SetTileOwner(t, o);
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   255
	_m[t].m2 = sid;
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   256
	_m[t].m3 = 0;
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   257
	_m[t].m4 = 0;
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   258
	_m[t].m5 = m5;
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   259
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   260
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   261
static inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   262
{
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   263
	MakeStation(t, o, sid, section + a);
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   264
	SetRailType(t, rt);
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   265
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   266
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   267
static inline void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStopType rst, DiagDirection d)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   268
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   269
	MakeStation(t, o, sid, (rst == RS_BUS ? GFX_BUS_BASE : GFX_TRUCK_BASE) + d);
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   270
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   271
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   272
static inline void MakeAirport(TileIndex t, Owner o, StationID sid, byte section)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   273
{
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   274
	MakeStation(t, o, sid, section);
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   275
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   276
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   277
static inline void MakeBuoy(TileIndex t, StationID sid)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   278
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   279
	MakeStation(t, OWNER_NONE, sid, GFX_BUOY_BASE);
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   280
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   281
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   282
static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   283
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   284
	MakeStation(t, o, sid, GFX_DOCK_BASE + d);
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   285
	MakeStation(t + TileOffsByDir(d), o, sid, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d));
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   286
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   287
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   288
static inline void MakeOilrig(TileIndex t, StationID sid)
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   289
{
3545
b08ce1bbb589 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3541
diff changeset
   290
	MakeStation(t, OWNER_NONE, sid, GFX_OILRIG_BASE);
3334
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   291
}
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   292
2999d2ddc0f9 (svn r4113) Moved all relevant map functions for stations to station_map.[ch]
celestar
parents: 3315
diff changeset
   293
#endif