OpenTTD Source: src/league_cmd.h File Reference

OpenTTD Source 14.1

Functions
league_cmd.h File Reference
`#include "league_type.h"`
`#include "command_type.h"`
`#include "company_type.h"`

Go to the source code of this file.

## Functions
std::tuple< CommandCost, LeagueTableID > | CmdCreateLeagueTable (DoCommandFlag flags, const std::string &title, const std::string &header, const std::string &footer)
| Create a new league table. More...
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. More...
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. More...
CommandCost | CmdUpdateLeagueTableElementScore (DoCommandFlag flags, LeagueTableElementID element, int64_t rating, const std::string &score)
| Update the score of a league table element. More...
CommandCost | CmdRemoveLeagueTableElement (DoCommandFlag flags, LeagueTableElementID element)
| Remove a league table element. More...

## Detailed Description

Command definitions related to league tables.

Definition in file league_cmd.h.

## Function Documentation

## ◆ CmdCreateLeagueTable()

std::tuple<CommandCost, LeagueTableID> CmdCreateLeagueTable | ( | DoCommandFlag | flags,
|  | const std::string & | title,
|  | const std::string & | header,
|  | const std::string & | footer
| ) |  |

Create a new league table.

Parameters

  flags | type of operation
  title | Title of the league table
  header | Text to show above the table
  footer | Text to show below the table

Returns
  the cost of this operation or an error

Definition at line 56 of file league_cmd.cpp.

References _current_company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_league_table_pool >::CanAllocateItem(), CMD_ERROR, DC_EXEC, LeagueTable::footer, LeagueTable::header, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_LEAGUE_TABLE, OWNER_DEITY, and LeagueTable::title.

## ◆ CmdCreateLeagueTableElement()

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.

Parameters

  flags | type of operation
  table | Id of the league table this element belongs to
  rating | Value that elements are ordered by
  company | Company to show the color blob for or INVALID_COMPANY
  text | Text of the element
  score | String representation of the score associated with the element
  link_type | Type of the referenced object
  link_target | Id of the referenced object

Returns
  the cost of this operation or an error

Definition at line 86 of file league_cmd.cpp.

References _current_company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_league_table_element_pool >::CanAllocateItem(), CMD_ERROR, LeagueTableElement::company, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_COMPANY, INVALID_LEAGUE_TABLE_ELEMENT, InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), IsValidLink(), LeagueTableElement::link, OWNER_DEITY, LeagueTableElement::rating, LeagueTableElement::score, LeagueTableElement::table, LeagueTableElement::text, and WC_COMPANY_LEAGUE.

## ◆ CmdRemoveLeagueTableElement()

CommandCost CmdRemoveLeagueTableElement | ( | DoCommandFlag | flags,
|  | LeagueTableElementID | element
| ) |  |

Remove a league table element.

Parameters

  flags | type of operation
  element | Id of the element to update

Returns
  the cost of this operation or an error

Definition at line 164 of file league_cmd.cpp.

References _current_company, CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_league_table_element_pool >::GetIfValid(), InvalidateWindowData(), OWNER_DEITY, and WC_COMPANY_LEAGUE.

## ◆ CmdUpdateLeagueTableElementData()

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.

Parameters

  flags | type of operation
  element | Id of the element to update
  company | Company to show the color blob for or INVALID_COMPANY
  text | Text of the element
  link_type | Type of the referenced object
  link_target | Id of the referenced object

Returns
  the cost of this operation or an error

Definition at line 118 of file league_cmd.cpp.

References _current_company, CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_league_table_element_pool >::GetIfValid(), INVALID_COMPANY, InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), IsValidLink(), OWNER_DEITY, and WC_COMPANY_LEAGUE.

## ◆ CmdUpdateLeagueTableElementScore()

CommandCost CmdUpdateLeagueTableElementScore | ( | DoCommandFlag | flags,
|  | LeagueTableElementID | element,
|  | int64_t | rating,
|  | const std::string & | score
| ) |  |

Update the score of a league table element.

Parameters

  flags | type of operation
  element | Id of the element to update
  rating | Value that elements are ordered by
  score | String representation of the score associated with the element

Returns
  the cost of this operation or an error

Definition at line 144 of file league_cmd.cpp.

References _current_company, CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_league_table_element_pool >::GetIfValid(), InvalidateWindowData(), OWNER_DEITY, and WC_COMPANY_LEAGUE.