mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Merge (IsOn|Toggle)(Snow|Desert) into (IsOn|Toggle)SnowOrDesert.
parent
252376ce3e
commit
42deccc4f5
|
@ -357,7 +357,7 @@ uint32_t GetTerrainType(TileIndex tile, TileContext context)
|
||||||
case MP_ROAD:
|
case MP_ROAD:
|
||||||
/* During map generation the snowstate may not be valid yet, as the tileloop may not have run yet. */
|
/* During map generation the snowstate may not be valid yet, as the tileloop may not have run yet. */
|
||||||
if (_generating_world) goto genworld; // we do not care about foundations here
|
if (_generating_world) goto genworld; // we do not care about foundations here
|
||||||
has_snow = IsOnSnow(tile);
|
has_snow = IsOnSnowOrDesert(tile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_TREES: {
|
case MP_TREES: {
|
||||||
|
|
|
@ -1628,7 +1628,7 @@ static void DrawRoadBits(TileInfo *ti)
|
||||||
/* DrawFoundation() modifies ti. */
|
/* DrawFoundation() modifies ti. */
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawRoadGroundSprites(ti, road, tram, road_rti, tram_rti, GetRoadside(ti->tile), IsOnSnow(ti->tile));
|
DrawRoadGroundSprites(ti, road, tram, road_rti, tram_rti, GetRoadside(ti->tile), IsOnSnowOrDesert(ti->tile));
|
||||||
|
|
||||||
/* Draw one way */
|
/* Draw one way */
|
||||||
if (road_rti != nullptr) {
|
if (road_rti != nullptr) {
|
||||||
|
@ -1720,7 +1720,7 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
SpriteID image = SPR_ROAD_Y + axis;
|
SpriteID image = SPR_ROAD_Y + axis;
|
||||||
|
|
||||||
Roadside roadside = GetRoadside(ti->tile);
|
Roadside roadside = GetRoadside(ti->tile);
|
||||||
if (DrawRoadAsSnowOrDesert(IsOnSnow(ti->tile), roadside)) {
|
if (DrawRoadAsSnowOrDesert(IsOnSnowOrDesert(ti->tile), roadside)) {
|
||||||
image += 19;
|
image += 19;
|
||||||
} else {
|
} else {
|
||||||
switch (roadside) {
|
switch (roadside) {
|
||||||
|
@ -1736,7 +1736,7 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
if (IsCrossingBarred(ti->tile)) image += 2;
|
if (IsCrossingBarred(ti->tile)) image += 2;
|
||||||
|
|
||||||
Roadside roadside = GetRoadside(ti->tile);
|
Roadside roadside = GetRoadside(ti->tile);
|
||||||
if (DrawRoadAsSnowOrDesert(IsOnSnow(ti->tile), roadside)) {
|
if (DrawRoadAsSnowOrDesert(IsOnSnowOrDesert(ti->tile), roadside)) {
|
||||||
image += 8;
|
image += 8;
|
||||||
} else {
|
} else {
|
||||||
switch (roadside) {
|
switch (roadside) {
|
||||||
|
@ -1975,16 +1975,16 @@ static void TileLoop_Road(TileIndex tile)
|
||||||
case LandscapeType::Arctic: {
|
case LandscapeType::Arctic: {
|
||||||
/* Roads on flat foundations use the snow level of the height they are elevated to. All others use the snow level of their minimum height. */
|
/* Roads on flat foundations use the snow level of the height they are elevated to. All others use the snow level of their minimum height. */
|
||||||
int tile_z = (std::get<Slope>(GetFoundationSlope(tile)) == SLOPE_FLAT) ? GetTileMaxZ(tile) : GetTileZ(tile);
|
int tile_z = (std::get<Slope>(GetFoundationSlope(tile)) == SLOPE_FLAT) ? GetTileMaxZ(tile) : GetTileZ(tile);
|
||||||
if (IsOnSnow(tile) != (tile_z > GetSnowLine())) {
|
if (IsOnSnowOrDesert(tile) != (tile_z > GetSnowLine())) {
|
||||||
ToggleSnow(tile);
|
ToggleSnowOrDesert(tile);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LandscapeType::Tropic:
|
case LandscapeType::Tropic:
|
||||||
if (GetTropicZone(tile) == TROPICZONE_DESERT && !IsOnDesert(tile)) {
|
if (GetTropicZone(tile) == TROPICZONE_DESERT && !IsOnSnowOrDesert(tile)) {
|
||||||
ToggleDesert(tile);
|
ToggleSnowOrDesert(tile);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -433,25 +433,21 @@ inline void BarCrossing(Tile t)
|
||||||
SetCrossingBarred(t, true);
|
SetCrossingBarred(t, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if a road tile has snow/desert. */
|
|
||||||
#define IsOnDesert IsOnSnow
|
|
||||||
/**
|
/**
|
||||||
* Check if a road tile has snow/desert.
|
* Check if a road tile has snow/desert.
|
||||||
* @param t The tile to query.
|
* @param t The tile to query.
|
||||||
* @return True if the tile has snow/desert.
|
* @return True if the tile has snow/desert.
|
||||||
*/
|
*/
|
||||||
inline bool IsOnSnow(Tile t)
|
inline bool IsOnSnowOrDesert(Tile t)
|
||||||
{
|
{
|
||||||
return HasBit(t.m7(), 5);
|
return HasBit(t.m7(), 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Toggle the snow/desert state of a road tile. */
|
|
||||||
#define ToggleDesert ToggleSnow
|
|
||||||
/**
|
/**
|
||||||
* Toggle the snow/desert state of a road tile.
|
* Toggle the snow/desert state of a road tile.
|
||||||
* @param t The tile to change.
|
* @param t The tile to change.
|
||||||
*/
|
*/
|
||||||
inline void ToggleSnow(Tile t)
|
inline void ToggleSnowOrDesert(Tile t)
|
||||||
{
|
{
|
||||||
ToggleBit(t.m7(), 5);
|
ToggleBit(t.m7(), 5);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue