Shows payment based on average transit speed

Prior to this change, the charts were pretty useless. They indicated at most what cargos were speed sensitive and which ones were not.

This change lets the graph show the average transit speed to profit mapping. With this graph it becomes obvious after exactly what speed any further speed increase brings no further profit. This makes train selection way easier.
This commit is contained in:
Andreas Schmitt
2021-06-10 11:43:28 +02:00
parent a7d8c6fe0c
commit 0acdea2852
2 changed files with 6 additions and 3 deletions

View File

@@ -1048,10 +1048,13 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
int i = 0;
const CargoSpec *cs;
const float factor = 200.0f * 28.57f * 0.4f;
FOR_ALL_SORTED_STANDARD_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, cs->Index());
for (int j = 0; j != 20; j++) {
const byte ctt = static_cast<byte>(factor / ((static_cast<float>(j) + 1) * 10.0f));
this->cost[i][j] = GetTransportedGoodsIncome(1, 200, ctt, cs->Index());
}
i++;
}