20 #include "table/strings.h" 36 Money feeder_share = 0;
41 DrawString(left, right, y + y_offset, STR_VEHICLE_INFO_BUILT_VALUE);
48 memset(subtype_text, 0,
sizeof(subtype_text));
50 for (
const Vehicle *u = v; u != NULL; u = u->
Next()) {
51 max_cargo[u->cargo_type] += u->cargo_cap;
52 if (u->cargo_cap > 0) {
54 if (text != STR_EMPTY) subtype_text[u->cargo_type] = text;
58 GetString(capacity, STR_VEHICLE_DETAILS_TRAIN_ARTICULATED_RV_CAPACITY,
lastof(capacity));
62 if (max_cargo[i] > 0) {
67 GetString(buffer, STR_JUST_CARGO,
lastof(buffer));
72 if (subtype_text[i] != 0) {
73 GetString(buffer, subtype_text[i],
lastof(buffer));
83 for (
const Vehicle *u = v; u != NULL; u = u->
Next()) {
84 if (u->cargo_cap == 0)
continue;
86 str = STR_VEHICLE_DETAILS_CARGO_EMPTY;
87 if (u->cargo.StoredCount() > 0) {
91 str = STR_VEHICLE_DETAILS_CARGO_FROM;
92 feeder_share += u->cargo.FeederShare();
106 str = STR_VEHICLE_DETAILS_CARGO_EMPTY;
111 str = STR_VEHICLE_DETAILS_CARGO_FROM;
138 int max_width = right - left + 1;
145 int px = rtl ? max_width + skip : -skip;
146 for (; u != NULL && (rtl ? px > 0 : px < max_width); u = u->
Next()) {
148 int width = u->GetDisplayImageWidth(&offset);
150 if (rtl ? px + width > 0 : px - width < max_width) {
153 u->GetImage(dir, image_type, &seq);
157 px += rtl ? -width : width;
160 if (v->
index == selection) {
StationID Source() const
Returns source of the first cargo packet in this list.
Functions related to OTTD's strings.
uint32 PaletteID
The number of the palette.
VehicleCargoList cargo
The cargo this vehicle is carrying.
Money value
Value of the vehicle.
Data about how and where to blit pixels.
static char * strecat(char *dst, const char *src, const char *last)
Appends characters from one string to another.
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
Functions related to vehicles.
void Draw(int x, int y, PaletteID default_pal, bool force_pal) const
Draw the sprite sequence.
Tindex index
Index of this pool item.
Money FeederShare() const
Returns total sum of the feeder share for all packets.
PaletteID GetVehiclePalette(const Vehicle *v)
Get the colour map for a vehicle.
#define lastof(x)
Get the last element of an fixed size array.
EngineImageType
Visualisation contexts of vehicles and engines.
uint StoredCount() const
Returns sum of cargo on board the vehicle (ie not only reserved).
static RoadVehicle * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
Direction
Defines the 8 directions on the map.
Functions, definitions and such used only by the GUI.
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
Buses, trucks and trams belong to this class.
uint16 cargo_cap
total capacity
Functions related to low-level strings.
uint32 VehicleID
The type all our vehicle IDs have.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
T * Next() const
Get next vehicle in the chain.
Definition of base types and functions in a cross-platform compatible way.
A number of safeguards to prevent using unsafe methods.
CargoID cargo_type
type of cargo this vehicle is carrying
bool HasArticulatedPart() const
Check if an engine has an articulated part.
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip)
Draws an image of a road vehicle chain.
Sprite sequence for a vehicle part.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Draw border only, no background.
Year build_year
Year the vehicle has been built.
Maximal number of cargo types in a game.
Class for storing amounts of cargo.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
Vehicle * Next() const
Get the next vehicle of this vehicle.
TextDirection _current_text_dir
Text direction of the currently selected language.
Functions related to zooming.
Coordinates of a point in 2D.
void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y)
Draw the details for the given vehicle at the given position.
EngineID engine_type
The type of engine used for this vehicle.
byte CargoID
Cargo slots to indicate a cargo type within a game.
Text is written right-to-left by default.
StringID GetCargoSubtypeText(const Vehicle *v)
Get the cargo subtype text from NewGRF for the vehicle details window.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.