OpenTTD Source 20261112-master-gbcbec5e63f
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 121 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 171 of file story.cpp.

References GB(), Invalid, 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 191 of file story.cpp.

References GB(), Invalid, 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 182 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 202 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 132 of file story.cpp.

References End, SB(), and to_underlying().

◆ 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 151 of file story.cpp.

References End, SB(), and to_underlying().

◆ SetFlags()

void StoryPageButtonData::SetFlags ( StoryPageButtonFlags flags)

Set the button flags.

See StoryPageButtonFlags for more details.

Parameters
flagsThe new state of flags.

Definition at line 142 of file story.cpp.

References BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::base(), and 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 161 of file story.cpp.

References CompanyEnd, Invalid, SB(), and to_underlying().

◆ 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 211 of file story.cpp.

References End, GB(), and to_underlying().

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 235 of file story.cpp.

References End, and 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 221 of file story.cpp.

References BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::All(), GB(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset().

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 244 of file story.cpp.

References CompanyEnd, GB(), and Invalid.

Referenced by VerifyElementContentParameters().

Field Documentation

◆ referenced_id

uint32_t StoryPageButtonData::referenced_id = 0

Definition at line 122 of file story_base.h.


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