From 67633606b00f87dd11d7cc2ad186624fed38271f Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 29 Jan 2019 00:09:25 +0000 Subject: Codechange: Remove value mangling and field misuse in SLE_WRITEBYTE. The original translation functionality hasn't been used since 2007. --- src/saveload/saveload.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/saveload/saveload.cpp') diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 29adb40c9..348ba93ba 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1710,17 +1710,15 @@ 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 */ + /* SL_WRITEBYTE writes a value to the savegame to identify the type of an object. + * When loading, the value is read explictly with SlReadByte() to determine which + * object description to use. */ case SL_WRITEBYTE: switch (_sl.action) { - case SLA_SAVE: SlWriteByte(sld->version_to); break; + case SLA_SAVE: SlWriteByte(*(uint8 *)ptr); break; case SLA_LOAD_CHECK: - case SLA_LOAD: *(byte *)ptr = sld->version_from; break; - case SLA_PTRS: break; + case SLA_LOAD: + case SLA_PTRS: case SLA_NULL: break; default: NOT_REACHED(); } -- cgit v1.2.3-70-g09d2