Initial support for NewGRF road stops (bus and lorry stops)
This commit is contained in:
642
src/road_gui.cpp
642
src/road_gui.cpp
@@ -33,6 +33,14 @@
|
||||
#include "date_func.h"
|
||||
#include "station_map.h"
|
||||
#include "waypoint_func.h"
|
||||
#include "newgrf_roadstop.h"
|
||||
#include "debug.h"
|
||||
#include "newgrf_station.h"
|
||||
#include "querystring_gui.h"
|
||||
#include "sortlist_type.h"
|
||||
#include "stringfilter_type.h"
|
||||
#include "string_func.h"
|
||||
|
||||
#include "widgets/road_widget.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -46,6 +54,17 @@ static void ShowRoadDepotPicker(Window *parent);
|
||||
static bool _remove_button_clicked;
|
||||
static bool _one_way_button_clicked;
|
||||
|
||||
static DiagDirection _build_depot_direction;
|
||||
|
||||
struct RoadStopGUISettings {
|
||||
DiagDirection orientation; // This replaces _road_station_picker_orientation
|
||||
|
||||
RoadStopClassID roadstop_class;
|
||||
byte roadstop_type;
|
||||
byte roadstop_count;
|
||||
};
|
||||
static RoadStopGUISettings _roadstop_gui_settings;
|
||||
|
||||
/**
|
||||
* Define the values of the RoadFlags
|
||||
* @see CmdBuildLongRoad
|
||||
@@ -65,8 +84,6 @@ static RoadFlags _place_road_flag;
|
||||
|
||||
static RoadType _cur_roadtype;
|
||||
|
||||
static DiagDirection _road_depot_orientation;
|
||||
static DiagDirection _road_station_picker_orientation;
|
||||
|
||||
void CcPlaySound_CONSTRUCTION_OTHER(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint64 p3, uint32 cmd)
|
||||
{
|
||||
@@ -184,17 +201,18 @@ void CcRoadStop(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2,
|
||||
*/
|
||||
static void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, uint32 p2, uint32 cmd)
|
||||
{
|
||||
uint8 ddir = _road_station_picker_orientation;
|
||||
SB(p2, 16, 16, INVALID_STATION); // no station to join
|
||||
uint8 ddir = _roadstop_gui_settings.orientation;
|
||||
|
||||
if (ddir >= DIAGDIR_END) {
|
||||
SetBit(p2, 1); // It's a drive-through stop.
|
||||
ddir -= DIAGDIR_END; // Adjust picker result to actual direction.
|
||||
}
|
||||
p2 |= ddir << 3; // Set the DiagDirecion into p2 bits 3 and 4.
|
||||
p2 |= INVALID_STATION << 16; // no station to join
|
||||
|
||||
TileArea ta(start_tile, end_tile);
|
||||
CommandContainer cmdcont = NewCommandContainerBasic(ta.tile, (uint32)(ta.w | ta.h << 8), p2, cmd, CcRoadStop);
|
||||
cmdcont.p3 = (_roadstop_gui_settings.roadstop_type << 8) | _roadstop_gui_settings.roadstop_class;
|
||||
ShowSelectStationIfNeeded(cmdcont, ta);
|
||||
}
|
||||
|
||||
@@ -217,7 +235,7 @@ static void PlaceRoad_Waypoint(TileIndex tile)
|
||||
} else {
|
||||
/* Tile where we can't build rail waypoints. This is always going to fail,
|
||||
* but provides the user with a proper error message. */
|
||||
DoCommandP(tile, 1 | 1 << 8, INVALID_STATION << 16, CMD_BUILD_ROAD_WAYPOINT | CMD_MSG(STR_ERROR_CAN_T_BUILD_ROAD_WAYPOINT));
|
||||
DoCommandP(tile, 1 | 1 << 8, ROADSTOP_CLASS_WAYP | INVALID_STATION << 16, CMD_BUILD_ROAD_WAYPOINT | CMD_MSG(STR_ERROR_CAN_T_BUILD_ROAD_WAYPOINT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,8 +248,8 @@ static void PlaceRoad_BusStation(TileIndex tile)
|
||||
if (_remove_button_clicked) {
|
||||
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_BUSSTOP);
|
||||
} else {
|
||||
if (_road_station_picker_orientation < DIAGDIR_END) { // Not a drive-through stop.
|
||||
VpStartPlaceSizing(tile, (DiagDirToAxis(_road_station_picker_orientation) == AXIS_X) ? VPM_X_LIMITED : VPM_Y_LIMITED, DDSP_BUILD_BUSSTOP);
|
||||
if (_roadstop_gui_settings.orientation < DIAGDIR_END) { // Not a drive-through stop.
|
||||
VpStartPlaceSizing(tile, (DiagDirToAxis(_roadstop_gui_settings.orientation) == AXIS_X) ? VPM_X_LIMITED : VPM_Y_LIMITED, DDSP_BUILD_BUSSTOP);
|
||||
} else {
|
||||
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_BUSSTOP);
|
||||
}
|
||||
@@ -248,8 +266,8 @@ static void PlaceRoad_TruckStation(TileIndex tile)
|
||||
if (_remove_button_clicked) {
|
||||
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_TRUCKSTOP);
|
||||
} else {
|
||||
if (_road_station_picker_orientation < DIAGDIR_END) { // Not a drive-through stop.
|
||||
VpStartPlaceSizing(tile, (DiagDirToAxis(_road_station_picker_orientation) == AXIS_X) ? VPM_X_LIMITED : VPM_Y_LIMITED, DDSP_BUILD_TRUCKSTOP);
|
||||
if (_roadstop_gui_settings.orientation < DIAGDIR_END) { // Not a drive-through stop.
|
||||
VpStartPlaceSizing(tile, (DiagDirToAxis(_roadstop_gui_settings.orientation) == AXIS_X) ? VPM_X_LIMITED : VPM_Y_LIMITED, DDSP_BUILD_TRUCKSTOP);
|
||||
} else {
|
||||
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_TRUCKSTOP);
|
||||
}
|
||||
@@ -584,7 +602,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_ROT_DEPOT:
|
||||
DoCommandP(tile, _cur_roadtype << 2 | _road_depot_orientation, 0,
|
||||
DoCommandP(tile, _cur_roadtype << 2 | _build_depot_direction, 0,
|
||||
CMD_BUILD_ROAD_DEPOT | CMD_MSG(this->rti->strings.err_depot), CcRoadDepot);
|
||||
break;
|
||||
|
||||
@@ -721,7 +739,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
DoCommandP(ta.tile, ta.w | ta.h << 8, (1 << 2), CMD_REMOVE_ROAD_STOP | CMD_MSG(STR_ERROR_CAN_T_REMOVE_ROAD_WAYPOINT), CcPlaySound_CONSTRUCTION_OTHER);
|
||||
} else {
|
||||
uint32 p1 = ta.w | ta.h << 8 | _ctrl_pressed << 16 | (select_method == VPM_X_LIMITED ? AXIS_X : AXIS_Y) << 17;
|
||||
uint32 p2 = INVALID_STATION << 16;
|
||||
uint32 p2 = ROADSTOP_CLASS_WAYP | INVALID_STATION << 16;
|
||||
|
||||
CommandContainer cmdcont = NewCommandContainerBasic(ta.tile, p1, p2, CMD_BUILD_ROAD_WAYPOINT | CMD_MSG(STR_ERROR_CAN_T_BUILD_ROAD_WAYPOINT), CcPlaySound_CONSTRUCTION_OTHER);
|
||||
ShowSelectWaypointIfNeeded(cmdcont, ta);
|
||||
@@ -731,24 +749,24 @@ struct BuildRoadToolbarWindow : Window {
|
||||
|
||||
case DDSP_BUILD_BUSSTOP:
|
||||
case DDSP_REMOVE_BUSSTOP:
|
||||
if (this->IsWidgetLowered(WID_ROT_BUS_STATION)) {
|
||||
if (this->IsWidgetLowered(WID_ROT_BUS_STATION) && GetIfClassHasNewStopsByType(RoadStopClass::Get(_roadstop_gui_settings.roadstop_class), ROADSTOP_BUS)) {
|
||||
if (_remove_button_clicked) {
|
||||
TileArea ta(start_tile, end_tile);
|
||||
DoCommandP(ta.tile, ta.w | ta.h << 8, (_ctrl_pressed << 1) | ROADSTOP_BUS, CMD_REMOVE_ROAD_STOP | CMD_MSG(this->rti->strings.err_remove_station[ROADSTOP_BUS]), CcPlaySound_CONSTRUCTION_OTHER);
|
||||
} else {
|
||||
PlaceRoadStop(start_tile, end_tile, _cur_roadtype << 5 | (_ctrl_pressed << 2) | ROADSTOP_BUS, CMD_BUILD_ROAD_STOP | CMD_MSG(this->rti->strings.err_build_station[ROADSTOP_BUS]));
|
||||
PlaceRoadStop(start_tile, end_tile, (_cur_roadtype << 5) | (_ctrl_pressed << 2) | ROADSTOP_BUS, CMD_BUILD_ROAD_STOP | CMD_MSG(this->rti->strings.err_build_station[ROADSTOP_BUS]));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DDSP_BUILD_TRUCKSTOP:
|
||||
case DDSP_REMOVE_TRUCKSTOP:
|
||||
if (this->IsWidgetLowered(WID_ROT_TRUCK_STATION)) {
|
||||
if (this->IsWidgetLowered(WID_ROT_TRUCK_STATION) && GetIfClassHasNewStopsByType(RoadStopClass::Get(_roadstop_gui_settings.roadstop_class), ROADSTOP_TRUCK)) {
|
||||
if (_remove_button_clicked) {
|
||||
TileArea ta(start_tile, end_tile);
|
||||
DoCommandP(ta.tile, ta.w | ta.h << 8, (_ctrl_pressed << 1) | ROADSTOP_TRUCK, CMD_REMOVE_ROAD_STOP | CMD_MSG(this->rti->strings.err_remove_station[ROADSTOP_TRUCK]), CcPlaySound_CONSTRUCTION_OTHER);
|
||||
} else {
|
||||
PlaceRoadStop(start_tile, end_tile, _cur_roadtype << 5 | (_ctrl_pressed << 2) | ROADSTOP_TRUCK, CMD_BUILD_ROAD_STOP | CMD_MSG(this->rti->strings.err_build_station[ROADSTOP_TRUCK]));
|
||||
PlaceRoadStop(start_tile, end_tile, (_cur_roadtype << 5) | (_ctrl_pressed << 2) | ROADSTOP_TRUCK, CMD_BUILD_ROAD_STOP | CMD_MSG(this->rti->strings.err_build_station[ROADSTOP_TRUCK]));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1044,7 +1062,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase {
|
||||
{
|
||||
this->CreateNestedTree();
|
||||
|
||||
this->LowerWidget(_road_depot_orientation + WID_BROD_DEPOT_NE);
|
||||
this->LowerWidget(_build_depot_direction + WID_BROD_DEPOT_NE);
|
||||
if (RoadTypeIsTram(_cur_roadtype)) {
|
||||
this->GetWidget<NWidgetCore>(WID_BROD_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION;
|
||||
for (int i = WID_BROD_DEPOT_NE; i <= WID_BROD_DEPOT_NW; i++) this->GetWidget<NWidgetCore>(i)->tool_tip = STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP;
|
||||
@@ -1075,9 +1093,9 @@ struct BuildRoadDepotWindow : public PickerWindowBase {
|
||||
case WID_BROD_DEPOT_NE:
|
||||
case WID_BROD_DEPOT_SW:
|
||||
case WID_BROD_DEPOT_SE:
|
||||
this->RaiseWidget(_road_depot_orientation + WID_BROD_DEPOT_NE);
|
||||
_road_depot_orientation = (DiagDirection)(widget - WID_BROD_DEPOT_NE);
|
||||
this->LowerWidget(_road_depot_orientation + WID_BROD_DEPOT_NE);
|
||||
this->RaiseWidget(_build_depot_direction + WID_BROD_DEPOT_NE);
|
||||
_build_depot_direction = (DiagDirection)(widget - WID_BROD_DEPOT_NE);
|
||||
this->LowerWidget(_build_depot_direction + WID_BROD_DEPOT_NE);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
this->SetDirty();
|
||||
break;
|
||||
@@ -1130,14 +1148,84 @@ static void ShowRoadDepotPicker(Window *parent)
|
||||
new BuildRoadDepotWindow(&_build_road_depot_desc, parent);
|
||||
}
|
||||
|
||||
/** Enum referring to the Hotkeys in the build road stop window */
|
||||
enum BuildRoadStopHotkeys {
|
||||
BROSHK_FOCUS_FILTER_BOX, ///< Focus the edit box for editing the filter string
|
||||
};
|
||||
|
||||
struct BuildRoadStationWindow : public PickerWindowBase {
|
||||
BuildRoadStationWindow(WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindowBase(desc, parent)
|
||||
private:
|
||||
RoadStopType roadStopType; ///< The RoadStopType for this Window.
|
||||
uint line_height; ///< Height of a single line in the newstation selection matrix.
|
||||
uint coverage_height; ///< Height of the coverage texts.
|
||||
Scrollbar *vscrollList; ///< Vertical scrollbar of the new station list.
|
||||
Scrollbar *vscrollMatrix; ///< Vertical scrollbar of the station picker matrix.
|
||||
|
||||
typedef GUIList<RoadStopClassID, StringFilter &> GUIRoadStopClassList; ///< Type definition for the list to hold available road stop classes.
|
||||
|
||||
static const uint EDITBOX_MAX_SIZE = 16; ///< The maximum number of characters for the filter edit box.
|
||||
|
||||
static Listing last_sorting; ///< Default sorting of #GUIRoadStopClassList.
|
||||
static Filtering last_filtering; ///< Default filtering of #GUIRoadStopClassList.
|
||||
static GUIRoadStopClassList::SortFunction * const sorter_funcs[]; ///< Sort functions of the #GUIRoadStopClassList.
|
||||
static GUIRoadStopClassList::FilterFunction * const filter_funcs[]; ///< Filter functions of the #GUIRoadStopClassList.
|
||||
GUIRoadStopClassList roadstop_classes; ///< Available road stop classes.
|
||||
StringFilter string_filter; ///< Filter for available road stop classes.
|
||||
QueryString filter_editbox; ///< Filter editbox.
|
||||
|
||||
void EnsureSelectedClassIsVisible()
|
||||
{
|
||||
uint pos = 0;
|
||||
for (auto rs_class : this->roadstop_classes) {
|
||||
if (rs_class == _roadstop_gui_settings.roadstop_class) break;
|
||||
pos++;
|
||||
}
|
||||
this->vscrollList->SetCount((int)this->roadstop_classes.size());
|
||||
this->vscrollList->ScrollTowards(pos);
|
||||
}
|
||||
|
||||
public:
|
||||
BuildRoadStationWindow(WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindowBase(desc, parent), filter_editbox(EDITBOX_MAX_SIZE * MAX_CHAR_LENGTH, EDITBOX_MAX_SIZE)
|
||||
{
|
||||
this->coverage_height = 2 * FONT_HEIGHT_NORMAL + 3 * WD_PAR_VSEP_NORMAL;
|
||||
this->vscrollList = nullptr;
|
||||
this->vscrollMatrix = nullptr;
|
||||
this->roadStopType = rs;
|
||||
bool newstops = GetIfNewStopsByType(rs);
|
||||
|
||||
this->CreateNestedTree();
|
||||
|
||||
/* Trams don't have non-drivethrough stations */
|
||||
if (RoadTypeIsTram(_cur_roadtype) && _road_station_picker_orientation < DIAGDIR_END) {
|
||||
_road_station_picker_orientation = DIAGDIR_END;
|
||||
NWidgetStacked *newst_additions = this->GetWidget<NWidgetStacked>(WID_BROS_SHOW_NEWST_ADDITIONS);
|
||||
newst_additions->SetDisplayedPlane(newstops ? 0 : SZSP_NONE);
|
||||
newst_additions = this->GetWidget<NWidgetStacked>(WID_BROS_SHOW_NEWST_MATRIX);
|
||||
newst_additions->SetDisplayedPlane(newstops ? 0 : SZSP_NONE);
|
||||
newst_additions = this->GetWidget<NWidgetStacked>(WID_BROS_SHOW_NEWST_DEFSIZE);
|
||||
newst_additions->SetDisplayedPlane(newstops ? 0 : SZSP_NONE);
|
||||
newst_additions = this->GetWidget<NWidgetStacked>(WID_BROS_SHOW_NEWST_RESIZE);
|
||||
newst_additions->SetDisplayedPlane(newstops ? 0 : SZSP_NONE);
|
||||
newst_additions = this->GetWidget<NWidgetStacked>(WID_BROS_SHOW_NEWST_ORIENTATION);
|
||||
newst_additions->SetDisplayedPlane(newstops ? 0 : SZSP_NONE);
|
||||
newst_additions = this->GetWidget<NWidgetStacked>(WID_BROS_SHOW_NEWST_TYPE_SEL);
|
||||
newst_additions->SetDisplayedPlane(newstops ? 0 : SZSP_NONE);
|
||||
/* Hide the station class filter if no stations other than the default one are available. */
|
||||
this->GetWidget<NWidgetStacked>(WID_BROS_FILTER_CONTAINER)->SetDisplayedPlane(newstops ? 0 : SZSP_NONE);
|
||||
if (newstops) {
|
||||
this->vscrollList = this->GetScrollbar(WID_BROS_NEWST_SCROLL);
|
||||
this->vscrollMatrix = this->GetScrollbar(WID_BROS_MATRIX_SCROLL);
|
||||
|
||||
this->querystrings[WID_BROS_FILTER_EDITBOX] = &this->filter_editbox;
|
||||
this->roadstop_classes.SetListing(this->last_sorting);
|
||||
this->roadstop_classes.SetFiltering(this->last_filtering);
|
||||
this->roadstop_classes.SetSortFuncs(this->sorter_funcs);
|
||||
this->roadstop_classes.SetFilterFuncs(this->filter_funcs);
|
||||
}
|
||||
|
||||
this->roadstop_classes.ForceRebuild();
|
||||
BuildRoadStopClassesAvailable();
|
||||
|
||||
// Trams don't have non-drivethrough stations
|
||||
if (RoadTypeIsTram(_cur_roadtype) && _roadstop_gui_settings.orientation < DIAGDIR_END) {
|
||||
_roadstop_gui_settings.orientation = DIAGDIR_END;
|
||||
}
|
||||
const RoadTypeInfo *rti = GetRoadTypeInfo(_cur_roadtype);
|
||||
this->GetWidget<NWidgetCore>(WID_BROS_CAPTION)->widget_data = rti->strings.picker_title[rs];
|
||||
@@ -1146,12 +1234,39 @@ struct BuildRoadStationWindow : public PickerWindowBase {
|
||||
this->GetWidget<NWidgetCore>(i)->tool_tip = rti->strings.picker_tooltip[rs];
|
||||
}
|
||||
|
||||
this->LowerWidget(_road_station_picker_orientation + WID_BROS_STATION_NE);
|
||||
this->LowerWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
||||
this->LowerWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF);
|
||||
|
||||
this->FinishInitNested(TRANSPORT_ROAD);
|
||||
|
||||
this->window_class = (rs == ROADSTOP_BUS) ? WC_BUS_STATION : WC_TRUCK_STATION;
|
||||
if (!newstops || _roadstop_gui_settings.roadstop_class >= (int)RoadStopClass::GetClassCount()) {
|
||||
/* There's no new stops available or the list has reduced in size.
|
||||
* Now, set the default road stops as selected. */
|
||||
_roadstop_gui_settings.roadstop_class = ROADSTOP_CLASS_DFLT;
|
||||
_roadstop_gui_settings.roadstop_type = 0;
|
||||
}
|
||||
if (newstops) {
|
||||
/* The currently selected class doesn't have any stops for this RoadStopType, reset the selection. */
|
||||
if (!GetIfClassHasNewStopsByType(RoadStopClass::Get(_roadstop_gui_settings.roadstop_class), rs)) {
|
||||
_roadstop_gui_settings.roadstop_class = ROADSTOP_CLASS_DFLT;
|
||||
_roadstop_gui_settings.roadstop_type = 0;
|
||||
}
|
||||
_roadstop_gui_settings.roadstop_count = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpecCount();
|
||||
_roadstop_gui_settings.roadstop_type = std::min((int)_roadstop_gui_settings.roadstop_type, _roadstop_gui_settings.roadstop_count - 1);
|
||||
|
||||
/* Reset back to default class if the previously selected class is not available for this road stop type. */
|
||||
if (!GetIfClassHasNewStopsByType(RoadStopClass::Get(_roadstop_gui_settings.roadstop_class), roadStopType)) {
|
||||
_roadstop_gui_settings.roadstop_class = ROADSTOP_CLASS_DFLT;
|
||||
}
|
||||
|
||||
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BROS_MATRIX);
|
||||
matrix->SetScrollbar(this->vscrollMatrix);
|
||||
matrix->SetCount(_roadstop_gui_settings.roadstop_count);
|
||||
matrix->SetClicked(_roadstop_gui_settings.roadstop_type);
|
||||
|
||||
this->EnsureSelectedClassIsVisible();
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~BuildRoadStationWindow()
|
||||
@@ -1159,10 +1274,86 @@ struct BuildRoadStationWindow : public PickerWindowBase {
|
||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||
}
|
||||
|
||||
/** Sort classes by RoadStopClassID. */
|
||||
static bool RoadStopClassIDSorter(RoadStopClassID const &a, RoadStopClassID const &b)
|
||||
{
|
||||
return a < b;
|
||||
}
|
||||
|
||||
/** Filter classes by class name. */
|
||||
static bool CDECL TagNameFilter(RoadStopClassID const *sc, StringFilter &filter)
|
||||
{
|
||||
char buffer[DRAW_STRING_BUFFER];
|
||||
GetString(buffer, RoadStopClass::Get(*sc)->name, lastof(buffer));
|
||||
|
||||
filter.ResetState();
|
||||
filter.AddLine(buffer);
|
||||
return filter.GetState();
|
||||
}
|
||||
|
||||
inline bool ShowNewStops() const
|
||||
{
|
||||
return this->vscrollList != nullptr;
|
||||
}
|
||||
|
||||
void BuildRoadStopClassesAvailable()
|
||||
{
|
||||
if (!this->roadstop_classes.NeedRebuild()) return;
|
||||
|
||||
this->roadstop_classes.clear();
|
||||
|
||||
for (uint i = 0; i < RoadStopClass::GetClassCount(); i++) {
|
||||
RoadStopClassID rs_id = (RoadStopClassID)i;
|
||||
if (rs_id == ROADSTOP_CLASS_WAYP) {
|
||||
// Skip waypoints.
|
||||
continue;
|
||||
}
|
||||
RoadStopClass *rs_class = RoadStopClass::Get(rs_id);
|
||||
if (GetIfClassHasNewStopsByType(rs_class, this->roadStopType)) this->roadstop_classes.push_back(rs_id);
|
||||
}
|
||||
|
||||
if (this->ShowNewStops()) {
|
||||
this->roadstop_classes.Filter(this->string_filter);
|
||||
this->roadstop_classes.shrink_to_fit();
|
||||
this->roadstop_classes.RebuildDone();
|
||||
this->roadstop_classes.Sort();
|
||||
|
||||
this->vscrollList->SetCount((uint)this->roadstop_classes.size());
|
||||
}
|
||||
}
|
||||
|
||||
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
|
||||
this->BuildRoadStopClassesAvailable();
|
||||
}
|
||||
|
||||
EventState OnHotkey(int hotkey) override
|
||||
{
|
||||
switch (hotkey) {
|
||||
case BROSHK_FOCUS_FILTER_BOX:
|
||||
this->SetFocusedWidget(WID_BROS_FILTER_EDITBOX);
|
||||
SetFocusedWindow(this); // The user has asked to give focus to the text box, so make sure this window is focused.
|
||||
break;
|
||||
|
||||
default:
|
||||
return ES_NOT_HANDLED;
|
||||
}
|
||||
|
||||
return ES_HANDLED;
|
||||
}
|
||||
|
||||
void OnEditboxChanged(int wid) override
|
||||
{
|
||||
string_filter.SetFilterTerm(this->filter_editbox.text.buf);
|
||||
this->roadstop_classes.SetFilterState(!string_filter.IsEmpty());
|
||||
this->roadstop_classes.ForceRebuild();
|
||||
this->InvalidateData();
|
||||
}
|
||||
|
||||
void OnPaint() override
|
||||
{
|
||||
this->DrawWidgets();
|
||||
|
||||
int rad = _settings_game.station.modified_catchment ? ((this->window_class == WC_BUS_STATION) ? CA_BUS : CA_TRUCK) : CA_UNMODIFIED;
|
||||
rad += _settings_game.station.catchment_increase;
|
||||
if (_settings_client.gui.station_show_coverage) {
|
||||
@@ -1171,50 +1362,172 @@ struct BuildRoadStationWindow : public PickerWindowBase {
|
||||
SetTileSelectSize(1, 1);
|
||||
}
|
||||
|
||||
this->DrawWidgets();
|
||||
|
||||
if (this->IsShaded()) return;
|
||||
/* 'Accepts' and 'Supplies' texts. */
|
||||
StationCoverageType sct = (this->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY;
|
||||
|
||||
NWidgetBase *cov = this->GetWidget<NWidgetBase>(WID_BROS_INFO);
|
||||
int top = cov->pos_y + WD_PAR_VSEP_NORMAL;
|
||||
int left = cov->pos_x + WD_FRAMERECT_LEFT;
|
||||
int right = cov->pos_x + cov->current_x - WD_FRAMERECT_RIGHT;
|
||||
int bottom = cov->pos_y + cov->current_y;
|
||||
top = DrawStationCoverageAreaText(left, right, top, sct, rad, false) + WD_PAR_VSEP_NORMAL;
|
||||
top = DrawStationCoverageAreaText(left, right, top, sct, rad, true) + WD_PAR_VSEP_NORMAL;
|
||||
|
||||
/*
|
||||
int top = this->GetWidget<NWidgetBase>(WID_BROS_LT_ON)->pos_y + this->GetWidget<NWidgetBase>(WID_BROS_LT_ON)->current_y + WD_PAR_VSEP_NORMAL;
|
||||
NWidgetBase *back_nwi = this->GetWidget<NWidgetBase>(WID_BROS_BACKGROUND);
|
||||
int right = back_nwi->pos_x + back_nwi->current_x;
|
||||
int bottom = back_nwi->pos_y + back_nwi->current_y;
|
||||
int right = back_nwi->pos_x + back_nwi->current_x;
|
||||
int bottom = back_nwi->pos_y + back_nwi->current_y;
|
||||
top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, false) + WD_PAR_VSEP_NORMAL;
|
||||
top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, true) + WD_PAR_VSEP_NORMAL;
|
||||
*/
|
||||
/* Resize background if the window is too small.
|
||||
* Never make the window smaller to avoid oscillating if the size change affects the acceptance.
|
||||
* (This is the case, if making the window bigger moves the mouse into the window.) */
|
||||
if (top > bottom) {
|
||||
ResizeWindow(this, 0, top - bottom, false);
|
||||
this->coverage_height += top - bottom;
|
||||
this->ReInit();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
||||
{
|
||||
if (!IsInsideMM(widget, WID_BROS_STATION_NE, WID_BROS_STATION_Y + 1)) return;
|
||||
|
||||
size->width = ScaleGUITrad(64) + 2;
|
||||
size->height = ScaleGUITrad(48) + 2;
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, int widget) const override
|
||||
{
|
||||
if (!IsInsideMM(widget, WID_BROS_STATION_NE, WID_BROS_STATION_Y + 1)) return;
|
||||
|
||||
StationType st = (this->window_class == WC_BUS_STATION) ? STATION_BUS : STATION_TRUCK;
|
||||
StationPickerDrawSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), st, INVALID_RAILTYPE, _cur_roadtype, widget - WID_BROS_STATION_NE);
|
||||
}
|
||||
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_BROS_NEWST_LIST: {
|
||||
Dimension d = { 0, 0 };
|
||||
for (auto rs_class : this->roadstop_classes) {
|
||||
d = maxdim(d, GetStringBoundingBox(RoadStopClass::Get(rs_class)->name));
|
||||
}
|
||||
size->width = std::max(size->width, d.width + padding.width);
|
||||
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
|
||||
size->height = 5 * this->line_height;
|
||||
resize->height = this->line_height;
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_BROS_IMAGE:
|
||||
size->width = ScaleGUITrad(64) + 2;
|
||||
size->height = ScaleGUITrad(58) + 2;
|
||||
break;
|
||||
|
||||
case WID_BROS_STATION_NE:
|
||||
case WID_BROS_STATION_SE:
|
||||
case WID_BROS_STATION_SW:
|
||||
case WID_BROS_STATION_NW:
|
||||
case WID_BROS_STATION_X:
|
||||
case WID_BROS_STATION_Y:
|
||||
this->RaiseWidget(_road_station_picker_orientation + WID_BROS_STATION_NE);
|
||||
_road_station_picker_orientation = (DiagDirection)(widget - WID_BROS_STATION_NE);
|
||||
this->LowerWidget(_road_station_picker_orientation + WID_BROS_STATION_NE);
|
||||
case WID_BROS_MATRIX:
|
||||
fill->height = 1;
|
||||
resize->height = 1;
|
||||
break;
|
||||
|
||||
case WID_BROS_INFO:
|
||||
size->height = this->coverage_height;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simply to have a easier way to get the StationType for bus, truck and trams from the WindowClass.
|
||||
*/
|
||||
StationType GetRoadStationTypeByWindowClass(WindowClass window_class) const {
|
||||
switch (window_class) {
|
||||
case WC_BUS_STATION: return STATION_BUS;
|
||||
case WC_TRUCK_STATION: return STATION_TRUCK;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, int widget) const override
|
||||
{
|
||||
DrawPixelInfo tmp_dpi;
|
||||
|
||||
switch (GB(widget, 0, 16)) {
|
||||
case WID_BROS_STATION_NE:
|
||||
case WID_BROS_STATION_SE:
|
||||
case WID_BROS_STATION_SW:
|
||||
case WID_BROS_STATION_NW:
|
||||
case WID_BROS_STATION_X:
|
||||
case WID_BROS_STATION_Y: {
|
||||
StationType st = GetRoadStationTypeByWindowClass(this->window_class);
|
||||
const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type);
|
||||
if (spec == nullptr) {
|
||||
StationPickerDrawSprite(r.left + WD_MATRIX_LEFT + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), st, INVALID_RAILTYPE, _cur_roadtype, widget - WID_BROS_STATION_NE);
|
||||
} else {
|
||||
DrawRoadStopTile(r.left + WD_MATRIX_LEFT + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), _cur_roadtype,
|
||||
RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type), st, (int)widget - WID_BROS_STATION_NE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_BROS_NEWST_LIST: {
|
||||
uint statclass = 0;
|
||||
uint row = 0;
|
||||
for (auto rs_class : this->roadstop_classes) {
|
||||
if (this->vscrollList->IsVisible(statclass)) {
|
||||
DrawString(r.left + WD_MATRIX_LEFT, r.right, row * this->line_height + r.top + WD_MATRIX_TOP,
|
||||
RoadStopClass::Get(rs_class)->name,
|
||||
rs_class == _roadstop_gui_settings.roadstop_class ? TC_WHITE : TC_BLACK);
|
||||
row++;
|
||||
}
|
||||
statclass++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_BROS_IMAGE: {
|
||||
byte type = GB(widget, 16, 16);
|
||||
assert(type < _roadstop_gui_settings.roadstop_count);
|
||||
|
||||
// Set up a clipping area for the sprite preview.
|
||||
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
|
||||
DrawPixelInfo *old_dpi = _cur_dpi;
|
||||
_cur_dpi = &tmp_dpi;
|
||||
int x = ScaleGUITrad(31) + 1;
|
||||
int y = r.bottom - r.top - ScaleGUITrad(31);
|
||||
// Instead of "5" (5th view), pass the orientation clicked in the selection.
|
||||
const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type);
|
||||
StationType st = GetRoadStationTypeByWindowClass(this->window_class);
|
||||
if (spec == nullptr) {
|
||||
StationPickerDrawSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), st, INVALID_RAILTYPE, _cur_roadtype, _roadstop_gui_settings.orientation);
|
||||
} else {
|
||||
DrawRoadStopTile(x, y, _cur_roadtype, RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(type), st, (uint8)_roadstop_gui_settings.orientation);
|
||||
}
|
||||
_cur_dpi = old_dpi;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnResize() override {
|
||||
if (this->vscrollList != nullptr) {
|
||||
this->vscrollList->SetCapacityFromWidget(this, WID_BROS_NEWST_LIST);
|
||||
}
|
||||
}
|
||||
|
||||
void SetStringParameters(int widget) const override {
|
||||
if (widget == WID_BROS_SHOW_NEWST_TYPE) {
|
||||
const RoadStopSpec *roadstopspec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type);
|
||||
SetDParam(0, (roadstopspec != nullptr && roadstopspec->name != 0) ? roadstopspec->name : STR_STATION_CLASS_DFLT);
|
||||
}
|
||||
}
|
||||
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
switch (GB(widget, 0, 16)) {
|
||||
case WID_BROS_STATION_NE:
|
||||
case WID_BROS_STATION_SE:
|
||||
case WID_BROS_STATION_SW:
|
||||
case WID_BROS_STATION_NW:
|
||||
case WID_BROS_STATION_X:
|
||||
case WID_BROS_STATION_Y:
|
||||
this->RaiseWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
||||
_roadstop_gui_settings.orientation = (DiagDirection)(widget - WID_BROS_STATION_NE);
|
||||
this->LowerWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
this->SetDirty();
|
||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||
@@ -1230,6 +1543,41 @@ struct BuildRoadStationWindow : public PickerWindowBase {
|
||||
SetViewportCatchmentStation(nullptr, true);
|
||||
break;
|
||||
|
||||
case WID_BROS_NEWST_LIST: {
|
||||
int y = this->vscrollList->GetScrolledRowFromWidget(pt.y, this, WID_BROS_NEWST_LIST);
|
||||
if (y >= (int)this->roadstop_classes.size()) return;
|
||||
RoadStopClassID class_id = this->roadstop_classes[y];
|
||||
if (_roadstop_gui_settings.roadstop_class != class_id && GetIfClassHasNewStopsByType(RoadStopClass::Get(class_id), roadStopType)) {
|
||||
_roadstop_gui_settings.roadstop_class = class_id;
|
||||
RoadStopClass *rsclass = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class);
|
||||
_roadstop_gui_settings.roadstop_count = rsclass->GetSpecCount();
|
||||
_roadstop_gui_settings.roadstop_type = std::min((int)_roadstop_gui_settings.roadstop_type, std::max(0, (int)_roadstop_gui_settings.roadstop_count - 1));
|
||||
|
||||
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BROS_MATRIX);
|
||||
matrix->SetCount(_roadstop_gui_settings.roadstop_count);
|
||||
matrix->SetClicked(_roadstop_gui_settings.roadstop_type);
|
||||
}
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
this->SetDirty();
|
||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_BROS_IMAGE: {
|
||||
int y = GB(widget, 16, 16);
|
||||
if (y >= _roadstop_gui_settings.roadstop_count) return;
|
||||
|
||||
/* Check station availability callback */
|
||||
_roadstop_gui_settings.roadstop_type = y;
|
||||
|
||||
this->GetWidget<NWidgetMatrix>(WID_BROS_MATRIX)->SetClicked(_roadstop_gui_settings.roadstop_type);
|
||||
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
this->SetDirty();
|
||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1239,6 +1587,25 @@ struct BuildRoadStationWindow : public PickerWindowBase {
|
||||
{
|
||||
CheckRedrawStationCoverage(this);
|
||||
}
|
||||
|
||||
static HotkeyList hotkeys;
|
||||
};
|
||||
|
||||
static Hotkey buildroadstop_hotkeys[] = {
|
||||
Hotkey('F', "focus_filter_box", BROSHK_FOCUS_FILTER_BOX),
|
||||
HOTKEY_LIST_END
|
||||
};
|
||||
HotkeyList BuildRoadStationWindow::hotkeys("buildroadstop", buildroadstop_hotkeys);
|
||||
|
||||
Listing BuildRoadStationWindow::last_sorting = { false, 0 };
|
||||
Filtering BuildRoadStationWindow::last_filtering = { false, 0 };
|
||||
|
||||
BuildRoadStationWindow::GUIRoadStopClassList::SortFunction * const BuildRoadStationWindow::sorter_funcs[] = {
|
||||
&RoadStopClassIDSorter,
|
||||
};
|
||||
|
||||
BuildRoadStationWindow::GUIRoadStopClassList::FilterFunction * const BuildRoadStationWindow::filter_funcs[] = {
|
||||
&TagNameFilter,
|
||||
};
|
||||
|
||||
/** Widget definition of the build road station window */
|
||||
@@ -1246,38 +1613,82 @@ static const NWidgetPart _nested_road_station_picker_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
|
||||
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BROS_CAPTION),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_DARK_GREEN),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_SHOW_NEWST_DEFSIZE),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_DARK_GREEN),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BROS_BACKGROUND),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_NW), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_NE), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_X), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_FILTER_CONTAINER),
|
||||
NWidget(NWID_HORIZONTAL), SetPadding(0, 5, 2, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_DARK_GREEN), SetFill(0, 1), SetDataTip(STR_LIST_FILTER_TITLE, STR_NULL),
|
||||
NWidget(WWT_EDITBOX, COLOUR_GREY, WID_BROS_FILTER_EDITBOX), SetFill(1, 0), SetResize(1, 0),
|
||||
SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_SHOW_NEWST_ADDITIONS),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(7, 0, 7), SetPadding(2, 0, 1, 0),
|
||||
NWidget(WWT_MATRIX, COLOUR_GREY, WID_BROS_NEWST_LIST), SetMinimalSize(122, 71), SetFill(1, 0),
|
||||
SetMatrixDataTip(1, 0, STR_STATION_BUILD_STATION_CLASS_TOOLTIP), SetScrollbar(WID_BROS_NEWST_SCROLL),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_BROS_NEWST_SCROLL),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_SHOW_NEWST_ORIENTATION),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(144, 11), SetDataTip(STR_STATION_BUILD_ORIENTATION, STR_NULL), SetPadding(4, 2, 1, 2),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(5, 2, 5), SetPadding(0, 0, 1, 0),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_NW), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_NE), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_X), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(5, 2, 5), SetPadding(0, 0, 1, 0), // For PIP, 5 because the 2 is applied before and after aswell. We want to use 7 to be the same as the class list
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_SW), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_SE), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_Y), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_SHOW_NEWST_TYPE_SEL),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BROS_SHOW_NEWST_TYPE), SetMinimalSize(144, 8), SetDataTip(STR_ORANGE_STRING, STR_NULL), SetPadding(4, 2, 4, 2),
|
||||
EndContainer(),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(140, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetPadding(3, 2, 0, 2),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_OFF), SetMinimalSize(60, 12),
|
||||
SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_ON), SetMinimalSize(60, 12),
|
||||
SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_SHOW_NEWST_MATRIX),
|
||||
/* We need an additional background for the matrix, as the matrix cannot handle the scrollbar due to not being an NWidgetCore. */
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetScrollbar(WID_BROS_MATRIX_SCROLL),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_MATRIX, COLOUR_DARK_GREEN, WID_BROS_MATRIX), SetScrollbar(WID_BROS_MATRIX_SCROLL), SetPIP(0, 2, 0), SetPadding(2, 0, 0, 0),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BROS_IMAGE), SetMinimalSize(66, 60),
|
||||
SetFill(0, 0), SetResize(0, 0), SetDataTip(0x0, STR_STATION_BUILD_STATION_TYPE_TOOLTIP), SetScrollbar(WID_BROS_MATRIX_SCROLL),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, WID_BROS_MATRIX_SCROLL),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_SW), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_SE), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_Y), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BROS_INFO), SetPadding(2, 5, 0, 1), SetFill(1, 1), SetResize(1, 0),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_SHOW_NEWST_RESIZE),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(0, 1), EndContainer(),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_DARK_GREEN),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BROS_INFO), SetMinimalSize(140, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_OFF), SetMinimalSize(60, 12),
|
||||
SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_ON), SetMinimalSize(60, 12),
|
||||
SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
@@ -1293,29 +1704,66 @@ static const NWidgetPart _nested_tram_station_picker_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
|
||||
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BROS_CAPTION),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_DARK_GREEN),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_SHOW_NEWST_DEFSIZE),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_DARK_GREEN),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BROS_BACKGROUND),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_X), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_Y), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_SHOW_NEWST_ADDITIONS),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(7, 0, 7), SetPadding(2, 0, 1, 0),
|
||||
NWidget(WWT_MATRIX, COLOUR_GREY, WID_BROS_NEWST_LIST), SetMinimalSize(122, 71), SetFill(1, 0),
|
||||
SetMatrixDataTip(1, 0, STR_STATION_BUILD_STATION_CLASS_TOOLTIP), SetScrollbar(WID_BROS_NEWST_SCROLL),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_BROS_NEWST_SCROLL),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(144, 11), SetDataTip(STR_STATION_BUILD_ORIENTATION, STR_NULL), SetPadding(1, 2, 0, 2),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_X), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_Y), SetMinimalSize(66, 50), SetFill(0, 0), EndContainer(),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BROS_SHOW_NEWST_TYPE), SetMinimalSize(144, 11), SetDataTip(STR_ORANGE_STRING, STR_NULL), SetPadding(1, 2, 4, 2),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_OFF), SetMinimalSize(60, 12),
|
||||
SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_ON), SetMinimalSize(60, 12),
|
||||
SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_SHOW_NEWST_MATRIX),
|
||||
/* We need an additional background for the matrix, as the matrix cannot handle the scrollbar due to not being an NWidgetCore. */
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetScrollbar(WID_BROS_MATRIX_SCROLL),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_MATRIX, COLOUR_DARK_GREEN, WID_BROS_MATRIX), SetScrollbar(WID_BROS_MATRIX_SCROLL), SetPIP(0, 2, 0), SetPadding(2, 0, 0, 0),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BROS_IMAGE), SetMinimalSize(66, 60),
|
||||
SetFill(0, 0), SetResize(0, 0), SetDataTip(0x0, STR_STATION_BUILD_STATION_TYPE_TOOLTIP), SetScrollbar(WID_BROS_MATRIX_SCROLL),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, WID_BROS_MATRIX_SCROLL),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 1),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
|
||||
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BROS_INFO), SetMinimalSize(140, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BROS_INFO), SetFill(1, 1), SetResize(1, 0),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BROS_SHOW_NEWST_RESIZE),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(0, 1), EndContainer(),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_DARK_GREEN),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_OFF), SetMinimalSize(60, 12),
|
||||
SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_ON), SetMinimalSize(60, 12),
|
||||
SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
@@ -1333,8 +1781,8 @@ static void ShowRVStationPicker(Window *parent, RoadStopType rs)
|
||||
|
||||
void InitializeRoadGui()
|
||||
{
|
||||
_road_depot_orientation = DIAGDIR_NW;
|
||||
_road_station_picker_orientation = DIAGDIR_NW;
|
||||
_build_depot_direction = DIAGDIR_NW;
|
||||
_roadstop_gui_settings.orientation = DIAGDIR_NW;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user