(svn r23860) -Feature: [NewGRF] Add cargo property 1D to set the capacity multipliers when refitting vehicles, which do not use callback 15.

This commit is contained in:
frosch
2012-01-28 12:08:03 +00:00
parent 01ef8aa478
commit 4cc26a1b86
5 changed files with 51 additions and 50 deletions

View File

@@ -258,18 +258,9 @@ uint Engine::DetermineCapacity(const Vehicle *v, uint16 *mail_capacity) const
/* Apply multipliers depending on cargo- and vehicletype.
* Note: This might change to become more consistent/flexible. */
if (this->type != VEH_SHIP && default_cargo != cargo_type) {
switch (default_cargo) {
case CT_PASSENGERS: break;
case CT_MAIL:
case CT_GOODS: capacity *= 2; break;
default: capacity *= 4; break;
}
switch (cargo_type) {
case CT_PASSENGERS: break;
case CT_MAIL:
case CT_GOODS: capacity /= 2; break;
default: capacity /= 4; break;
}
uint16 default_multiplier = CargoSpec::Get(default_cargo)->multiplier;
uint16 cargo_multiplier = CargoSpec::Get(cargo_type)->multiplier;
capacity = (capacity * cargo_multiplier + default_multiplier / 2) / default_multiplier;
}
return capacity;