summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ai/trolly/trolly.c2
-rw-r--r--npf.c14
-rw-r--r--road_map.c5
-rw-r--r--roadveh_cmd.c6
-rw-r--r--station.h13
-rw-r--r--station_map.h14
-rw-r--r--vehicle.c5
7 files changed, 31 insertions, 28 deletions
diff --git a/ai/trolly/trolly.c b/ai/trolly/trolly.c
index 006e04850..8c466c218 100644
--- a/ai/trolly/trolly.c
+++ b/ai/trolly/trolly.c
@@ -617,7 +617,7 @@ static void AiNew_State_FindStation(Player *p)
if (AiNew_CheckVehicleStation(p, st)) {
// We did found a station that was good enough!
new_tile = st->xy;
- direction = GetRoadStationDir(st->xy);
+ direction = GetRoadStopDir(st->xy);
break;
}
}
diff --git a/npf.c b/npf.c
index 2c7bd06ca..3d1e6c145 100644
--- a/npf.c
+++ b/npf.c
@@ -459,7 +459,7 @@ static bool VehicleMayEnterTile(Owner owner, TileIndex tile, DiagDirection enter
if (IsTileType(tile, MP_RAILWAY) || /* Rail tile (also rail depot) */
IsTrainStationTile(tile) || /* Rail station tile */
IsTileDepotType(tile, TRANSPORT_ROAD) || /* Road depot tile */
- IsRoadStationTile(tile) || /* Road station tile */
+ IsRoadStopTile(tile) || /* Road station tile */
IsTileDepotType(tile, TRANSPORT_WATER)) { /* Water depot tile */
return IsTileOwner(tile, owner); /* You need to own these tiles entirely to use them */
}
@@ -533,15 +533,15 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
* otherwise we wouldn't have got here. It is also facing us,
* so we should skip it's body */
dst_tile = GetOtherTunnelEnd(src_tile);
- } else if (type != TRANSPORT_WATER && (IsRoadStationTile(src_tile) || IsTileDepotType(src_tile, type))) {
+ } else if (type != TRANSPORT_WATER && (IsRoadStopTile(src_tile) || IsTileDepotType(src_tile, type))) {
/* This is a road station or a train or road depot. We can enter and exit
* those from one side only. Trackdirs don't support that (yet), so we'll
* do this here. */
DiagDirection exitdir;
/* Find out the exit direction first */
- if (IsRoadStationTile(src_tile)) {
- exitdir = GetRoadStationDir(src_tile);
+ if (IsRoadStopTile(src_tile)) {
+ exitdir = GetRoadStopDir(src_tile);
} else { /* Train or road depot */
exitdir = GetDepotDirection(src_tile, type);
}
@@ -597,11 +597,11 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
}
/* Determine available tracks */
- if (type != TRANSPORT_WATER && (IsRoadStationTile(dst_tile) || IsTileDepotType(dst_tile, type))){
+ if (type != TRANSPORT_WATER && (IsRoadStopTile(dst_tile) || IsTileDepotType(dst_tile, type))){
/* Road stations and road and train depots return 0 on GTTS, so we have to do this by hand... */
DiagDirection exitdir;
- if (IsRoadStationTile(dst_tile)) {
- exitdir = GetRoadStationDir(dst_tile);
+ if (IsRoadStopTile(dst_tile)) {
+ exitdir = GetRoadStopDir(dst_tile);
} else { /* Road or train depot */
exitdir = GetDepotDirection(dst_tile, type);
}
diff --git a/road_map.c b/road_map.c
index aa1c50470..7e75d683f 100644
--- a/road_map.c
+++ b/road_map.c
@@ -7,6 +7,7 @@
#include "road_map.h"
#include "station.h"
#include "tunnel_map.h"
+#include "station_map.h"
RoadBits GetAnyRoadBits(TileIndex tile)
@@ -21,8 +22,8 @@ RoadBits GetAnyRoadBits(TileIndex tile)
}
case MP_STATION:
- if (!IsRoadStationTile(tile)) return 0;
- return DiagDirToRoadBits(GetRoadStationDir(tile));
+ if (!IsRoadStopTile(tile)) return 0;
+ return DiagDirToRoadBits(GetRoadStopDir(tile));
case MP_TUNNELBRIDGE:
if (IsBridge(tile)) {
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index d3b6ae63d..2ee1a3c72 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -1012,7 +1012,7 @@ static int RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection enterdir
/* Road depot */
bitmask |= _road_veh_fp_ax_or[GetRoadDepotDirection(tile)];
}
- } else if (IsTileType(tile, MP_STATION) && IsRoadStationTile(tile)) {
+ } else if (IsTileType(tile, MP_STATION) && IsRoadStopTile(tile)) {
if (IsTileOwner(tile, v->owner)) {
/* Our station */
RoadStopType rstype = (v->cargo_type == CT_PASSENGERS) ? RS_BUS : RS_TRUCK;
@@ -1021,7 +1021,7 @@ static int RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection enterdir
const RoadStop *rs = GetRoadStopByTile(tile, rstype);
if (rs != NULL && (_patches.roadveh_queue || GB(rs->status, 0, 2) != 0)) {
- bitmask |= _road_veh_fp_ax_or[GetRoadStationDir(tile)];
+ bitmask |= _road_veh_fp_ax_or[GetRoadStopDir(tile)];
}
}
}
@@ -1089,7 +1089,7 @@ static int RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection enterdir
}
} else if (IsTileType(desttile, MP_STATION)) {
if (IsRoadStop(desttile)) {
- dir = GetRoadStationDir(desttile);
+ dir = GetRoadStopDir(desttile);
do_it:;
/* When we are heading for a depot or station, we just
* pretend we are heading for the tile in front, we'll
diff --git a/station.h b/station.h
index c1538bf9d..ad458076a 100644
--- a/station.h
+++ b/station.h
@@ -213,10 +213,6 @@ static inline bool IsCompatibleTrainStationTile(TileIndex tile, TileIndex ref)
GB(_m[tile].m5, 0, 1) == GB(_m[ref].m5, 0, 1); // same direction?
}
-static inline bool IsRoadStationTile(TileIndex tile) {
- return IsTileType(tile, MP_STATION) && IS_BYTE_INSIDE(_m[tile].m5, 0x43, 0x4B);
-}
-
/**
* Check if a station really exists.
*/
@@ -235,13 +231,4 @@ static inline bool IsBuoyTile(TileIndex tile)
return IsTileType(tile, MP_STATION) && _m[tile].m5 == 0x52;
}
-/**
- * Get's the direction the road stop entrance points towards.
- */
-static inline DiagDirection GetRoadStationDir(TileIndex tile)
-{
- assert(IsRoadStationTile(tile));
- return (_m[tile].m5 - 0x43) & 3;
-}
-
#endif /* STATION_H */
diff --git a/station_map.h b/station_map.h
index 1da92a0d9..e0ed3def0 100644
--- a/station_map.h
+++ b/station_map.h
@@ -105,6 +105,20 @@ static inline bool IsRoadStop(TileIndex t)
return IsTruckStop(t) || IsBusStop(t);
}
+static inline bool IsRoadStopTile(TileIndex t)
+{
+ return IsTileType(t, MP_STATION) && IsRoadStop(t);
+}
+
+/**
+ * Gets the direction the road stop entrance points towards.
+ */
+static inline DiagDirection GetRoadStopDir(TileIndex tile)
+{
+ assert(IsRoadStopTile(tile));
+ return (_m[tile].m5 - TRUCK_BASE) & 3;
+}
+
static inline bool IsOilRig(TileIndex t)
{
assert(IsTileType(t, MP_STATION));
diff --git a/vehicle.c b/vehicle.c
index 0d938f5f7..7f5aabc20 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -23,6 +23,7 @@
#include "station.h"
#include "rail.h"
#include "train.h"
+#include "station_map.h"
#define INVALID_COORD (-0x8000)
#define GEN_HASH(x,y) (((x & 0x1F80)>>7) + ((y & 0xFC0)))
@@ -1988,8 +1989,8 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
if (v->u.road.state == 254) /* We'll assume the road vehicle is facing outwards */
return DiagdirToDiagTrackdir(GetRoadDepotDirection(v->tile));
- if (IsRoadStationTile(v->tile)) /* We'll assume the road vehicle is facing outwards */
- return DiagdirToDiagTrackdir(GetRoadStationDir(v->tile)); /* Road vehicle in a station */
+ if (IsRoadStopTile(v->tile)) /* We'll assume the road vehicle is facing outwards */
+ return DiagdirToDiagTrackdir(GetRoadStopDir(v->tile)); /* Road vehicle in a station */
return DiagdirToDiagTrackdir(DirToDiagDir(v->direction));