MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetCargoBase

Method GetCargoBase

src/industry_gui.cpp:2126–2132  ·  view source on GitHub ↗

* For a #CFT_CARGO, compute the left position of the left-most vertical cargo connection. * @param xpos Left position of the field. * @return Left position of the left-most vertical cargo column. */

Source from the content-addressed store, hash-verified

2124 * @return Left position of the left-most vertical cargo column.
2125 */
2126 int GetCargoBase(int xpos) const
2127 {
2128 assert(this->type == CFT_CARGO);
2129 int n = this->u.cargo.num_cargoes;
2130
2131 return xpos + cargo_field_width / 2 - (CargoesField::cargo_line.width * n + CargoesField::cargo_space.width * (n - 1)) / 2;
2132 }
2133
2134 /**
2135 * Draw the field.

Callers 2

DrawMethod · 0.95
CargoClickedAtMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected