Changeset - r25714:01c5c60a6abd
[Not reviewed]
master
0 1 0
PeterN - 3 years ago 2021-06-17 22:34:59
peter1138@openttd.org
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.
1 file changed with 1 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/industry_gui.cpp
Show inline comments
 
@@ -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;
 
	}
 

	
 
	/**
0 comments (0 inline, 0 general)