|
OpenTTD Source 20251104-master-g3befbdd52f
|
NewGRF string mapping implementation. More...
#include "../stdafx.h"#include "../debug.h"#include "../newgrf.h"#include "../newgrf_text.h"#include "../newgrf_text_type.h"#include "../strings_type.h"#include "newgrf_internal.h"#include "newgrf_stringmapping.h"#include "table/strings.h"#include "../safeguards.h"Go to the source code of this file.
Data Structures | |
| struct | StringIDMapping |
| Information for mapping static StringIDs. More... | |
Macros | |
| #define | TEXTID_TO_STRINGID(begin, end, stringid, stringend) |
Functions | |
| void | AddStringForMapping (GRFStringID source, std::function< void(StringID)> &&func) |
| Record a static StringID for getting translated later. | |
| void | AddStringForMapping (GRFStringID source, StringID *target) |
| Record a static StringID for getting translated later. | |
| static StringID | TTDPStringIDToOTTDStringIDMapping (GRFStringID str) |
| Perform a mapping from TTDPatch's string IDs to OpenTTD's string IDs, but only for the ones we are aware off; the rest like likely unused and will show a warning. | |
| StringID | MapGRFStringID (uint32_t grfid, GRFStringID str) |
| Used when setting an object's property to map to the GRF's strings while taking in consideration the "drift" between TTDPatch string system and OpenTTD's one. | |
| void | FinaliseStringMapping () |
| Finalise all string mappings. | |
Variables | |
| static std::vector< StringIDMapping > | _string_to_grf_mapping |
| Strings to be mapped during load. | |
NewGRF string mapping implementation.
Definition in file newgrf_stringmapping.cpp.
| #define TEXTID_TO_STRINGID | ( | begin, | |
| end, | |||
| stringid, | |||
| stringend | |||
| ) |
| void AddStringForMapping | ( | GRFStringID | source, |
| std::function< void(StringID)> && | func | ||
| ) |
Record a static StringID for getting translated later.
| source | Source grf-local GRFStringID. |
| func | Function to call to set the mapping result. |
Definition at line 42 of file newgrf_stringmapping.cpp.
References _string_to_grf_mapping, and GrfProcessingState::grffile.
Referenced by AddStringForMapping(), AirportChangeInfo(), CargoReserveInfo(), GlobalVarChangeInfo(), IndustriesChangeInfo(), ObjectChangeInfo(), RailTypeChangeInfo(), RoadTypeChangeInfo(), StationChangeInfo(), and TownHouseChangeInfo().
| void AddStringForMapping | ( | GRFStringID | source, |
| StringID * | target | ||
| ) |
Record a static StringID for getting translated later.
| source | Source grf-local GRFStringID. |
| target | Destination for the mapping result. |
Definition at line 53 of file newgrf_stringmapping.cpp.
References AddStringForMapping().
| void FinaliseStringMapping | ( | ) |
Finalise all string mappings.
Definition at line 159 of file newgrf_stringmapping.cpp.
References _string_to_grf_mapping, and MapGRFStringID().
Referenced by AfterLoadGRFs().
| StringID MapGRFStringID | ( | uint32_t | grfid, |
| GRFStringID | str | ||
| ) |
Used when setting an object's property to map to the GRF's strings while taking in consideration the "drift" between TTDPatch string system and OpenTTD's one.
| grfid | Id of the grf file. |
| str | GRF-local GRFStringID that we want to have the equivalent in OpenTTD. |
Definition at line 129 of file newgrf_stringmapping.cpp.
References GetGRFStringID(), IsInsideMM(), and TTDPStringIDToOTTDStringIDMapping().
Referenced by ChangeIndustryProduction(), FinaliseStringMapping(), ProcessNewGRFStringControlCode(), and TranslateTTDPatchCodes().
|
static |
Perform a mapping from TTDPatch's string IDs to OpenTTD's string IDs, but only for the ones we are aware off; the rest like likely unused and will show a warning.
| str | Grf-local GRFStringID to convert. |
Definition at line 65 of file newgrf_stringmapping.cpp.
References Debug, and IsInsideMM().
Referenced by MapGRFStringID().
|
static |
Strings to be mapped during load.
Definition at line 35 of file newgrf_stringmapping.cpp.
Referenced by AddStringForMapping(), and FinaliseStringMapping().