|
OpenTTD Source 20251104-master-g3befbdd52f
|
Code handling saving and loading of strings. More...
#include "../stdafx.h"#include "../string_func.h"#include "../strings_func.h"#include "../core/string_builder.hpp"#include "saveload_internal.h"#include "table/strings.h"#include "../safeguards.h"Go to the source code of this file.
Data Structures | |
| struct | NAMEChunkHandler |
Functions | |
| StringID | RemapOldStringID (StringID s) |
| Remap a string ID from the old format to the new format. | |
| std::string | CopyFromOldName (StringID id) |
| Copy and convert old custom names to UTF-8. | |
| void | ResetOldNames () |
| Free the memory of the old names array. | |
| void | InitializeOldNames () |
| Initialize the old names table memory. | |
| const ChunkHandlerTable | _name_chunk_handlers (name_chunk_handlers) |
Variables | |
| static const int | NUM_OLD_STRINGS = 512 |
| The number of custom strings stored in old savegames. | |
| static const size_t | LEN_OLD_STRINGS = 32 |
| The number of characters per string. | |
| std::unique_ptr< std::string[]> | _old_name_array |
| Location to load the old names to. | |
| static const NAMEChunkHandler | NAME |
| static const ChunkHandlerRef | name_chunk_handlers [] |
Code handling saving and loading of strings.
Definition in file strings_sl.cpp.
| std::string CopyFromOldName | ( | StringID | id | ) |
Copy and convert old custom names to UTF-8.
They were all stored in a 512 by 32 (200 by 24 for TTO) long string array and are now stored with stations, waypoints and other places with names.
| id | the StringID of the custom name to clone. |
Definition at line 59 of file strings_sl.cpp.
References _old_name_array, GB(), GetStringTab(), IsSavegameVersionBefore(), BaseStringBuilder::PutUtf8(), SLV_37, and StrMakeValid().
Referenced by AfterLoadGame(), CHKPChunkHandler::FixPointers(), ENGSChunkHandler::Load(), and WriteValue().
| void InitializeOldNames | ( | ) |
Initialize the old names table memory.
Definition at line 108 of file strings_sl.cpp.
References _old_name_array, and NUM_OLD_STRINGS.
Remap a string ID from the old format to the new format.
| s | StringID that requires remapping |
Definition at line 28 of file strings_sl.cpp.
References IsInsideMM(), and SPECSTR_COMPANY_NAME_START.
Referenced by SlSaveLoadConv().
| void ResetOldNames | ( | ) |
Free the memory of the old names array.
Should be called once the old names have all been converted.
Definition at line 100 of file strings_sl.cpp.
References _old_name_array.
Referenced by AfterLoadGame().
| std::unique_ptr<std::string[]> _old_name_array |
Location to load the old names to.
Definition at line 50 of file strings_sl.cpp.
Referenced by CopyFromOldName(), InitializeOldNames(), NAMEChunkHandler::Load(), LoadOldCustomString(), and ResetOldNames().
|
static |
The number of characters per string.
Definition at line 21 of file strings_sl.cpp.
Referenced by NAMEChunkHandler::Load().
|
static |
Definition at line 130 of file strings_sl.cpp.
|
static |
Definition at line 131 of file strings_sl.cpp.
|
static |
The number of custom strings stored in old savegames.
Definition at line 20 of file strings_sl.cpp.
Referenced by InitializeOldNames(), and NAMEChunkHandler::Load().