|
@@ -836,26 +836,29 @@ struct PaymentRatesGraphWindow : BaseGra
|
|
|
if (!this->first_init) {
|
|
|
/* Initialise the dataset */
|
|
|
this->OnHundredthTick();
|
|
|
this->UpdateLoweredWidgets();
|
|
|
}
|
|
|
this->first_init = false;
|
|
|
}
|
|
|
|
|
|
void UpdateExcludedData()
|
|
|
{
|
|
|
this->excluded_data = 0;
|
|
|
|
|
|
for (int i = 0; i < _sorted_cargo_specs_size; i++) {
|
|
|
if (HasBit(_legend_excluded_cargo, _sorted_cargo_specs[i]->Index())) SetBit(this->excluded_data, i);
|
|
|
int i = 0;
|
|
|
const CargoSpec *cs;
|
|
|
FOR_ALL_SORTED_CARGOSPECS(cs) {
|
|
|
if (HasBit(_legend_excluded_cargo, cs->Index())) SetBit(this->excluded_data, i);
|
|
|
i++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void UpdateLoweredWidgets()
|
|
|
{
|
|
|
for (int i = 0; i < _sorted_cargo_specs_size; i++) {
|
|
|
this->SetWidgetLoweredState(CPW_CARGO_FIRST + i, !HasBit(this->excluded_data, i));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
|
|
{
|
|
@@ -910,30 +913,32 @@ struct PaymentRatesGraphWindow : BaseGra
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnTick()
|
|
|
{
|
|
|
/* Override default OnTick */
|
|
|
}
|
|
|
|
|
|
virtual void OnHundredthTick()
|
|
|
{
|
|
|
this->UpdateExcludedData();
|
|
|
|
|
|
int i;
|
|
|
for (i = 0; i < _sorted_cargo_specs_size; i++) {
|
|
|
this->colours[i] = _sorted_cargo_specs[i]->legend_colour;
|
|
|
int i = 0;
|
|
|
const CargoSpec *cs;
|
|
|
FOR_ALL_SORTED_CARGOSPECS(cs) {
|
|
|
this->colours[i] = cs->legend_colour;
|
|
|
for (uint j = 0; j != 20; j++) {
|
|
|
this->cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 4 + 4, _sorted_cargo_specs[i]->Index());
|
|
|
this->cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 4 + 4, cs->Index());
|
|
|
}
|
|
|
i++;
|
|
|
}
|
|
|
this->num_dataset = i;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/** Construct the row containing the digit keys. */
|
|
|
static NWidgetBase *MakeCargoButtons(int *biggest_index)
|
|
|
{
|
|
|
NWidgetVertical *ver = new NWidgetVertical;
|
|
|
|
|
|
for (int i = 0; i < _sorted_cargo_specs_size; i++) {
|
|
|
NWidgetBackground *leaf = new NWidgetBackground(WWT_PANEL, COLOUR_ORANGE, CPW_CARGO_FIRST + i, NULL);
|