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

Function TrainDetailsCargoTab

src/train_gui.cpp:210–223  ·  view source on GitHub ↗

* Draw the details cargo 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

208 * @param y The y coordinate
209 */
210static void TrainDetailsCargoTab(const CargoSummaryItem *item, int left, int right, int y)
211{
212 std::string str;
213 if (!IsValidCargoType(item->cargo)) {
214 str = GetString(STR_QUANTITY_N_A);
215 } else if (item->amount == 0) {
216 str = GetString(STR_VEHICLE_DETAILS_CARGO_EMPTY);
217 } else if (FreightWagonMult(item->cargo) > 1) {
218 str = GetString(STR_VEHICLE_DETAILS_CARGO_FROM_MULT, item->cargo, item->amount, item->source, _settings_game.vehicle.freight_trains);
219 } else {
220 str = GetString(STR_VEHICLE_DETAILS_CARGO_FROM, item->cargo, item->amount, item->source);
221 }
222 DrawString(left, right, y, str, TC_LIGHT_BLUE);
223}
224
225/**
226 * Draw the details info tab for the given vehicle at the given position

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