OpenTTD Source 20260206-master-g4d4e37dbf1
StoryPageButtonData Struct Reference

Helper to construct packed "id" values for button-type StoryPageElement. More...

#include <story_base.h>

Public Member Functions

void SetColour (Colours button_colour)
 Set the button background colour.
void SetFlags (StoryPageButtonFlags flags)
 Set the button flags.
void SetCursor (StoryPageButtonCursor cursor)
 Set the mouse cursor used while waiting for input for the button.
void SetVehicleType (VehicleType vehtype)
 Set the type of vehicles that are accepted by the button.
Colours GetColour () const
 Get the button background colour.
StoryPageButtonFlags GetFlags () const
 Get the button flags.
StoryPageButtonCursor GetCursor () const
 Get the mouse cursor used while waiting for input for the button.
VehicleType GetVehicleType () const
 Get the type of vehicles that are accepted by the button.
bool ValidateColour () const
 Verify that the data stored a valid Colour value.
bool ValidateFlags () const
 Verify that valid flags were set.
bool ValidateCursor () const
 Verify that the data stores a valid StoryPageButtonCursor value.
bool ValidateVehicleType () const
 Verity that the data stored a valid VehicleType value.

Data Fields

uint32_t referenced_id = 0

Detailed Description

Helper to construct packed "id" values for button-type StoryPageElement.

Definition at line 123 of file story_base.h.

Member Function Documentation

◆ GetColour()

Colours StoryPageButtonData::GetColour ( ) const

Get the button background colour.

Returns
The background colour.

Definition at line 172 of file story.cpp.

References GB(), and IsValidColours().

Referenced by StoryBookWindow::DrawWidget().

◆ GetCursor()

StoryPageButtonCursor StoryPageButtonData::GetCursor ( ) const

Get the mouse cursor used while waiting for input for the button.

Returns
The waiting for input cursor.

Definition at line 192 of file story.cpp.

References GB(), and IsValidStoryPageButtonCursor().

Referenced by StoryBookWindow::OnPageElementClick().

◆ GetFlags()

StoryPageButtonFlags StoryPageButtonData::GetFlags ( ) const

Get the button flags.

See StoryPageButtonFlags for more details.

Returns
The flags set for this button.

Definition at line 183 of file story.cpp.

References GB().

Referenced by StoryBookWindow::GetPageElementFloat().

◆ GetVehicleType()

VehicleType StoryPageButtonData::GetVehicleType ( ) const

Get the type of vehicles that are accepted by the button.

Returns
The accepted type of vehicle.

Definition at line 203 of file story.cpp.

References GB().

◆ SetColour()

void StoryPageButtonData::SetColour ( Colours button_colour)

Set the button background colour.

Parameters
button_colourThe new background colour.

Definition at line 133 of file story.cpp.

References SB().

◆ SetCursor()

void StoryPageButtonData::SetCursor ( StoryPageButtonCursor cursor)

Set the mouse cursor used while waiting for input for the button.

Parameters
cursorThe cursor to use.

Definition at line 152 of file story.cpp.

References SB().

◆ SetFlags()

void StoryPageButtonData::SetFlags ( StoryPageButtonFlags flags)

Set the button flags.

See StoryPageButtonFlags for more details.

Parameters
flagsThe new state of flags.

Definition at line 143 of file story.cpp.

References SB().

◆ SetVehicleType()

void StoryPageButtonData::SetVehicleType ( VehicleType vehtype)

Set the type of vehicles that are accepted by the button.

Parameters
vehtypeThe type of vehicle to accept.

Definition at line 162 of file story.cpp.

References SB(), VEH_COMPANY_END, and VEH_INVALID.

◆ ValidateColour()

bool StoryPageButtonData::ValidateColour ( ) const

Verify that the data stored a valid Colour value.

Returns
true iff the stored colour is valid.

Definition at line 212 of file story.cpp.

References GB().

Referenced by VerifyElementContentParameters().

◆ ValidateCursor()

bool StoryPageButtonData::ValidateCursor ( ) const

Verify that the data stores a valid StoryPageButtonCursor value.

Returns
true iff the stored cursor is valid.

Definition at line 236 of file story.cpp.

References GB().

Referenced by VerifyElementContentParameters().

◆ ValidateFlags()

bool StoryPageButtonData::ValidateFlags ( ) const

Verify that valid flags were set.

Some flags in StoryPageButtonFlags can't be used together.

Returns
true iff the flags are valid.

Definition at line 222 of file story.cpp.

References GB().

Referenced by VerifyElementContentParameters().

◆ ValidateVehicleType()

bool StoryPageButtonData::ValidateVehicleType ( ) const

Verity that the data stored a valid VehicleType value.

Returns
true iff the stored VehicleType is valid.

Definition at line 245 of file story.cpp.

References GB(), VEH_COMPANY_END, and VEH_INVALID.

Referenced by VerifyElementContentParameters().

Field Documentation

◆ referenced_id

uint32_t StoryPageButtonData::referenced_id = 0

Definition at line 124 of file story_base.h.


The documentation for this struct was generated from the following files: