OpenTTD Source 20241224-master-gf74b0cf984
AllowedSubtags Struct Reference

Data structure to store the allowed id/type combinations for action 14. More...

Public Member Functions

 AllowedSubtags ()
 Create empty subtags object used to identify the end of a list.
 
 AllowedSubtags (uint32_t id, DataHandler handler)
 Create a binary leaf node.
 
 AllowedSubtags (uint32_t id, TextHandler handler)
 Create a text leaf node.
 
 AllowedSubtags (uint32_t id, BranchHandler handler)
 Create a branch node with a callback handler.
 
 AllowedSubtags (uint32_t id, AllowedSubtags *subtags)
 Create a branch node with a list of sub-nodes.
 

Data Fields

uint32_t id
 The identifier for this node.
 
uint8_t type
 The type of the node, must be one of 'C', 'B' or 'T'.
 
union { 
 
   DataHandler   data 
 Callback function for a binary node, only valid if type == 'B'. More...
 
   TextHandler   text 
 Callback function for a text node, only valid if type == 'T'. More...
 
   struct { 
 
      union { 
 
         BranchHandler   branch 
 Callback function for a branch node, only valid if type == 'C' && call_handler. More...
 
         AllowedSubtags *   subtags 
 Pointer to a list of subtags, only valid if type == 'C' && !call_handler. More...
 
      }   u 
 
      bool   call_handler 
 True if there is a callback function for this node, false if there is a list of subnodes. More...
 
   }  
 
handler 
 

Detailed Description

Data structure to store the allowed id/type combinations for action 14.

The data can be represented as a tree with 3 types of nodes:

  1. Branch nodes (identified by 'C' for choice).
  2. Binary leaf nodes (identified by 'B').
  3. Text leaf nodes (identified by 'T').

Definition at line 8374 of file newgrf.cpp.

Constructor & Destructor Documentation

◆ AllowedSubtags() [1/5]

AllowedSubtags::AllowedSubtags ( )
inline

Create empty subtags object used to identify the end of a list.

Definition at line 8376 of file newgrf.cpp.

◆ AllowedSubtags() [2/5]

AllowedSubtags::AllowedSubtags ( uint32_t  id,
DataHandler  handler 
)
inline

Create a binary leaf node.

Parameters
idThe id for this node.
handlerThe callback function to call.

Definition at line 8386 of file newgrf.cpp.

◆ AllowedSubtags() [3/5]

AllowedSubtags::AllowedSubtags ( uint32_t  id,
TextHandler  handler 
)
inline

Create a text leaf node.

Parameters
idThe id for this node.
handlerThe callback function to call.

Definition at line 8398 of file newgrf.cpp.

◆ AllowedSubtags() [4/5]

AllowedSubtags::AllowedSubtags ( uint32_t  id,
BranchHandler  handler 
)
inline

Create a branch node with a callback handler.

Parameters
idThe id for this node.
handlerThe callback function to call.

Definition at line 8410 of file newgrf.cpp.

◆ AllowedSubtags() [5/5]

AllowedSubtags::AllowedSubtags ( uint32_t  id,
AllowedSubtags subtags 
)
inline

Create a branch node with a list of sub-nodes.

Parameters
idThe id for this node.
subtagsArray with all valid subtags.

Definition at line 8423 of file newgrf.cpp.

References subtags.

Field Documentation

◆ branch

BranchHandler AllowedSubtags::branch

Callback function for a branch node, only valid if type == 'C' && call_handler.

Definition at line 8438 of file newgrf.cpp.

Referenced by HandleNode().

◆ call_handler

bool AllowedSubtags::call_handler

True if there is a callback function for this node, false if there is a list of subnodes.

Definition at line 8441 of file newgrf.cpp.

Referenced by HandleNode().

◆ data

DataHandler AllowedSubtags::data

Callback function for a binary node, only valid if type == 'B'.

Definition at line 8434 of file newgrf.cpp.

Referenced by HandleNode().

◆ id

uint32_t AllowedSubtags::id

The identifier for this node.

Definition at line 8431 of file newgrf.cpp.

Referenced by HandleNode().

◆ subtags

AllowedSubtags* AllowedSubtags::subtags

Pointer to a list of subtags, only valid if type == 'C' && !call_handler.

Definition at line 8439 of file newgrf.cpp.

Referenced by AllowedSubtags(), and HandleNode().

◆ text

TextHandler AllowedSubtags::text

Callback function for a text node, only valid if type == 'T'.

Definition at line 8435 of file newgrf.cpp.

Referenced by HandleNode().

◆ type

uint8_t AllowedSubtags::type

The type of the node, must be one of 'C', 'B' or 'T'.

Definition at line 8432 of file newgrf.cpp.

Referenced by HandleNode().


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