|
OpenTTD Source
14.0-beta1
|
Go to the documentation of this file.
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 DrawString(r.left, r.right, y, STR_VEHICLE_INFO_BUILT_VALUE);
48 DrawString(r.left, r.right, y, (u->Next()->cargo_cap != 0) ? STR_VEHICLE_INFO_CAPACITY_CAPACITY : STR_VEHICLE_INFO_CAPACITY);
52 if (u->cargo_cap != 0) {
53 uint cargo_count = u->cargo.StoredCount();
55 if (cargo_count != 0) {
60 DrawString(r.left, r.right, y, STR_VEHICLE_DETAILS_CARGO_FROM);
62 feeder_share += u->cargo.GetFeederShare();
69 DrawString(r.left, r.right, y, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
91 int x = rtl ? r.right - width - x_offs : r.left - x_offs;
103 GetCustomRotorSprite(a, image_type, &rotor_seq);
104 if (!rotor_seq.
IsValid()) rotor_seq.
Set(SPR_ROTOR_STOPPED);
106 rotor_seq.
Draw(x, y - heli_offs, PAL_NONE,
false);
108 if (v->
index == selection) {
int Height() const
Get height of Rect.
T * Next() const
Get next vehicle in the chain.
void Set(SpriteID sprite)
Assign a single sprite to the sequence.
Tindex index
Index of this pool item.
Rect Expand(int s) const
Copy and expand Rect by s pixels.
EngineImageType
Visualisation contexts of vehicles and engines.
void Draw(int x, int y, PaletteID default_pal, bool force_pal) const
Draw the sprite sequence.
uint32_t PaletteID
The number of the palette.
Aircraft, helicopters, rotors and their shadows belong to this class.
virtual void GetImage([[maybe_unused]] Direction direction, [[maybe_unused]] EngineImageType image_type, [[maybe_unused]] VehicleSpriteSeq *result) const
Gets the sprite to show for the given direction.
bool IsValid() const
Check whether the sequence contains any sprites.
@ FS_NORMAL
Index of the normal font in the font tables.
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.
@ VS_CRASHED
Vehicle is crashed.
Sprite sequence for a vehicle part.
uint32_t VehicleID
The type all our vehicle IDs have.
int CenterBounds(int min, int max, int size)
Determine where to draw a centred object inside a widget.
StringID GetCargoSubtypeText(const Vehicle *v)
Get the cargo subtype text from NewGRF for the vehicle details window.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
static Aircraft * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
PaletteID GetVehiclePalette(const Vehicle *v)
Get the colour map for a vehicle.
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
@ AIR_HELICOPTER
an helicopter
void DrawAircraftDetails(const Aircraft *v, const Rect &r)
Draw the details for the given vehicle at the given position.
int ScaleSpriteTrad(int value)
Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.
@ VehicleDetails
Name is shown in the vehicle details GUI.
byte subtype
subtype (Filled with values from AircraftSubType/DisasterSubType/EffectVehicleType/GroundVehicleSubty...
int UnScaleGUI(int value)
Short-hand to apply GUI zoom level.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
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.
void DrawAircraftImage(const Vehicle *v, const Rect &r, VehicleID selection, EngineImageType image_type)
Draws an image of an aircraft.
int Width() const
Get width of Rect.
Specification of a rectangle with absolute coordinates of all edges.
void GetBounds(Rect *bounds) const
Determine shared bounds of all sprites.
@ TD_RTL
Text is written right-to-left by default.
TextDirection _current_text_dir
Text direction of the currently selected language.
@ FR_BORDERONLY
Draw border only, no background.