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;
Common return value for all commands.
Functions related to commands.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
Types related to commands.
DoCommandFlag
List of flags for a command.
@ DC_EXEC
execute the given command
CompanyID _current_company
Company currently doing an action.
Owner
Enum for all companies/owners.
@ INVALID_COMPANY
An invalid company.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
CommandCost CmdRemoveLeagueTableElement(DoCommandFlag flags, LeagueTableElementID element)
Remove a league table element.
std::tuple< CommandCost, LeagueTableID > CmdCreateLeagueTable(DoCommandFlag flags, const std::string &title, const std::string &header, const std::string &footer)
Create a new league table.
CommandCost CmdUpdateLeagueTableElementScore(DoCommandFlag flags, LeagueTableElementID element, int64_t rating, const std::string &score)
Update the score of a league table element.
bool IsValidLink(Link link)
Checks whether a link is valid, i.e.
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.
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.
Command definitions related to league tables.
static const LeagueTableElementID INVALID_LEAGUE_TABLE_ELEMENT
Invalid/unknown index of LeagueTableElement.
uint16_t LeagueTableElementID
ID of a league table element.
uint8_t LeagueTableID
ID of a league table.
LinkType
Types of the possible link targets.
@ LT_COMPANY
Link a company.
@ LT_STORY_PAGE
Link a story page.
@ LT_INDUSTRY
Link an industry.
uint32_t LinkTargetID
Contains either tile, industry ID, town ID, story page ID or company ID.
static const LeagueTableID INVALID_LEAGUE_TABLE
Invalid/unknown index of LeagueTable.
Some methods of Pool are placed here in order to reduce compilation time and binary size.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
Struct about league table elements.
std::string score
String representation of the score associated with the element.
std::string text
Text of the element.
int64_t rating
Value that determines ordering of elements in the table (higher=better)
Link link
What opens when element is clicked.
LeagueTableID table
Id of the table which this element belongs to.
CompanyID company
Company Id to show the color blob for or INVALID_COMPANY.
Struct about custom league tables.
std::string header
Text to show above the table.
std::string title
Title of the table.
std::string footer
Text to show below the table.
Tindex index
Index of this pool item.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
Base class for all pools.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
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-...
Window functions not directly related to making/drawing windows.
@ WC_COMPANY_LEAGUE
Company league window; Window numbers: