diff options
author | matthijs <matthijs@openttd.org> | 2005-06-17 00:22:46 +0000 |
---|---|---|
committer | matthijs <matthijs@openttd.org> | 2005-06-17 00:22:46 +0000 |
commit | 8e535337861d419c6fc9cdd450e90689fad30e7d (patch) | |
tree | a60eac6f771503fb49ad4ddc8a7898fb0e6ee996 /vehicle.c | |
parent | bacc5396e6e6851877da254319301bee6c1c0255 (diff) | |
download | openttd-8e535337861d419c6fc9cdd450e90689fad30e7d.tar.xz |
(svn r2450) * Codechange: Replaced all uses of the arrays in tile.h with calls to the associated wrapper functions.
* Codechange: Made npf.c use some map array accessing wrappers instead of direct access.
* Codechange/Fix: Named every enum in tile.h. Fixes a nasty bug on MSVC where arrays would be initialised with zeroes (tnx Asterix_)
* Removed magic numbers from tables in tile.c.
* Added some explicit casts in tile.h.
Diffstat (limited to 'vehicle.c')
-rw-r--r-- | vehicle.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1736,7 +1736,7 @@ byte GetDirectionTowards(Vehicle *v, int x, int y) return (dir+((dirdiff&7)<5?1:-1)) & 7; } -byte GetVehicleTrackdir(const Vehicle* v) +Trackdir GetVehicleTrackdir(const Vehicle* v) { if (v->vehstatus & VS_CRASHED) return 0xFF; @@ -1744,28 +1744,28 @@ byte GetVehicleTrackdir(const Vehicle* v) { case VEH_Train: if (v->u.rail.track == 0x80) /* We'll assume the train is facing outwards */ - return _dir_to_diag_trackdir[GetDepotDirection(v->tile, TRANSPORT_RAIL)]; /* Train in depot */ + 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 _dir_to_diag_trackdir[(v->direction >> 1) & 3]; + return DiagdirToDiagTrackdir((v->direction >> 1) & 3); - return _track_direction_to_trackdir[FIND_FIRST_BIT(v->u.rail.track)][v->direction]; + return TrackDirectionToTrackdir(FIND_FIRST_BIT(v->u.rail.track),v->direction); break; case VEH_Ship: if (v->u.ship.state == 0x80) /* Inside a depot? */ /* We'll assume the ship is facing outwards */ - return _dir_to_diag_trackdir[GetDepotDirection(v->tile, TRANSPORT_WATER)]; /* Ship in depot */ + return DiagdirToDiagTrackdir(GetDepotDirection(v->tile, TRANSPORT_WATER)); /* Ship in depot */ - return _track_direction_to_trackdir[FIND_FIRST_BIT(v->u.ship.state)][v->direction]; + return TrackDirectionToTrackdir(FIND_FIRST_BIT(v->u.ship.state),v->direction); break; case VEH_Road: if (v->u.road.state == 254) /* We'll assume the road vehicle is facing outwards */ - return _dir_to_diag_trackdir[GetDepotDirection(v->tile, TRANSPORT_ROAD)]; /* Road vehicle in depot */ + return DiagdirToDiagTrackdir(GetDepotDirection(v->tile, TRANSPORT_ROAD)); /* Road vehicle in depot */ if (IsRoadStationTile(v->tile)) /* We'll assume the road vehicle is facing outwards */ - return _dir_to_diag_trackdir[GetRoadStationDir(v->tile)]; /* Road vehicle in a station */ + return DiagdirToDiagTrackdir(GetRoadStationDir(v->tile)); /* Road vehicle in a station */ - return _dir_to_diag_trackdir[(v->direction >> 1) & 3]; + return DiagdirToDiagTrackdir((v->direction >> 1) & 3); break; /* case VEH_Aircraft: case VEH_Special: case VEH_Disaster: */ default: return 0xFF; |