From: nethack.allison Date: Sat, 3 Jun 2006 17:55:24 +0000 (+0000) Subject: lost ball and chain (trunk only) X-Git-Tag: MOVE2GIT~992 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9ca2d7c030ecb85a1184db8ae0fe45e8f0f0cfc9;p=nethack lost ball and chain (trunk only) Saving the game while punished, not carrying the attached ball, and while swallowed by a purple worm resulted in losing the ball and chain. Since the required information was not being written to the save file at all, I couldn't come up with a clean way to do this for the branch, and preserve save file format. I could think of lots of kludgy ways to do it (insert ball and chain into the hero's inventory prior to saving, and remove it on restore, etc.) --- diff --git a/src/save.c b/src/save.c index 6820b4699..4666ae707 100644 --- a/src/save.c +++ b/src/save.c @@ -352,6 +352,10 @@ register int fd, mode; uball->nobj = uchain; uchain->nobj = (struct obj *)0; saveobjchn(fd, uball, mode); + } else { + int minusone = -1; + if (perform_bwrite(mode)) + bwrite(fd, (genericptr_t) &minusone, sizeof(int)); } saveobjchn(fd, migrating_objs, mode);