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.
pull/332/head
PeterN 3 years ago committed by GitHub
parent 1e6a2163a5
commit ce7ef4d824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2021,11 +2021,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