OpenTTD Source: src/league_cmd.h Source File

OpenTTD Source 15.3

league_cmd.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef LEAGUE_CMD_H
11#define LEAGUE_CMD_H
12
13#include "league_type.h"
14#include "command_type.h"
15#include "company_type.h"
16
17std::tuple<CommandCost, LeagueTableID> CmdCreateLeagueTable(DoCommandFlags flags, const EncodedString &title, const EncodedString &header, const EncodedString &footer);
18std::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);
19 CommandCost CmdUpdateLeagueTableElementData(DoCommandFlags flags, LeagueTableElementID element, CompanyID company, const EncodedString &text, LinkType link_type, LinkTargetID link_target);
20 CommandCost CmdUpdateLeagueTableElementScore(DoCommandFlags flags, LeagueTableElementID element, int64_t rating, const EncodedString &score);
21 CommandCost CmdRemoveLeagueTableElement(DoCommandFlags flags, LeagueTableElementID element);
22
23DEF_CMD_TRAIT(CMD_CREATE_LEAGUE_TABLE, CmdCreateLeagueTable, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
24DEF_CMD_TRAIT(CMD_CREATE_LEAGUE_TABLE_ELEMENT, CmdCreateLeagueTableElement, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
25DEF_CMD_TRAIT(CMD_UPDATE_LEAGUE_TABLE_ELEMENT_DATA, CmdUpdateLeagueTableElementData, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
26DEF_CMD_TRAIT(CMD_UPDATE_LEAGUE_TABLE_ELEMENT_SCORE, CmdUpdateLeagueTableElementScore, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
27DEF_CMD_TRAIT(CMD_REMOVE_LEAGUE_TABLE_ELEMENT, CmdRemoveLeagueTableElement, CommandFlag::Deity, CommandType::OtherManagement)
28
29#endif /* LEAGUE_CMD_H */
CommandCost
Common return value for all commands.
Definition command_type.h:24
EncodedString
Container for an encoded string, created by GetEncodedString.
Definition strings_type.h:98
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
command_type.h
Types related to commands.
CommandType::OtherManagement
@ OtherManagement
Renaming stuff, changing company colours, placing signs, etc.
CommandFlag::Deity
@ Deity
the command may be executed by COMPANY_DEITY
CommandFlag::StrCtrl
@ StrCtrl
the command's string may contain control strings
CMD_UPDATE_LEAGUE_TABLE_ELEMENT_DATA
@ CMD_UPDATE_LEAGUE_TABLE_ELEMENT_DATA
update the data fields of a league table element
Definition command_type.h:374
CMD_REMOVE_LEAGUE_TABLE_ELEMENT
@ CMD_REMOVE_LEAGUE_TABLE_ELEMENT
remove a league table element
Definition command_type.h:376
CMD_CREATE_LEAGUE_TABLE_ELEMENT
@ CMD_CREATE_LEAGUE_TABLE_ELEMENT
create a new element in a league table
Definition command_type.h:373
CMD_CREATE_LEAGUE_TABLE
@ CMD_CREATE_LEAGUE_TABLE
create a new league table
Definition command_type.h:372
CMD_UPDATE_LEAGUE_TABLE_ELEMENT_SCORE
@ CMD_UPDATE_LEAGUE_TABLE_ELEMENT_SCORE
update the score of a league table element
Definition command_type.h:375
company_type.h
Types related to companies.
CmdCreateLeagueTableElement
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.
Definition league_cmd.cpp:83
CmdUpdateLeagueTableElementData
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.
Definition league_cmd.cpp:109
CmdUpdateLeagueTableElementScore
CommandCost CmdUpdateLeagueTableElementScore(DoCommandFlags flags, LeagueTableElementID element, int64_t rating, const EncodedString &score)
Update the score of a league table element.
Definition league_cmd.cpp:135
CmdRemoveLeagueTableElement
CommandCost CmdRemoveLeagueTableElement(DoCommandFlags flags, LeagueTableElementID element)
Remove a league table element.
Definition league_cmd.cpp:155
CmdCreateLeagueTable
std::tuple< CommandCost, LeagueTableID > CmdCreateLeagueTable(DoCommandFlags flags, const EncodedString &title, const EncodedString &header, const EncodedString &footer)
Create a new league table.
Definition league_cmd.cpp:56
league_type.h
basic types related to league tables
LinkType
LinkType
Types of the possible link targets.
Definition league_type.h:16
LinkTargetID
uint32_t LinkTargetID
Contains either tile, industry ID, town ID, story page ID or company ID.
Definition league_type.h:25
PoolID< uint8_t, struct LeagueTableIDTag, 255, 0xFF >