OpenTTD
engine_gui.cpp
Go to the documentation of this file.
1 /* $Id$ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #include "stdafx.h"
13 #include "window_gui.h"
14 #include "engine_base.h"
15 #include "command_func.h"
16 #include "strings_func.h"
17 #include "engine_gui.h"
18 #include "articulated_vehicles.h"
19 #include "vehicle_func.h"
20 #include "company_func.h"
21 #include "rail.h"
22 #include "road.h"
23 #include "settings_type.h"
24 #include "train.h"
25 #include "roadveh.h"
26 #include "ship.h"
27 #include "aircraft.h"
28 
29 #include "widgets/engine_widget.h"
30 
31 #include "table/strings.h"
32 
33 #include "safeguards.h"
34 
41 {
42  const Engine *e = Engine::Get(engine);
43  switch (e->type) {
44  default: NOT_REACHED();
45  case VEH_ROAD:
46  return GetRoadTypeInfo(e->u.road.roadtype)->strings.new_engine;
47  case VEH_AIRCRAFT: return STR_ENGINE_PREVIEW_AIRCRAFT;
48  case VEH_SHIP: return STR_ENGINE_PREVIEW_SHIP;
49  case VEH_TRAIN:
50  return GetRailTypeInfo(e->u.rail.railtype)->strings.new_loco;
51  }
52 }
53 
54 static const NWidgetPart _nested_engine_preview_widgets[] = {
56  NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE),
57  NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_ENGINE_PREVIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
58  EndContainer(),
59  NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE),
60  NWidget(WWT_EMPTY, INVALID_COLOUR, WID_EP_QUESTION), SetMinimalSize(300, 0), SetPadding(8, 8, 8, 8), SetFill(1, 0),
62  NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_EP_NO), SetDataTip(STR_QUIT_NO, STR_NULL), SetFill(1, 0),
63  NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_EP_YES), SetDataTip(STR_QUIT_YES, STR_NULL), SetFill(1, 0),
64  EndContainer(),
66  EndContainer(),
67 };
68 
70  int vehicle_space; // The space to show the vehicle image
71 
73  {
74  this->InitNested(window_number);
75 
76  /* There is no way to recover the window; so disallow closure via DEL; unless SHIFT+DEL */
77  this->flags |= WF_STICKY;
78  }
79 
80  void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
81  {
82  if (widget != WID_EP_QUESTION) return;
83 
84  /* Get size of engine sprite, on loan from depot_gui.cpp */
85  EngineID engine = this->window_number;
86  EngineImageType image_type = EIT_PURCHASE;
87  uint x, y;
88  int x_offs, y_offs;
89 
90  const Engine *e = Engine::Get(engine);
91  switch (e->type) {
92  default: NOT_REACHED();
93  case VEH_TRAIN: GetTrainSpriteSize( engine, x, y, x_offs, y_offs, image_type); break;
94  case VEH_ROAD: GetRoadVehSpriteSize( engine, x, y, x_offs, y_offs, image_type); break;
95  case VEH_SHIP: GetShipSpriteSize( engine, x, y, x_offs, y_offs, image_type); break;
96  case VEH_AIRCRAFT: GetAircraftSpriteSize(engine, x, y, x_offs, y_offs, image_type); break;
97  }
98  this->vehicle_space = max<int>(40, y - y_offs);
99 
100  size->width = max(size->width, x - x_offs);
101  SetDParam(0, GetEngineCategoryName(engine));
102  size->height = GetStringHeight(STR_ENGINE_PREVIEW_MESSAGE, size->width) + WD_PAR_VSEP_WIDE + FONT_HEIGHT_NORMAL + this->vehicle_space;
103  SetDParam(0, engine);
104  size->height += GetStringHeight(GetEngineInfoString(engine), size->width);
105  }
106 
107  void DrawWidget(const Rect &r, int widget) const override
108  {
109  if (widget != WID_EP_QUESTION) return;
110 
111  EngineID engine = this->window_number;
112  SetDParam(0, GetEngineCategoryName(engine));
113  int y = r.top + GetStringHeight(STR_ENGINE_PREVIEW_MESSAGE, r.right - r.left + 1);
114  y = DrawStringMultiLine(r.left, r.right, r.top, y, STR_ENGINE_PREVIEW_MESSAGE, TC_FROMSTRING, SA_CENTER) + WD_PAR_VSEP_WIDE;
115 
116  SetDParam(0, engine);
117  DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_ENGINE_NAME, TC_BLACK, SA_HOR_CENTER);
118  y += FONT_HEIGHT_NORMAL;
119 
120  DrawVehicleEngine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, this->width >> 1, y + this->vehicle_space / 2, engine, GetEnginePalette(engine, _local_company), EIT_PREVIEW);
121 
122  y += this->vehicle_space;
123  DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, r.bottom, GetEngineInfoString(engine), TC_FROMSTRING, SA_CENTER);
124  }
125 
126  void OnClick(Point pt, int widget, int click_count) override
127  {
128  switch (widget) {
129  case WID_EP_YES:
130  DoCommandP(0, this->window_number, 0, CMD_WANT_ENGINE_PREVIEW);
131  FALLTHROUGH;
132  case WID_EP_NO:
133  if (!_shift_pressed) delete this;
134  break;
135  }
136  }
137 
138  void OnInvalidateData(int data = 0, bool gui_scope = true) override
139  {
140  if (!gui_scope) return;
141 
142  EngineID engine = this->window_number;
143  if (Engine::Get(engine)->preview_company != _local_company) delete this;
144  }
145 };
146 
147 static WindowDesc _engine_preview_desc(
148  WDP_CENTER, "engine_preview", 0, 0,
151  _nested_engine_preview_widgets, lengthof(_nested_engine_preview_widgets)
152 );
153 
154 
155 void ShowEnginePreviewWindow(EngineID engine)
156 {
157  AllocateWindowDescFront<EnginePreviewWindow>(&_engine_preview_desc, engine);
158 }
159 
166 {
168  return cap.GetSum<uint>();
169 }
170 
171 static StringID GetTrainEngineInfoString(const Engine *e)
172 {
173  SetDParam(0, e->GetCost());
174  SetDParam(2, e->GetDisplayMaxSpeed());
175  SetDParam(3, e->GetPower());
176  SetDParam(1, e->GetDisplayWeight());
178 
179  SetDParam(4, e->GetRunningCost());
180 
181  uint capacity = GetTotalCapacityOfArticulatedParts(e->index);
182  if (capacity != 0) {
184  SetDParam(6, capacity);
185  } else {
186  SetDParam(5, CT_INVALID);
187  }
188  return (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL && GetRailTypeInfo(e->u.rail.railtype)->acceleration_type != 2) ? STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER_MAX_TE : STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER;
189 }
190 
191 static StringID GetAircraftEngineInfoString(const Engine *e)
192 {
193  CargoID cargo = e->GetDefaultCargoType();
194  uint16 mail_capacity;
195  uint capacity = e->GetDisplayDefaultCapacity(&mail_capacity);
196  uint16 range = e->GetRange();
197 
198  uint i = 0;
199  SetDParam(i++, e->GetCost());
200  SetDParam(i++, e->GetDisplayMaxSpeed());
201  SetDParam(i++, e->GetAircraftTypeText());
202  if (range > 0) SetDParam(i++, range);
203  SetDParam(i++, cargo);
204  SetDParam(i++, capacity);
205 
206  if (mail_capacity > 0) {
207  SetDParam(i++, CT_MAIL);
208  SetDParam(i++, mail_capacity);
209  SetDParam(i++, e->GetRunningCost());
210  return range > 0 ? STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_RANGE_CAP_CAP_RUNCOST : STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_CAP_CAP_RUNCOST;
211  } else {
212  SetDParam(i++, e->GetRunningCost());
213  return range > 0 ? STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_RANGE_CAP_RUNCOST : STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_CAP_RUNCOST;
214  }
215 }
216 
217 static StringID GetRoadVehEngineInfoString(const Engine *e)
218 {
220  SetDParam(0, e->GetCost());
221  SetDParam(1, e->GetDisplayMaxSpeed());
222  uint capacity = GetTotalCapacityOfArticulatedParts(e->index);
223  if (capacity != 0) {
225  SetDParam(3, capacity);
226  } else {
227  SetDParam(2, CT_INVALID);
228  }
229  SetDParam(4, e->GetRunningCost());
230  return STR_ENGINE_PREVIEW_COST_MAX_SPEED_CAP_RUNCOST;
231  } else {
232  SetDParam(0, e->GetCost());
233  SetDParam(2, e->GetDisplayMaxSpeed());
234  SetDParam(3, e->GetPower());
235  SetDParam(1, e->GetDisplayWeight());
237 
238  SetDParam(4, e->GetRunningCost());
239 
240  uint capacity = GetTotalCapacityOfArticulatedParts(e->index);
241  if (capacity != 0) {
243  SetDParam(6, capacity);
244  } else {
245  SetDParam(5, CT_INVALID);
246  }
247  return STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER_MAX_TE;
248  }
249 }
250 
251 static StringID GetShipEngineInfoString(const Engine *e)
252 {
253  SetDParam(0, e->GetCost());
254  SetDParam(1, e->GetDisplayMaxSpeed());
257  SetDParam(4, e->GetRunningCost());
258  return STR_ENGINE_PREVIEW_COST_MAX_SPEED_CAP_RUNCOST;
259 }
260 
261 
269 {
270  const Engine *e = Engine::Get(engine);
271 
272  switch (e->type) {
273  case VEH_TRAIN:
274  return GetTrainEngineInfoString(e);
275 
276  case VEH_ROAD:
277  return GetRoadVehEngineInfoString(e);
278 
279  case VEH_SHIP:
280  return GetShipEngineInfoString(e);
281 
282  case VEH_AIRCRAFT:
283  return GetAircraftEngineInfoString(e);
284 
285  default: NOT_REACHED();
286  }
287 }
288 
298 void DrawVehicleEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type)
299 {
300  const Engine *e = Engine::Get(engine);
301 
302  switch (e->type) {
303  case VEH_TRAIN:
304  DrawTrainEngine(left, right, preferred_x, y, engine, pal, image_type);
305  break;
306 
307  case VEH_ROAD:
308  DrawRoadVehEngine(left, right, preferred_x, y, engine, pal, image_type);
309  break;
310 
311  case VEH_SHIP:
312  DrawShipEngine(left, right, preferred_x, y, engine, pal, image_type);
313  break;
314 
315  case VEH_AIRCRAFT:
316  DrawAircraftEngine(left, right, preferred_x, y, engine, pal, image_type);
317  break;
318 
319  default: NOT_REACHED();
320  }
321 }
322 
329 {
330  if (el->size() < 2) return;
331  std::sort(el->begin(), el->end(), compare);
332 }
333 
341 void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items)
342 {
343  if (num_items < 2) return;
344  assert(begin < el->size());
345  assert(begin + num_items <= el->size());
346  std::sort(el->begin() + begin, el->begin() + begin + num_items, compare);
347 }
348 
void DrawVehicleEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type)
Draw an engine.
Definition: engine_gui.cpp:298
Functions related to OTTD&#39;s strings.
Road vehicle states.
VehicleSettings vehicle
options for vehicles
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:48
uint32 PaletteID
The number of the palette.
Definition: gfx_type.h:20
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:81
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
Definition: rail.h:306
Horizontally center the text.
Definition: gfx_func.h:97
ResizeInfo resize
Resize information.
Definition: window_gui.h:324
StringID GetEngineInfoString(EngineID engine)
Get a multi-line string with some technical data, describing the engine.
Definition: engine_gui.cpp:268
StringID GetEngineCategoryName(EngineID engine)
Return the category of an engine.
Definition: engine_gui.cpp:40
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition: window.cpp:1851
High level window description.
Definition: window_gui.h:168
WindowFlags flags
Window flags.
Definition: window_gui.h:312
int left
x position of left edge of the window
Definition: window_gui.h:319
StringID GetAircraftTypeText() const
Get the name of the aircraft type for display purposes.
Definition: engine.cpp:470
Train vehicle type.
Definition: vehicle_type.h:26
static Titem * Get(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:246
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: engine_gui.cpp:126
Base for the train class.
uint16 GetRange() const
Get the range of an aircraft type.
Definition: engine.cpp:456
Horizontal container.
Definition: widget_type.h:75
Ship vehicle type.
Definition: vehicle_type.h:28
CargoArray GetCapacityOfArticulatedParts(EngineID engine)
Get the capacity of the parts of a given engine.
Rail specific functions.
Road specific functions.
Functions related to vehicles.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition: engine_gui.cpp:138
StringID new_engine
Name of an engine for this type of road in the engine preview GUI.
Definition: road.h:107
Tindex index
Index of this pool item.
Definition: pool_type.hpp:147
int GetStringHeight(const char *str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
Definition: gfx.cpp:547
Close box (at top-left of a window)
Definition: widget_type.h:69
Base for aircraft.
Vehicle drawn in purchase list, autoreplace gui, ...
Definition: vehicle_type.h:92
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
Definition: engine_gui.cpp:80
static T max(const T a, const T b)
Returns the maximum of two values.
Definition: math_func.hpp:26
EngineImageType
Visualisation contexts of vehicles and engines.
Definition: vehicle_type.h:87
struct RailtypeInfo::@39 strings
Strings associated with the rail type.
Window is made sticky by user.
Definition: window_gui.h:240
CargoID GetDefaultCargoType() const
Determines the default cargo type of an engine.
Definition: engine_base.h:81
Large amount of vertical space between two paragraphs of text.
Definition: window_gui.h:140
StringID new_loco
Name of an engine for this type of rail in the engine preview GUI.
Definition: rail.h:180
Functions, definitions and such used only by the GUI.
RoadType roadtype
Road type.
Definition: engine_type.h:127
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:910
Data structure for an opened window.
Definition: window_gui.h:278
Invalid cargo type.
Definition: cargo_type.h:70
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1046
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1841
static const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
Definition: road.h:226
Money GetCost() const
Return how much a new engine costs.
Definition: engine.cpp:321
Engine preview window; Window numbers:
Definition: window_type.h:585
Invisible widget that takes some space.
Definition: widget_type.h:79
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:210
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
Definition: gfx_func.h:178
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1014
Types related to global configuration settings.
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:947
Definition of base types and functions in a cross-platform compatible way.
Center both horizontally and vertically.
Definition: gfx_func.h:106
PaletteID GetEnginePalette(EngineID engine_type, CompanyID company)
Get the colour map for an engine.
Definition: vehicle.cpp:1980
void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items)
Sort selected range of items (on indices @ <begin, begin+num_items-1>)
Definition: engine_gui.cpp:341
A number of safeguards to prevent using unsafe methods.
uint8 acceleration_type
Acceleration type of this rail type.
Definition: rail.h:225
bool EngList_SortTypeFunction(const EngineID &, const EngineID &)
argument type for EngList_Sort.
Definition: engine_gui.h:22
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
Vehicle drawn in preview window, news, ...
Definition: vehicle_type.h:93
Simple depressed panel.
Definition: widget_type.h:50
No button.
Definition: engine_widget.h:18
Engine GUI functions, used by build_vehicle_gui and autoreplace_gui
void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
Get the size of the sprite of an aircraft sprite heading west (used for lists).
VehicleType type
Vehicle type, ie VEH_ROAD, VEH_TRAIN, etc.
Definition: engine_base.h:42
Center the window.
Definition: window_gui.h:157
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new &#39;real&#39; widget.
Definition: widget_type.h:1114
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.
Definition: gfx.cpp:499
Yes button.
Definition: engine_widget.h:19
struct RoadTypeInfo::@42 strings
Strings associated with the rail type.
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
Definition: command.cpp:534
#define lengthof(x)
Return the length of an fixed size array.
Definition: depend.cpp:42
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:18
uint GetDisplayMaxSpeed() const
Returns max speed of the engine for display purposes.
Definition: engine.cpp:361
bool _shift_pressed
Is Shift pressed?
Definition: gfx.cpp:38
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:40
confirm the preview of an engine
Definition: command_type.h:242
uint GetPower() const
Returns the power of the engine for display and sorting purposes.
Definition: engine.cpp:393
Functions related to companies.
Functions related to articulated vehicles.
Class for storing amounts of cargo.
Definition: cargo_type.h:83
Base class for engines.
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:61
uint16 EngineID
Unique identification number of an engine.
Definition: engine_type.h:23
Types related to the engine widgets.
uint GetTotalCapacityOfArticulatedParts(EngineID engine)
Get the capacity of an engine with articulated parts.
Definition: engine_gui.cpp:165
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL).
Definition: widget_type.h:999
The container for the question.
Definition: engine_widget.h:17
void GetRoadVehSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
Get the size of the sprite of a road vehicle sprite heading west (used for lists).
uint GetDisplayDefaultCapacity(uint16 *mail_capacity=nullptr) const
Determines the default cargo capacity of an engine for display purposes.
Definition: engine_base.h:101
void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare)
Sort all items using quick sort and given &#39;CompareItems&#39; function.
Definition: engine_gui.cpp:328
Functions related to commands.
Coordinates of a point in 2D.
uint8 train_acceleration_model
realistic acceleration for trains
Base for ships.
void DrawRoadVehEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type)
Draw a road vehicle engine.
Aircraft vehicle type.
Definition: vehicle_type.h:29
uint8 roadveh_acceleration_model
realistic acceleration for road vehicles
Offset at right to draw the frame rectangular area.
Definition: window_gui.h:63
Money GetRunningCost() const
Return how much the running costs of this engine are.
Definition: engine.cpp:284
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:983
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:707
Specification of a rectangle with absolute coordinates of all edges.
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
void GetShipSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
Get the size of the sprite of a ship sprite heading west (used for lists).
Definition: ship_cmd.cpp:115
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:314
uint GetDisplayWeight() const
Returns the weight of the engine for display purposes.
Definition: engine.cpp:411
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: engine_gui.cpp:107
uint GetDisplayMaxTractiveEffort() const
Returns the tractive effort of the engine for display purposes.
Definition: engine.cpp:429
void GetTrainSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
Get the size of the sprite of a train sprite heading west, or both heads (used for lists)...
Definition: train_cmd.cpp:552
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:46
Dimensions (a width and height) of a rectangle in 2D.
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:429
Offset at left to draw the frame rectangular area.
Definition: window_gui.h:62
Road vehicle type.
Definition: vehicle_type.h:27
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1076
const T GetSum() const
Get the sum of all cargo amounts.
Definition: cargo_type.h:123
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
Definition: gfx.cpp:620
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
Definition: strings_func.h:201