(svn r4242) Pass TileIndex and slope to GetSlopeTileh_*() instead of TileInfo

This commit is contained in:
tron 2006-04-02 12:49:18 +00:00
parent e9a5ca70e2
commit 892a4c587d
13 changed files with 29 additions and 32 deletions

View File

@ -518,9 +518,9 @@ static uint GetSlopeZ_Clear(const TileInfo* ti)
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; 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) static void GetAcceptedCargo_Clear(TileIndex tile, AcceptedCargo ac)

View File

@ -19,7 +19,7 @@ static uint GetSlopeZ_Dummy(const TileInfo* ti)
return 0; return 0;
} }
static uint GetSlopeTileh_Dummy(const TileInfo* ti) static uint GetSlopeTileh_Dummy(TileIndex tile, uint tileh)
{ {
return 0; return 0;
} }

View File

@ -404,7 +404,7 @@ static uint GetSlopeZ_Industry(const TileInfo* ti)
return ti->z + (ti->tileh == 0 ? 0 : 8); 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; return 0;
} }

View File

@ -183,11 +183,11 @@ uint GetSlopeZ(int x, int y)
// direction=true: check for foundation in east and south corner // direction=true: check for foundation in east and south corner
// direction=false: check for foundation in west 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 bool south, other; // southern corner and east/west corner
uint slope = _tile_type_procs[ti->type]->get_slope_tileh_proc(ti); uint tileh = GetTileSlope(tile, NULL);
uint tileh = ti->tileh; uint slope = _tile_type_procs[GetTileType(tile)]->get_slope_tileh_proc(tile, tileh);
if (slope == 0 && slope != tileh) tileh = 15; if (slope == 0 && slope != tileh) tileh = 15;
south = (tileh & 2) != (slope & 2); south = (tileh & 2) != (slope & 2);
@ -204,11 +204,8 @@ void DrawFoundation(TileInfo *ti, uint f)
{ {
uint32 sprite_base = SPR_SLOPES_BASE-14; uint32 sprite_base = SPR_SLOPES_BASE-14;
TileInfo ti2; if (HasFoundation(TILE_ADDXY(ti->tile, 0, -1), true)) sprite_base += 22; // foundation in NW direction
FindLandscapeHeight(&ti2, ti->x, ti->y - 1); if (HasFoundation(TILE_ADDXY(ti->tile, -1, 0), false)) sprite_base += 44; // foundation in NE direction
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 (f < 15) { if (f < 15) {
// leveled foundation // leveled foundation

View File

@ -333,7 +333,7 @@ typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID n
* other bits that can be set? */ * other bits that can be set? */
typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y); typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
typedef void VehicleLeaveTileProc(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 { typedef struct {
DrawTileProc *draw_tile_proc; DrawTileProc *draw_tile_proc;

View File

@ -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 (tileh == 0) return 0;
if (GetRailTileType(ti->tile) == RAIL_TYPE_DEPOT_WAYPOINT) { if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) {
return 0; return 0;
} else { } 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 if (f < 15) return 0; // leveled foundation
return _inclined_tileh[f - 15]; // inclined foundation return _inclined_tileh[f - 15]; // inclined foundation
} }

View File

@ -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 (tileh == 0) return 0;
if (GetRoadType(ti->tile) == ROAD_NORMAL) { if (GetRoadType(tile) == ROAD_NORMAL) {
uint f = GetRoadFoundation(ti->tileh, GetRoadBits(ti->tile)); uint f = GetRoadFoundation(tileh, GetRoadBits(tile));
if (f == 0) return ti->tileh; if (f == 0) return tileh;
if (f < 15) return 0; // leveled foundation if (f < 15) return 0; // leveled foundation
return _inclined_tileh[f - 15]; // inclined foundation return _inclined_tileh[f - 15]; // inclined foundation
} else { } else {

View File

@ -1999,7 +1999,7 @@ static uint GetSlopeZ_Station(const TileInfo* ti)
return ti->z + (ti->tileh == 0 ? 0 : 8); 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; return 0;
} }

View File

@ -150,7 +150,7 @@ static uint GetSlopeZ_Town(const TileInfo* ti)
return ti->z + (ti->tileh == 0 ? 0 : 8); 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; return 0;
} }

View File

@ -326,9 +326,9 @@ static uint GetSlopeZ_Trees(const TileInfo* ti)
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; 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) static int32 ClearTile_Trees(TileIndex tile, byte flags)

View File

@ -1143,7 +1143,7 @@ static uint GetSlopeZ_TunnelBridge(const TileInfo* ti)
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, tileh) + ti->z; 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 // not accurate, but good enough for slope graphics drawing
return 0; return 0;

View File

@ -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) static int32 ClearTile_Unmovable(TileIndex tile, byte flags)

View File

@ -446,9 +446,9 @@ static uint GetSlopeZ_Water(const TileInfo* ti)
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; 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) static void GetAcceptedCargo_Water(TileIndex tile, AcceptedCargo ac)