Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -29,14 +29,15 @@
|
||||
void DrawRoadVehDetails(const Vehicle *v, const Rect &r)
|
||||
{
|
||||
int y = r.top + (v->HasArticulatedPart() ? ScaleSpriteTrad(15) : 0); // Draw the first line below the sprite of an articulated RV instead of after it.
|
||||
StringID str;
|
||||
Money feeder_share = 0;
|
||||
|
||||
SetDParam(0, PackEngineNameDParam(v->engine_type, EngineNameContext::VehicleDetails));
|
||||
SetDParam(1, v->build_year);
|
||||
SetDParam(2, v->value);
|
||||
if (_settings_client.gui.newgrf_developer_tools) SetDParam(3, v->index); // CM
|
||||
DrawString(r.left, r.right, y, _settings_client.gui.newgrf_developer_tools ? CM_STR_VEHICLE_INFO_BUILT_VALUE_WITH_ID : STR_VEHICLE_INFO_BUILT_VALUE);
|
||||
std::string line;
|
||||
if (_settings_client.gui.newgrf_developer_tools) {
|
||||
line = GetString(CM_STR_VEHICLE_INFO_BUILT_VALUE_WITH_ID, PackEngineNameDParam(v->engine_type, EngineNameContext::VehicleDetails), v->index);
|
||||
} else {
|
||||
line = GetString(STR_VEHICLE_INFO_BUILT_VALUE, PackEngineNameDParam(v->engine_type, EngineNameContext::VehicleDetails));
|
||||
}
|
||||
DrawString(r.left, r.right, y, line, v->build_year, v->value);
|
||||
y += GetCharacterHeight(FS_NORMAL);
|
||||
|
||||
if (v->HasArticulatedPart()) {
|
||||
@@ -56,16 +57,15 @@ void DrawRoadVehDetails(const Vehicle *v, const Rect &r)
|
||||
|
||||
bool first = true;
|
||||
for (const CargoSpec *cs : _sorted_cargo_specs) {
|
||||
CargoID cid = cs->Index();
|
||||
if (max_cargo[cid] > 0) {
|
||||
CargoType cargo_type = cs->Index();
|
||||
if (max_cargo[cargo_type] > 0) {
|
||||
if (!first) capacity += list_separator;
|
||||
|
||||
SetDParam(0, cid);
|
||||
SetDParam(1, max_cargo[cid]);
|
||||
AppendStringInPlace(capacity, STR_JUST_CARGO);
|
||||
auto params = MakeParameters(cargo_type, max_cargo[cargo_type]);
|
||||
AppendStringWithArgsInPlace(capacity, STR_JUST_CARGO, params);
|
||||
|
||||
if (subtype_text[cid] != STR_NULL) {
|
||||
AppendStringInPlace(capacity, subtype_text[cid]);
|
||||
if (subtype_text[cargo_type] != STR_NULL) {
|
||||
AppendStringInPlace(capacity, subtype_text[cargo_type]);
|
||||
}
|
||||
|
||||
first = false;
|
||||
@@ -78,40 +78,34 @@ void DrawRoadVehDetails(const Vehicle *v, const Rect &r)
|
||||
for (const Vehicle *u = v; u != nullptr; u = u->Next()) {
|
||||
if (u->cargo_cap == 0) continue;
|
||||
|
||||
str = STR_VEHICLE_DETAILS_CARGO_EMPTY;
|
||||
std::string str;
|
||||
if (u->cargo.StoredCount() > 0) {
|
||||
SetDParam(0, u->cargo_type);
|
||||
SetDParam(1, u->cargo.StoredCount());
|
||||
SetDParam(2, u->cargo.GetFirstStation());
|
||||
str = STR_VEHICLE_DETAILS_CARGO_FROM;
|
||||
str = GetString(STR_VEHICLE_DETAILS_CARGO_FROM, u->cargo_type, u->cargo.StoredCount(), u->cargo.GetFirstStation());
|
||||
feeder_share += u->cargo.GetFeederShare();
|
||||
} else {
|
||||
str = GetString(STR_VEHICLE_DETAILS_CARGO_EMPTY);
|
||||
}
|
||||
DrawString(r.left, r.right, y, str);
|
||||
y += GetCharacterHeight(FS_NORMAL);
|
||||
}
|
||||
y += WidgetDimensions::scaled.vsep_normal;
|
||||
} else {
|
||||
SetDParam(0, v->cargo_type);
|
||||
SetDParam(1, v->cargo_cap);
|
||||
SetDParam(4, GetCargoSubtypeText(v));
|
||||
DrawString(r.left, r.right, y, STR_VEHICLE_INFO_CAPACITY);
|
||||
DrawString(r.left, r.right, y, GetString(STR_VEHICLE_INFO_CAPACITY, v->cargo_type, v->cargo_cap, GetCargoSubtypeText(v)));
|
||||
y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
|
||||
|
||||
str = STR_VEHICLE_DETAILS_CARGO_EMPTY;
|
||||
std::string str;
|
||||
if (v->cargo.StoredCount() > 0) {
|
||||
SetDParam(0, v->cargo_type);
|
||||
SetDParam(1, v->cargo.StoredCount());
|
||||
SetDParam(2, v->cargo.GetFirstStation());
|
||||
str = STR_VEHICLE_DETAILS_CARGO_FROM;
|
||||
str = GetString(STR_VEHICLE_DETAILS_CARGO_FROM, v->cargo_type, v->cargo.StoredCount(), v->cargo.GetFirstStation());
|
||||
feeder_share += v->cargo.GetFeederShare();
|
||||
} else {
|
||||
str = GetString(STR_VEHICLE_DETAILS_CARGO_EMPTY);
|
||||
}
|
||||
DrawString(r.left, r.right, y, str);
|
||||
y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
|
||||
}
|
||||
|
||||
/* Draw Transfer credits text */
|
||||
SetDParam(0, feeder_share);
|
||||
DrawString(r.left, r.right, y, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
|
||||
DrawString(r.left, r.right, y, GetString(STR_VEHICLE_INFO_FEEDER_CARGO_VALUE, feeder_share));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,10 +140,10 @@ void DrawRoadVehImage(const Vehicle *v, const Rect &r, VehicleID selection, Engi
|
||||
int width = u->GetDisplayImageWidth(&offset);
|
||||
|
||||
if (rtl ? px + width > 0 : px - width < max_width) {
|
||||
PaletteID pal = (u->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(u);
|
||||
PaletteID pal = u->vehstatus.Test(VehState::Crashed) ? PALETTE_CRASH : GetVehiclePalette(u);
|
||||
VehicleSpriteSeq seq;
|
||||
u->GetImage(dir, image_type, &seq);
|
||||
seq.Draw(px + (rtl ? -offset.x : offset.x), y + offset.y, pal, (u->vehstatus & VS_CRASHED) != 0);
|
||||
seq.Draw(px + (rtl ? -offset.x : offset.x), y + offset.y, pal, u->vehstatus.Test(VehState::Crashed));
|
||||
}
|
||||
|
||||
if (do_overlays) AddCargoIconOverlay(overlays, px, width, u);
|
||||
@@ -164,6 +158,6 @@ void DrawRoadVehImage(const Vehicle *v, const Rect &r, VehicleID selection, Engi
|
||||
if (v->index == selection) {
|
||||
int height = ScaleSpriteTrad(12);
|
||||
Rect hr = {(rtl ? px : 0), 0, (rtl ? max_width : px) - 1, height - 1};
|
||||
DrawFrameRect(hr.Translate(r.left, CenterBounds(r.top, r.bottom, height)).Expand(WidgetDimensions::scaled.bevel), COLOUR_WHITE, FR_BORDERONLY);
|
||||
DrawFrameRect(hr.Translate(r.left, CenterBounds(r.top, r.bottom, height)).Expand(WidgetDimensions::scaled.bevel), COLOUR_WHITE, FrameFlag::BorderOnly);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user