src/saveload.cpp
changeset 7313 921f236ba638
parent 7306 2c4eaac57ff8
child 7425 350b9265b7a2
--- a/src/saveload.cpp	Thu Jun 07 12:37:27 2007 +0000
+++ b/src/saveload.cpp	Thu Jun 07 12:37:48 2007 +0000
@@ -744,6 +744,7 @@
 			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 @@
 		}
 		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 */