fix github issue #587 - incompatible save files
Save files from before the 'disambiguate WHACK' patch were not necessarily compatible with ones after it, leading to potential restore problems. Comments in objclass.h (from before the patch) suggested that inappropriate assumptions were being made about field layout. This deliberately introduces new incompatibility and increments EDITLEVEL to caused earlier save and bones files to be thrown away. Fixes #587
This commit is contained in:
@@ -803,6 +803,8 @@ if an invisible monster put on or took off armor while out of hero's sight
|
|||||||
an item thrown or dropped while swallowed was treated as being picked up by an
|
an item thrown or dropped while swallowed was treated as being picked up by an
|
||||||
unseen monster so object fields {known, dknown, bknown} got cleared
|
unseen monster so object fields {known, dknown, bknown} got cleared
|
||||||
segfault if gremlin fled weaponless hero wearing gold dragon scales/mail
|
segfault if gremlin fled weaponless hero wearing gold dragon scales/mail
|
||||||
|
'disambiguate WHACK' patch affected field layout of objects[] but EDITLEVEL
|
||||||
|
wasn't incremented, allowing incompatable save files to be restored
|
||||||
|
|
||||||
curses: 'msg_window' option wasn't functional for curses unless the binary
|
curses: 'msg_window' option wasn't functional for curses unless the binary
|
||||||
also included tty support
|
also included tty support
|
||||||
|
|||||||
+26
-28
@@ -50,11 +50,11 @@ struct objclass {
|
|||||||
Bitfield(oc_name_known, 1); /* discovered */
|
Bitfield(oc_name_known, 1); /* discovered */
|
||||||
Bitfield(oc_merge, 1); /* merge otherwise equal objects */
|
Bitfield(oc_merge, 1); /* merge otherwise equal objects */
|
||||||
Bitfield(oc_uses_known, 1); /* obj->known affects full description;
|
Bitfield(oc_uses_known, 1); /* obj->known affects full description;
|
||||||
otherwise, obj->dknown and obj->bknown
|
* otherwise, obj->dknown and obj->bknown
|
||||||
tell all, and obj->known should always
|
* tell all, and obj->known should always
|
||||||
be set for proper merging behavior. */
|
* be set for proper merging behavior. */
|
||||||
Bitfield(oc_pre_discovered, 1); /* Already known at start of game;
|
Bitfield(oc_pre_discovered, 1); /* already known at start of game; flagged
|
||||||
won't be listed as a discovery. */
|
* as such when discoveries are listed */
|
||||||
Bitfield(oc_magic, 1); /* inherently magical object */
|
Bitfield(oc_magic, 1); /* inherently magical object */
|
||||||
Bitfield(oc_charged, 1); /* may have +n or (n) charges */
|
Bitfield(oc_charged, 1); /* may have +n or (n) charges */
|
||||||
Bitfield(oc_unique, 1); /* special one-of-a-kind object */
|
Bitfield(oc_unique, 1); /* special one-of-a-kind object */
|
||||||
@@ -65,6 +65,10 @@ struct objclass {
|
|||||||
#define oc_bulky oc_big /* for armor */
|
#define oc_bulky oc_big /* for armor */
|
||||||
Bitfield(oc_tough, 1); /* hard gems/rings */
|
Bitfield(oc_tough, 1); /* hard gems/rings */
|
||||||
|
|
||||||
|
Bitfield(oc_spare1, 6); /* padding to align oc_dir + oc_material;
|
||||||
|
* can be canabalized for other use;
|
||||||
|
* aka 6 free bits */
|
||||||
|
|
||||||
Bitfield(oc_dir, 3);
|
Bitfield(oc_dir, 3);
|
||||||
/* oc_dir: zap style for wands and spells */
|
/* oc_dir: zap style for wands and spells */
|
||||||
#define NODIR 1 /* non-directional */
|
#define NODIR 1 /* non-directional */
|
||||||
@@ -74,31 +78,8 @@ struct objclass {
|
|||||||
#define PIERCE 01 /* pointed weapon punctures target */
|
#define PIERCE 01 /* pointed weapon punctures target */
|
||||||
#define SLASH 02 /* sharp weapon cuts target */
|
#define SLASH 02 /* sharp weapon cuts target */
|
||||||
#define WHACK 04 /* blunt weapon bashes target */
|
#define WHACK 04 /* blunt weapon bashes target */
|
||||||
|
|
||||||
/* 3 free bits */
|
|
||||||
|
|
||||||
Bitfield(oc_material, 5); /* one of obj_material_types */
|
Bitfield(oc_material, 5); /* one of obj_material_types */
|
||||||
|
|
||||||
#define is_organic(otmp) (objects[otmp->otyp].oc_material <= WOOD)
|
|
||||||
#define is_metallic(otmp) \
|
|
||||||
(objects[otmp->otyp].oc_material >= IRON \
|
|
||||||
&& objects[otmp->otyp].oc_material <= MITHRIL)
|
|
||||||
|
|
||||||
/* primary damage: fire/rust/--- */
|
|
||||||
/* is_flammable(otmp), is_rottable(otmp) in mkobj.c */
|
|
||||||
#define is_rustprone(otmp) (objects[otmp->otyp].oc_material == IRON)
|
|
||||||
|
|
||||||
/* secondary damage: rot/acid/acid */
|
|
||||||
#define is_corrodeable(otmp) \
|
|
||||||
(objects[otmp->otyp].oc_material == COPPER \
|
|
||||||
|| objects[otmp->otyp].oc_material == IRON)
|
|
||||||
|
|
||||||
#define is_damageable(otmp) \
|
|
||||||
(is_rustprone(otmp) || is_flammable(otmp) || is_rottable(otmp) \
|
|
||||||
|| is_corrodeable(otmp))
|
|
||||||
|
|
||||||
/* 3 free bits */
|
|
||||||
|
|
||||||
schar oc_subtyp;
|
schar oc_subtyp;
|
||||||
#define oc_skill oc_subtyp /* Skills of weapons, spellbooks, tools, gems */
|
#define oc_skill oc_subtyp /* Skills of weapons, spellbooks, tools, gems */
|
||||||
#define oc_armcat oc_subtyp /* for armor (enum obj_armor_types) */
|
#define oc_armcat oc_subtyp /* for armor (enum obj_armor_types) */
|
||||||
@@ -200,4 +181,21 @@ extern NEARDATA struct objdescr obj_descr[NUM_OBJECTS + 1];
|
|||||||
#define OBJ_NAME(obj) (obj_descr[(obj).oc_name_idx].oc_name)
|
#define OBJ_NAME(obj) (obj_descr[(obj).oc_name_idx].oc_name)
|
||||||
#define OBJ_DESCR(obj) (obj_descr[(obj).oc_descr_idx].oc_descr)
|
#define OBJ_DESCR(obj) (obj_descr[(obj).oc_descr_idx].oc_descr)
|
||||||
|
|
||||||
|
#define is_organic(otmp) (objects[otmp->otyp].oc_material <= WOOD)
|
||||||
|
#define is_metallic(otmp) \
|
||||||
|
(objects[otmp->otyp].oc_material >= IRON \
|
||||||
|
&& objects[otmp->otyp].oc_material <= MITHRIL)
|
||||||
|
|
||||||
|
/* primary damage: fire/rust/--- */
|
||||||
|
/* is_flammable(otmp), is_rottable(otmp) in mkobj.c */
|
||||||
|
#define is_rustprone(otmp) (objects[otmp->otyp].oc_material == IRON)
|
||||||
|
/* secondary damage: rot/acid/acid */
|
||||||
|
#define is_corrodeable(otmp) \
|
||||||
|
(objects[otmp->otyp].oc_material == COPPER \
|
||||||
|
|| objects[otmp->otyp].oc_material == IRON)
|
||||||
|
/* subject to any damage */
|
||||||
|
#define is_damageable(otmp) \
|
||||||
|
(is_rustprone(otmp) || is_flammable(otmp) \
|
||||||
|
|| is_rottable(otmp) || is_corrodeable(otmp))
|
||||||
|
|
||||||
#endif /* OBJCLASS_H */
|
#endif /* OBJCLASS_H */
|
||||||
|
|||||||
+20
-5
@@ -21,6 +21,13 @@
|
|||||||
#define HARDGEM(n) (0)
|
#define HARDGEM(n) (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note...
|
||||||
|
* OBJECTS() currently has 15 parameters; it more become needed, some
|
||||||
|
* will need to be combined the way BITS() is used, because compilers
|
||||||
|
* are allowed to impose a limit of 15.
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined(OBJECTS_DESCR_INIT)
|
#if defined(OBJECTS_DESCR_INIT)
|
||||||
#define OBJ(name,desc) name, desc
|
#define OBJ(name,desc) name, desc
|
||||||
#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \
|
#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \
|
||||||
@@ -28,21 +35,28 @@
|
|||||||
|
|
||||||
#elif defined(OBJECTS_INIT)
|
#elif defined(OBJECTS_INIT)
|
||||||
#define COLOR_FIELD(X) X,
|
#define COLOR_FIELD(X) X,
|
||||||
|
/* notes: 'sub' was once a bitfield but got changed to separate schar when
|
||||||
|
it was overloaded to hold negative weapon skill indices; the first zero
|
||||||
|
is padding for oc_prediscovered which has variable init at run-time;
|
||||||
|
the second zero is oc_spare1 for padding between oc_tough and oc_dir */
|
||||||
#define BITS(nmkn,mrg,uskn,ctnr,mgc,chrg,uniq,nwsh,big,tuf,dir,sub,mtrl) \
|
#define BITS(nmkn,mrg,uskn,ctnr,mgc,chrg,uniq,nwsh,big,tuf,dir,sub,mtrl) \
|
||||||
nmkn,mrg,uskn,0,mgc,chrg,uniq,nwsh,big,tuf,dir,mtrl,sub /*SCO cpp fodder*/
|
nmkn,mrg,uskn,0,mgc,chrg,uniq,nwsh,big,tuf,0,dir,mtrl,sub /*cpp fodder*/
|
||||||
#define OBJECT(obj,bits,prp,sym,prob,dly,wt,cost,sdam,ldam,oc1,oc2,nut,color,sn) \
|
#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \
|
||||||
|
cost,sdam,ldam,oc1,oc2,nut,color,sn) \
|
||||||
{ 0, 0, (char *) 0, bits, prp, sym, dly, COLOR_FIELD(color) prob, wt, \
|
{ 0, 0, (char *) 0, bits, prp, sym, dly, COLOR_FIELD(color) prob, wt, \
|
||||||
cost, sdam, ldam, oc1, oc2, nut }
|
cost, sdam, ldam, oc1, oc2, nut }
|
||||||
|
|
||||||
#elif defined(OBJECTS_ENUM)
|
#elif defined(OBJECTS_ENUM)
|
||||||
#define OBJ(name,desc)
|
#define OBJ(name,desc)
|
||||||
#define OBJECT(obj,bits,prp,sym,prob,dly,wt,cost,sdam,ldam,oc1,oc2,nut,color,sn) \
|
#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \
|
||||||
|
cost,sdam,ldam,oc1,oc2,nut,color,sn) \
|
||||||
sn
|
sn
|
||||||
|
|
||||||
#elif defined(DUMP_ENUMS)
|
#elif defined(DUMP_ENUMS)
|
||||||
#define OBJ(name,desc)
|
#define OBJ(name,desc)
|
||||||
#define OBJECT(obj,bits,prp,sym,prob,dly,wt,cost,sdam,ldam,oc1,oc2,nut,color,sn) \
|
#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \
|
||||||
{sn, #sn}
|
cost,sdam,ldam,oc1,oc2,nut,color,sn) \
|
||||||
|
{ sn, #sn }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error Unproductive inclusion of objects.h
|
#error Unproductive inclusion of objects.h
|
||||||
@@ -75,6 +89,7 @@ OBJECT(OBJ("strange object", NoDes),
|
|||||||
/* Note: for weapons that don't do an even die of damage (ex. 2-7 or 3-18)
|
/* Note: for weapons that don't do an even die of damage (ex. 2-7 or 3-18)
|
||||||
the extra damage is added on in weapon.c, not here! */
|
the extra damage is added on in weapon.c, not here! */
|
||||||
|
|
||||||
|
/* weapon strike mode overloads the oc_dir field */
|
||||||
#define P PIERCE
|
#define P PIERCE
|
||||||
#define S SLASH
|
#define S SLASH
|
||||||
#define B WHACK
|
#define B WHACK
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* Incrementing EDITLEVEL can be used to force invalidation of old bones
|
* Incrementing EDITLEVEL can be used to force invalidation of old bones
|
||||||
* and save files.
|
* and save files.
|
||||||
*/
|
*/
|
||||||
#define EDITLEVEL 39
|
#define EDITLEVEL 40
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Development status possibilities.
|
* Development status possibilities.
|
||||||
|
|||||||
Reference in New Issue
Block a user