Merge tag '13.0-beta2' into jgrpp

# Conflicts:
#	src/cheat_gui.cpp
#	src/company_gui.cpp
#	src/console_gui.cpp
#	src/depot_gui.cpp
#	src/error_gui.cpp
#	src/gfx.cpp
#	src/graph_gui.cpp
#	src/group_gui.cpp
#	src/lang/english.txt
#	src/lang/korean.txt
#	src/lang/polish.txt
#	src/misc_gui.cpp
#	src/network/network_content_gui.h
#	src/newgrf_debug_gui.cpp
#	src/order_gui.cpp
#	src/rail_gui.cpp
#	src/road_gui.cpp
#	src/settings_gui.cpp
#	src/settings_type.h
#	src/station_gui.cpp
#	src/subsidy_gui.cpp
#	src/table/settings/gui_settings.ini
#	src/timetable_gui.cpp
#	src/town_gui.cpp
#	src/train_cmd.cpp
#	src/vehicle_gui.cpp
#	src/viewport.cpp
#	src/water_cmd.cpp
#	src/widgets/dropdown.cpp
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2022-12-04 20:25:38 +00:00
172 changed files with 3061 additions and 2809 deletions

View File

@@ -27,7 +27,7 @@
*/
void DrawRoadVehDetails(const Vehicle *v, const Rect &r)
{
int y = r.top + (v->HasArticulatedPart() ? ScaleGUITrad(15) : 0); // Draw the first line below the sprite of an articulated RV instead of after it.
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;
@@ -76,7 +76,7 @@ void DrawRoadVehDetails(const Vehicle *v, const Rect &r)
}
DrawString(r.left, r.right, y, capacity, TC_BLUE);
y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
for (const Vehicle *u = v; u != nullptr; u = u->Next()) {
if (u->cargo_cap == 0) continue;
@@ -92,13 +92,13 @@ void DrawRoadVehDetails(const Vehicle *v, const Rect &r)
DrawString(r.left, r.right, y, str);
y += FONT_HEIGHT_NORMAL;
}
y += WD_PAR_VSEP_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);
y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
str = STR_VEHICLE_DETAILS_CARGO_EMPTY;
if (v->cargo.StoredCount() > 0) {
@@ -109,13 +109,13 @@ void DrawRoadVehDetails(const Vehicle *v, const Rect &r)
feeder_share += v->cargo.FeederShare();
}
DrawString(r.left, r.right, y, str);
y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
y += FONT_HEIGHT_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);
y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
if (RoadVehicle::From(v)->critical_breakdown_count > 0) {
SetDParam(0, RoadVehicle::From(v)->GetDisplayEffectiveMaxSpeed());
@@ -126,28 +126,28 @@ void DrawRoadVehDetails(const Vehicle *v, const Rect &r)
/**
* Draws an image of a road vehicle chain
* @param v Front vehicle
* @param left The minimum horizontal position
* @param right The maximum horizontal position
* @param y Vertical position to draw at
* @param r Rect to draw at
* @param selection Selected vehicle to draw a frame around
* @param skip Number of pixels to skip at the front (for scrolling)
*/
void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip)
void DrawRoadVehImage(const Vehicle *v, const Rect &r, VehicleID selection, EngineImageType image_type, int skip)
{
bool rtl = _current_text_dir == TD_RTL;
Direction dir = rtl ? DIR_E : DIR_W;
const RoadVehicle *u = RoadVehicle::From(v);
DrawPixelInfo tmp_dpi, *old_dpi;
int max_width = right - left + 1;
int max_width = r.Width();
if (!FillDrawPixelInfo(&tmp_dpi, left, y, max_width, ScaleGUITrad(14))) return;
if (!FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.Width(), r.Height())) return;
old_dpi = _cur_dpi;
_cur_dpi = &tmp_dpi;
int px = rtl ? max_width + skip : -skip;
for (; u != nullptr && (rtl ? px > 0 : px < max_width); u = u->Next()) {
int y = r.Height() / 2;
for (; u != nullptr && (rtl ? px > 0 : px < max_width); u = u->Next())
{
Point offset;
int width = u->GetDisplayImageWidth(&offset);
@@ -155,15 +155,17 @@ void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID se
PaletteID pal = (u->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(u);
VehicleSpriteSeq seq;
u->GetImage(dir, image_type, &seq);
seq.Draw(px + (rtl ? -offset.x : offset.x), ScaleGUITrad(6) + offset.y, pal, (u->vehstatus & VS_CRASHED) != 0);
seq.Draw(px + (rtl ? -offset.x : offset.x), y + offset.y, pal, (u->vehstatus & VS_CRASHED) != 0);
}
px += rtl ? -width : width;
}
if (v->index == selection) {
DrawFrameRect((rtl ? px : 0), 0, (rtl ? max_width : px) - 1, ScaleGUITrad(13) - 1, COLOUR_WHITE, FR_BORDERONLY);
}
_cur_dpi = old_dpi;
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);
}
}