Change station cargo history storage format

Use uint16 to avoid truncation issues
Don't reserve memory for unused cargoes
Store history as ring buffer
Update history graph immediately on storage date
Show total waiting cargo
This commit is contained in:
Jonathan G Rennison
2021-06-29 18:09:49 +01:00
parent f901da344e
commit 5698507d0b
7 changed files with 57 additions and 38 deletions

View File

@@ -1366,6 +1366,12 @@ struct StationViewWindow : public Window {
SetViewportCatchmentStation(Station::Get(this->window_number), false);
}
void OnInit() override
{
const Station *st = Station::Get(this->window_number);
SetWidgetDisabledState(WID_SV_HISTORY, st->station_cargo_history_cargoes == 0);
}
/**
* Show a certain cargo entry characterized by source/next/dest station, cargo ID and amount of cargo at the
* right place in the cargo view. I.e. update as many rows as are expanded following that characterization.