20#include "table/strings.h"
32 Money feeder_share = 0;
35 for (
const Aircraft *u = v; u !=
nullptr; u = u->
Next()) {
36 if (u->IsNormalAircraft()) {
40 if (u->Next()->cargo_cap != 0) {
48 if (u->cargo_cap != 0) {
49 uint cargo_count = u->cargo.StoredCount();
51 if (cargo_count != 0) {
53 DrawString(r.left, r.right, y,
GetString(STR_VEHICLE_DETAILS_CARGO_FROM, u->cargo_type, cargo_count, u->cargo.GetFirstStation()));
55 feeder_share += u->cargo.GetFeederShare();
61 DrawString(r.left, r.right, y,
GetString(STR_VEHICLE_INFO_FEEDER_CARGO_VALUE, feeder_share));
83 int x = rtl ? r.right - width - x_offs : r.left - x_offs;
106 GetCustomRotorSprite(a, image_type, &rotor_seq);
107 if (!rotor_seq.
IsValid()) rotor_seq.
Set(SPR_ROTOR_STOPPED);
109 rotor_seq.
Draw(x, y - heli_offs, PAL_NONE,
false);
111 if (v->
index == selection) {
@ AIR_HELICOPTER
an helicopter
void DrawAircraftDetails(const Aircraft *v, const Rect &r)
Draw the details for the given vehicle at the given position.
void DrawAircraftImage(const Vehicle *v, const Rect &r, VehicleID selection, EngineImageType image_type)
Draws an image of an aircraft.
Dimension GetLargestCargoIconSize()
Get dimensions of largest cargo icon.
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
uint64_t PackEngineNameDParam(EngineID engine_id, EngineNameContext context, uint32_t extra_data=0)
Combine an engine ID and a name context to an engine name dparam.
@ VehicleDetails
Name is shown in the vehicle details GUI.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
int CentreBounds(int min, int max, int size)
Determine where to position a centred object.
int DrawString(int left, int right, int top, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
@ FS_NORMAL
Index of the normal font in the font tables.
uint32_t PaletteID
The number of the palette.
Functions for NewGRF engines.
A number of safeguards to prevent using unsafe methods.
Functions to cache sprites in memory.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
Definition of base types and functions in a cross-platform compatible way.
std::string GetString(StringID string)
Resolve the given StringID into a std::string with formatting but no parameters.
TextDirection _current_text_dir
Text direction of the currently selected language.
Functions related to OTTD's strings.
@ TD_RTL
Text is written right-to-left by default.
Aircraft, helicopters, rotors and their shadows belong to this class.
Tindex index
Index of this pool item.
Specification of a rectangle with absolute coordinates of all edges.
int Width() const
Get width of Rect.
int Height() const
Get height of Rect.
Rect Expand(int s) const
Copy and expand Rect by s pixels.
T * Next() const
Get next vehicle in the chain.
static Aircraft * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
Sprite sequence for a vehicle part.
bool IsValid() const
Check whether the sequence contains any sprites.
void GetBounds(Rect *bounds) const
Determine shared bounds of all sprites.
void Set(SpriteID sprite)
Assign a single sprite to the sequence.
void Draw(int x, int y, PaletteID default_pal, bool force_pal) const
Draw the sprite sequence.
uint16_t cargo_cap
total capacity
uint8_t subtype
subtype (Filled with values from AircraftSubType/DisasterSubType/EffectVehicleType/GroundVehicleSubty...
VehStates vehstatus
Status.
CargoType cargo_type
type of cargo this vehicle is carrying
Vehicle * Next() const
Get the next vehicle of this vehicle.
virtual void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const
Gets the sprite to show for the given direction.
PaletteID GetVehiclePalette(const Vehicle *v)
Get the colour map for a vehicle.
@ Crashed
Vehicle is crashed.
Functions related to vehicles.
StringID GetCargoSubtypeText(const Vehicle *v)
Get the cargo subtype text from NewGRF for the vehicle details window.
void DrawCargoIconOverlay(int x, int y, CargoType cargo_type)
Draw a cargo icon overlaying an existing sprite, with a black contrast outline.
Functions related to the vehicle's GUIs.
EngineImageType
Visualisation contexts of vehicles and engines.
Functions, definitions and such used only by the GUI.
@ BorderOnly
Draw border only, no background.
Functions related to zooming.
int ScaleSpriteTrad(int value)
Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.
int UnScaleGUI(int value)
Short-hand to apply GUI zoom level.