# HG changeset patch # User PeterN # Date 2021-06-17 22:34:59 # Node ID 01c5c60a6abdaad7d78b9f3d061bfb9ab8358df1 # Parent 455552b75fe2b25adc3b4462363abe733ed44e7e 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. diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -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; } /**