From 0d85b92e434548b2699ef0b007bc70138fe1d44b Mon Sep 17 00:00:00 2001 From: tron Date: Tue, 18 Jan 2005 17:19:34 +0000 Subject: (svn r1559) Use IsTileType() instead of bit shifting and comparisons --- vehicle.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/vehicle.c b/vehicle.c index dd4d0934c..b0a86e6a6 100644 --- a/vehicle.c +++ b/vehicle.c @@ -514,15 +514,16 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v) bool CanFillVehicle(Vehicle *v) { - byte *t = &_map_type_and_height[v->tile]; - - if (t[0] >> 4 == MP_STATION || - (v->type == VEH_Ship && - (t[TILE_XY(1,0)] >> 4 == MP_STATION || - t[TILE_XY(-1,0)] >> 4 == MP_STATION || - t[TILE_XY(0,1)] >> 4 == MP_STATION || - t[TILE_XY(0,-1)] >> 4 == MP_STATION || - t[TILE_XY(-2,0)] >> 4 == MP_STATION))) { + TileIndex tile = v->tile; + + if (IsTileType(tile, MP_STATION) || + (v->type == VEH_Ship && ( + IsTileType(TILE_ADDXY(tile, 1, 0), MP_STATION) || + IsTileType(TILE_ADDXY(tile, -1, 0), MP_STATION) || + IsTileType(TILE_ADDXY(tile, 0, 1), MP_STATION) || + IsTileType(TILE_ADDXY(tile, 0, -1), MP_STATION) || + IsTileType(TILE_ADDXY(tile, -2, 0), MP_STATION) + ))) { // If patch is active, use alternative CanFillVehicle-function if (_patches.full_load_any) -- cgit v1.2.3-54-g00ecf