Mercurial > hg > openttd
changeset 3161:cc1a916e7dab draft
(svn r3787) Use DirToDiagDir() instead of >> 1
author | tron <tron@openttd.org> |
---|---|
date | Wed, 08 Mar 2006 08:28:48 +0000 |
parents | 861da3bb4986 |
children | d22ae987ccd9 |
files | disaster_cmd.c roadveh_cmd.c station_cmd.c train_cmd.c vehicle.c |
diffstat | 5 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/disaster_cmd.c +++ b/disaster_cmd.c @@ -656,7 +656,7 @@ 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)) {
--- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -918,7 +918,7 @@ 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) {
--- a/station_cmd.c +++ b/station_cmd.c @@ -2177,7 +2177,7 @@ { 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) ||
--- a/train_cmd.c +++ b/train_cmd.c @@ -2172,7 +2172,7 @@ 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;
--- a/vehicle.c +++ b/vehicle.c @@ -1960,7 +1960,7 @@ 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 @@ 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;