|
OpenTTD Source
14.0-beta3
|
Go to the documentation of this file.
37 case LT_NONE:
return (link.target == 0);
43 default:
return false;
90 Link link{link_type, link_target};
124 Link link{link_type, link_target};
128 lte->company = company;
151 lte->rating = rating;
171 auto table = lte->table;
std::tuple< CommandCost, LeagueTableID > CmdCreateLeagueTable(DoCommandFlag flags, const std::string &title, const std::string &header, const std::string &footer)
Create a new league table.
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
std::string title
Title of the table.
static const LeagueTableID INVALID_LEAGUE_TABLE
Invalid/unknown index of LeagueTable.
Struct about league table elements.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
Tindex index
Index of this pool item.
Struct about custom league tables.
std::string header
Text to show above the table.
Owner
Enum for all companies/owners.
@ DC_EXEC
execute the given command
@ WC_COMPANY_LEAGUE
Company league window; Window numbers:
DoCommandFlag
List of flags for a command.
CommandCost CmdUpdateLeagueTableElementData(DoCommandFlag flags, LeagueTableElementID element, CompanyID company, const std::string &text, LinkType link_type, LinkTargetID link_target)
Update the attributes of a league table element.
@ LT_INDUSTRY
Link an industry.
LinkType
Types of the possible link targets.
@ LT_STORY_PAGE
Link a story page.
Common return value for all commands.
bool IsValidLink(Link link)
Checks whether a link is valid, i.e.
uint8_t LeagueTableID
ID of a league table.
CommandCost CmdUpdateLeagueTableElementScore(DoCommandFlag flags, LeagueTableElementID element, int64_t rating, const std::string &score)
Update the score of a league table element.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
int64_t rating
Value that determines ordering of elements in the table (higher=better)
Link link
What opens when element is clicked.
CompanyID company
Company Id to show the color blob for or INVALID_COMPANY.
CompanyID _current_company
Company currently doing an action.
Base class for all pools.
std::string score
String representation of the score associated with the element.
std::string footer
Text to show below the table.
std::tuple< CommandCost, LeagueTableElementID > CmdCreateLeagueTableElement(DoCommandFlag flags, LeagueTableID table, int64_t rating, CompanyID company, const std::string &text, const std::string &score, LinkType link_type, LinkTargetID link_target)
Create a new element in a league table.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
@ OWNER_DEITY
The object is owned by a superuser / goal script.
static const LeagueTableElementID INVALID_LEAGUE_TABLE_ELEMENT
Invalid/unknown index of LeagueTableElement.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
CommandCost CmdRemoveLeagueTableElement(DoCommandFlag flags, LeagueTableElementID element)
Remove a league table element.
std::string text
Text of the element.
@ INVALID_COMPANY
An invalid company.
uint16_t LeagueTableElementID
ID of a league table element.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
uint32_t LinkTargetID
Contains either tile, industry ID, town ID, story page ID or company ID.
@ LT_COMPANY
Link a company.
LeagueTableID table
Id of the table which this element belongs to.