Handling of translated strings. More...
#include "stdafx.h"
#include "currency.h"
#include "station_base.h"
#include "town.h"
#include "screenshot.h"
#include "waypoint_base.h"
#include "depot_base.h"
#include "industry.h"
#include "newgrf_text.h"
#include "fileio_func.h"
#include "signs_base.h"
#include "fontcache.h"
#include "error.h"
#include "strings_func.h"
#include "rev.h"
#include "core/endian_func.hpp"
#include "date_func.h"
#include "vehicle_base.h"
#include "engine_base.h"
#include "language.h"
#include "townname_func.h"
#include "string_func.h"
#include "company_base.h"
#include "smallmap_gui.h"
#include "window_func.h"
#include "debug.h"
#include "game/game_text.hpp"
#include <stack>
#include "table/strings.h"
#include "table/control_codes.h"
Go to the source code of this file.
Data Structures | |
struct | LanguagePack |
struct | UnitConversion |
Helper for unit conversion. More... | |
struct | Units |
class | LanguagePackGlyphSearcher |
Helper for searching through the language pack. More... | |
Functions | |
void | SetDParamMaxValue (uint n, uint64 max_value, uint min_count) |
Set DParam n to some number that is suitable for string size computations. | |
void | SetDParamMaxDigits (uint n, uint count) |
Set DParam n to some number that is suitable for string size computations. | |
void | CopyInDParam (int offs, const uint64 *src, int num) |
Copy num string parameters from array src into the global string parameter array. | |
void | CopyOutDParam (uint64 *dst, int offs, int num) |
Copy num string parameters from the global string parameter array to the dst array. | |
void | CopyOutDParam (uint64 *dst, const char **strings, StringID string, int num) |
Copy num string parameters from the global string parameter array to the dst array. | |
static char * | StationGetSpecialString (char *buff, int x, const char *last) |
static char * | GetSpecialTownNameString (char *buff, int ind, uint32 seed, const char *last) |
static char * | GetSpecialNameString (char *buff, int ind, StringParameters *args, const char *last) |
static char * | FormatString (char *buff, const char *str_arg, StringParameters *args, const char *last, uint case_index, bool game_script, bool dry_run) |
Parse most format codes within a string and write the result to a buffer. | |
const char * | GetStringPtr (StringID string) |
char * | GetStringWithArgs (char *buffr, StringID string, StringParameters *args, const char *last, uint case_index, bool game_script) |
Get a parsed string with most special stringcodes replaced by the string parameters. | |
char * | GetString (char *buffr, StringID string, const char *last) |
char * | InlineString (char *buf, StringID string) |
void | SetDParamStr (uint n, const char *str) |
This function is used to "bind" a C string to a OpenTTD dparam slot. | |
void | InjectDParam (uint amount) |
Shift the string parameters in the global string parameter array by amount positions, making room at the beginning. | |
static char * | FormatNumber (char *buff, int64 number, const char *last, const char *separator, int zerofill=1, int fractional_digits=0) |
Format a number into a string. | |
static char * | FormatCommaNumber (char *buff, int64 number, const char *last, int fractional_digits=0) |
static char * | FormatNoCommaNumber (char *buff, int64 number, const char *last) |
static char * | FormatZerofillNumber (char *buff, int64 number, int64 count, const char *last) |
static char * | FormatHexNumber (char *buff, uint64 number, const char *last) |
static char * | FormatBytes (char *buff, int64 number, const char *last) |
Format a given number as a number of bytes with the SI prefix. | |
static char * | FormatYmdString (char *buff, Date date, const char *last, uint case_index) |
static char * | FormatMonthAndYear (char *buff, Date date, const char *last, uint case_index) |
static char * | FormatTinyOrISODate (char *buff, Date date, StringID str, const char *last) |
static char * | FormatGenericCurrency (char *buff, const CurrencySpec *spec, Money number, bool compact, const char *last) |
static int | DeterminePluralForm (int64 count, int plural_form) |
Determine the "plural" index given a plural form and a number. | |
static const char * | ParseStringChoice (const char *b, uint form, char **dst, const char *last) |
uint | ConvertSpeedToDisplaySpeed (uint speed) |
Convert the given (internal) speed to the display speed. | |
uint | ConvertDisplaySpeedToSpeed (uint speed) |
Convert the given display speed to the (internal) speed. | |
uint | ConvertKmhishSpeedToDisplaySpeed (uint speed) |
Convert the given km/h-ish speed to the display speed. | |
uint | ConvertDisplaySpeedToKmhishSpeed (uint speed) |
Convert the given display speed to the km/h-ish speed. | |
static char * | GenAndCoName (char *buff, uint32 arg, const char *last) |
static char * | GenPresidentName (char *buff, uint32 x, const char *last) |
void | SortNetworkLanguages () |
bool | ReadLanguagePack (const LanguageMetadata *lang) |
Read a particular language. | |
const char * | GetCurrentLocale (const char *param) |
Determine the current charset based on the environment First check some default values, after this one we passed ourselves and if none exist return the value for $LANG. | |
int CDECL | StringIDSorter (const StringID *a, const StringID *b) |
const LanguageMetadata * | GetLanguage (byte newgrflangid) |
Get the language with the given NewGRF language ID. | |
static bool | GetLanguageFileHeader (const char *file, LanguagePackHeader *hdr) |
Reads the language file header and checks compatibility. | |
static void | GetLanguageList (const char *path) |
Gets a list of languages from the given directory. | |
void | InitializeLanguagePacks () |
Make a list of the available language packs. | |
const char * | GetCurrentLanguageIsoCode () |
Get the ISO language code of the currently loaded language. | |
void | CheckForMissingGlyphs (bool base_font, MissingGlyphSearcher *searcher) |
Check whether the currently loaded language pack uses characters that the currently loaded font does not support. | |
Variables | |
char | _config_language_file [MAX_PATH] |
The file (name) stored in the configuration. | |
LanguageList | _languages |
The actual list of language meta data. | |
const LanguageMetadata * | _current_language = NULL |
The currently loaded language. | |
TextDirection | _current_text_dir |
Text direction of the currently selected language. | |
Collator * | _current_collator = NULL |
Collator for the language currently in use. | |
static uint64 | _global_string_params_data [20] |
Global array of string parameters. To access, use SetDParam. | |
static WChar | _global_string_params_type [20] |
Type of parameters stored in _decode_parameters. | |
StringParameters | _global_string_params (_global_string_params_data, 20, _global_string_params_type) |
static char ** | _langpack_offs |
static LanguagePack * | _langpack |
static uint | _langtab_num [TAB_COUNT] |
Offset into langpack offs. | |
static uint | _langtab_start [TAB_COUNT] |
Offset into langpack offs. | |
static bool | _scan_for_gender_data = false |
Are we scanning for the gender of the current string? (instead of formatting it). | |
static const Units | _units [] |
static const char *const | _silly_company_names [] |
static const char *const | _surname_list [] |
static const char *const | _silly_surname_list [] |
static const char | _initial_name_letters [] |
Handling of translated strings.
Definition in file strings.cpp.
void CheckForMissingGlyphs | ( | bool | base_font, | |
MissingGlyphSearcher * | searcher | |||
) |
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.
base_font | Whether to look at the base font as well. | |
searcher | The methods to use to search for strings to check. If NULL the loaded language pack searcher is used. |
Definition at line 2110 of file strings.cpp.
References _current_text_dir, MissingGlyphSearcher::FindMissingGlyphs(), InitFreeType(), INVALID_STRING_ID, LanguagePackHeader::isocode, LoadStringWidthTable(), MissingGlyphSearcher::Monospace(), SetDParamStr(), SetFallbackFont(), ShowErrorMessage(), TD_LTR, Utf8Encode(), LanguagePackHeader::winlangid, WL_ERROR, and WL_WARNING.
Referenced by HandleBootstrap(), LoadIntroGame(), TextfileWindow::LoadTextfile(), and GameOptionsWindow::OnDropdownSelect().
uint ConvertDisplaySpeedToKmhishSpeed | ( | uint | speed | ) |
Convert the given display speed to the km/h-ish speed.
speed | the speed to convert |
Definition at line 751 of file strings.cpp.
References _settings_game, Units::c_velocity, UnitConversion::FromDisplay(), GameSettings::locale, and LocaleSettings::units.
Referenced by TimetableWindow::OnQueryTextFinished().
uint ConvertDisplaySpeedToSpeed | ( | uint | speed | ) |
Convert the given display speed to the (internal) speed.
speed | the speed to convert |
Definition at line 731 of file strings.cpp.
References _settings_game, Units::c_velocity, UnitConversion::FromDisplay(), GameSettings::locale, and LocaleSettings::units.
Referenced by OrdersWindow::OnQueryTextFinished().
uint ConvertKmhishSpeedToDisplaySpeed | ( | uint | speed | ) |
Convert the given km/h-ish speed to the display speed.
speed | the speed to convert |
Definition at line 741 of file strings.cpp.
References _settings_game, Units::c_velocity, GameSettings::locale, UnitConversion::ToDisplay(), and LocaleSettings::units.
Referenced by FormatString(), and TimetableWindow::OnClick().
uint ConvertSpeedToDisplaySpeed | ( | uint | speed | ) |
Convert the given (internal) speed to the display speed.
speed | the speed to convert |
Definition at line 718 of file strings.cpp.
References _settings_game, Units::c_velocity, GameSettings::locale, UnitConversion::ToDisplay(), and LocaleSettings::units.
Referenced by DrawOrderString(), OrdersWindow::OnClick(), and OrdersWindow::SetStringParameters().
void CopyInDParam | ( | int | offs, | |
const uint64 * | src, | |||
int | num | |||
) |
Copy num string parameters from array src into the global string parameter array.
offs | Index in the global array to copy the first string parameter to. | |
src | Source array of string parameters. | |
num | Number of string parameters to copy. |
Definition at line 131 of file strings.cpp.
References StringParameters::GetPointerToOffset(), and MemCpyT().
Referenced by DrawNewsString(), NewsWindow::DrawWidget(), QueryWindow::SetStringParameters(), and NewsWindow::UpdateWidgetSize().
void CopyOutDParam | ( | uint64 * | dst, | |
int | offs, | |||
int | num | |||
) |
Copy num string parameters from the global string parameter array to the dst array.
dst | Destination array of string parameters. | |
offs | Index in the global array to copy the first string parameter from. | |
num | Number of string parameters to copy. |
Definition at line 142 of file strings.cpp.
References StringParameters::GetPointerToOffset(), and MemCpyT().
Referenced by AddNewsItem(), and ErrorMessageData::CopyOutDParams().
void CopyOutDParam | ( | uint64 * | dst, | |
const char ** | strings, | |||
StringID | string, | |||
int | num | |||
) |
Copy num string parameters from the global string parameter array to the dst array.
Furthermore clone raw string parameters into strings and amend the data in dst.
dst | Destination array of string parameters. | |
strings | Destination array for clone of the raw strings. Must be of same length as dst. Deallocation left to the caller. | |
string | The string used to determine where raw strings are and where there are no raw strings. | |
num | Number of string parameters to copy. |
Definition at line 155 of file strings.cpp.
References DRAW_STRING_BUFFER, StringParameters::GetPointerToOffset(), StringParameters::GetTypeAtOffset(), StringParameters::HasTypeInformation(), lastof, and MemCpyT().
static int DeterminePluralForm | ( | int64 | count, | |
int | plural_form | |||
) | [static] |
Determine the "plural" index given a plural form and a number.
count | The number to get the plural index of. | |
plural_form | The plural form we want an index for. |
Definition at line 513 of file strings.cpp.
References abs().
Referenced by FormatString().
static char* FormatBytes | ( | char * | buff, | |
int64 | number, | |||
const char * | last | |||
) | [static] |
Format a given number as a number of bytes with the SI prefix.
buff | the buffer to write to | |
number | the number of bytes to write down | |
last | the last element in the buffer |
Definition at line 383 of file strings.cpp.
References _settings_game, LanguagePackHeader::digit_decimal_separator, LocaleSettings::digit_decimal_separator, lengthof, GameSettings::locale, and seprintf().
Referenced by FormatString().
static char* FormatNumber | ( | char * | buff, | |
int64 | number, | |||
const char * | last, | |||
const char * | separator, | |||
int | zerofill = 1 , |
|||
int | fractional_digits = 0 | |||
) | [static] |
Format a number into a string.
buff | the buffer to write to | |
number | the number to write down | |
last | the last element in the buffer | |
separator | the thousands-separator to use | |
zerofill | minimum number of digits to print for the integer part. The number will be filled with zeros at the front if necessary. | |
fractional_digits | number of fractional digits to display after a decimal separator. The decimal separator is inserted in front of the fractional_digits last digit of number. |
Definition at line 315 of file strings.cpp.
References _settings_game, LanguagePackHeader::digit_decimal_separator, LocaleSettings::digit_decimal_separator, GameSettings::locale, seprintf(), and strecpy().
static char * FormatString | ( | char * | buff, | |
const char * | str_arg, | |||
StringParameters * | args, | |||
const char * | last, | |||
uint | case_index, | |||
bool | game_script, | |||
bool | dry_run | |||
) | [static] |
Parse most format codes within a string and write the result to a buffer.
buff | The buffer to write the final string to. | |
str | The original string with format codes. | |
args | Pointer to extra arguments used by various string codes. | |
case_index | ||
last | Pointer to just past the end of the buff array. | |
dry_run | True when the argt array is not yet initialized. |
Definition at line 764 of file strings.cpp.
References _resolutions, _scan_for_gender_data, _settings_game, Units::c_force, Units::c_height, Units::c_power, Units::c_volume, Units::c_weight, StringParameters::ClearTypeInformation(), ConvertKmhishSpeedToDisplaySpeed(), CreateTextRefStackBackup(), CT_INVALID, DeterminePluralForm(), FACIL_AIRPORT, FACIL_BUS_STOP, FACIL_DOCK, FACIL_TRAIN, FACIL_TRUCK_STOP, FOR_ALL_SORTED_CARGOSPECS, Units::force, FormatBytes(), free(), GameSettings::game_creation, GAME_TEXT_TAB, GB(), GenerateTownNameString(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_depot_pool >::Get(), CargoSpec::Get(), CargoSpec::GetArraySize(), StringParameters::GetDataPointer(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_sign_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), SpecializedStation< Waypoint, true >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetIfValid(), SpecializedStation< Station, false >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), GetIndustrySpec(), StringParameters::GetInt32(), StringParameters::GetInt64(), StringParameters::GetPointerToOffset(), GetScreenshotFormatDesc(), GetStringWithArgs(), GetTownName(), StringParameters::GetTypeAtOffset(), HasBit(), StringParameters::HasTypeInformation(), Units::height, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, CargoSpec::Index(), Station::indtype, Engine::IsEnabled(), IsInsideMM(), Company::IsValidHumanID(), Units::l_volume, Units::l_weight, GameCreationSettings::landscape, lastof, lengthof, GameSettings::locale, min(), BaseConsist::name, BaseStation::name, IndustrySpec::name, Group::name, Engine::name, CompanyProperties::name, CargoSpec::name, CompanyProperties::name_1, CompanyProperties::name_2, StringParameters::num_param, StringParameters::offset, LanguagePackHeader::own_name, Units::power, CompanyProperties::president_name, CompanyProperties::president_name_1, CompanyProperties::president_name_2, CargoSpec::quantifier, RemapNewGRFStringControlCode(), RestoreTextRefStackBackup(), Units::s_volume, Units::s_weight, SCC_NEWGRF_FIRST, SCC_NEWGRF_PRINT_WORD_STRING_ID, SCC_NEWGRF_STRINL, seprintf(), IndustrySpec::station_name, strecat(), strecpy(), BaseStation::string_id, EngineInfo::string_id, TAB_COUNT_BITS, TAB_COUNT_OFFSET, TAB_SIZE, UnitConversion::ToDisplay(), BaseStation::town, Industry::town, Waypoint::town_cn, Depot::town_cn, BaseVehicle::type, Industry::type, Vehicle::unitnumber, LocaleSettings::units, CargoSpec::units_volume, UsingNewGRFTextStack(), Utf8CharLen(), Utf8Decode(), Utf8Encode(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, and Units::velocity.
Referenced by GetStringWithArgs().
const char* GetCurrentLanguageIsoCode | ( | ) |
Get the ISO language code of the currently loaded language.
Definition at line 2006 of file strings.cpp.
References LanguagePackHeader::isocode.
Referenced by GameOptionsWindow::DrawWidget(), GetTextfile(), and GameOptionsWindow::UpdateWidgetSize().
const char* GetCurrentLocale | ( | const char * | param | ) |
Determine the current charset based on the environment First check some default values, after this one we passed ourselves and if none exist return the value for $LANG.
param | environment variable to check conditionally if default ones are not set. Pass NULL if you don't want additional checks. |
Definition at line 1853 of file strings.cpp.
const LanguageMetadata* GetLanguage | ( | byte | newgrflangid | ) |
Get the language with the given NewGRF language ID.
newgrflangid | NewGRF languages ID to check. |
Definition at line 1889 of file strings.cpp.
References SmallVector< T, S >::Begin(), and SmallVector< T, S >::End().
Referenced by GetLanguageList(), and GlobalVarChangeInfo().
static bool GetLanguageFileHeader | ( | const char * | file, | |
LanguagePackHeader * | hdr | |||
) | [static] |
Reads the language file header and checks compatibility.
file | the file to read | |
hdr | the place to write the header information to |
Definition at line 1904 of file strings.cpp.
References LanguagePackHeader::IsValid(), LanguagePackHeader::missing, and LanguagePackHeader::winlangid.
Referenced by GetLanguageList().
static void GetLanguageList | ( | const char * | path | ) | [static] |
Gets a list of languages from the given directory.
path | the base directory to search in |
Definition at line 1926 of file strings.cpp.
References SmallVector< T, S >::Append(), DEBUG, LanguageMetadata::file, FS2OTTD(), GetLanguage(), GetLanguageFileHeader(), lastof, LanguagePackHeader::newgrflangid, seprintf(), and ttd_opendir().
Referenced by InitializeLanguagePacks().
char* GetStringWithArgs | ( | char * | buffr, | |
StringID | string, | |||
StringParameters * | args, | |||
const char * | last, | |||
uint | case_index, | |||
bool | game_script | |||
) |
Get a parsed string with most special stringcodes replaced by the string parameters.
buffr | Pointer to a string buffer where the formatted string should be written to. | |
string | ||
args | Arguments for the string. | |
last | Pointer just past the end of buffr. | |
case_index | The "case index". This will only be set when FormatString wants to print the string in a different case. | |
game_script | The string is coming directly from a game script. |
Definition at line 211 of file strings.cpp.
References _langtab_num, error(), FormatString(), GAME_TEXT_TAB, GB(), GetGameStringPtr(), GetGRFStringID(), GetGRFStringPtr(), StringParameters::GetInt32(), GetStringWithArgs(), HasBit(), TAB_COUNT_BITS, TAB_COUNT_OFFSET, TAB_SIZE_BITS, and TAB_SIZE_OFFSET.
Referenced by FormatString(), GetStringWithArgs(), and GetTownName().
void InitializeLanguagePacks | ( | ) |
Make a list of the available language packs.
Put the data in _languages list.
< Matching the language in the configuration 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 1958 of file strings.cpp.
References _config_language_file, SmallVector< T, S >::Begin(), SmallVector< T, S >::End(), LanguageMetadata::file, FOR_ALL_SEARCHPATHS, GetCurrentLocale(), GetLanguageList(), LANG_DIR, SmallVector< T, S >::Length(), lengthof, ReadLanguagePack(), and usererror().
void InjectDParam | ( | uint | amount | ) |
Shift the string parameters in the global string parameter array by amount positions, making room at the beginning.
amount | Number of positions to shift. |
Definition at line 299 of file strings.cpp.
References StringParameters::ShiftParameters().
Referenced by Subsidy::AwardTo().
bool ReadLanguagePack | ( | const LanguageMetadata * | lang | ) |
Read a particular language.
lang | The metadata about the language. |
Definition at line 1738 of file strings.cpp.
References _config_language_file, _current_collator, _current_text_dir, _langtab_num, _langtab_start, BuildIndustriesLegend(), LanguageMetadata::file, free(), InitializeSortedCargoSpecs(), InvalidateWindowClassesData(), LanguagePackHeader::isocode, LanguagePackHeader::IsValid(), lastof, LanguagePackHeader::newgrflangid, LanguagePackHeader::offsets, ReadFileToMem(), ReconsiderGameScriptLanguage(), SetCurrentGrfLangID(), SortIndustryTypes(), strecpy(), TAB_COUNT, LanguagePackHeader::text_dir, WC_AIRCRAFT_LIST, WC_BUILD_VEHICLE, WC_INDUSTRY_DIRECTORY, WC_ROADVEH_LIST, WC_SHIPS_LIST, WC_STATION_LIST, and WC_TRAINS_LIST.
Referenced by InitializeLanguagePacks(), and GameOptionsWindow::OnDropdownSelect().
void SetDParamMaxDigits | ( | uint | n, | |
uint | count | |||
) |
Set DParam n to some number that is suitable for string size computations.
n | Index of the string parameter. | |
count | Number of digits which shall be displayable. |
< Digit with the biggest string width.
Definition at line 115 of file strings.cpp.
References SetDParam().
Referenced by DrawEngineList(), SetDParamMaxValue(), TownDirectoryWindow::UpdateWidgetSize(), ScanProgressWindow::UpdateWidgetSize(), and NetworkJoinStatusWindow::UpdateWidgetSize().
void SetDParamMaxValue | ( | uint | n, | |
uint64 | max_value, | |||
uint | min_count | |||
) |
Set DParam n to some number that is suitable for string size computations.
n | Index of the string parameter. | |
max_value | The biggest value which shall be displayed. For the result only the number of digits of max_value matter. | |
min_count | Minimum number of digits independent of max. |
Definition at line 100 of file strings.cpp.
References max(), and SetDParamMaxDigits().
Referenced by VehicleGroupWindow::ComputeGroupInfoSize(), TimetableWindow::DrawWidget(), OrdersWindow::DrawWidget(), VehicleDetailsWindow::UpdateWidgetSize(), TimetableWindow::UpdateWidgetSize(), StatusBarWindow::UpdateWidgetSize(), ScanProgressWindow::UpdateWidgetSize(), NewGRFParametersWindow::UpdateWidgetSize(), NetworkJoinStatusWindow::UpdateWidgetSize(), NetworkGameWindow::UpdateWidgetSize(), PerformanceRatingDetailWindow::UpdateWidgetSize(), BaseGraphWindow::UpdateWidgetSize(), GenerateProgressWindow::UpdateWidgetSize(), CreateScenarioWindow::UpdateWidgetSize(), GenerateLandscapeWindow::UpdateWidgetSize(), DepotWindow::UpdateWidgetSize(), CompanyWindow::UpdateWidgetSize(), CompanyInfrastructureWindow::UpdateWidgetSize(), CompanyFinancesWindow::UpdateWidgetSize(), and CheatWindow::UpdateWidgetSize().
void SetDParamStr | ( | uint | n, | |
const char * | str | |||
) |
This function is used to "bind" a C string to a OpenTTD dparam slot.
n | slot of the string | |
str | string to bind |
Definition at line 290 of file strings.cpp.
References SetDParam().
Referenced by Subsidy::AwardTo(), CheckForMissingGlyphs(), CmdCompanyCtrl(), CmdCustomNewsItem(), CmdFoundTown(), CompanyCheckBankrupt(), NetworkContentListWindow::DrawDetails(), IndustryViewWindow::DrawInfo(), GoalListWindow::DrawPartialGoalList(), TownViewWindow::DrawWidget(), GameOptionsWindow::DrawWidget(), NewsWindow::DrawWidget(), NewGRFParametersWindow::DrawWidget(), NetworkChatWindow::DrawWidget(), MusicWindow::DrawWidget(), MusicTrackSelectionWindow::DrawWidget(), LandInfoWindow::DrawWidget(), BuildIndustryWindow::DrawWidget(), GoalQuestionWindow::DrawWidget(), SaveLoadWindow::DrawWidget(), AIConfigWindow::DrawWidget(), AISettingsWindow::DrawWidget(), AIListWindow::DrawWidget(), ErrorUnknownCallbackResult(), GenerateCompanyName(), TownViewWindow::GetDesiredInfoHeight(), IndustryDirectoryWindow::GetIndustryString(), GetSavegameFormat(), GetSaveLoadErrorString(), GRFLoadConfig(), IndustryProductionCallback(), MakeScreenshot(), CustomCurrencyWindow::OnClick(), NetworkStartServerWindow::OnClick(), NetworkGameWindow::OnClick(), LandInfoWindow::OnInit(), IConsoleWindow::OnPaint(), SaveFileError(), CustomCurrencyWindow::SetStringParameters(), GameOptionsWindow::SetStringParameters(), SpriteAlignerWindow::SetStringParameters(), NetworkLobbyWindow::SetStringParameters(), AboutWindow::SetStringParameters(), AIDebugWindow::SetStringParameters(), ShowNewGRFError(), ShowNewGrfVehicleError(), GameOptionsWindow::UpdateWidgetSize(), NetworkChatWindow::UpdateWidgetSize(), MusicWindow::UpdateWidgetSize(), MusicTrackSelectionWindow::UpdateWidgetSize(), LandInfoWindow::UpdateWidgetSize(), BuildIndustryWindow::UpdateWidgetSize(), GoalQuestionWindow::UpdateWidgetSize(), and WarnCorruptSprite().
const LanguageMetadata* _current_language = NULL |
The currently loaded language.
Definition at line 46 of file strings.cpp.
Referenced by GameOptionsWindow::BuildDropDownList(), SelectGameWindow::DrawWidget(), UnmappedChoiceList::Flush(), CrashLog::LogConfiguration(), SelectGameWindow::OnInit(), ReconsiderGameScriptLanguage(), GameOptionsWindow::SetStringParameters(), and SelectGameWindow::UpdateWidgetSize().
const char _initial_name_letters[] [static] |
{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'W', }
Definition at line 1609 of file strings.cpp.
The actual list of language meta data.
Definition at line 45 of file strings.cpp.
Referenced by GameOptionsWindow::BuildDropDownList(), and GameOptionsWindow::OnDropdownSelect().
const char* const _silly_company_names[] [static] |
{ "Bloggs Brothers", "Tiny Transport Ltd.", "Express Travel", "Comfy-Coach & Co.", "Crush & Bump Ltd.", "Broken & Late Ltd.", "Sam Speedy & Son", "Supersonic Travel", "Mike's Motors", "Lightning International", "Pannik & Loozit Ltd.", "Inter-City Transport", "Getout & Pushit Ltd." }
Definition at line 1546 of file strings.cpp.
const char* const _silly_surname_list[] [static] |
{ "Grumpy", "Dozy", "Speedy", "Nosey", "Dribble", "Mushroom", "Cabbage", "Sniffle", "Fishy", "Swindle", "Sneaky", "Nutkins" }
Definition at line 1594 of file strings.cpp.
const Units _units[] [static] |
{ { { 1, 0}, STR_UNITS_VELOCITY_IMPERIAL, { 1, 0}, STR_UNITS_POWER_IMPERIAL, { 1, 0}, STR_UNITS_WEIGHT_SHORT_METRIC, STR_UNITS_WEIGHT_LONG_METRIC, {1000, 0}, STR_UNITS_VOLUME_SHORT_METRIC, STR_UNITS_VOLUME_LONG_METRIC, { 1, 0}, STR_UNITS_FORCE_SI, { 3, 0}, STR_UNITS_HEIGHT_IMPERIAL, }, { { 103, 6}, STR_UNITS_VELOCITY_METRIC, {4153, 12}, STR_UNITS_POWER_METRIC, { 1, 0}, STR_UNITS_WEIGHT_SHORT_METRIC, STR_UNITS_WEIGHT_LONG_METRIC, {1000, 0}, STR_UNITS_VOLUME_SHORT_METRIC, STR_UNITS_VOLUME_LONG_METRIC, { 1, 0}, STR_UNITS_FORCE_SI, { 1, 0}, STR_UNITS_HEIGHT_SI, }, { {1831, 12}, STR_UNITS_VELOCITY_SI, {6109, 13}, STR_UNITS_POWER_SI, {1000, 0}, STR_UNITS_WEIGHT_SHORT_SI, STR_UNITS_WEIGHT_LONG_SI, { 1, 0}, STR_UNITS_VOLUME_SHORT_SI, STR_UNITS_VOLUME_LONG_SI, { 1, 0}, STR_UNITS_FORCE_SI, { 1, 0}, STR_UNITS_HEIGHT_SI, }, }
Definition at line 686 of file strings.cpp.