24#include "table/strings.h"
52 if (!s->IsAwarded()) {
81 void HandleClick(
const Subsidy *s)
88 default: NOT_REACHED();
98 default: NOT_REACHED();
147 void DrawCargoIcon(
const Rect &r,
int y_offset,
CargoID cid)
const
253static constexpr NWidgetPart _nested_subsidies_list_widgets[] = {
271 WDP_AUTO,
"list_subsidies", 500, 127,
274 _nested_subsidies_list_widgets
278void ShowSubsidiesList()
280 AllocateWindowDescFront<SubsidyListWindow>(_subsidies_list_desc, 0);
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
@ Industry
Source/destination is an industry.
@ Town
Source/destination is a town.
Dimension GetLargestCargoIconSize()
Get dimensions of largest cargo icon.
static Date date
Current date in days (day counter).
static bool UsingWallclockUnits(bool newgame=false)
Check if we are using wallclock units.
static YearMonthDay ConvertDateToYMD(Date date)
Converts a Date to a Year, Month & Day.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
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.
bool _ctrl_pressed
Is Ctrl pressed?
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
int CenterBounds(int min, int max, int size)
Determine where to draw a centred object inside a widget.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
@ FS_NORMAL
Index of the normal font in the font tables.
GUI functions that shouldn't be here.
void ShowExtraViewportWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
constexpr bool IsInsideMM(const T x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
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.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
SpriteID GetCargoIcon() const
Get sprite for showing cargo of this type.
Dimensions (a width and height) of a rectangle in 2D.
Coordinates of a point in 2D.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
static Titem * Get(size_t index)
Returns Titem with given index.
constexpr uint Horizontal() const
Get total horizontal padding of RectPadding.
constexpr uint Vertical() const
Get total vertical padding of RectPadding.
Specification of a rectangle with absolute coordinates of all edges.
Rect WithWidth(int width, bool end) const
Copy Rect and set its width.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Rect WithHeight(int height, bool end=false) const
Copy Rect and set its height.
Rect Indent(int indent, bool end) const
Copy Rect and indent it from its position.
uint CountLines()
Count the number of lines in this window.
void OnInit() override
Notification that the nested widget tree gets initialized.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
void OnResize() override
Called after the window got resized.
Struct about subsidies, offered and awarded.
bool IsAwarded() const
Tests whether this subsidy has been awarded to someone.
SourceType dst_type
Destination of subsidised path (SourceType::Industry or SourceType::Town)
SourceType src_type
Source of subsidised path (SourceType::Industry or SourceType::Town)
CompanyID awarded
Subsidy is awarded to this company; INVALID_COMPANY if it's not awarded to anyone.
CargoID cargo_type
Cargo type involved in this subsidy, INVALID_CARGO for invalid subsidy.
uint16_t remaining
Remaining months when this subsidy is valid.
SourceID src
Index of source. Either TownID or IndustryID.
SourceID dst
Index of destination. Either TownID or IndustryID.
High level window description.
Data structure for an opened window.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
ResizeInfo resize
Resize information.
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
const NWID * GetWidget(WidgetID widnum) const
Get the nested widget with number widnum from the nested widget tree.
const Scrollbar * GetScrollbar(WidgetID widnum) const
Return the Scrollbar to a widget index.
WindowNumber window_number
Window number within the window class.
std::pair< NewsReferenceType, NewsReferenceType > SetupSubsidyDecodeParam(const Subsidy *s, SubsidyDecodeParamType mode, uint parameter_offset)
Setup the string parameters for printing the subsidy at the screen, and compute the news reference fo...
@ Gui
Subsidies listed in the Subsidy GUI.
Functions related to subsidies.
Definition of the game-calendar-timer.
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Functions related to (drawing on) viewports.
Functions, definitions and such used only by the GUI.
@ WDP_AUTO
Find a place automatically.
int32_t WindowNumber
Number to differentiate different windows of the same class.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
@ WC_SUBSIDIES_LIST
Subsidies list; Window numbers: