mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-28 06:34:33 +01:00
Change: Add variable ground types for road waypoints
This commit is contained in:
committed by
rubidium42
parent
eebd5e47db
commit
c35a5e5cb1
@@ -66,6 +66,7 @@
|
||||
#include "timer/timer_game_economy.h"
|
||||
#include "timer/timer_game_tick.h"
|
||||
#include "cheat_type.h"
|
||||
#include "road_func.h"
|
||||
|
||||
#include "widgets/station_widget.h"
|
||||
|
||||
@@ -3254,6 +3255,20 @@ draw_default_foundation:
|
||||
DrawClearLandTile(ti, 3);
|
||||
}
|
||||
}
|
||||
} else if (IsRoadWaypointTile(ti->tile)) {
|
||||
RoadBits bits = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? ROAD_X : ROAD_Y;
|
||||
RoadType road_rt = GetRoadTypeRoad(ti->tile);
|
||||
RoadType tram_rt = GetRoadTypeTram(ti->tile);
|
||||
RoadBits road = (road_rt != INVALID_ROADTYPE) ? bits : ROAD_NONE;
|
||||
RoadBits tram = (tram_rt != INVALID_ROADTYPE) ? bits : ROAD_NONE;
|
||||
const RoadTypeInfo *road_rti = (road_rt != INVALID_ROADTYPE) ? GetRoadTypeInfo(road_rt) : nullptr;
|
||||
const RoadTypeInfo *tram_rti = (tram_rt != INVALID_ROADTYPE) ? GetRoadTypeInfo(tram_rt) : nullptr;
|
||||
|
||||
if (ti->tileh != SLOPE_FLAT) {
|
||||
DrawFoundation(ti, FOUNDATION_LEVELED);
|
||||
}
|
||||
|
||||
DrawRoadGroundSprites(ti, road, tram, road_rti, tram_rti, GetRoadWaypointRoadside(ti->tile), IsRoadWaypointOnSnowOrDesert(ti->tile));
|
||||
} else {
|
||||
if (layout != nullptr) {
|
||||
/* Sprite layout which needs preprocessing */
|
||||
@@ -3601,6 +3616,42 @@ static void TileLoop_Station(TileIndex tile)
|
||||
TileLoop_Water(tile);
|
||||
break;
|
||||
|
||||
case STATION_ROADWAYPOINT: {
|
||||
switch (_settings_game.game_creation.landscape) {
|
||||
case LT_ARCTIC:
|
||||
if (IsRoadWaypointOnSnowOrDesert(tile) != (GetTileZ(tile) > GetSnowLine())) {
|
||||
ToggleRoadWaypointOnSnowOrDesert(tile);
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
break;
|
||||
|
||||
case LT_TROPIC:
|
||||
if (GetTropicZone(tile) == TROPICZONE_DESERT && !IsRoadWaypointOnSnowOrDesert(tile)) {
|
||||
ToggleRoadWaypointOnSnowOrDesert(tile);
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
HouseZonesBits new_zone = HZB_TOWN_EDGE;
|
||||
const Town *t = ClosestTownFromTile(tile, UINT_MAX);
|
||||
if (t != nullptr) {
|
||||
new_zone = GetTownRadiusGroup(t, tile);
|
||||
}
|
||||
|
||||
/* Adjust road ground type depending on 'new_zone' */
|
||||
Roadside new_rs = new_zone > HZB_TOWN_EDGE ? ROADSIDE_PAVED : ROADSIDE_GRASS;
|
||||
Roadside cur_rs = GetRoadWaypointRoadside(tile);
|
||||
|
||||
if (new_rs != cur_rs) {
|
||||
SetRoadWaypointRoadside(tile, cur_rs == ROADSIDE_BARREN ? new_rs : ROADSIDE_BARREN);
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user