mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
5 Commits
27fc87d6bd
...
eb24523f58
Author | SHA1 | Date |
---|---|---|
|
eb24523f58 | |
|
10eeba86a6 | |
|
d99dad9e9e | |
|
6e4048e397 | |
|
4215654f22 |
|
@ -261,8 +261,6 @@ public:
|
|||
|
||||
this->FinishInitNested(TRANSPORT_AIR);
|
||||
|
||||
this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
|
||||
this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
|
||||
this->OnInvalidateData();
|
||||
|
||||
/* Ensure airport class is valid (changing NewGRFs). */
|
||||
|
@ -485,7 +483,7 @@ public:
|
|||
this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE, _selected_airport_layout + 1U >= as->layouts.size());
|
||||
|
||||
int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
|
||||
if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,16 +502,6 @@ public:
|
|||
break;
|
||||
}
|
||||
|
||||
case WID_AP_BTN_DONTHILIGHT: case WID_AP_BTN_DOHILIGHT:
|
||||
_settings_client.gui.station_show_coverage = (widget != WID_AP_BTN_DONTHILIGHT);
|
||||
this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
|
||||
this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
|
||||
this->SetDirty();
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
this->UpdateSelectSize();
|
||||
SetViewportCatchmentStation(nullptr, true);
|
||||
break;
|
||||
|
||||
case WID_AP_LAYOUT_DECREASE:
|
||||
_selected_airport_layout--;
|
||||
this->UpdateSelectSize();
|
||||
|
@ -602,15 +590,6 @@ static constexpr NWidgetPart _nested_build_airport_widgets[] = {
|
|||
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetArrowWidgetTypeTip(AWV_INCREASE),
|
||||
EndContainer(),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
|
||||
NWidget(WWT_LABEL, INVALID_COLOUR), SetStringTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(14, 0, 14), SetPIPRatio(1, 0, 1),
|
||||
NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
|
||||
SetStringTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
|
||||
SetStringTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_AP_ACCEPTANCE), SetResize(0, 1), SetFill(1, 0), SetMinimalTextLines(2, WidgetDimensions::unscaled.vsep_normal),
|
||||
EndContainer(),
|
||||
|
|
|
@ -415,9 +415,6 @@ Window *ShowBuildDocksScenToolbar()
|
|||
/** Widget numbers of the build-dock GUI. */
|
||||
enum BuildDockStationWidgets {
|
||||
BDSW_BACKGROUND, ///< Background panel.
|
||||
BDSW_LT_OFF, ///< 'Off' button of coverage high light.
|
||||
BDSW_LT_ON, ///< 'On' button of coverage high light.
|
||||
BDSW_INFO, ///< 'Coverage highlight' label.
|
||||
BDSW_ACCEPTANCE, ///< Acceptance info.
|
||||
};
|
||||
|
||||
|
@ -426,7 +423,6 @@ public:
|
|||
BuildDocksStationWindow(WindowDesc &desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->InitNested(TRANSPORT_WATER);
|
||||
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
||||
}
|
||||
|
||||
void Close([[maybe_unused]] int data = 0) override
|
||||
|
@ -441,11 +437,7 @@ public:
|
|||
|
||||
this->DrawWidgets();
|
||||
|
||||
if (_settings_client.gui.station_show_coverage) {
|
||||
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
} else {
|
||||
SetTileSelectSize(1, 1);
|
||||
}
|
||||
|
||||
/* strings such as 'Size' and 'Coverage Area' */
|
||||
Rect r = this->GetWidget<NWidgetBase>(BDSW_ACCEPTANCE)->GetCurrentRect();
|
||||
|
@ -461,21 +453,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
||||
{
|
||||
switch (widget) {
|
||||
case BDSW_LT_OFF:
|
||||
case BDSW_LT_ON:
|
||||
this->RaiseWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
||||
_settings_client.gui.station_show_coverage = (widget != BDSW_LT_OFF);
|
||||
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
this->SetDirty();
|
||||
SetViewportCatchmentStation(nullptr, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
|
||||
{
|
||||
CheckRedrawStationCoverage(this);
|
||||
|
@ -494,14 +471,7 @@ static constexpr NWidgetPart _nested_build_dock_station_widgets[] = {
|
|||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BDSW_BACKGROUND),
|
||||
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_normal, 0), SetPadding(WidgetDimensions::unscaled.picker),
|
||||
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_picker, 0),
|
||||
NWidget(WWT_LABEL, INVALID_COLOUR, BDSW_INFO), SetStringTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize), SetPIP(14, 0, 14),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, BDSW_LT_OFF), SetMinimalSize(60, 12), SetFill(1, 0), SetStringTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, BDSW_LT_ON), SetMinimalSize(60, 12), SetFill(1, 0), SetStringTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, BDSW_ACCEPTANCE), SetResize(0, 1), SetMinimalTextLines(2, WidgetDimensions::unscaled.vsep_normal),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, BDSW_ACCEPTANCE), SetResize(0, 1), SetMinimalTextLines(2, WidgetDimensions::unscaled.vsep_normal), SetMinimalSize(150, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
|
|
@ -2757,11 +2757,6 @@ STR_LINKGRAPH_STATS_TOOLTIP_RETURN_EXTENSION :{}{CARGO_LONG}
|
|||
STR_LINKGRAPH_STATS_TOOLTIP_TIME_EXTENSION :{}Average travel time: {UNITS_DAYS_OR_SECONDS}
|
||||
|
||||
# Base for station construction window(s)
|
||||
STR_STATION_BUILD_COVERAGE_AREA_TITLE :{BLACK}Coverage area highlight
|
||||
STR_STATION_BUILD_COVERAGE_OFF :{BLACK}Off
|
||||
STR_STATION_BUILD_COVERAGE_ON :{BLACK}On
|
||||
STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP :{BLACK}Don't highlight coverage area of proposed site
|
||||
STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP :{BLACK}Highlight coverage area of proposed site
|
||||
STR_STATION_BUILD_ACCEPTS_CARGO :{BLACK}Accepts: {GOLD}{CARGO_LIST}
|
||||
STR_STATION_BUILD_SUPPLIES_CARGO :{BLACK}Supplies: {GOLD}{CARGO_LIST}
|
||||
STR_STATION_BUILD_INFRASTRUCTURE_COST_YEAR :{BLACK}Maintenance cost: {GOLD}{CURRENCY_SHORT}/year
|
||||
|
|
|
@ -1102,8 +1102,6 @@ public:
|
|||
this->LowerWidget(WID_BRAS_PLATFORM_NUM_BEGIN + _settings_client.gui.station_numtracks);
|
||||
this->LowerWidget(WID_BRAS_PLATFORM_LEN_BEGIN + _settings_client.gui.station_platlength);
|
||||
}
|
||||
this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_OFF, !_settings_client.gui.station_show_coverage);
|
||||
this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_ON, _settings_client.gui.station_show_coverage);
|
||||
|
||||
this->PickerWindow::OnInit();
|
||||
}
|
||||
|
@ -1141,7 +1139,7 @@ public:
|
|||
|
||||
int rad = (_settings_game.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
|
||||
|
||||
if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
|
||||
for (uint bits = 0; bits < 7; bits++) {
|
||||
bool disable = bits >= _settings_game.station.station_spread;
|
||||
|
@ -1344,17 +1342,6 @@ public:
|
|||
break;
|
||||
}
|
||||
|
||||
case WID_BRAS_HIGHLIGHT_OFF:
|
||||
case WID_BRAS_HIGHLIGHT_ON:
|
||||
_settings_client.gui.station_show_coverage = (widget != WID_BRAS_HIGHLIGHT_OFF);
|
||||
|
||||
this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_OFF, !_settings_client.gui.station_show_coverage);
|
||||
this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_ON, _settings_client.gui.station_show_coverage);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
this->SetDirty();
|
||||
SetViewportCatchmentStation(nullptr, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
this->PickerWindow::OnClick(pt, widget, click_count);
|
||||
break;
|
||||
|
@ -1424,11 +1411,6 @@ static constexpr NWidgetPart _nested_station_builder_widgets[] = {
|
|||
NWidget(NWID_HORIZONTAL), SetPIPRatio(1, 0, 1),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BRAS_PLATFORM_DRAG_N_DROP), SetMinimalSize(75, 12), SetStringTip(STR_STATION_BUILD_DRAG_DROP, STR_STATION_BUILD_DRAG_DROP_TOOLTIP),
|
||||
EndContainer(),
|
||||
NWidget(WWT_LABEL, INVALID_COLOUR), SetStringTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL), SetPIPRatio(1, 0, 1),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BRAS_HIGHLIGHT_OFF), SetMinimalSize(60, 12), SetStringTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BRAS_HIGHLIGHT_ON), SetMinimalSize(60, 12), SetStringTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
EndContainer(),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BRAS_COVERAGE_TEXTS), SetFill(1, 1), SetResize(1, 0), SetMinimalTextLines(2, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
|
|
|
@ -1342,7 +1342,6 @@ public:
|
|||
}
|
||||
|
||||
this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui.orientation);
|
||||
this->LowerWidget(WID_BROS_LT_OFF + _settings_client.gui.station_show_coverage);
|
||||
|
||||
this->window_class = (rs == RoadStopType::Bus) ? WC_BUS_STATION : WC_TRUCK_STATION;
|
||||
}
|
||||
|
@ -1369,11 +1368,7 @@ public:
|
|||
this->DrawWidgets();
|
||||
|
||||
int rad = _settings_game.station.modified_catchment ? ((this->window_class == WC_BUS_STATION) ? CA_BUS : CA_TRUCK) : CA_UNMODIFIED;
|
||||
if (_settings_client.gui.station_show_coverage) {
|
||||
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
} else {
|
||||
SetTileSelectSize(1, 1);
|
||||
}
|
||||
|
||||
if (this->IsShaded()) return;
|
||||
|
||||
|
@ -1482,16 +1477,6 @@ public:
|
|||
CloseWindowById(WC_SELECT_STATION, 0);
|
||||
break;
|
||||
|
||||
case WID_BROS_LT_OFF:
|
||||
case WID_BROS_LT_ON:
|
||||
this->RaiseWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF);
|
||||
_settings_client.gui.station_show_coverage = (widget != WID_BROS_LT_OFF);
|
||||
this->LowerWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
this->SetDirty();
|
||||
SetViewportCatchmentStation(nullptr, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
this->PickerWindow::OnClick(pt, widget, click_count);
|
||||
break;
|
||||
|
@ -1551,13 +1536,6 @@ static constexpr NWidgetPart _nested_road_station_picker_widgets[] = {
|
|||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_LABEL, INVALID_COLOUR), SetStringTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL), SetPIPRatio(1, 0, 1),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_OFF), SetMinimalSize(60, 12),
|
||||
SetStringTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_ON), SetMinimalSize(60, 12),
|
||||
SetStringTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
EndContainer(),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BROS_ACCEPTANCE), SetFill(1, 1), SetResize(1, 0), SetMinimalTextLines(2, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
|
@ -1591,13 +1569,6 @@ static constexpr NWidgetPart _nested_tram_station_picker_widgets[] = {
|
|||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_X), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_Y), SetFill(0, 0), EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_LABEL, INVALID_COLOUR), SetStringTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL), SetPIPRatio(1, 0, 1),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_OFF), SetMinimalSize(60, 12),
|
||||
SetStringTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_ON), SetMinimalSize(60, 12),
|
||||
SetStringTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
EndContainer(),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BROS_ACCEPTANCE), SetFill(1, 1), SetResize(1, 0), SetMinimalTextLines(2, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
|
|
|
@ -201,7 +201,6 @@ struct GUISettings {
|
|||
uint8_t station_numtracks; ///< the number of platforms to default on for rail stations
|
||||
uint8_t station_platlength; ///< the platform length, in tiles, for rail stations
|
||||
bool station_dragdrop; ///< whether drag and drop is enabled for stations
|
||||
bool station_show_coverage; ///< whether to highlight coverage area
|
||||
bool persistent_buildingtools; ///< keep the building tools active after usage
|
||||
bool expenses_layout; ///< layout of expenses window
|
||||
uint32_t last_newgrf_count; ///< the numbers of NewGRFs we found during the last scan
|
||||
|
|
|
@ -168,7 +168,7 @@ void CheckRedrawStationCoverage(const Window *w)
|
|||
_thd.dirty &= ~1;
|
||||
w->SetDirty();
|
||||
|
||||
if (_settings_client.gui.station_show_coverage && _thd.drawstyle == HT_RECT) {
|
||||
if (_thd.drawstyle == HT_RECT) {
|
||||
FindStationsAroundSelection<StationTypeFilter>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,9 +36,14 @@
|
|||
# define MW(a) {a, PALETTE_TO_STRUCT_WHITE}
|
||||
# define MC(a) {a, PALETTE_TO_STRUCT_CONCRETE}
|
||||
|
||||
static const PalSpriteID _aqueduct_sprites[] = {
|
||||
{ SPR_AQUEDUCT_MIDDLE_X, PAL_NONE }, { 0x0, PAL_NONE }, { SPR_AQUEDUCT_PILLAR_X, PAL_NONE }, { 0x0, PAL_NONE },
|
||||
{ SPR_AQUEDUCT_MIDDLE_Y, PAL_NONE }, { 0x0, PAL_NONE }, { SPR_AQUEDUCT_PILLAR_Y, PAL_NONE }, { 0x0, PAL_NONE },
|
||||
/* Sprite table for middle part of aqueduct. */
|
||||
static const PalSpriteID _aqueduct_sprite_table_middle[] = {
|
||||
{SPR_AQUEDUCT_MIDDLE_X, PAL_NONE}, {0x0, PAL_NONE}, {SPR_AQUEDUCT_PILLAR_X, PAL_NONE}, {0x0, PAL_NONE}, // AXIS_X
|
||||
{SPR_AQUEDUCT_MIDDLE_Y, PAL_NONE}, {0x0, PAL_NONE}, {SPR_AQUEDUCT_PILLAR_Y, PAL_NONE}, {0x0, PAL_NONE}, // AIXS_Y
|
||||
};
|
||||
|
||||
/* Sprite table for head part of aqueduct. */
|
||||
static const PalSpriteID _aqueduct_sprite_table_heads[] = {
|
||||
{SPR_AQUEDUCT_RAMP_SW, PAL_NONE}, {SPR_AQUEDUCT_RAMP_SE, PAL_NONE}, {SPR_AQUEDUCT_RAMP_NE, PAL_NONE}, {SPR_AQUEDUCT_RAMP_NW, PAL_NONE},
|
||||
};
|
||||
|
||||
|
|
|
@ -691,12 +691,6 @@ flags = SettingFlag::NotInSave, SettingFlag::NoNetworkSync
|
|||
def = true
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDTC_BOOL]
|
||||
var = gui.station_show_coverage
|
||||
flags = SettingFlag::NotInSave, SettingFlag::NoNetworkSync
|
||||
def = false
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDTC_BOOL]
|
||||
var = gui.persistent_buildingtools
|
||||
flags = SettingFlag::NotInSave, SettingFlag::NoNetworkSync
|
||||
|
|
|
@ -138,15 +138,58 @@ bool HasBridgeFlatRamp(Slope tileh, Axis axis)
|
|||
return (tileh != SLOPE_FLAT);
|
||||
}
|
||||
|
||||
static inline std::span<const PalSpriteID> GetBridgeSpriteTable(int index, BridgePieces table)
|
||||
/**
|
||||
* Get the sprite table for a rail/road bridge piece.
|
||||
* @param bridge_type Bridge type.
|
||||
* @param piece Bridge piece.
|
||||
* @return Sprite table for the bridge piece.
|
||||
*/
|
||||
static std::span<const PalSpriteID> GetBridgeSpriteTable(BridgeType bridge_type, BridgePieces piece)
|
||||
{
|
||||
const BridgeSpec *bridge = GetBridgeSpec(index);
|
||||
assert(table < NUM_BRIDGE_PIECES);
|
||||
if (table < bridge->sprite_table.size() && !bridge->sprite_table[table].empty()) return bridge->sprite_table[table];
|
||||
assert(piece < NUM_BRIDGE_PIECES);
|
||||
|
||||
return _bridge_sprite_table[index][table];
|
||||
const BridgeSpec *bridge = GetBridgeSpec(bridge_type);
|
||||
if (piece < bridge->sprite_table.size() && !bridge->sprite_table[piece].empty()) return bridge->sprite_table[piece];
|
||||
|
||||
return _bridge_sprite_table[bridge_type][piece];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sprite table transport type base offset for a rail/road bridge.
|
||||
* @param transport_type Transport type of bridge.
|
||||
* @param ramp Tile of bridge ramp.
|
||||
* @return Offset for transport type.
|
||||
*/
|
||||
static uint8_t GetBridgeSpriteTableBaseOffset(TransportType transport_type, TileIndex ramp)
|
||||
{
|
||||
switch (transport_type) {
|
||||
case TRANSPORT_RAIL: return GetRailTypeInfo(GetRailType(ramp))->bridge_offset;
|
||||
case TRANSPORT_ROAD: return 8;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bridge sprite table base offset for the ramp part of bridge.
|
||||
* @param diagdir Direction of ramp.
|
||||
* @return Offset for direction.
|
||||
*/
|
||||
static uint8_t GetBridgeRampDirectionBaseOffset(DiagDirection diagdir)
|
||||
{
|
||||
/* Bridge ramps are ordered SW, SE, NE, NW instead of NE, SE, SW, NW. */
|
||||
static constexpr uint8_t ramp_offsets[DIAGDIR_END] = {2, 1, 0, 3};
|
||||
return ramp_offsets[diagdir];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bridge sprite table base offset for the middle part of bridge.
|
||||
* @param axis Axis of bridge.
|
||||
* @return Offset for axis.
|
||||
*/
|
||||
static uint8_t GetBridgeMiddleAxisBaseOffset(Axis axis)
|
||||
{
|
||||
return axis == AXIS_X ? 0 : 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the foundation for the bridge head, and tests if the resulting slope is valid.
|
||||
|
@ -1017,10 +1060,10 @@ static CommandCost ClearTile_TunnelBridge(TileIndex tile, DoCommandFlags flags)
|
|||
* @param h Bounding box size in Y direction
|
||||
* @param subsprite Optional subsprite for drawing halfpillars
|
||||
*/
|
||||
static inline void DrawPillar(const PalSpriteID *psid, int x, int y, int z, uint8_t w, uint8_t h, const SubSprite *subsprite)
|
||||
static inline void DrawPillar(const PalSpriteID &psid, int x, int y, int z, uint8_t w, uint8_t h, const SubSprite *subsprite)
|
||||
{
|
||||
static const int PILLAR_Z_OFFSET = TILE_HEIGHT - BRIDGE_Z_START; ///< Start offset of pillar wrt. bridge (downwards)
|
||||
AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, z, {{0, 0, -PILLAR_Z_OFFSET}, {w, h, BB_HEIGHT_UNDER_BRIDGE}, {0, 0, PILLAR_Z_OFFSET}}, IsTransparencySet(TO_BRIDGES), subsprite);
|
||||
AddSortableSpriteToDraw(psid.sprite, psid.pal, x, y, z, {{0, 0, -PILLAR_Z_OFFSET}, {w, h, BB_HEIGHT_UNDER_BRIDGE}, {0, 0, PILLAR_Z_OFFSET}}, IsTransparencySet(TO_BRIDGES), subsprite);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1034,7 +1077,7 @@ static inline void DrawPillar(const PalSpriteID *psid, int x, int y, int z, uint
|
|||
* @param h Bounding box size in Y direction
|
||||
* @return Reached Z at the bottom
|
||||
*/
|
||||
static int DrawPillarColumn(int z_bottom, int z_top, const PalSpriteID *psid, int x, int y, int w, int h)
|
||||
static int DrawPillarColumn(int z_bottom, int z_top, const PalSpriteID &psid, int x, int y, int w, int h)
|
||||
{
|
||||
int cur_z;
|
||||
for (cur_z = z_top; cur_z >= z_bottom; cur_z -= TILE_HEIGHT) {
|
||||
|
@ -1054,7 +1097,7 @@ static int DrawPillarColumn(int z_bottom, int z_top, const PalSpriteID *psid, in
|
|||
* @param y Sprite Y position of front pillar.
|
||||
* @param z_bridge Absolute height of bridge bottom.
|
||||
*/
|
||||
static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo *ti, Axis axis, bool drawfarpillar, int x, int y, int z_bridge)
|
||||
static void DrawBridgePillars(const PalSpriteID &psid, const TileInfo *ti, Axis axis, bool drawfarpillar, int x, int y, int z_bridge)
|
||||
{
|
||||
static const int bounding_box_size[2] = {16, 2}; ///< bounding box size of pillars along bridge direction
|
||||
static const int back_pillar_offset[2] = { 0, 9}; ///< sprite position offset of back facing pillar
|
||||
|
@ -1065,7 +1108,7 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo *ti, Axis
|
|||
{ { -INF, -INF, 15, INF }, { 16, -INF, INF, INF } }, // Y axis, north and south
|
||||
};
|
||||
|
||||
if (psid->sprite == 0) return;
|
||||
if (psid.sprite == 0) return;
|
||||
|
||||
/* Determine ground height under pillars */
|
||||
DiagDirection south_dir = AxisToDiagDir(axis);
|
||||
|
@ -1404,34 +1447,20 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||
|
||||
DrawBridgeMiddle(ti);
|
||||
} else { // IsBridge(ti->tile)
|
||||
const PalSpriteID *psid;
|
||||
int base_offset;
|
||||
bool ice = HasTunnelBridgeSnowOrDesert(ti->tile);
|
||||
|
||||
if (transport_type == TRANSPORT_RAIL) {
|
||||
base_offset = GetRailTypeInfo(GetRailType(ti->tile))->bridge_offset;
|
||||
assert(base_offset != 8); // This one is used for roads
|
||||
} else {
|
||||
base_offset = 8;
|
||||
}
|
||||
|
||||
/* as the lower 3 bits are used for other stuff, make sure they are clear */
|
||||
assert( (base_offset & 0x07) == 0x00);
|
||||
|
||||
DrawFoundation(ti, GetBridgeFoundation(ti->tileh, DiagDirToAxis(tunnelbridge_direction)));
|
||||
|
||||
/* HACK Wizardry to convert the bridge ramp direction into a sprite offset */
|
||||
base_offset += (6 - tunnelbridge_direction) % 4;
|
||||
|
||||
/* Table number BRIDGE_PIECE_HEAD always refers to the bridge heads for any bridge type */
|
||||
uint base_offset = GetBridgeRampDirectionBaseOffset(tunnelbridge_direction);
|
||||
std::span<const PalSpriteID> psid;
|
||||
if (transport_type != TRANSPORT_WATER) {
|
||||
if (ti->tileh == SLOPE_FLAT) base_offset += 4; // sloped bridge head
|
||||
psid = &GetBridgeSpriteTable(GetBridgeType(ti->tile), BRIDGE_PIECE_HEAD)[base_offset];
|
||||
base_offset += GetBridgeSpriteTableBaseOffset(transport_type, ti->tile);
|
||||
psid = GetBridgeSpriteTable(GetBridgeType(ti->tile), BRIDGE_PIECE_HEAD);
|
||||
} else {
|
||||
psid = _aqueduct_sprites + base_offset;
|
||||
psid = _aqueduct_sprite_table_heads;
|
||||
}
|
||||
psid = psid.subspan(base_offset, 1);
|
||||
|
||||
if (!ice) {
|
||||
if (!HasTunnelBridgeSnowOrDesert(ti->tile)) {
|
||||
TileIndex next = ti->tile + TileOffsByDiagDir(tunnelbridge_direction);
|
||||
if (ti->tileh != SLOPE_FLAT && ti->z == 0 && HasTileWaterClass(next) && GetWaterClass(next) == WATER_CLASS_SEA) {
|
||||
DrawShoreTile(ti->tileh);
|
||||
|
@ -1451,7 +1480,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||
* it doesn't disappear behind it
|
||||
*/
|
||||
/* Bridge heads are drawn solid no matter how invisibility/transparency is set */
|
||||
AddSortableSpriteToDraw(psid->sprite, psid->pal, *ti, {{}, {TILE_SIZE, TILE_SIZE, static_cast<uint8_t>(ti->tileh == SLOPE_FLAT ? 0 : TILE_HEIGHT)}, {}});
|
||||
AddSortableSpriteToDraw(psid[0].sprite, psid[0].pal, *ti, {{}, {TILE_SIZE, TILE_SIZE, static_cast<uint8_t>(ti->tileh == SLOPE_FLAT ? 0 : TILE_HEIGHT)}, {}});
|
||||
|
||||
if (transport_type == TRANSPORT_ROAD) {
|
||||
uint offset = tunnelbridge_direction;
|
||||
|
@ -1572,33 +1601,21 @@ void DrawBridgeMiddle(const TileInfo *ti)
|
|||
TileIndex rampnorth = GetNorthernBridgeEnd(ti->tile);
|
||||
TileIndex rampsouth = GetSouthernBridgeEnd(ti->tile);
|
||||
TransportType transport_type = GetTunnelBridgeTransportType(rampsouth);
|
||||
|
||||
Axis axis = GetBridgeAxis(ti->tile);
|
||||
BridgePieces piece = CalcBridgePiece(
|
||||
GetTunnelBridgeLength(ti->tile, rampnorth) + 1,
|
||||
GetTunnelBridgeLength(ti->tile, rampsouth) + 1
|
||||
);
|
||||
|
||||
const PalSpriteID *psid;
|
||||
uint base_offset = GetBridgeMiddleAxisBaseOffset(axis);
|
||||
std::span<const PalSpriteID> psid;
|
||||
bool drawfarpillar;
|
||||
if (transport_type != TRANSPORT_WATER) {
|
||||
BridgeType type = GetBridgeType(rampsouth);
|
||||
drawfarpillar = !HasBit(GetBridgeSpec(type)->flags, 0);
|
||||
|
||||
uint base_offset;
|
||||
if (transport_type == TRANSPORT_RAIL) {
|
||||
base_offset = GetRailTypeInfo(GetRailType(rampsouth))->bridge_offset;
|
||||
} else {
|
||||
base_offset = 8;
|
||||
}
|
||||
|
||||
psid = &GetBridgeSpriteTable(type, piece)[base_offset];
|
||||
BridgeType bridge_type = GetBridgeType(rampsouth);
|
||||
drawfarpillar = !HasBit(GetBridgeSpec(bridge_type)->flags, 0);
|
||||
base_offset += GetBridgeSpriteTableBaseOffset(transport_type, rampsouth);
|
||||
psid = GetBridgeSpriteTable(bridge_type, CalcBridgePiece(GetTunnelBridgeLength(ti->tile, rampnorth) + 1, GetTunnelBridgeLength(ti->tile, rampsouth) + 1));
|
||||
} else {
|
||||
drawfarpillar = true;
|
||||
psid = _aqueduct_sprites;
|
||||
psid = _aqueduct_sprite_table_middle;
|
||||
}
|
||||
|
||||
if (axis != AXIS_X) psid += 4;
|
||||
psid = psid.subspan(base_offset, 3);
|
||||
|
||||
int x = ti->x;
|
||||
int y = ti->y;
|
||||
|
@ -1614,14 +1631,12 @@ void DrawBridgeMiddle(const TileInfo *ti)
|
|||
/* Draw floor and far part of bridge*/
|
||||
if (!IsInvisibilitySet(TO_BRIDGES)) {
|
||||
if (axis == AXIS_X) {
|
||||
AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, z, {{0, 0, BRIDGE_Z_START}, {TILE_SIZE, 1, 40}, {0, 0, -BRIDGE_Z_START}}, IsTransparencySet(TO_BRIDGES));
|
||||
AddSortableSpriteToDraw(psid[0].sprite, psid[0].pal, x, y, z, {{0, 0, BRIDGE_Z_START}, {TILE_SIZE, 1, 40}, {0, 0, -BRIDGE_Z_START}}, IsTransparencySet(TO_BRIDGES));
|
||||
} else {
|
||||
AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, z, {{0, 0, BRIDGE_Z_START}, {1, TILE_SIZE, 40}, {0, 0, -BRIDGE_Z_START}}, IsTransparencySet(TO_BRIDGES));
|
||||
AddSortableSpriteToDraw(psid[0].sprite, psid[0].pal, x, y, z, {{0, 0, BRIDGE_Z_START}, {1, TILE_SIZE, 40}, {0, 0, -BRIDGE_Z_START}}, IsTransparencySet(TO_BRIDGES));
|
||||
}
|
||||
}
|
||||
|
||||
psid++;
|
||||
|
||||
if (transport_type == TRANSPORT_ROAD) {
|
||||
/* DrawBridgeRoadBits() calls EndSpriteCombine() and StartSpriteCombine() */
|
||||
DrawBridgeRoadBits(rampsouth, x, y, bridge_z, axis ^ 1, false);
|
||||
|
@ -1654,10 +1669,10 @@ void DrawBridgeMiddle(const TileInfo *ti)
|
|||
if (!IsInvisibilitySet(TO_BRIDGES)) {
|
||||
if (axis == AXIS_X) {
|
||||
y += 12;
|
||||
if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, z, {{0, 3, BRIDGE_Z_START}, {TILE_SIZE, 1, 40}, {0, -3, -BRIDGE_Z_START}}, IsTransparencySet(TO_BRIDGES));
|
||||
if (psid[1].sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid[1].sprite, psid[1].pal, x, y, z, {{0, 3, BRIDGE_Z_START}, {TILE_SIZE, 1, 40}, {0, -3, -BRIDGE_Z_START}}, IsTransparencySet(TO_BRIDGES));
|
||||
} else {
|
||||
x += 12;
|
||||
if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, z, {{3, 0, BRIDGE_Z_START}, {1, TILE_SIZE, 40}, {-3, 0, -BRIDGE_Z_START}}, IsTransparencySet(TO_BRIDGES));
|
||||
if (psid[1].sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid[1].sprite, psid[1].pal, x, y, z, {{3, 0, BRIDGE_Z_START}, {1, TILE_SIZE, 40}, {-3, 0, -BRIDGE_Z_START}}, IsTransparencySet(TO_BRIDGES));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1667,8 +1682,7 @@ void DrawBridgeMiddle(const TileInfo *ti)
|
|||
/* Do not draw anything more if bridges are invisible */
|
||||
if (IsInvisibilitySet(TO_BRIDGES)) return;
|
||||
|
||||
psid++;
|
||||
DrawBridgePillars(psid, ti, axis, drawfarpillar, x, y, z);
|
||||
DrawBridgePillars(psid[2], ti, axis, drawfarpillar, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,9 +28,6 @@ enum AirportPickerWidgets : WidgetID {
|
|||
WID_AP_LAYOUT_INCREASE, ///< Increase the layout number.
|
||||
WID_AP_AIRPORT_SPRITE, ///< A visual display of the airport currently selected.
|
||||
WID_AP_EXTRA_TEXT, ///< Additional text about the airport.
|
||||
WID_AP_COVERAGE_LABEL, ///< Label if you want to see the coverage.
|
||||
WID_AP_BTN_DONTHILIGHT, ///< Don't show the coverage button.
|
||||
WID_AP_BTN_DOHILIGHT, ///< Show the coverage button.
|
||||
WID_AP_ACCEPTANCE, ///< Acceptance info.
|
||||
};
|
||||
|
||||
|
|
|
@ -56,8 +56,6 @@ enum BuildRailStationWidgets : WidgetID {
|
|||
|
||||
WID_BRAS_PLATFORM_DRAG_N_DROP, ///< Button to enable drag and drop type station placement.
|
||||
|
||||
WID_BRAS_HIGHLIGHT_OFF, ///< Button for turning coverage highlighting off.
|
||||
WID_BRAS_HIGHLIGHT_ON, ///< Button for turning coverage highlighting on.
|
||||
WID_BRAS_COVERAGE_TEXTS, ///< Empty space for the coverage texts.
|
||||
|
||||
WID_BRAS_PLATFORM_NUM_BEGIN = WID_BRAS_PLATFORM_NUM_1 - 1, ///< Helper for determining the chosen platform width.
|
||||
|
|
Loading…
Reference in New Issue