|
@@ -200,25 +200,25 @@ static CargoSummary _cargo_summary;
|
|
|
* @param y The y coordinate
|
|
|
*/
|
|
|
static void TrainDetailsCargoTab(const CargoSummaryItem *item, int left, int right, int y)
|
|
|
{
|
|
|
StringID str;
|
|
|
if (item->amount > 0) {
|
|
|
SetDParam(0, item->cargo);
|
|
|
SetDParam(1, item->amount);
|
|
|
SetDParam(2, item->source);
|
|
|
SetDParam(3, _settings_game.vehicle.freight_trains);
|
|
|
str = FreightWagonMult(item->cargo) > 1 ? STR_VEHICLE_DETAILS_CARGO_FROM_MULT : STR_VEHICLE_DETAILS_CARGO_FROM;
|
|
|
} else {
|
|
|
str = item->cargo == INVALID_CARGO ? STR_QUANTITY_N_A : STR_VEHICLE_DETAILS_CARGO_EMPTY;
|
|
|
str = !IsValidCargoID(item->cargo) ? STR_QUANTITY_N_A : STR_VEHICLE_DETAILS_CARGO_EMPTY;
|
|
|
}
|
|
|
|
|
|
DrawString(left, right, y, str, TC_LIGHT_BLUE);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Draw the details info tab for the given vehicle at the given position
|
|
|
*
|
|
|
* @param v current vehicle
|
|
|
* @param left The left most coordinate to draw
|
|
|
* @param right The right most coordinate to draw
|
|
|
* @param y The y coordinate
|
|
@@ -239,25 +239,25 @@ static void TrainDetailsInfoTab(const Ve
|
|
|
|
|
|
/**
|
|
|
* 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
|
|
|
*/
|
|
|
static void TrainDetailsCapacityTab(const CargoSummaryItem *item, int left, int right, int y)
|
|
|
{
|
|
|
StringID str;
|
|
|
if (item->cargo != INVALID_CARGO) {
|
|
|
if (IsValidCargoID(item->cargo)) {
|
|
|
SetDParam(0, item->cargo);
|
|
|
SetDParam(1, item->capacity);
|
|
|
SetDParam(4, item->subtype);
|
|
|
SetDParam(5, _settings_game.vehicle.freight_trains);
|
|
|
str = FreightWagonMult(item->cargo) > 1 ? STR_VEHICLE_INFO_CAPACITY_MULT : STR_VEHICLE_INFO_CAPACITY;
|
|
|
} else {
|
|
|
/* Draw subtype only */
|
|
|
SetDParam(0, item->subtype);
|
|
|
str = STR_VEHICLE_INFO_NO_CAPACITY;
|
|
|
}
|
|
|
DrawString(left, right, y, str);
|
|
|
}
|
|
@@ -267,25 +267,25 @@ static void TrainDetailsCapacityTab(cons
|
|
|
* @param v Vehicle to process
|
|
|
* @param summary Space for the result
|
|
|
*/
|
|
|
static void GetCargoSummaryOfArticulatedVehicle(const Train *v, CargoSummary *summary)
|
|
|
{
|
|
|
summary->clear();
|
|
|
do {
|
|
|
if (!v->GetEngine()->CanCarryCargo()) continue;
|
|
|
|
|
|
CargoSummaryItem new_item;
|
|
|
new_item.cargo = v->cargo_cap > 0 ? v->cargo_type : INVALID_CARGO;
|
|
|
new_item.subtype = GetCargoSubtypeText(v);
|
|
|
if (new_item.cargo == INVALID_CARGO && new_item.subtype == STR_EMPTY) continue;
|
|
|
if (!IsValidCargoID(new_item.cargo) && new_item.subtype == STR_EMPTY) continue;
|
|
|
|
|
|
auto item = std::find(summary->begin(), summary->end(), new_item);
|
|
|
if (item == summary->end()) {
|
|
|
summary->emplace_back();
|
|
|
item = summary->end() - 1;
|
|
|
item->cargo = new_item.cargo;
|
|
|
item->subtype = new_item.subtype;
|
|
|
item->capacity = 0;
|
|
|
item->amount = 0;
|
|
|
item->source = INVALID_STATION;
|
|
|
}
|
|
|
|