diff options
author | tron <tron@openttd.org> | 2006-04-02 12:49:18 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-04-02 12:49:18 +0000 |
commit | 7163a64c25e5ad8be4bf261c6fbbd909f75f4de3 (patch) | |
tree | 6165bdad32d288513a9323a661873fa96839184c | |
parent | ed1bd5242d00ec4ddaf40053f7e033dc0d17e0e7 (diff) | |
download | openttd-7163a64c25e5ad8be4bf261c6fbbd909f75f4de3.tar.xz |
(svn r4242) Pass TileIndex and slope to GetSlopeTileh_*() instead of TileInfo
-rw-r--r-- | clear_cmd.c | 4 | ||||
-rw-r--r-- | dummy_land.c | 2 | ||||
-rw-r--r-- | industry_cmd.c | 2 | ||||
-rw-r--r-- | landscape.c | 13 | ||||
-rw-r--r-- | openttd.h | 2 | ||||
-rw-r--r-- | rail_cmd.c | 10 | ||||
-rw-r--r-- | road_cmd.c | 10 | ||||
-rw-r--r-- | station_cmd.c | 2 | ||||
-rw-r--r-- | town_cmd.c | 2 | ||||
-rw-r--r-- | tree_cmd.c | 4 | ||||
-rw-r--r-- | tunnelbridge_cmd.c | 2 | ||||
-rw-r--r-- | unmovable_cmd.c | 4 | ||||
-rw-r--r-- | water_cmd.c | 4 |
13 files changed, 29 insertions, 32 deletions
diff --git a/clear_cmd.c b/clear_cmd.c index aea144127..d859a9823 100644 --- a/clear_cmd.c +++ b/clear_cmd.c @@ -518,9 +518,9 @@ static uint GetSlopeZ_Clear(const TileInfo* ti) return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; } -static uint GetSlopeTileh_Clear(const TileInfo *ti) +static uint GetSlopeTileh_Clear(TileIndex tile, uint tileh) { - return ti->tileh; + return tileh; } static void GetAcceptedCargo_Clear(TileIndex tile, AcceptedCargo ac) diff --git a/dummy_land.c b/dummy_land.c index 9cc7ec590..b852ddcdf 100644 --- a/dummy_land.c +++ b/dummy_land.c @@ -19,7 +19,7 @@ static uint GetSlopeZ_Dummy(const TileInfo* ti) return 0; } -static uint GetSlopeTileh_Dummy(const TileInfo* ti) +static uint GetSlopeTileh_Dummy(TileIndex tile, uint tileh) { return 0; } diff --git a/industry_cmd.c b/industry_cmd.c index 66b6f2334..407fcb0cb 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -404,7 +404,7 @@ static uint GetSlopeZ_Industry(const TileInfo* ti) return ti->z + (ti->tileh == 0 ? 0 : 8); } -static uint GetSlopeTileh_Industry(const TileInfo* ti) +static uint GetSlopeTileh_Industry(TileIndex tile, uint tileh) { return 0; } diff --git a/landscape.c b/landscape.c index 033ef3205..ad684160a 100644 --- a/landscape.c +++ b/landscape.c @@ -183,11 +183,11 @@ uint GetSlopeZ(int x, int y) // direction=true: check for foundation in east and south corner // direction=false: check for foundation in west and south corner -static bool hasFoundation(const TileInfo* ti, bool direction) +static bool HasFoundation(TileIndex tile, bool direction) { bool south, other; // southern corner and east/west corner - uint slope = _tile_type_procs[ti->type]->get_slope_tileh_proc(ti); - uint tileh = ti->tileh; + uint tileh = GetTileSlope(tile, NULL); + uint slope = _tile_type_procs[GetTileType(tile)]->get_slope_tileh_proc(tile, tileh); if (slope == 0 && slope != tileh) tileh = 15; south = (tileh & 2) != (slope & 2); @@ -204,11 +204,8 @@ void DrawFoundation(TileInfo *ti, uint f) { uint32 sprite_base = SPR_SLOPES_BASE-14; - TileInfo ti2; - FindLandscapeHeight(&ti2, ti->x, ti->y - 1); - if (hasFoundation(&ti2, true)) sprite_base += 22; // foundation in NW direction - FindLandscapeHeight(&ti2, ti->x - 1, ti->y); - if (hasFoundation(&ti2, false)) sprite_base += 22 * 2; // foundation in NE direction + if (HasFoundation(TILE_ADDXY(ti->tile, 0, -1), true)) sprite_base += 22; // foundation in NW direction + if (HasFoundation(TILE_ADDXY(ti->tile, -1, 0), false)) sprite_base += 44; // foundation in NE direction if (f < 15) { // leveled foundation @@ -333,7 +333,7 @@ typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID n * other bits that can be set? */ typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y); typedef void VehicleLeaveTileProc(Vehicle *v, TileIndex tile, int x, int y); -typedef uint GetSlopeTilehProc(const TileInfo *ti); +typedef uint GetSlopeTilehProc(TileIndex, uint tileh); typedef struct { DrawTileProc *draw_tile_proc; diff --git a/rail_cmd.c b/rail_cmd.c index 1f61b7e6f..092ed6f77 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -1770,15 +1770,15 @@ static uint GetSlopeZ_Track(const TileInfo* ti) } } -static uint GetSlopeTileh_Track(const TileInfo *ti) +static uint GetSlopeTileh_Track(TileIndex tile, uint tileh) { - if (ti->tileh == 0) return ti->tileh; - if (GetRailTileType(ti->tile) == RAIL_TYPE_DEPOT_WAYPOINT) { + if (tileh == 0) return 0; + if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) { return 0; } else { - uint f = GetRailFoundation(ti->tileh, GetTrackBits(ti->tile)); + uint f = GetRailFoundation(tileh, GetTrackBits(tile)); - if (f == 0) return ti->tileh; + if (f == 0) return tileh; if (f < 15) return 0; // leveled foundation return _inclined_tileh[f - 15]; // inclined foundation } diff --git a/road_cmd.c b/road_cmd.c index 5e961254a..7edc503f7 100644 --- a/road_cmd.c +++ b/road_cmd.c @@ -863,13 +863,13 @@ static uint GetSlopeZ_Road(const TileInfo* ti) } } -static uint GetSlopeTileh_Road(const TileInfo *ti) +static uint GetSlopeTileh_Road(TileIndex tile, uint tileh) { - if (ti->tileh == 0) return ti->tileh; - if (GetRoadType(ti->tile) == ROAD_NORMAL) { - uint f = GetRoadFoundation(ti->tileh, GetRoadBits(ti->tile)); + if (tileh == 0) return 0; + if (GetRoadType(tile) == ROAD_NORMAL) { + uint f = GetRoadFoundation(tileh, GetRoadBits(tile)); - if (f == 0) return ti->tileh; + if (f == 0) return tileh; if (f < 15) return 0; // leveled foundation return _inclined_tileh[f - 15]; // inclined foundation } else { diff --git a/station_cmd.c b/station_cmd.c index d5b5afea0..06772f9e4 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -1999,7 +1999,7 @@ static uint GetSlopeZ_Station(const TileInfo* ti) return ti->z + (ti->tileh == 0 ? 0 : 8); } -static uint GetSlopeTileh_Station(const TileInfo *ti) +static uint GetSlopeTileh_Station(TileIndex tile, uint tileh) { return 0; } diff --git a/town_cmd.c b/town_cmd.c index 94ba74938..afd0d690c 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -150,7 +150,7 @@ static uint GetSlopeZ_Town(const TileInfo* ti) return ti->z + (ti->tileh == 0 ? 0 : 8); } -static uint GetSlopeTileh_Town(const TileInfo *ti) +static uint GetSlopeTileh_Town(TileIndex tile, uint tileh) { return 0; } diff --git a/tree_cmd.c b/tree_cmd.c index 28290c7fe..eb87d7766 100644 --- a/tree_cmd.c +++ b/tree_cmd.c @@ -326,9 +326,9 @@ static uint GetSlopeZ_Trees(const TileInfo* ti) return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; } -static uint GetSlopeTileh_Trees(const TileInfo* ti) +static uint GetSlopeTileh_Trees(TileIndex tile, uint tileh) { - return ti->tileh; + return tileh; } static int32 ClearTile_Trees(TileIndex tile, byte flags) diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index 68cc8246a..612a24821 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -1143,7 +1143,7 @@ static uint GetSlopeZ_TunnelBridge(const TileInfo* ti) return GetPartialZ(ti->x & 0xF, ti->y & 0xF, tileh) + ti->z; } -static uint GetSlopeTileh_TunnelBridge(const TileInfo* ti) +static uint GetSlopeTileh_TunnelBridge(TileIndex tile, uint tileh) { // not accurate, but good enough for slope graphics drawing return 0; diff --git a/unmovable_cmd.c b/unmovable_cmd.c index da6b8cf2c..78c958462 100644 --- a/unmovable_cmd.c +++ b/unmovable_cmd.c @@ -212,9 +212,9 @@ static uint GetSlopeZ_Unmovable(const TileInfo* ti) } } -static uint GetSlopeTileh_Unmovable(const TileInfo *ti) +static uint GetSlopeTileh_Unmovable(TileIndex tile, uint tileh) { - return IsOwnedLand(ti->tile) ? ti->tileh : 0; + return IsOwnedLand(tile) ? tileh : 0; } static int32 ClearTile_Unmovable(TileIndex tile, byte flags) diff --git a/water_cmd.c b/water_cmd.c index c3e7aa7ab..5d9ca0ac2 100644 --- a/water_cmd.c +++ b/water_cmd.c @@ -446,9 +446,9 @@ static uint GetSlopeZ_Water(const TileInfo* ti) return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; } -static uint GetSlopeTileh_Water(const TileInfo *ti) +static uint GetSlopeTileh_Water(TileIndex tile, uint tileh) { - return ti->tileh; + return tileh; } static void GetAcceptedCargo_Water(TileIndex tile, AcceptedCargo ac) |