# strings_func.h File Reference

Functions related to OTTD's strings. More...

`#include "strings_type.h"`

Go to the source code of this file.

## Data Structures
struct | StringIDCompare
| Key comparison function for std::map. More...
## Functions
char * | InlineString (char *buf, StringID string)
char * | GetString (char *buffr, StringID string, const char *last)
const char * | GetStringPtr (StringID string)
void | InjectDParam (uint amount)
static void | SetDParamX (uint64 *s, uint n, uint64 v)
static void | SetDParam (uint n, uint64 v)
void | SetDParamStr (uint n, const char *str)
| This function is used to "bind" a C string to a OpenTTD dparam slot.
static uint64 | GetDParamX (const uint64 *s, uint n)
static uint64 | GetDParam (uint n)
static void | CopyInDParam (int offs, const uint64 *src, int num)
static void | CopyOutDParam (uint64 *dst, int offs, int num)
bool | ReadLanguagePack (int index)
void | InitializeLanguagePacks ()
| Make a list of the available language packs.
int CDECL | StringIDSorter (const void *a, const void *b)
void | CheckForMissingGlyphsInLoadedLanguagePack ()
| Check whether the currently loaded language pack uses characters that the currently loaded font does not support.
## Variables
DynamicLanguages | _dynlang

## Detailed Description

Functions related to OTTD's strings.

Definition in file strings_func.h.

## Function Documentation

void CheckForMissingGlyphsInLoadedLanguagePack | ( |  | ) |

Check whether the currently loaded language pack uses characters that the currently loaded font does not support.

If this is the case an error message will be shown in English. The error message will not be localized because that would mean it might use characters that are not in the font, which is the whole reason this check has been added.

Definition at line 1543 of file strings.cpp.

References GetGlyph(), INVALID_STRING_ID, LoadStringWidthTable(), SetDParamStr(), TD_LTR, and DynamicLanguages::text_dir.

void InitializeLanguagePacks | ( |  | ) |

Make a list of the available language packs.

put the data in _dynlang struct.

< Matching the language in the configuartion file or the current locale

< Using pt_PT for pt_BR locale when pt_BR is not available

< Fallback when no locale-matching language has been found

Definition at line 1475 of file strings.cpp.

References DynamicLanguages::curr_file, DynamicLanguages::ent, Language::file, FOR_ALL_SEARCHPATHS, GetCurrentLocale(), GetLanguageFileHeader(), GetLanguageList(), LANG_DIR, lengthof, MAX_LANG, Language::name, DynamicLanguages::num, and usererror().

void SetDParamStr | ( | uint | n,
|  | const char * | str |
| ) |  |  |

This function is used to "bind" a C string to a OpenTTD dparam slot.

Parameters:

  | n | slot of the string
  | str | string to bind

Definition at line 172 of file strings.cpp.

Referenced by CheckForMissingGlyphsInLoadedLanguagePack(), CmdCompanyCtrl(), GetSaveLoadErrorString(), IndustryProductionCallback(), NewGRFWindow::OnClick(), StationViewWindow::OnPaint(), NewGRFWindow::OnPaint(), AIConfigWindow::OnPaint(), AIListWindow::OnPaint(), SaveFileError(), ShowNewGrfVehicleError(), ShowRefitOptionsList(), StartScenario(), and WarnCorruptSprite().