Initial LinkRefresher support for cargo-specific links.

This commit is contained in:
Jonathan G Rennison
2016-09-04 16:49:27 +01:00
parent a670966acf
commit 3507b51d9e
8 changed files with 188 additions and 94 deletions

View File

@@ -3563,28 +3563,6 @@ void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint c
}
}
/**
* Increase capacity for all link stats associated with vehicles in the given consist.
* @param st Station to get the link stats from.
* @param front First vehicle in the consist.
* @param next_station_id Station the consist will be travelling to next.
*/
void IncreaseStats(Station *st, const Vehicle *front, StationID next_station_id)
{
for (const Vehicle *v = front; v != NULL; v = v->Next()) {
if (v->refit_cap > 0) {
/* The cargo count can indeed be higher than the refit_cap if
* wagons have been auto-replaced and subsequently auto-
* refitted to a higher capacity. The cargo gets redistributed
* among the wagons in that case.
* As usage is not such an important figure anyway we just
* ignore the additional cargo then.*/
IncreaseStats(st, v->cargo_type, next_station_id, v->refit_cap,
min(v->refit_cap, v->cargo.StoredCount()), EUM_INCREASE);
}
}
}
/* called for every station each tick */
static void StationHandleSmallTick(BaseStation *st)
{