mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 06:15:04 +00:00
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.
This commit is contained in:
parent
1e6a2163a5
commit
ce7ef4d824
@ -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…
Reference in New Issue
Block a user