OpenTTD Source 20260206-master-g4d4e37dbf1
story_cmd.h File Reference

Command definitions related to stories. More...

#include "command_type.h"
#include "company_type.h"
#include "story_type.h"
#include "vehicle_type.h"

Go to the source code of this file.

Functions

std::tuple< CommandCost, StoryPageIDCmdCreateStoryPage (DoCommandFlags flags, CompanyID company, const EncodedString &text)
 Create a new story page.
std::tuple< CommandCost, StoryPageElementIDCmdCreateStoryPageElement (DoCommandFlags flags, TileIndex tile, StoryPageID page_id, StoryPageElementType type, uint32_t reference, const EncodedString &text)
 Create a new story page element.
CommandCost CmdUpdateStoryPageElement (DoCommandFlags flags, TileIndex tile, StoryPageElementID page_element_id, uint32_t reference, const EncodedString &text)
 Update a new story page element.
CommandCost CmdSetStoryPageTitle (DoCommandFlags flags, StoryPageID page_id, const EncodedString &text)
 Update title of a story page.
CommandCost CmdSetStoryPageDate (DoCommandFlags flags, StoryPageID page_id, TimerGameCalendar::Date date)
 Update date of a story page.
CommandCost CmdShowStoryPage (DoCommandFlags flags, StoryPageID page_id)
 Display a story page for all clients that are allowed to view the story page.
CommandCost CmdRemoveStoryPage (DoCommandFlags flags, StoryPageID page_id)
 Remove a story page and associated story page elements.
CommandCost CmdRemoveStoryPageElement (DoCommandFlags flags, StoryPageElementID page_element_id)
 Remove a story page element.
CommandCost CmdStoryPageButton (DoCommandFlags flags, TileIndex tile, StoryPageElementID page_element_id, VehicleID reference)
 Clicked/used a button on a story page.

Detailed Description

Command definitions related to stories.

Definition in file story_cmd.h.

Function Documentation

◆ CmdCreateStoryPage()

std::tuple< CommandCost, StoryPageID > CmdCreateStoryPage ( DoCommandFlags flags,
CompanyID company,
const EncodedString & text )

Create a new story page.

Parameters
flagstype of operation
companyCompany for which this story page belongs to.
textTitle of the story page. Null is allowed in which case a generic page title is provided by OpenTTD.
Returns
the cost of this operation or an error

Definition at line 258 of file story.cpp.

References _current_company, CMD_ERROR, TimerGameCalendar::date, Execute, InvalidateWindowClassesData(), InvalidateWindowData(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), WC_MAIN_TOOLBAR, and WC_STORY_BOOK.

◆ 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.

Parameters
flagstype of operation
tileTile location if it is a location page element, otherwise unused.
page_idThe page which the element belongs to.
typePage element type
referenceId of referenced object
textText content in case it is a text or location page element
Returns
the cost of this operation or an error

Definition at line 293 of file story.cpp.

References _current_company, CMD_ERROR, Execute, InvalidateWindowClassesData(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), UpdateElement(), VerifyElementContentParameters(), and WC_STORY_BOOK.

◆ CmdRemoveStoryPage()

CommandCost CmdRemoveStoryPage ( DoCommandFlags flags,
StoryPageID page_id )

Remove a story page and associated story page elements.

Parameters
flagstype of operation
page_idStoryPageID to remove.
Returns
the cost of this operation or an error

Definition at line 424 of file story.cpp.

References _current_company, CMD_ERROR, Execute, InvalidateWindowClassesData(), InvalidateWindowData(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), WC_MAIN_TOOLBAR, and WC_STORY_BOOK.

◆ CmdRemoveStoryPageElement()

CommandCost CmdRemoveStoryPageElement ( DoCommandFlags flags,
StoryPageElementID page_element_id )

Remove a story page element.

Parameters
flagstype of operation
page_element_idStoryPageElementID to remove.
Returns
the cost of this operation or an error

Definition at line 453 of file story.cpp.

References _current_company, CMD_ERROR, Execute, InvalidateWindowClassesData(), OWNER_DEITY, StoryPageElement::page, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and WC_STORY_BOOK.

◆ CmdSetStoryPageDate()

CommandCost CmdSetStoryPageDate ( DoCommandFlags flags,
StoryPageID page_id,
TimerGameCalendar::Date date )

Update date of a story page.

Parameters
flagstype of operation
page_idStoryPageID to update.
datedate
Returns
the cost of this operation or an error

Definition at line 384 of file story.cpp.

References _current_company, CMD_ERROR, StoryPage::date, Execute, InvalidateWindowClassesData(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and WC_STORY_BOOK.

◆ CmdSetStoryPageTitle()

CommandCost CmdSetStoryPageTitle ( DoCommandFlags flags,
StoryPageID page_id,
const EncodedString & text )

Update title of a story page.

Parameters
flagstype of operation
page_idStoryPageID to update.
texttitle text of the story page.
Returns
the cost of this operation or an error

Definition at line 362 of file story.cpp.

References _current_company, CMD_ERROR, Execute, InvalidateWindowClassesData(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), StoryPage::title, and WC_STORY_BOOK.

◆ CmdShowStoryPage()

CommandCost CmdShowStoryPage ( DoCommandFlags flags,
StoryPageID page_id )

Display a story page for all clients that are allowed to view the story page.

Parameters
flagstype of operation
page_idStoryPageID to show.
Returns
the cost of this operation or an error

Definition at line 406 of file story.cpp.

References _current_company, _local_company, CMD_ERROR, StoryPage::company, Execute, OWNER_DEITY, ShowStoryBook(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

◆ CmdStoryPageButton()

CommandCost CmdStoryPageButton ( DoCommandFlags flags,
TileIndex tile,
StoryPageElementID page_element_id,
VehicleID reference )

Clicked/used a button on a story page.

Parameters
flagsType of operation.
tileTile selected, for tile selection buttons, otherwise unused.
page_element_idstory page element id of button.
referenceID of selected item for buttons that select an item (e.g. vehicle), otherwise unused.
Returns
The cost of the operation, or an error.

Definition at line 478 of file story.cpp.

References _current_company, CMD_ERROR, StoryPage::company, Execute, IsValidTile(), Game::NewEvent(), StoryPageElement::page, SPET_BUTTON_PUSH, SPET_BUTTON_TILE, SPET_BUTTON_VEHICLE, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and StoryPageElement::type.

◆ CmdUpdateStoryPageElement()

CommandCost CmdUpdateStoryPageElement ( DoCommandFlags flags,
TileIndex tile,
StoryPageElementID page_element_id,
uint32_t reference,
const EncodedString & text )

Update a new story page element.

Parameters
flagstype of operation
tileTile location if it is a location page element, otherwise unused.
page_element_idThe page element to update.
referenceId of referenced object
textText content in case it is a text or location page element
Returns
the cost of this operation or an error

Definition at line 336 of file story.cpp.

References _current_company, CMD_ERROR, Execute, InvalidateWindowClassesData(), OWNER_DEITY, StoryPageElement::page, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), StoryPageElement::type, UpdateElement(), VerifyElementContentParameters(), and WC_STORY_BOOK.