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

Function TrainDetailsCapacityTab

src/train_gui.cpp:252–264  ·  view source on GitHub ↗

* Draw the details capacity tab for the given vehicle at the given position * * @param item Data to draw * @param left The left most coordinate to draw * @param right The right most coordinate to draw * @param y The y coordinate */

Source from the content-addressed store, hash-verified

250 * @param y The y coordinate
251 */
252static void TrainDetailsCapacityTab(const CargoSummaryItem *item, int left, int right, int y)
253{
254 std::string str;
255 if (!IsValidCargoType(item->cargo)) {
256 /* Draw subtype only */
257 str = GetString(STR_VEHICLE_INFO_NO_CAPACITY, item->subtype);
258 } else if (FreightWagonMult(item->cargo) > 1) {
259 str = GetString(STR_VEHICLE_INFO_CAPACITY_MULT, item->cargo, item->capacity, item->subtype, _settings_game.vehicle.freight_trains);
260 } else {
261 str = GetString(STR_VEHICLE_INFO_CAPACITY, item->cargo, item->capacity, item->subtype);
262 }
263 DrawString(left, right, y, str);
264}
265
266/**
267 * Collects the cargo transported

Callers 1

DrawTrainDetailsFunction · 0.85

Calls 4

IsValidCargoTypeFunction · 0.85
FreightWagonMultFunction · 0.85
GetStringFunction · 0.70
DrawStringFunction · 0.70

Tested by

no test coverage detected