From ed27d7a24f387fb5fa753546e1949d0530ea8e33 Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Wed, 8 Feb 2017 19:50:36 -0500 Subject: [PATCH] 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. --- urogue/state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/urogue/state.c b/urogue/state.c index 46f0572..7a0b45f 100644 --- a/urogue/state.c +++ b/urogue/state.c @@ -350,7 +350,7 @@ ur_write_room(FILE *savef, struct room *r) 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 @@ ur_read_room(FILE *savef) 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); }