37 case LT_NONE:
return (link.target == 0);
43 default:
return false;
60 if (title.empty())
return {
CMD_ERROR, LeagueTableID::Invalid() };
87 Link link{link_type, link_target};
96 return {
CommandCost(), LeagueTableElementID::Invalid() };
115 Link link{link_type, link_target};
119 lte->company = company;
142 lte->rating = rating;
162 auto table = lte->table;
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
Common return value for all commands.
Container for an encoded string, created by GetEncodedString.
Functions related to commands.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
Types related to commands.
@ Execute
execute the given command
CompanyID _current_company
Company currently doing an action.
static constexpr Owner OWNER_DEITY
The object is owned by a superuser / goal script.
std::tuple< CommandCost, LeagueTableElementID > CmdCreateLeagueTableElement(DoCommandFlags flags, LeagueTableID table, int64_t rating, CompanyID company, const EncodedString &text, const EncodedString &score, LinkType link_type, LinkTargetID link_target)
Create a new element in a league table.
CommandCost CmdUpdateLeagueTableElementData(DoCommandFlags flags, LeagueTableElementID element, CompanyID company, const EncodedString &text, LinkType link_type, LinkTargetID link_target)
Update the attributes of a league table element.
bool IsValidLink(Link link)
Checks whether a link is valid, i.e.
CommandCost CmdUpdateLeagueTableElementScore(DoCommandFlags flags, LeagueTableElementID element, int64_t rating, const EncodedString &score)
Update the score of a league table element.
CommandCost CmdRemoveLeagueTableElement(DoCommandFlags flags, LeagueTableElementID element)
Remove a league table element.
std::tuple< CommandCost, LeagueTableID > CmdCreateLeagueTable(DoCommandFlags flags, const EncodedString &title, const EncodedString &header, const EncodedString &footer)
Create a new league table.
Command definitions related to league tables.
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.
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.
Struct about custom league tables.
Tindex index
Index of this pool item.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
static bool IsValidID(auto index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
static Titem * GetIfValid(auto index)
Returns Titem with given index.
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: