summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--disaster_cmd.c2
-rw-r--r--industry_cmd.c4
-rw-r--r--landscape.c18
-rw-r--r--order_gui.c5
-rw-r--r--road_cmd.c2
-rw-r--r--smallmap_gui.c12
-rw-r--r--station_cmd.c2
-rw-r--r--tile.h22
-rw-r--r--train_cmd.c2
-rw-r--r--ttd.h14
-rw-r--r--vehicle.c4
-rw-r--r--water_cmd.c4
12 files changed, 47 insertions, 44 deletions
diff --git a/disaster_cmd.c b/disaster_cmd.c
index bd3955a9c..f31487de1 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -19,7 +19,7 @@ static void DisasterClearSquare(TileIndex tile)
if (!EnsureNoVehicle(tile))
return;
- switch (TileType(tile)) {
+ switch (GetTileType(tile)) {
case MP_RAILWAY:
if (IS_HUMAN_PLAYER(_map_owner[tile])) DoClearSquare(tile);
break;
diff --git a/industry_cmd.c b/industry_cmd.c
index 9836d16f7..149d7fc68 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -857,7 +857,7 @@ static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5,
static bool IsBadFarmFieldTile(TileIndex tile)
{
- switch (TileType(tile)) {
+ switch (GetTileType(tile)) {
case MP_CLEAR: {
byte m5 = _map5[tile] & 0x1C;
return m5 == 0xC || m5 == 0x10;
@@ -873,7 +873,7 @@ static bool IsBadFarmFieldTile(TileIndex tile)
static bool IsBadFarmFieldTile2(TileIndex tile)
{
- switch (TileType(tile)) {
+ switch (GetTileType(tile)) {
case MP_CLEAR: {
byte m5 = _map5[tile] & 0x1C;
return m5 == 0x10;
diff --git a/landscape.c b/landscape.c
index 993badea8..16694f137 100644
--- a/landscape.c
+++ b/landscape.c
@@ -87,7 +87,7 @@ void FindLandscapeHeightByTile(TileInfo *ti, TileIndex tile)
ti->tile = tile;
ti->map5 = _map5[tile];
- ti->type = TileType(tile);
+ ti->type = GetTileType(tile);
ti->tileh = GetTileSlope(tile, &ti->z);
}
@@ -288,28 +288,28 @@ void DoClearSquare(uint tile)
uint32 GetTileTrackStatus(uint tile, TransportType mode)
{
- return _tile_type_procs[TileType(tile)]->get_tile_track_status_proc(tile, mode);
+ return _tile_type_procs[GetTileType(tile)]->get_tile_track_status_proc(tile, mode);
}
void ChangeTileOwner(uint tile, byte old_player, byte new_player)
{
- _tile_type_procs[TileType(tile)]->change_tile_owner_proc(tile, old_player, new_player);
+ _tile_type_procs[GetTileType(tile)]->change_tile_owner_proc(tile, old_player, new_player);
}
void GetAcceptedCargo(uint tile, AcceptedCargo ac)
{
memset(ac, 0, sizeof(AcceptedCargo));
- _tile_type_procs[TileType(tile)]->get_accepted_cargo_proc(tile, ac);
+ _tile_type_procs[GetTileType(tile)]->get_accepted_cargo_proc(tile, ac);
}
void AnimateTile(uint tile)
{
- _tile_type_procs[TileType(tile)]->animate_tile_proc(tile);
+ _tile_type_procs[GetTileType(tile)]->animate_tile_proc(tile);
}
void ClickTile(uint tile)
{
- _tile_type_procs[TileType(tile)]->click_tile_proc(tile);
+ _tile_type_procs[GetTileType(tile)]->click_tile_proc(tile);
}
void DrawTile(TileInfo *ti)
@@ -319,7 +319,7 @@ void DrawTile(TileInfo *ti)
void GetTileDesc(uint tile, TileDesc *td)
{
- _tile_type_procs[TileType(tile)]->get_tile_desc_proc(tile, td);
+ _tile_type_procs[GetTileType(tile)]->get_tile_desc_proc(tile, td);
}
/* Clear a piece of landscape
@@ -333,7 +333,7 @@ int32 CmdLandscapeClear(int x, int y, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
tile = TILE_FROM_XY(x,y);
- return _tile_type_procs[TileType(tile)]->clear_tile_proc(tile, flags);
+ return _tile_type_procs[GetTileType(tile)]->clear_tile_proc(tile, flags);
}
// p1 = end tile
@@ -446,7 +446,7 @@ void RunTileLoop(void)
assert( (tile & ~TILELOOP_ASSERTMASK) == 0);
count = (MapSizeX() / TILELOOP_SIZE) * (MapSizeY() / TILELOOP_SIZE);
do {
- _tile_type_procs[TileType(tile)]->tile_loop_proc(tile);
+ _tile_type_procs[GetTileType(tile)]->tile_loop_proc(tile);
if (TileX(tile) < MapSizeX() - TILELOOP_SIZE) {
tile += TILELOOP_SIZE; /* no overflow */
diff --git a/order_gui.c b/order_gui.c
index f944a6e48..d99f07144 100644
--- a/order_gui.c
+++ b/order_gui.c
@@ -185,7 +185,7 @@ static Order GetOrderCmdFromTile(Vehicle *v, uint tile)
// check depot first
if (_patches.gotodepot) {
- switch (TileType(tile)) {
+ switch (GetTileType(tile)) {
case MP_RAILWAY:
if (v->type == VEH_Train && _map_owner[tile] == _local_player) {
if ((_map5[tile]&0xFC)==0xC0) {
@@ -228,6 +228,9 @@ static Order GetOrderCmdFromTile(Vehicle *v, uint tile)
order.station = GetDepotByTile(tile);
return order;
}
+
+ default:
+ break;
}
}
diff --git a/road_cmd.c b/road_cmd.c
index a0d68637c..7dd27b902 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -26,7 +26,7 @@ static bool HasTileRoadAt(uint tile, int i)
int mask;
byte b;
- switch (TileType(tile)) {
+ switch (GetTileType(tile)) {
case MP_STREET:
b = _map5[tile];
diff --git a/smallmap_gui.c b/smallmap_gui.c
index eed9a9c6a..ac9fce8a9 100644
--- a/smallmap_gui.c
+++ b/smallmap_gui.c
@@ -298,7 +298,7 @@ static inline uint32 GetSmallMapCountoursPixels(uint tile)
{
uint t;
- t = TileType(tile);
+ t = GetTileType(tile);
if (t == MP_TUNNELBRIDGE) {
t = _map5[tile];
if ((t & 0x80) == 0) t>>=1;
@@ -328,7 +328,7 @@ static inline uint32 GetSmallMapVehiclesPixels(uint tile)
{
uint t;
- t = TileType(tile);
+ t = GetTileType(tile);
if (t == MP_TUNNELBRIDGE) {
t = _map5[tile];
if ((t & 0x80) == 0) t>>=1;
@@ -381,7 +381,7 @@ static inline uint32 GetSmallMapIndustriesPixels(uint tile)
{
int t;
- t = TileType(tile);
+ t = GetTileType(tile);
if (t == MP_INDUSTRY) {
byte color = _industry_smallmap_colors[_map5[tile]];
return color + (color << 8) + (color << 16) + (color << 24);
@@ -414,7 +414,7 @@ static inline uint32 GetSmallMapRoutesPixels(uint tile)
int t;
uint32 bits;
- t = TileType(tile);
+ t = GetTileType(tile);
if (t == MP_STATION) {
byte m5 = _map5[tile];
(bits = MKCOLOR(0x56565656), m5 < 8) || // 8 - railroad station (green)
@@ -470,7 +470,7 @@ static inline uint32 GetSmallMapVegetationPixels(uint tile)
int i,t;
uint32 bits;
- t = TileType(tile);
+ t = GetTileType(tile);
if (t == MP_CLEAR) {
i = (_map5[tile] & 0x1F) - 4;
if (i >= 0) i = (i >> 2);
@@ -515,7 +515,7 @@ static inline uint32 GetSmallMapOwnerPixels(uint tile)
{
int t;
- t = TileType(tile);
+ t = GetTileType(tile);
if (t == MP_HOUSE || _map_owner[tile] == OWNER_TOWN) {
t = 0x80;
} else if (t == MP_INDUSTRY) {
diff --git a/station_cmd.c b/station_cmd.c
index d43468307..ebf77d903 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -436,7 +436,7 @@ void GetProductionAroundTiles(uint *produced, uint tile, int w, int h, int rad)
if (!(IS_INSIDE_1D(xc, x, w) && IS_INSIDE_1D(yc, y, h))) {
GetProducedCargoProc *gpc;
uint tile = TILE_XY(xc, yc);
- gpc = _tile_type_procs[TileType(tile)]->get_produced_cargo_proc;
+ gpc = _tile_type_procs[GetTileType(tile)]->get_produced_cargo_proc;
if (gpc != NULL) {
cargos[0] = cargos[1] = 0xFF;
gpc(tile, cargos);
diff --git a/tile.h b/tile.h
index ec274d62f..bd2917223 100644
--- a/tile.h
+++ b/tile.h
@@ -3,6 +3,20 @@
#include "map.h"
+typedef enum TileType {
+ MP_CLEAR,
+ MP_RAILWAY,
+ MP_STREET,
+ MP_HOUSE,
+ MP_TREES,
+ MP_STATION,
+ MP_WATER,
+ MP_VOID, // invisible tiles at the SW and SE border
+ MP_INDUSTRY,
+ MP_TUNNELBRIDGE,
+ MP_UNMOVABLE
+} TileType;
+
void SetMapExtraBits(TileIndex tile, byte flags);
uint GetMapExtraBits(TileIndex tile);
@@ -25,22 +39,22 @@ static inline uint TilePixelHeight(TileIndex tile)
return TileHeight(tile) * 8;
}
-static inline int TileType(TileIndex tile)
+static inline TileType GetTileType(TileIndex tile)
{
assert(tile < MapSize());
return _map_type_and_height[tile] >> 4;
}
-static inline void SetTileType(TileIndex tile, uint type)
+static inline void SetTileType(TileIndex tile, TileType type)
{
assert(tile < MapSize());
_map_type_and_height[tile] &= ~0xF0;
_map_type_and_height[tile] |= type << 4;
}
-static inline bool IsTileType(TileIndex tile, int type)
+static inline bool IsTileType(TileIndex tile, TileType type)
{
- return TileType(tile) == type;
+ return GetTileType(tile) == type;
}
#endif
diff --git a/train_cmd.c b/train_cmd.c
index 3d55f2484..08afbd391 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -2079,7 +2079,7 @@ static int GetDirectionToVehicle(Vehicle *v, int x, int y)
/* Check if the vehicle is compatible with the specified tile */
static bool CheckCompatibleRail(const Vehicle *v, TileIndex tile)
{
- switch (TileType(tile)) {
+ switch (GetTileType(tile)) {
case MP_RAILWAY:
case MP_STATION:
// normal tracks, jump to owner check
diff --git a/ttd.h b/ttd.h
index af8033f27..9e9127156 100644
--- a/ttd.h
+++ b/ttd.h
@@ -86,20 +86,6 @@ enum SwitchModes {
SM_START_SCENARIO = 10,
};
-enum MapTileTypes {
- MP_CLEAR,
- MP_RAILWAY,
- MP_STREET,
- MP_HOUSE,
- MP_TREES,
- MP_STATION,
- MP_WATER,
- MP_VOID, // invisible tiles at the SW and SE border
- MP_INDUSTRY,
- MP_TUNNELBRIDGE,
- MP_UNMOVABLE
-};
-
typedef enum TransportTypes {
/* These constants are for now linked to the representation of bridges
* and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge
diff --git a/vehicle.c b/vehicle.c
index eb048a840..7d6901708 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1733,13 +1733,13 @@ byte GetDirectionTowards(Vehicle *v, int x, int y)
uint32 VehicleEnterTile(Vehicle *v, uint tile, int x, int y)
{
uint old_tile = v->tile;
- uint32 result = _tile_type_procs[TileType(tile)]->vehicle_enter_tile_proc(v, tile, x, y);
+ uint32 result = _tile_type_procs[GetTileType(tile)]->vehicle_enter_tile_proc(v, tile, x, y);
/* When vehicle_enter_tile_proc returns 8, that apparently means that
* we cannot enter the tile at all. In that case, don't call
* leave_tile. */
if (!(result & 8) && old_tile != tile) {
- VehicleLeaveTileProc *proc = _tile_type_procs[TileType(old_tile)]->vehicle_leave_tile_proc;
+ VehicleLeaveTileProc *proc = _tile_type_procs[GetTileType(old_tile)]->vehicle_leave_tile_proc;
if (proc != NULL)
proc(v, old_tile, x, y);
}
diff --git a/water_cmd.c b/water_cmd.c
index 082d50bce..5f5a4c59f 100644
--- a/water_cmd.c
+++ b/water_cmd.c
@@ -320,7 +320,7 @@ static bool IsWateredTile(TileIndex tile)
{
byte m5 = _map5[tile];
- switch (TileType(tile)) {
+ switch (GetTileType(tile)) {
case MP_WATER:
// true, if not coast/riverbank
return m5 != 1;
@@ -502,7 +502,7 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs)
if (TileHeight(TILE_ADD(tile, ToTileIndexDiff(offs[3]))) != 0 ||
TileHeight(TILE_ADD(tile, ToTileIndexDiff(offs[4]))) != 0) {
// make coast..
- switch (TileType(target)) {
+ switch (GetTileType(target)) {
case MP_RAILWAY: {
uint slope = GetTileSlope(target, NULL);
byte tracks = _map5[target] & 0x3F;