OpenTTD Source 20260311-master-g511d3794ce
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 173 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 193 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 184 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 204 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 134 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 153 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 144 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 163 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 213 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 237 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 223 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 246 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 122 of file story_base.h.


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