Add station cargo history
This commit is contained in:
@@ -184,6 +184,7 @@ extern void CompaniesMonthlyLoop();
|
||||
extern void EnginesMonthlyLoop();
|
||||
extern void TownsMonthlyLoop();
|
||||
extern void IndustryMonthlyLoop();
|
||||
extern void StationDailyLoop();
|
||||
extern void StationMonthlyLoop();
|
||||
extern void SubsidyMonthlyLoop();
|
||||
|
||||
@@ -276,6 +277,7 @@ static void OnNewDay()
|
||||
|
||||
DisasterDailyLoop();
|
||||
IndustryDailyLoop();
|
||||
StationDailyLoop();
|
||||
|
||||
if (!_settings_time.time_in_minutes || _settings_client.gui.date_with_time > 0) {
|
||||
SetWindowWidgetDirty(WC_STATUS_BAR, 0, WID_S_LEFT);
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "safeguards.h"
|
||||
#include "station_base.h"
|
||||
|
||||
/* Bitmasks of company and cargo indices that shouldn't be drawn. */
|
||||
static CompanyMask _legend_excluded_companies;
|
||||
@@ -1649,3 +1650,274 @@ void InitializeGraphGui()
|
||||
_legend_excluded_companies = 0;
|
||||
_legend_excluded_cargo = 0;
|
||||
}
|
||||
|
||||
/*************************/
|
||||
/* STATION CARGO HISTORY */
|
||||
/*************************/
|
||||
struct StationCargoGraphWindow final : BaseGraphWindow {
|
||||
StationID station_id;
|
||||
uint line_height {}; ///< Pixel height of each cargo type row.
|
||||
Scrollbar *vscroll; ///< Cargo list scrollbar.
|
||||
uint legend_width {}; ///< Width of legend 'blob'.
|
||||
CargoTypes legend_excluded_cargo;
|
||||
|
||||
StationCargoGraphWindow(WindowDesc *desc, WindowNumber window) :
|
||||
BaseGraphWindow(desc, WID_SCG_GRAPH, STR_JUST_COMMA)
|
||||
{
|
||||
station_id = static_cast<uint16>(window);
|
||||
|
||||
this->num_on_x_axis = MAX_STATION_CARGO_HISTORY_DAYS; // Four weeks
|
||||
this->num_vert_lines = MAX_STATION_CARGO_HISTORY_DAYS;
|
||||
this->month = 0xFF;
|
||||
this->x_values_start = 2;
|
||||
this->x_values_increment = 2;
|
||||
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_SCG_MATRIX_SCROLLBAR);
|
||||
this->vscroll->SetCount(_sorted_standard_cargo_specs_size);
|
||||
|
||||
/* Initialise the data set */
|
||||
this->OnHundredthTick();
|
||||
|
||||
this->FinishInitNested(window);
|
||||
}
|
||||
|
||||
void OnInit() override
|
||||
{
|
||||
/* Width of the legend blob. */
|
||||
this->legend_width = (FONT_HEIGHT_SMALL - ScaleFontTrad(1)) * 8 / 5;
|
||||
this->legend_excluded_cargo = 0;
|
||||
|
||||
const Station* station = Station::GetIfValid(this->station_id);
|
||||
|
||||
if (station == nullptr) return;
|
||||
|
||||
const CargoSpec *cs;
|
||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
||||
if (station->goods[cs->Index()].cargo.AvailableCount() == 0) {
|
||||
SetBit(legend_excluded_cargo, cs->Index());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetStringParameters(int widget) const override
|
||||
{
|
||||
if (widget == WID_SCG_CAPTION) {
|
||||
SetDParam(0, this->station_id);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateExcludedData()
|
||||
{
|
||||
this->excluded_data = 0;
|
||||
|
||||
uint8 i = 0;
|
||||
const CargoSpec *cs;
|
||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
||||
if (HasBit(legend_excluded_cargo, cs->Index())) SetBit(this->excluded_data, i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
|
||||
{
|
||||
if (widget < WID_SCG_MATRIX) {
|
||||
BaseGraphWindow::UpdateWidgetSize(widget, size, padding, fill, resize);
|
||||
return;
|
||||
}
|
||||
|
||||
const CargoSpec *cs;
|
||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
||||
SetDParam(0, cs->name);
|
||||
Dimension d = GetStringBoundingBox(STR_GRAPH_CARGO_PAYMENT_CARGO);
|
||||
d.width += this->legend_width + 4; // color field
|
||||
d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
|
||||
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
||||
*size = maxdim(d, *size);
|
||||
}
|
||||
|
||||
this->line_height = size->height;
|
||||
size->height = this->line_height * 11; /* Default number of cargo types in most climates. */
|
||||
resize->width = 0;
|
||||
resize->height = this->line_height;
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, int widget) const override
|
||||
{
|
||||
if (widget < WID_SCG_MATRIX) {
|
||||
BaseGraphWindow::DrawWidget(r, widget);
|
||||
return;
|
||||
}
|
||||
|
||||
const bool rtl = _current_text_dir == TD_RTL;
|
||||
|
||||
int x = r.left + WD_FRAMERECT_LEFT;
|
||||
int y = r.top;
|
||||
const uint row_height = FONT_HEIGHT_SMALL;
|
||||
const int padding = ScaleFontTrad(1);
|
||||
|
||||
int pos = this->vscroll->GetPosition();
|
||||
int max = pos + this->vscroll->GetCapacity();
|
||||
|
||||
const CargoSpec *cs;
|
||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
||||
if (pos-- > 0) continue;
|
||||
if (--max < 0) break;
|
||||
|
||||
const bool lowered = !HasBit(legend_excluded_cargo, cs->Index());
|
||||
|
||||
/* Redraw box if lowered */
|
||||
if (lowered) DrawFrameRect(r.left, y, r.right, y + this->line_height - 1, COLOUR_BROWN, lowered ? FR_LOWERED : FR_NONE);
|
||||
|
||||
const byte clk_dif = lowered ? 1 : 0;
|
||||
const int rect_x = clk_dif + (rtl ? r.right - this->legend_width - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT);
|
||||
|
||||
GfxFillRect(rect_x, y + padding + clk_dif, rect_x + this->legend_width, y + row_height - 1 + clk_dif, PC_BLACK);
|
||||
GfxFillRect(rect_x + 1, y + padding + 1 + clk_dif, rect_x + this->legend_width - 1, y + row_height - 2 + clk_dif, cs->legend_colour);
|
||||
SetDParam(0, cs->name);
|
||||
DrawString(rtl ? r.left : x + this->legend_width + 4 + clk_dif, (rtl ? r.right - this->legend_width - 4 + clk_dif : r.right), y + clk_dif, STR_GRAPH_CARGO_PAYMENT_CARGO);
|
||||
|
||||
y += this->line_height;
|
||||
}
|
||||
}
|
||||
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_SCG_ENABLE_CARGOES:
|
||||
/* Remove all cargoes from the excluded lists. */
|
||||
legend_excluded_cargo = 0;
|
||||
this->excluded_data = 0;
|
||||
this->SetDirty();
|
||||
break;
|
||||
|
||||
case WID_SCG_DISABLE_CARGOES: {
|
||||
/* Add all cargoes to the excluded lists. */
|
||||
int i = 0;
|
||||
const CargoSpec *cs;
|
||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
||||
SetBit(legend_excluded_cargo, cs->Index());
|
||||
SetBit(this->excluded_data, i);
|
||||
i++;
|
||||
}
|
||||
this->SetDirty();
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_SCG_MATRIX: {
|
||||
uint row = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SCG_MATRIX);
|
||||
if (row >= this->vscroll->GetCount()) return;
|
||||
|
||||
const CargoSpec *cs;
|
||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
||||
if (row-- > 0) continue;
|
||||
|
||||
ToggleBit(legend_excluded_cargo, cs->Index());
|
||||
this->UpdateExcludedData();
|
||||
this->SetDirty();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnResize() override
|
||||
{
|
||||
this->vscroll->SetCapacityFromWidget(this, WID_SCG_MATRIX);
|
||||
}
|
||||
|
||||
void OnGameTick() override
|
||||
{
|
||||
/* Override default OnGameTick */
|
||||
}
|
||||
|
||||
/**
|
||||
* Some data on this window has become invalid.
|
||||
* @param data Information about the changed data.
|
||||
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
|
||||
*/
|
||||
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
this->OnHundredthTick();
|
||||
}
|
||||
|
||||
void OnHundredthTick() override
|
||||
{
|
||||
this->UpdateExcludedData();
|
||||
|
||||
const Station* station = Station::GetIfValid(this->station_id);
|
||||
|
||||
if (station == nullptr) return;
|
||||
|
||||
uint8 i = 0;
|
||||
const CargoSpec *cs;
|
||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
||||
this->colours[i] = cs->legend_colour;
|
||||
|
||||
for (uint j = 0; j < MAX_STATION_CARGO_HISTORY_DAYS; j++) {
|
||||
|
||||
this->cost[i][j] = station->station_cargo_history[cs->Index() * MAX_STATION_CARGO_HISTORY_DAYS + j] * STATION_CARGO_HISTORY_FACTOR;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
this->num_dataset = i;
|
||||
|
||||
this->SetDirty();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static const NWidgetPart _nested_station_cargo_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY, WID_SCG_CAPTION), SetDataTip(STR_GRAPH_STATION_CARGO_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_SCG_BACKGROUND), SetMinimalSize(568, 128),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_GREY, WID_SCG_HEADER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_STATION_CARGO_TITLE, STR_NULL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_SCG_GRAPH), SetMinimalSize(495, 0), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 24), SetFill(0, 0), SetResize(0, 1),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SCG_ENABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_ENABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_ENABLE_ALL), SetFill(1, 0),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SCG_DISABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_DISABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_DISABLE_ALL), SetFill(1, 0),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 4),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_MATRIX, COLOUR_BROWN, WID_SCG_MATRIX), SetResize(0, 2), SetMatrixDataTip(1, 0, STR_GRAPH_CARGO_PAYMENT_TOGGLE_CARGO), SetScrollbar(WID_SCG_MATRIX_SCROLLBAR),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_SCG_MATRIX_SCROLLBAR),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 24), SetFill(0, 1), SetResize(0, 1),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(5, 0), SetFill(0, 1), SetResize(0, 1),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(WD_RESIZEBOX_WIDTH, 0), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_GREY, WID_SCG_FOOTER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_STATION_CARGO_X_LABEL, STR_NULL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_SCG_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
static WindowDesc _station_cargo_desc(
|
||||
WDP_AUTO, "graph_station_cargo", 0, 0,
|
||||
WC_STATION_CARGO, WC_NONE,
|
||||
0,
|
||||
_nested_station_cargo_widgets, lengthof(_nested_station_cargo_widgets)
|
||||
);
|
||||
|
||||
|
||||
void ShowStationCargo(StationID station_id)
|
||||
{
|
||||
AllocateWindowDescFront<StationCargoGraphWindow>(&_station_cargo_desc, station_id);
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,8 @@
|
||||
|
||||
extern uint8 _cargo_payment_x_mode;
|
||||
|
||||
typedef uint16 StationID;
|
||||
|
||||
void ShowOperatingProfitGraph();
|
||||
void ShowIncomeGraph();
|
||||
void ShowDeliveredCargoGraph();
|
||||
@@ -20,5 +22,6 @@ void ShowCompanyValueGraph();
|
||||
void ShowCargoPaymentRates();
|
||||
void ShowCompanyLeagueTable();
|
||||
void ShowPerformanceRatingDetail();
|
||||
void ShowStationCargo(StationID);
|
||||
|
||||
#endif /* GRAPH_GUI_H */
|
||||
|
@@ -613,6 +613,10 @@ STR_GRAPH_CARGO_TOOLTIP_DISABLE_ALL :{BLACK}Display
|
||||
STR_GRAPH_CARGO_PAYMENT_TOGGLE_CARGO :{BLACK}Toggle graph for cargo type on/off
|
||||
STR_GRAPH_CARGO_PAYMENT_CARGO :{TINY_FONT}{BLACK}{STRING}
|
||||
|
||||
STR_GRAPH_STATION_CARGO_CAPTION :{WHITE}{STATION} - Waiting Cargo History
|
||||
STR_GRAPH_STATION_CARGO_X_LABEL :{TINY_FONT}{BLACK}Development over the last 48 days
|
||||
STR_GRAPH_STATION_CARGO_TITLE :{TINY_FONT}{BLACK}Units of cargo waiting at the station
|
||||
|
||||
STR_GRAPH_CARGO_DAYS_MODE :{TINY_FONT}{BLACK}Days in transit
|
||||
STR_GRAPH_CARGO_SPEED_MODE :{TINY_FONT}{BLACK}Average speed
|
||||
STR_GRAPH_CARGO_TOOLTIP_DAYS_MODE :{BLACK}Display days in transit on the x-axis of the graph
|
||||
@@ -4181,6 +4185,9 @@ STR_STATION_VIEW_GROUP_D_V_S :Destination-Via
|
||||
STR_STATION_VIEW_DEPARTURES_BUTTON :{BLACK}Departures
|
||||
STR_STATION_VIEW_DEPARTURES_TOOLTIP :{BLACK}Show list of scheduled departures
|
||||
|
||||
STR_STATION_VIEW_HISTORY_BUTTON :{BLACK}History
|
||||
STR_STATION_VIEW_HISTORY_TOOLTIP :{BLACK}Show waiting cargo history
|
||||
|
||||
############ range for rating starts
|
||||
STR_CARGO_RATING_APPALLING :Appalling
|
||||
STR_CARGO_RATING_VERY_POOR :Very Poor
|
||||
|
@@ -459,6 +459,7 @@ static const SaveLoad _station_desc[] = {
|
||||
SLE_CONDVAR(Station, always_accepted, SLE_FILE_U32 | SLE_VAR_U64, SLV_127, SLV_EXTEND_CARGOTYPES),
|
||||
SLE_CONDVAR(Station, always_accepted, SLE_UINT64, SLV_EXTEND_CARGOTYPES, SL_MAX_VERSION),
|
||||
SLE_CONDNULL_X(32 * 24, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_JOKERPP, SL_JOKER_1_22)),
|
||||
SLE_CONDARR(Station, station_cargo_history, SLE_UINT8, NUM_CARGO * MAX_STATION_CARGO_HISTORY_DAYS, SL_JOKER_1_22, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@@ -62,6 +62,7 @@ BaseStation::~BaseStation()
|
||||
DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->index).Pack());
|
||||
DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->index).Pack());
|
||||
DeleteWindowById(WC_DEPARTURES_BOARD, this->index);
|
||||
DeleteWindowById(WC_STATION_CARGO, this->index);
|
||||
|
||||
if (HasBit(_display_opt, Station::IsExpected(this) ? DO_SHOW_STATION_NAMES : DO_SHOW_WAYPOINT_NAMES) &&
|
||||
!(_local_company != this->owner && this->owner != OWNER_NONE && !HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS))) {
|
||||
@@ -76,7 +77,8 @@ Station::Station(TileIndex tile) :
|
||||
ship_station(INVALID_TILE, 0, 0),
|
||||
indtype(IT_INVALID),
|
||||
time_since_load(255),
|
||||
time_since_unload(255)
|
||||
time_since_unload(255),
|
||||
station_cargo_history{}
|
||||
{
|
||||
/* this->random_bits is set in Station::AddFacility() */
|
||||
}
|
||||
|
@@ -808,6 +808,8 @@ public:
|
||||
IndustryList industries_near; ///< Cached list of industries near the station that can accept cargo, @see DeliverGoodsToIndustry()
|
||||
Industry *industry; ///< NOSAVE: Associated industry for neutral stations. (Rebuilt on load from Industry->st)
|
||||
|
||||
uint8 station_cargo_history[NUM_CARGO * MAX_STATION_CARGO_HISTORY_DAYS]; ///< Station history of waiting cargo.
|
||||
|
||||
Station(TileIndex tile = INVALID_TILE);
|
||||
~Station();
|
||||
|
||||
@@ -817,6 +819,8 @@ public:
|
||||
|
||||
void UpdateVirtCoord() override;
|
||||
|
||||
void UpdateCargoHistory();
|
||||
|
||||
void MoveSign(TileIndex new_xy) override;
|
||||
|
||||
void AfterStationTileSetChange(bool adding, StationType type);
|
||||
|
@@ -404,6 +404,23 @@ void Station::GetTileArea(TileArea *ta, StationType type) const
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the cargo history.
|
||||
*/
|
||||
void Station::UpdateCargoHistory()
|
||||
{
|
||||
const CargoSpec* cs;
|
||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
||||
auto amount = this->goods[cs->Index()].cargo.AvailableCount();
|
||||
|
||||
std::rotate(std::begin(this->station_cargo_history) + cs->Index() * MAX_STATION_CARGO_HISTORY_DAYS,
|
||||
std::begin(this->station_cargo_history) + cs->Index() * MAX_STATION_CARGO_HISTORY_DAYS + 1,
|
||||
std::begin(this->station_cargo_history) + (cs->Index() + 1) * MAX_STATION_CARGO_HISTORY_DAYS);
|
||||
|
||||
this->station_cargo_history[(cs->Index() + 1) * MAX_STATION_CARGO_HISTORY_DAYS - 1] = std::clamp(amount / STATION_CARGO_HISTORY_FACTOR, (uint)0, (uint)UINT8_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the virtual coords needed to draw the station sign.
|
||||
*/
|
||||
@@ -4240,6 +4257,17 @@ void OnTick_Station()
|
||||
}
|
||||
}
|
||||
|
||||
/** Daily loop for stations. */
|
||||
void StationDailyLoop()
|
||||
{
|
||||
// Only record cargo history every second day.
|
||||
if (_date % 2 != 0) {
|
||||
for (Station *st : Station::Iterate()) {
|
||||
st->UpdateCargoHistory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Monthly loop for stations. */
|
||||
void StationMonthlyLoop()
|
||||
{
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "linkgraph/linkgraph.h"
|
||||
#include "zoom_func.h"
|
||||
#include "departures_gui.h"
|
||||
#include "graph_gui.h"
|
||||
#include "zoning.h"
|
||||
#include "newgrf_debug.h"
|
||||
|
||||
@@ -831,6 +832,8 @@ static const NWidgetPart _nested_station_view_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_ACCEPTS_RATINGS), SetMinimalSize(46, 12), SetResize(1, 0), SetFill(1, 1),
|
||||
SetDataTip(STR_STATION_VIEW_RATINGS_BUTTON, STR_STATION_VIEW_RATINGS_TOOLTIP),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_HISTORY), SetMinimalSize(60, 12), SetResize(1, 0), SetFill(1, 1),
|
||||
SetDataTip(STR_STATION_VIEW_HISTORY_BUTTON, STR_STATION_VIEW_HISTORY_TOOLTIP),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_DEPARTURES), SetMinimalSize(46, 12), SetResize(1, 0), SetFill(1, 1),
|
||||
SetDataTip(STR_STATION_VIEW_DEPARTURES_BUTTON, STR_STATION_VIEW_DEPARTURES_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SV_CLOSE_AIRPORT), SetMinimalSize(45, 12), SetResize(1, 0), SetFill(1, 1),
|
||||
@@ -2052,6 +2055,11 @@ struct StationViewWindow : public Window {
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_SV_HISTORY: {
|
||||
ShowStationCargo((StationID)this->window_number);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_SV_DEPARTURES: {
|
||||
ShowStationDepartures((StationID)this->window_number);
|
||||
break;
|
||||
|
@@ -27,6 +27,9 @@ struct Waypoint;
|
||||
static const StationID NEW_STATION = 0xFFFE;
|
||||
static const StationID INVALID_STATION = 0xFFFF;
|
||||
|
||||
static const uint MAX_STATION_CARGO_HISTORY_DAYS = 24;
|
||||
static const uint STATION_CARGO_HISTORY_FACTOR = 25;
|
||||
|
||||
typedef SmallStack<StationID, StationID, INVALID_STATION, 8, 0xFFFD> StationIDStack;
|
||||
|
||||
/** Station types */
|
||||
|
@@ -53,6 +53,20 @@ enum CargoPaymentRatesWidgets {
|
||||
WID_CPR_SPEED, ///< Speed mode.
|
||||
};
|
||||
|
||||
/** Widget of the #StationCargoGraphWindow class. */
|
||||
enum StationCargoWidgets {
|
||||
WID_SCG_CAPTION, ///< Window title
|
||||
WID_SCG_BACKGROUND, ///< Background of the window.
|
||||
WID_SCG_HEADER, ///< Header.
|
||||
WID_SCG_GRAPH, ///< Graph itself.
|
||||
WID_SCG_RESIZE, ///< Resize button.
|
||||
WID_SCG_FOOTER, ///< Footer.
|
||||
WID_SCG_ENABLE_CARGOES, ///< Enable cargoes button.
|
||||
WID_SCG_DISABLE_CARGOES, ///< Disable cargoes button.
|
||||
WID_SCG_MATRIX, ///< Cargo list.
|
||||
WID_SCG_MATRIX_SCROLLBAR, ///< Cargo list scrollbar.
|
||||
};
|
||||
|
||||
/** Widget of the #CompanyLeagueWindow class. */
|
||||
enum CompanyLeagueWidgets {
|
||||
WID_CL_BACKGROUND, ///< Background of the window.
|
||||
|
@@ -30,6 +30,7 @@ enum StationViewWidgets {
|
||||
WID_SV_PLANES, ///< List of scheduled planes button.
|
||||
WID_SV_CATCHMENT, ///< Toggle catchment area highlight.
|
||||
WID_SV_DEPARTURES, ///< Departures button.
|
||||
WID_SV_HISTORY, ///< Cargo history button.
|
||||
};
|
||||
|
||||
/** Widgets of the #CompanyStationsWindow class. */
|
||||
|
@@ -581,6 +581,12 @@ enum WindowClass {
|
||||
*/
|
||||
WC_PAYMENT_RATES,
|
||||
|
||||
/**
|
||||
* Station cargo graph; %Window numbers:
|
||||
* - #StationID = #StationCargoWidgets
|
||||
*/
|
||||
WC_STATION_CARGO,
|
||||
|
||||
/**
|
||||
* Performance detail window; %Window numbers:
|
||||
* - 0 = #PerformanceRatingDetailsWidgets
|
||||
|
Reference in New Issue
Block a user