diff options
author | tron <tron@openttd.org> | 2005-01-18 17:19:34 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-01-18 17:19:34 +0000 |
commit | 0d85b92e434548b2699ef0b007bc70138fe1d44b (patch) | |
tree | 66dc086c651c411715496af7a5a9ff3a41128ec1 | |
parent | 7768e97fa6580c1fb250795576b3dd642cd54e39 (diff) | |
download | openttd-0d85b92e434548b2699ef0b007bc70138fe1d44b.tar.xz |
(svn r1559) Use IsTileType() instead of bit shifting and comparisons
-rw-r--r-- | vehicle.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -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) |