# newgrf_text.h File Reference

Header of Action 04 "universal holder" structure and functions. More...

Go to the source code of this file.

## Functions
StringID | AddGRFString (uint32 grfid, uint16 stringid, byte langid, bool new_scheme, const char *text_to_add, StringID def_string)
| Add the new read string into our structure.
StringID | GetGRFStringID (uint32 grfid, uint16 stringid)
| Returns the index for this stringid associated with its grfID.
const char * | GetGRFStringPtr (uint16 stringid)
void | CleanUpStrings ()
| House cleaning.
void | SetCurrentGrfLangID (const char *iso_name)
| Equivalence Setter function between game and newgrf langID.
char * | TranslateTTDPatchCodes (uint32 grfid, const char *str)
bool | CheckGrfLangID (byte lang_id, byte grf_version)
void | PrepareTextRefStackUsage (byte numEntries)
| Prepare the TTDP compatible string code parsing.
void | StopTextRefStackUsage ()
| Stop using the TTDP compatible string code parsing.
void | SwitchToNormalRefStack ()
void | SwitchToErrorRefStack ()
void | RewindTextRefStack ()
uint | RemapNewGRFStringControlCode (uint scc, char **buff, const char **str, int64 *argv)
| FormatString for NewGRF specific "magic" string control codes.

## Detailed Description

Header of Action 04 "universal holder" structure and functions.

Definition in file newgrf_text.h.

## Function Documentation

void CleanUpStrings | ( |  | ) |

House cleaning.

Remove all strings and reset the text counter.

Definition at line 490 of file newgrf_text.cpp.

References GRFTextEntry::grfid, GRFText::next, GRFTextEntry::stringid, and GRFTextEntry::textholder.

Referenced by ResetNewGRFData().

void PrepareTextRefStackUsage | ( | byte | numEntries | ) |

Prepare the TTDP compatible string code parsing.

Parameters:

  | numEntries | number of entries to copy from the registers

Definition at line 576 of file newgrf_text.cpp.

References GB(), and TemporaryStorageArray< TYPE, SIZE >::Get().

Referenced by ShowAdditionalText().

uint RemapNewGRFStringControlCode | ( | uint | scc,
|  | char ** | buff,
|  | const char ** | str,
|  | int64 * | argv |
| ) |  |  |

FormatString for NewGRF specific "magic" string control codes.

Parameters:

  | scc | the string control code that has been read
  | stack | the current "stack"

Returns:
  the string control code to "execute" now

Definition at line 615 of file newgrf_text.cpp.

References DAYS_TILL_ORIGINAL_BASE_YEAR.

void SetCurrentGrfLangID | ( | const char * | iso_name | ) |

Equivalence Setter function between game and newgrf langID.

This function will adjust _currentLangID as to what is the LangID of the current language set by the user. The array iso_codes will be used to find that match. If not found, it will have to be standard english This function is called after the user changed language, from strings.cpp:ReadLanguagePack

Parameters:

  | iso_name | iso code of current selection

Definition at line 456 of file newgrf_text.cpp.

References _currentLangID.