|
@@ -61,30 +61,30 @@ static void BuildAirClick_Demolish(Windo
|
|
|
|
|
|
|
|
|
typedef void OnButtonClick(Window *w);
|
|
|
static OnButtonClick * const _build_air_button_proc[] = {
|
|
|
BuildAirClick_Airport,
|
|
|
BuildAirClick_Demolish,
|
|
|
};
|
|
|
|
|
|
struct BuildAirToolbarWindow : Window {
|
|
|
BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
|
|
|
{
|
|
|
this->FindWindowPlacementAndResize(desc);
|
|
|
if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
|
|
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
|
|
}
|
|
|
|
|
|
~BuildAirToolbarWindow()
|
|
|
{
|
|
|
if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
|
|
|
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
|
|
|
}
|
|
|
|
|
|
virtual void OnPaint()
|
|
|
{
|
|
|
this->DrawWidgets();
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
{
|
|
|
if (widget - 3 >= 0) {
|
|
|
_build_air_button_proc[widget - 3](this);
|
|
|
}
|
|
@@ -169,25 +169,25 @@ class AirportPickerWindow : public Picke
|
|
|
BAW_BTN_DONTHILIGHT = BAW_LAST_AIRPORT + 1,
|
|
|
BAW_BTN_DOHILIGHT,
|
|
|
};
|
|
|
|
|
|
public:
|
|
|
|
|
|
AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
|
|
{
|
|
|
this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_station_show_coverage);
|
|
|
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage);
|
|
|
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
|
|
|
|
|
|
if (_settings.economy.station_noise_level) {
|
|
|
if (_settings_game.economy.station_noise_level) {
|
|
|
ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, 10);
|
|
|
}
|
|
|
|
|
|
this->FindWindowPlacementAndResize(desc);
|
|
|
}
|
|
|
|
|
|
virtual void OnPaint()
|
|
|
{
|
|
|
int i; // airport enabling loop
|
|
|
uint16 y_noise_offset = 0;
|
|
|
uint32 avail_airports;
|
|
|
const AirportFTAClass *airport;
|
|
@@ -202,32 +202,32 @@ public:
|
|
|
/* 'Country Airport' starts at widget BAW_SMALL_AIRPORT, and if its bit is set, it is
|
|
|
* available, so take its opposite value to set the disabled state.
|
|
|
* There are 9 buildable airports
|
|
|
* XXX TODO : all airports should be held in arrays, with all relevant data.
|
|
|
* This should be part of newgrf-airports, i suppose
|
|
|
*/
|
|
|
for (i = 0; i < BAW_AIRPORT_COUNT; i++) this->SetWidgetDisabledState(i + BAW_SMALL_AIRPORT, !HasBit(avail_airports, i));
|
|
|
|
|
|
/* select default the coverage area to 'Off' (16) */
|
|
|
airport = GetAirport(_selected_airport_type);
|
|
|
SetTileSelectSize(airport->size_x, airport->size_y);
|
|
|
|
|
|
int rad = _settings.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
|
|
|
int rad = _settings_game.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
|
|
|
|
|
|
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
|
|
|
|
|
this->DrawWidgets();
|
|
|
|
|
|
/* only show the station (airport) noise, if the noise option is activated */
|
|
|
if (_settings.economy.station_noise_level) {
|
|
|
if (_settings_game.economy.station_noise_level) {
|
|
|
/* show the noise of the selected airport */
|
|
|
SetDParam(0, airport->noise_level);
|
|
|
DrawString(2, 206, STR_STATION_NOISE, 0);
|
|
|
y_noise_offset = 10;
|
|
|
}
|
|
|
|
|
|
/* strings such as 'Size' and 'Coverage Area' */
|
|
|
int text_end = DrawStationCoverageAreaText(2, this->widget[BAW_BTN_DOHILIGHT].bottom + 4 + y_noise_offset, SCT_ALL, rad, false);
|
|
|
text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;
|
|
|
if (text_end != this->widget[BAW_BOTTOMPANEL].bottom) {
|
|
|
this->SetDirty();
|
|
|
ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, text_end - this->widget[BAW_BOTTOMPANEL].bottom);
|