From ce7ef4d824b9e6cd852826b6fcc41263487ebd5e Mon Sep 17 00:00:00 2001 From: PeterN Date: Thu, 17 Jun 2021 23:34:59 +0100 Subject: 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. --- src/industry_gui.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index fd5f5d487..648939975 100644 --- 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; } /** -- cgit v1.2.3-54-g00ecf