diff options
author | smatz <smatz@openttd.org> | 2009-01-23 02:35:17 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-01-23 02:35:17 +0000 |
commit | f0ff90d71c2645a8f920ae94be34c3865d4308cf (patch) | |
tree | a9ff58b51d34b7c243c907d8eed0d99110f3ce45 /src/saveload/strings_sl.cpp | |
parent | 80e59f375fbf693c1bf8658359f1aa3c2482c89e (diff) | |
download | openttd-f0ff90d71c2645a8f920ae94be34c3865d4308cf.tar.xz |
(svn r15216) -Feature: native support for Transport Tycoon (Original) savegames. Based on SVXConverter's source code and documentation by Roman Vetter
Diffstat (limited to 'src/saveload/strings_sl.cpp')
-rw-r--r-- | src/saveload/strings_sl.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/saveload/strings_sl.cpp b/src/saveload/strings_sl.cpp index f436bdedf..e220d687a 100644 --- a/src/saveload/strings_sl.cpp +++ b/src/saveload/strings_sl.cpp @@ -8,6 +8,7 @@ #include "../core/bitmath_func.hpp" #include "../core/alloc_func.hpp" #include "../string_func.h" +#include "saveload_internal.h" #include "table/strings.h" @@ -44,8 +45,8 @@ char *_old_name_array = NULL; /** * Copy and convert old custom names to UTF-8. - * They were all stored in a 512 by 32 long string array and are - * now stored with stations, waypoints and other places with names. + * 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. * @param id the StringID of the custom name to clone. * @return the clones custom name. */ @@ -55,10 +56,11 @@ char *CopyFromOldName(StringID id) if (GB(id, 11, 5) != 15) return NULL; if (CheckSavegameVersion(37)) { - /* Old names were 32 characters long, so 128 characters should be + /* Old names were 24/32 characters long, so 128 characters should be * plenty to allow for expansion when converted to UTF-8. */ char tmp[128]; - const char *strfrom = &_old_name_array[32 * GB(id, 0, 9)]; + uint offs = _savegame_type == SGT_TTO ? 24 * GB(id, 0, 8) : 32 * GB(id, 0, 9); + const char *strfrom = &_old_name_array[offs]; char *strto = tmp; for (; *strfrom != '\0'; strfrom++) { @@ -109,7 +111,7 @@ void ResetOldNames() void InitializeOldNames() { free(_old_name_array); - _old_name_array = CallocT<char>(512 * 32); + _old_name_array = CallocT<char>(512 * 32); // 200 * 24 would be enough for TTO savegames } static void Load_NAME() |