mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r3066) Constify the parameter of GetSlopeZ_*()
This commit is contained in:
parent
5f604ec63a
commit
ece9b9b2b6
|
@ -549,7 +549,7 @@ static void DrawTile_Clear(TileInfo *ti)
|
||||||
DrawClearLandFence(ti);
|
DrawClearLandFence(ti);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint GetSlopeZ_Clear(TileInfo *ti)
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@ static void DrawTile_Dummy(TileInfo *ti)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint GetSlopeZ_Dummy(TileInfo *ti) {
|
static uint GetSlopeZ_Dummy(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -398,7 +398,8 @@ static void DrawTile_Industry(TileInfo *ti)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint GetSlopeZ_Industry(TileInfo *ti) {
|
static uint GetSlopeZ_Industry(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,7 @@ typedef struct {
|
||||||
typedef int32 CommandProc(int x, int y, uint32 flags, uint32 p1, uint32 p2);
|
typedef int32 CommandProc(int x, int y, uint32 flags, uint32 p1, uint32 p2);
|
||||||
|
|
||||||
typedef void DrawTileProc(TileInfo *ti);
|
typedef void DrawTileProc(TileInfo *ti);
|
||||||
typedef uint GetSlopeZProc(TileInfo *ti);
|
typedef uint GetSlopeZProc(const TileInfo* ti);
|
||||||
typedef int32 ClearTileProc(TileIndex tile, byte flags);
|
typedef int32 ClearTileProc(TileIndex tile, byte flags);
|
||||||
typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
|
typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
|
||||||
typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
|
typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
|
||||||
|
|
|
@ -1934,7 +1934,7 @@ void SetSignalsOnBothDir(TileIndex tile, byte track)
|
||||||
UpdateSignalsOnSegment(tile, _search_dir_2[track]);
|
UpdateSignalsOnSegment(tile, _search_dir_2[track]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint GetSlopeZ_Track(TileInfo *ti)
|
static uint GetSlopeZ_Track(const TileInfo* ti)
|
||||||
{
|
{
|
||||||
uint z = ti->z;
|
uint z = ti->z;
|
||||||
int th = ti->tileh;
|
int th = ti->tileh;
|
||||||
|
|
|
@ -932,7 +932,7 @@ void DrawRoadDepotSprite(int x, int y, int image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint GetSlopeZ_Road(TileInfo *ti)
|
static uint GetSlopeZ_Road(const TileInfo* ti)
|
||||||
{
|
{
|
||||||
uint z = ti->z;
|
uint z = ti->z;
|
||||||
int th = ti->tileh;
|
int th = ti->tileh;
|
||||||
|
|
|
@ -2225,7 +2225,7 @@ void StationPickerDrawSprite(int x, int y, RailType railtype, int image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint GetSlopeZ_Station(TileInfo *ti)
|
static uint GetSlopeZ_Station(const TileInfo* ti)
|
||||||
{
|
{
|
||||||
uint z = ti->z;
|
uint z = ti->z;
|
||||||
if (ti->tileh != 0)
|
if (ti->tileh != 0)
|
||||||
|
|
|
@ -143,7 +143,7 @@ static void DrawTile_Town(TileInfo *ti)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint GetSlopeZ_Town(TileInfo *ti)
|
static uint GetSlopeZ_Town(const TileInfo* ti)
|
||||||
{
|
{
|
||||||
uint z = GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
|
uint z = GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
|
||||||
if (ti->tileh != 0) z = (z & ~7) + 4;
|
if (ti->tileh != 0) z = (z & ~7) + 4;
|
||||||
|
|
|
@ -339,7 +339,8 @@ static void DrawTile_Trees(TileInfo *ti)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint GetSlopeZ_Trees(TileInfo *ti) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1215,10 +1215,12 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint GetSlopeZ_TunnelBridge(TileInfo *ti) {
|
static uint GetSlopeZ_TunnelBridge(const TileInfo* ti)
|
||||||
|
{
|
||||||
uint z = ti->z;
|
uint z = ti->z;
|
||||||
uint x = ti->x & 0xF;
|
uint x = ti->x & 0xF;
|
||||||
uint y = ti->y & 0xF;
|
uint y = ti->y & 0xF;
|
||||||
|
uint tileh = ti->tileh;
|
||||||
|
|
||||||
// swap directions if Y tunnel/bridge to let the code handle the X case only.
|
// swap directions if Y tunnel/bridge to let the code handle the X case only.
|
||||||
if (ti->map5 & 1) uintswap(x,y);
|
if (ti->map5 & 1) uintswap(x,y);
|
||||||
|
@ -1233,11 +1235,11 @@ static uint GetSlopeZ_TunnelBridge(TileInfo *ti) {
|
||||||
if ( ti->map5 & 0x80 ) {
|
if ( ti->map5 & 0x80 ) {
|
||||||
// bridge ending?
|
// bridge ending?
|
||||||
if (!(ti->map5 & 0x40)) {
|
if (!(ti->map5 & 0x40)) {
|
||||||
if (BRIDGE_FULL_LEVELED_FOUNDATION & (1 << ti->tileh)) // 7, 11, 13, 14
|
if (BRIDGE_FULL_LEVELED_FOUNDATION & (1 << tileh)) // 7, 11, 13, 14
|
||||||
z += 8;
|
z += 8;
|
||||||
|
|
||||||
// no ramp for bridge ending
|
// no ramp for bridge ending
|
||||||
if ((BRIDGE_PARTLY_LEVELED_FOUNDATION & (1 << ti->tileh) || BRIDGE_NO_FOUNDATION & (1 << ti->tileh)) && ti->tileh != 0) {
|
if ((BRIDGE_PARTLY_LEVELED_FOUNDATION & (1 << tileh) || BRIDGE_NO_FOUNDATION & (1 << tileh)) && tileh != 0) {
|
||||||
return z + 8;
|
return z + 8;
|
||||||
|
|
||||||
} else if (!(ti->map5 & 0x20)) { // northern / southern ending
|
} else if (!(ti->map5 & 0x20)) { // northern / southern ending
|
||||||
|
@ -1251,7 +1253,7 @@ static uint GetSlopeZ_TunnelBridge(TileInfo *ti) {
|
||||||
// bridge middle part
|
// bridge middle part
|
||||||
} else {
|
} else {
|
||||||
// build on slopes?
|
// build on slopes?
|
||||||
if (ti->tileh) z+=8;
|
if (tileh != 0) z += 8;
|
||||||
|
|
||||||
// keep the same elevation because we're on the bridge?
|
// keep the same elevation because we're on the bridge?
|
||||||
if (_get_z_hint >= z + 8)
|
if (_get_z_hint >= z + 8)
|
||||||
|
@ -1264,12 +1266,12 @@ static uint GetSlopeZ_TunnelBridge(TileInfo *ti) {
|
||||||
// in the shared area, assume that we're below the bridge, cause otherwise the hint would've caught it.
|
// in the shared area, assume that we're below the bridge, cause otherwise the hint would've caught it.
|
||||||
// if rail or road below then it means it's possibly build on slope below the bridge.
|
// if rail or road below then it means it's possibly build on slope below the bridge.
|
||||||
if (ti->map5 & 0x20) {
|
if (ti->map5 & 0x20) {
|
||||||
uint f = _bridge_foundations[ti->map5&1][ti->tileh];
|
uint f = _bridge_foundations[ti->map5 & 1][tileh];
|
||||||
// make sure that the slope is not inclined foundation
|
// make sure that the slope is not inclined foundation
|
||||||
if (IS_BYTE_INSIDE(f, 1, 15)) return z;
|
if (IS_BYTE_INSIDE(f, 1, 15)) return z;
|
||||||
|
|
||||||
// change foundation type? XXX - should be const; accessor function!
|
// change foundation type? XXX - should be const; accessor function!
|
||||||
if (f) ti->tileh = _inclined_tileh[f - 15];
|
if (f != 0) tileh = _inclined_tileh[f - 15];
|
||||||
}
|
}
|
||||||
|
|
||||||
// no transport route, fallback to default
|
// no transport route, fallback to default
|
||||||
|
@ -1279,16 +1281,16 @@ static uint GetSlopeZ_TunnelBridge(TileInfo *ti) {
|
||||||
// if it's a bridge middle with transport route below, then we need to compensate for build on slopes
|
// if it's a bridge middle with transport route below, then we need to compensate for build on slopes
|
||||||
if ( (ti->map5 & (0x80 + 0x40 + 0x20)) == (0x80 + 0x40 + 0x20)) {
|
if ( (ti->map5 & (0x80 + 0x40 + 0x20)) == (0x80 + 0x40 + 0x20)) {
|
||||||
uint f;
|
uint f;
|
||||||
if (ti->tileh) z += 8;
|
if (tileh != 0) z += 8;
|
||||||
f = _bridge_foundations[ti->map5&1][ti->tileh];
|
f = _bridge_foundations[ti->map5&1][tileh];
|
||||||
if (IS_BYTE_INSIDE(f, 1, 15)) return z;
|
if (IS_BYTE_INSIDE(f, 1, 15)) return z;
|
||||||
if (f) ti->tileh = _inclined_tileh[f - 15];
|
if (f != 0) tileh = _inclined_tileh[f - 15];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// default case
|
// default case
|
||||||
z = ti->z;
|
z = ti->z;
|
||||||
return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + z;
|
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, tileh) + z;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint GetSlopeTileh_TunnelBridge(const TileInfo *ti) {
|
static uint GetSlopeTileh_TunnelBridge(const TileInfo *ti) {
|
||||||
|
|
|
@ -180,7 +180,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint GetSlopeZ_Unmovable(TileInfo *ti)
|
static uint GetSlopeZ_Unmovable(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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -460,7 +460,7 @@ void DrawShipDepotSprite(int x, int y, int image)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint GetSlopeZ_Water(TileInfo *ti)
|
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue