OpenTTD Source
20241121-master-g67a0fccfad
|
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. More... | |
AllowedSubtags (uint32_t id, TextHandler handler) | |
Create a text leaf node. More... | |
AllowedSubtags (uint32_t id, BranchHandler handler) | |
Create a branch node with a callback handler. More... | |
AllowedSubtags (uint32_t id, AllowedSubtags *subtags) | |
Create a branch node with a list of sub-nodes. More... | |
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'. | |
TextHandler text | |
Callback function for a text node, only valid if type == 'T'. | |
struct { | |
union { | |
BranchHandler branch | |
Callback function for a branch node, only valid if type == 'C' && call_handler. | |
AllowedSubtags * subtags | |
Pointer to a list of subtags, only valid if type == 'C' && !call_handler. | |
} u | |
bool call_handler | |
True if there is a callback function for this node, false if there is a list of subnodes. | |
} | |
} | handler |
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:
Definition at line 8318 of file newgrf.cpp.
|
inline |
Create a binary leaf node.
id | The id for this node. |
handler | The callback function to call. |
Definition at line 8330 of file newgrf.cpp.
|
inline |
Create a text leaf node.
id | The id for this node. |
handler | The callback function to call. |
Definition at line 8342 of file newgrf.cpp.
|
inline |
Create a branch node with a callback handler.
id | The id for this node. |
handler | The callback function to call. |
Definition at line 8354 of file newgrf.cpp.
|
inline |
Create a branch node with a list of sub-nodes.
id | The id for this node. |
subtags | Array with all valid subtags. |
Definition at line 8367 of file newgrf.cpp.
References subtags.