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 | 6dffd8ae82e78ed98b66a3f2fcd4cdccbe57ee72 (patch) | |
tree | a9ff58b51d34b7c243c907d8eed0d99110f3ce45 /src/saveload/strings_sl.cpp | |
parent | 83e1288c6a327f711f047aff1e03e5f4a9dfc058 (diff) | |
download | openttd-6dffd8ae82e78ed98b66a3f2fcd4cdccbe57ee72.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() |