# strings_sl.cpp File Reference

Code handling saving and loading of strings. More...

`#include "../stdafx.h"`
`#include "../string_func.h"`
`#include "saveload_internal.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Functions
StringID | RemapOldStringID (StringID s)
| Remap a string ID from the old format to the new format.
char * | 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.
static void | Load_NAME ()
## Variables
char * | _old_name_array = NULL
| Location to load the old names to.
const ChunkHandler | _name_chunk_handlers []

## Detailed Description

Code handling saving and loading of strings.

Definition in file strings_sl.cpp.

## Function Documentation

char* 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.

Parameters:

  | id | the StringID of the custom name to clone.

Returns:
  the clones custom name.

Definition at line 54 of file strings_sl.cpp.

References _old_name_array, _savegame_type, CheckSavegameVersion(), GB(), lastof, SGT_TTO, and Utf8CharLen().

Referenced by WriteValue().

StringID RemapOldStringID | ( | StringID | s | ) |

Remap a string ID from the old format to the new format.

Parameters:

  | s | StringID that requires remapping

Returns:
  translated ID

Definition at line 23 of file strings_sl.cpp.

References IsInsideMM().

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 103 of file strings_sl.cpp.

References _old_name_array.

## Variable Documentation

const ChunkHandler _name_chunk_handlers[]

Initial value:

     {
      { 'NAME', NULL, Load_NAME, NULL, CH_ARRAY | CH_LAST},
    }

char* _old_name_array = NULL

Location to load the old names to.

Definition at line 45 of file strings_sl.cpp.

Referenced by CopyFromOldName(), InitializeOldNames(), and ResetOldNames().