diff options
author | rubidium <rubidium@openttd.org> | 2007-06-07 12:37:48 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-06-07 12:37:48 +0000 |
commit | 0fcda4e45cbbda0872bc6216853b3fb5258dab8f (patch) | |
tree | ead0e50ca3c1bb5247c4dfc6369a2016562e7867 /src/saveload.cpp | |
parent | 5d5b3968a1b5fd0e94e68f695aa547cc9e5e94d8 (diff) | |
download | openttd-0fcda4e45cbbda0872bc6216853b3fb5258dab8f.tar.xz |
(svn r10056) -Revert (r10049): removing SLE_WRITEBYTE didn't work as expected :(. Somehow SlIterateArray and SlObject depend on eachother and adding a some arbitrary data before the SlObject makes it go crazy.
Diffstat (limited to 'src/saveload.cpp')
-rw-r--r-- | src/saveload.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/saveload.cpp b/src/saveload.cpp index 26dc7df51..420e5e98a 100644 --- a/src/saveload.cpp +++ b/src/saveload.cpp @@ -744,6 +744,7 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad *sld) default: NOT_REACHED(); } break; + case SL_WRITEBYTE: return 1; // a byte is logically of size 1 case SL_INCLUDE: return SlCalcObjLength(object, _sl.includes[sld->version_from]); default: NOT_REACHED(); } @@ -781,6 +782,19 @@ bool SlObjectMember(void *ptr, const SaveLoad *sld) } break; + /* SL_WRITEBYTE translates a value of a variable to another one upon + * saving or loading. + * XXX - variable renaming abuse + * game_value: the value of the variable ingame is abused by sld->version_from + * file_value: the value of the variable in the savegame is abused by sld->version_to */ + case SL_WRITEBYTE: + if (_sl.save) { + SlWriteByte(sld->version_to); + } else { + *(byte*)ptr = sld->version_from; + } + break; + /* SL_INCLUDE loads common code for a type * XXX - variable renaming abuse * include_index: common code to include from _desc_includes[], abused by sld->version_from */ |