OpenTTD Source: src/story_cmd.h Source File

OpenTTD Source 15.0-RC2

story_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 STORY_CMD_H
11#define STORY_CMD_H
12
13#include "command_type.h"
14#include "company_type.h"
15#include "story_type.h"
16#include "vehicle_type.h"
17
18std::tuple<CommandCost, StoryPageID> CmdCreateStoryPage(DoCommandFlags flags, CompanyID company, const EncodedString &text);
19std::tuple<CommandCost, StoryPageElementID> CmdCreateStoryPageElement(DoCommandFlags flags, TileIndex tile, StoryPageID page_id, StoryPageElementType type, uint32_t reference, const EncodedString &text);
20 CommandCost CmdUpdateStoryPageElement(DoCommandFlags flags, TileIndex tile, StoryPageElementID page_element_id, uint32_t reference, const EncodedString &text);
21 CommandCost CmdSetStoryPageTitle(DoCommandFlags flags, StoryPageID page_id, const EncodedString &text);
22 CommandCost CmdSetStoryPageDate(DoCommandFlags flags, StoryPageID page_id, TimerGameCalendar::Date date);
23 CommandCost CmdShowStoryPage(DoCommandFlags flags, StoryPageID page_id);
24 CommandCost CmdRemoveStoryPage(DoCommandFlags flags, StoryPageID page_id);
25 CommandCost CmdRemoveStoryPageElement(DoCommandFlags flags, StoryPageElementID page_element_id);
26 CommandCost CmdStoryPageButton(DoCommandFlags flags, TileIndex tile, StoryPageElementID page_element_id, VehicleID reference);
27
28DEF_CMD_TRAIT(CMD_CREATE_STORY_PAGE, CmdCreateStoryPage, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
29DEF_CMD_TRAIT(CMD_CREATE_STORY_PAGE_ELEMENT, CmdCreateStoryPageElement, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
30DEF_CMD_TRAIT(CMD_UPDATE_STORY_PAGE_ELEMENT, CmdUpdateStoryPageElement, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
31DEF_CMD_TRAIT(CMD_SET_STORY_PAGE_TITLE, CmdSetStoryPageTitle, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
32DEF_CMD_TRAIT(CMD_SET_STORY_PAGE_DATE, CmdSetStoryPageDate, CommandFlag::Deity, CommandType::OtherManagement)
33DEF_CMD_TRAIT(CMD_SHOW_STORY_PAGE, CmdShowStoryPage, CommandFlag::Deity, CommandType::OtherManagement)
34DEF_CMD_TRAIT(CMD_REMOVE_STORY_PAGE, CmdRemoveStoryPage, CommandFlag::Deity, CommandType::OtherManagement)
35DEF_CMD_TRAIT(CMD_REMOVE_STORY_PAGE_ELEMENT, CmdRemoveStoryPageElement, CommandFlag::Deity, CommandType::OtherManagement)
36DEF_CMD_TRAIT(CMD_STORY_PAGE_BUTTON, CmdStoryPageButton, CommandFlag::Deity, CommandType::OtherManagement)
37
38#endif /* STORY_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_REMOVE_STORY_PAGE
@ CMD_REMOVE_STORY_PAGE
remove a story page
Definition command_type.h:329
CMD_CREATE_STORY_PAGE_ELEMENT
@ CMD_CREATE_STORY_PAGE_ELEMENT
create a new story page element
Definition command_type.h:324
CMD_SHOW_STORY_PAGE
@ CMD_SHOW_STORY_PAGE
show a story page
Definition command_type.h:328
CMD_UPDATE_STORY_PAGE_ELEMENT
@ CMD_UPDATE_STORY_PAGE_ELEMENT
update a story page element
Definition command_type.h:325
CMD_CREATE_STORY_PAGE
@ CMD_CREATE_STORY_PAGE
create a new story page
Definition command_type.h:323
CMD_STORY_PAGE_BUTTON
@ CMD_STORY_PAGE_BUTTON
selection via story page button
Definition command_type.h:332
CMD_SET_STORY_PAGE_TITLE
@ CMD_SET_STORY_PAGE_TITLE
update title of a story page
Definition command_type.h:326
CMD_SET_STORY_PAGE_DATE
@ CMD_SET_STORY_PAGE_DATE
update date of a story page
Definition command_type.h:327
CMD_REMOVE_STORY_PAGE_ELEMENT
@ CMD_REMOVE_STORY_PAGE_ELEMENT
remove a story page element
Definition command_type.h:330
company_type.h
Types related to companies.
StoryPageElementType
StoryPageElementType
Definition story_base.h:31
CmdCreateStoryPageElement
std::tuple< CommandCost, StoryPageElementID > CmdCreateStoryPageElement(DoCommandFlags flags, TileIndex tile, StoryPageID page_id, StoryPageElementType type, uint32_t reference, const EncodedString &text)
Create a new story page element.
Definition story.cpp:253
CmdCreateStoryPage
std::tuple< CommandCost, StoryPageID > CmdCreateStoryPage(DoCommandFlags flags, CompanyID company, const EncodedString &text)
Create a new story page.
Definition story.cpp:218
CmdUpdateStoryPageElement
CommandCost CmdUpdateStoryPageElement(DoCommandFlags flags, TileIndex tile, StoryPageElementID page_element_id, uint32_t reference, const EncodedString &text)
Update a new story page element.
Definition story.cpp:296
CmdRemoveStoryPageElement
CommandCost CmdRemoveStoryPageElement(DoCommandFlags flags, StoryPageElementID page_element_id)
Remove a story page element.
Definition story.cpp:413
CmdRemoveStoryPage
CommandCost CmdRemoveStoryPage(DoCommandFlags flags, StoryPageID page_id)
Remove a story page and associated story page elements.
Definition story.cpp:384
CmdStoryPageButton
CommandCost CmdStoryPageButton(DoCommandFlags flags, TileIndex tile, StoryPageElementID page_element_id, VehicleID reference)
Clicked/used a button on a story page.
Definition story.cpp:438
CmdSetStoryPageTitle
CommandCost CmdSetStoryPageTitle(DoCommandFlags flags, StoryPageID page_id, const EncodedString &text)
Update title of a story page.
Definition story.cpp:322
CmdSetStoryPageDate
CommandCost CmdSetStoryPageDate(DoCommandFlags flags, StoryPageID page_id, TimerGameCalendar::Date date)
Update date of a story page.
Definition story.cpp:344
CmdShowStoryPage
CommandCost CmdShowStoryPage(DoCommandFlags flags, StoryPageID page_id)
Display a story page for all clients that are allowed to view the story page.
Definition story.cpp:366
story_type.h
basic types related to story pages
PoolID< uint8_t, struct CompanyIDTag, 0xF, 0xFF >
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
vehicle_type.h
Types related to vehicles.