OpenTTD
|
Element of the linked list. More...
Public Member Functions | |
void * | operator new (size_t size) |
Helper allocation function to disallow something. | |
void | operator delete (void *p) |
Free the memory we allocated. |
Static Public Member Functions | |
static GRFText * | New (byte langid, const char *text, size_t len) |
Allocate, and assign a new GRFText with the given text. | |
static GRFText * | Copy (GRFText *orig) |
Create a copy of this GRFText. |
Data Fields | |
GRFText * | next |
The next GRFText in this chain. | |
size_t | len |
The length of the stored string, used for copying. | |
byte | langid |
The language associated with this GRFText. | |
char | text [] |
The actual (translated) text. |
Private Member Functions | |
GRFText (byte langid_, const char *text_, size_t len_) | |
Actually construct the GRFText. | |
void * | operator new (size_t size, size_t extra) |
Allocate memory for this class. |
Element of the linked list.
Each of those elements represent the string, but according to a different lang.
Definition at line 69 of file newgrf_text.cpp.
|
inlineprivate |
Create a copy of this GRFText.
orig | the grftext to copy. |
Definition at line 91 of file newgrf_text.cpp.
References langid, len, New(), and text.
Referenced by DuplicateGRFText().
|
inlinestatic |
Allocate, and assign a new GRFText with the given text.
As these strings can have string terminations in them, e.g. due to "choice lists" we (sometimes) cannot rely on detecting the length by means of strlen. Also, if the length of already known not scanning the whole string is more efficient.
langid | The language of the text. |
text | The text to store in the new GRFText. |
len | The length of the text. |
Definition at line 81 of file newgrf_text.cpp.
References GRFText(), and len.
Referenced by AddGRFString(), AddGRFTextToList(), and Copy().
|
inline |
Free the memory we allocated.
p | memory to free. |
Definition at line 110 of file newgrf_text.cpp.
References free().
|
inline |
Helper allocation function to disallow something.
Don't allow simple 'news'; they wouldn't have enough memory.
size | the amount of space not to allocate. |
Definition at line 101 of file newgrf_text.cpp.
|
inlineprivate |
Allocate memory for this class.
size | the size of the instance |
extra | the extra memory for the text |
Definition at line 135 of file newgrf_text.cpp.