Fix: Wrong cargo line position in IndustryCargo window. (#9383)

Resolved by changing calculation to determine the offset based on centring the cargo lines in the available space.

(cherry picked from commit ce7ef4d824)
pull/326/head
PeterN 3 years ago committed by Jonathan G Rennison
parent 48b287a22f
commit 32571a0ccd

@ -2022,11 +2022,7 @@ struct CargoesField {
assert(this->type == CFT_CARGO);
int n = this->u.cargo.num_cargoes;
if (n % 2 == 0) {
return xpos + cargo_field_width / 2 - (CargoesField::cargo_line.width + CargoesField::cargo_space.width / 2) * (n / 2);
} else {
return xpos + cargo_field_width / 2 - CargoesField::cargo_line.width / 2 - (CargoesField::cargo_line.width + CargoesField::cargo_space.width) * (n / 2);
}
return xpos + cargo_field_width / 2 - (CargoesField::cargo_line.width * n + CargoesField::cargo_space.width * (n - 1)) / 2;
}
/**

Loading…
Cancel
Save