changeset 258:2908dc47f9e2

UltraRogue: fix crash when restoring. The r_flags field in struct room was being written as an int and read as a short. This caused the restore functions to receive the wrong data, usually an impossible string length, and abort. This breaks save compatibility, though the save files had problems anyway: the r_fires field should have been used, instead of reading and writing r_flags twice.
author John "Elwin" Edwards
date Wed, 08 Feb 2017 19:50:36 -0500
parents c4b12d2d1dcd
children 096d3cfd9afd
files urogue/state.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/urogue/state.c	Tue Jan 31 20:33:49 2017 -0500
+++ b/urogue/state.c	Wed Feb 08 19:50:36 2017 -0500
@@ -350,7 +350,7 @@
 
     ur_write_int(savef, r->r_flags);
     ur_write_int(savef, r->r_nexits);
-    ur_write_int(savef, r->r_flags);
+    ur_write_short(savef, r->r_fires);
 }
 
 struct room *
@@ -369,7 +369,7 @@
 
     r->r_flags = ur_read_int(savef);
     r->r_nexits = ur_read_int(savef);
-    r->r_flags = ur_read_short(savef);
+    r->r_fires = ur_read_short(savef);
 
     return(r);
 }