12 #include "../stdafx.h" 13 #include "../string_func.h" 14 #include "../strings_func.h" 17 #include "table/strings.h" 19 #include "../safeguards.h" 33 case 0x0006:
return STR_SV_EMPTY;
34 case 0x7000:
return STR_SV_UNNAMED;
35 case 0x70E4:
return SPECSTR_COMPANY_NAME_START;
36 case 0x70E9:
return SPECSTR_COMPANY_NAME_START;
37 case 0x8864:
return STR_SV_TRAIN_NAME;
38 case 0x902B:
return STR_SV_ROAD_VEHICLE_NAME;
39 case 0x9830:
return STR_SV_SHIP_NAME;
40 case 0xA02F:
return STR_SV_AIRCRAFT_NAME;
44 return s - 0x300F + STR_SV_STNAME;
64 if (
GetStringTab(
id) != TEXT_TAB_OLD_CUSTOM)
return NULL;
73 for (; *strfrom !=
'\0'; strfrom++) {
74 WChar c = (byte)*strfrom;
78 case 0xA4: c = 0x20AC;
break;
79 case 0xA6: c = 0x0160;
break;
80 case 0xA8: c = 0x0161;
break;
81 case 0xB4: c = 0x017D;
break;
82 case 0xB8: c = 0x017E;
break;
83 case 0xBC: c = 0x0152;
break;
84 case 0xBD: c = 0x0153;
break;
85 case 0xBE: c = 0x0178;
break;
const ChunkHandler _name_chunk_handlers[]
Chunk handlers related to strings.
void NORETURN SlErrorCorrupt(const char *msg)
Error handler for corrupt savegames.
static bool IsInsideMM(const T x, const uint min, const uint max)
Checks if a value is in an interval.
#define lastof(x)
Get the last element of an fixed size array.
static StringTab GetStringTab(StringID str)
Extract the StringTab from a StringID.
void InitializeOldNames()
Initialize the old names table memory.
size_t SlGetFieldLength()
Get the length of the current object.
void SlArray(void *array, size_t length, VarType conv)
Save/Load an array.
static const int MAX_CHAR_LENGTH
Max. length of UTF-8 encoded unicode character.
char * stredup(const char *s, const char *last)
Create a duplicate of the given string.
static int8 Utf8CharLen(WChar c)
Return the length of a UTF-8 encoded character.
SavegameType _savegame_type
type of savegame we are loading
static bool IsSavegameVersionBefore(uint16 major, byte minor=0)
Checks whether the savegame is below major.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
Handlers and description of chunk.
char * _old_name_array
Location to load the old names to.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
static void Load_NAME()
Load the NAME chunk.
StringID RemapOldStringID(StringID s)
Remap a string ID from the old format to the new format.
static const int NUM_OLD_STRINGS
The number of custom strings stored in old savegames.
size_t Utf8Encode(char *buf, WChar c)
Encode a unicode character and place it in the buffer.
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
static const int LEN_OLD_STRINGS
The number of characters per string.
void ResetOldNames()
Free the memory of the old names array.
uint32 WChar
Type for wide characters, i.e.
char * CopyFromOldName(StringID id)
Copy and convert old custom names to UTF-8.
static const int LEN_OLD_STRINGS_TTO
The number of characters per string in TTO savegames.
Declaration of functions used in more save/load files.
Last chunk in this array.