summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-08 08:28:48 +0000
committertron <tron@openttd.org>2006-03-08 08:28:48 +0000
commitab9af3b05d2b99a63b10a9923026916015788099 (patch)
tree2ff4a5c18f268f19fbfd9e5f264a66079d450100
parentfa6632ec3240c1407668f55169d316c1c4b6bd45 (diff)
downloadopenttd-ab9af3b05d2b99a63b10a9923026916015788099.tar.xz
(svn r3787) Use DirToDiagDir() instead of >> 1
-rw-r--r--disaster_cmd.c2
-rw-r--r--roadveh_cmd.c2
-rw-r--r--station_cmd.c2
-rw-r--r--train_cmd.c2
-rw-r--r--vehicle.c4
5 files changed, 6 insertions, 6 deletions
diff --git a/disaster_cmd.c b/disaster_cmd.c
index d053ff199..06d856a87 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -656,7 +656,7 @@ static void DisasterTick_5_and_6(Vehicle *v)
if (!(v->tick_counter&1))
return;
- tile = v->tile + TileOffsByDir(v->direction >> 1);
+ tile = v->tile + TileOffsByDir(DirToDiagDir(v->direction));
if (IsValidTile(tile) &&
(r=GetTileTrackStatus(tile,TRANSPORT_WATER),(byte)(r+(r >> 8)) == 0x3F) &&
!CHANCE16(1,90)) {
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 6c3d27d69..b941f2e24 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -918,7 +918,7 @@ static void RoadVehCheckOvertake(Vehicle *v, Vehicle *u)
od.tile = v->tile;
if (FindRoadVehToOvertake(&od)) return;
- od.tile = v->tile + TileOffsByDir(v->direction >> 1);
+ od.tile = v->tile + TileOffsByDir(DirToDiagDir(v->direction));
if (FindRoadVehToOvertake(&od)) return;
if (od.u->cur_speed == 0 || od.u->vehstatus&VS_STOPPED) {
diff --git a/station_cmd.c b/station_cmd.c
index 90601855a..b40657191 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -2177,7 +2177,7 @@ static uint32 VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
{
if (v->type == VEH_Train) {
if (IS_BYTE_INSIDE(_m[tile].m5, 0, 8) && IsFrontEngine(v) &&
- !IsCompatibleTrainStationTile(tile + TileOffsByDir(v->direction >> 1), tile)) {
+ !IsCompatibleTrainStationTile(tile + TileOffsByDir(DirToDiagDir(v->direction)), tile)) {
StationID station_id = _m[tile].m2;
if ((!(v->current_order.flags & OF_NON_STOP) && !_patches.new_nonstop) ||
diff --git a/train_cmd.c b/train_cmd.c
index 88e8881d2..cb08e52b1 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -2172,7 +2172,7 @@ static bool CheckReverseTrain(Vehicle *v)
assert(v->u.rail.track);
- i = _search_directions[FIND_FIRST_BIT(v->u.rail.track)][v->direction>>1];
+ i = _search_directions[FIND_FIRST_BIT(v->u.rail.track)][DirToDiagDir(v->direction)];
if (_patches.new_pathfinding_all) { /* Use a new pathfinding for everything */
NPFFindStationOrTileData fstd;
diff --git a/vehicle.c b/vehicle.c
index 24d7b731f..6fddacc61 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1960,7 +1960,7 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
return DiagdirToDiagTrackdir(GetDepotDirection(v->tile, TRANSPORT_RAIL)); /* Train in depot */
if (v->u.rail.track == 0x40) /* train in tunnel, so just use his direction and assume a diagonal track */
- return DiagdirToDiagTrackdir((v->direction >> 1) & 3);
+ return DiagdirToDiagTrackdir(DirToDiagDir(v->direction));
return TrackDirectionToTrackdir(FIND_FIRST_BIT(v->u.rail.track),v->direction);
@@ -1978,7 +1978,7 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
if (IsRoadStationTile(v->tile)) /* We'll assume the road vehicle is facing outwards */
return DiagdirToDiagTrackdir(GetRoadStationDir(v->tile)); /* Road vehicle in a station */
- return DiagdirToDiagTrackdir((v->direction >> 1) & 3);
+ return DiagdirToDiagTrackdir(DirToDiagDir(v->direction));
/* case VEH_Aircraft: case VEH_Special: case VEH_Disaster: */
default: return 0xFF;