unsplitting split object stack
Replace the code that Dean objected to with something a little bit more robust. It doesn't rely on the two stacks being adjacent or having the same inventory letter. It is still vulnerable to having another splitobj() occur between the offending split and its attempted unsplit, or to either of the two halves of a split being extracted from their object chain. As before, failure to unsplit only results in the two halves of the split remaining separate stacks, not anything more drastic like the panic() that prompted all this. Simplification of hallucinated currency names got mixed in with this patch. I haven't bothered separating it back out. Whoever reset PATCHLEVEL to 0 jumped the gun. This patch increments it since change to the 'context' structure breaks save file compatibility, so it will need to undergo another reset before release.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 context.h $NHDT-Date: 1434421363 2015/06/16 02:22:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
|
||||
/* NetHack 3.6 context.h $NHDT-Date: 1445215010 2015/10/19 00:36:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -76,6 +76,11 @@ struct polearm_info {
|
||||
unsigned m_id; /* monster id of hitmon, in save file */
|
||||
};
|
||||
|
||||
struct obj_split {
|
||||
unsigned parent_oid, /* set: splitobj(), */
|
||||
child_oid; /* reset: clear_splitobjs() */
|
||||
};
|
||||
|
||||
struct tribute_info {
|
||||
size_t tributesz; /* make it possible to skip this in future */
|
||||
boolean enabled; /* Do we have tributes turned on? */
|
||||
@@ -117,6 +122,7 @@ struct context_info {
|
||||
struct takeoff_info takeoff;
|
||||
struct warntype_info warntype;
|
||||
struct polearm_info polearm;
|
||||
struct obj_split objsplit; /* track most recently split object stack */
|
||||
struct tribute_info tribute;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1445126411 2015/10/18 00:00:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.508 $ */
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1445215014 2015/10/19 00:36:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.509 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1214,6 +1214,8 @@ E struct obj *FDECL(mkobj, (CHAR_P, BOOLEAN_P));
|
||||
E int NDECL(rndmonnum);
|
||||
E boolean FDECL(bogon_is_pname, (CHAR_P));
|
||||
E struct obj *FDECL(splitobj, (struct obj *, long));
|
||||
E struct obj *FDECL(unsplitobj, (struct obj *));
|
||||
E void NDECL(clear_splitobjs);
|
||||
E void FDECL(replace_object, (struct obj *, struct obj *));
|
||||
E void FDECL(bill_dummy_object, (struct obj *));
|
||||
E void FDECL(costly_alteration, (struct obj *, int));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 patchlevel.h $NHDT-Date: 1432512782 2015/05/25 00:13:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.107 $ */
|
||||
/* NetHack 3.6 patchlevel.h $NHDT-Date: 1445215015 2015/10/19 00:36:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.109 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/*
|
||||
* PATCHLEVEL is updated for each release.
|
||||
*/
|
||||
#define PATCHLEVEL 0
|
||||
#define PATCHLEVEL 1
|
||||
/*
|
||||
* Incrementing EDITLEVEL can be used to force invalidation of old bones
|
||||
* and save files.
|
||||
|
||||
Reference in New Issue
Block a user