obj->oextra->{omid,olong}

Change obj->oextra->omid from a usually-Null pointer field in
oextra to a simple 'unsigned' that doesn't need any allocation
beyond obj->oextra itself.  Value 0 means that it is not in use;
it is used to hold a monst.m_id and those are always non-zero.

Delete unused obj->oextra->olong.  'olong' used to be the last
field in struct obj, put there to force alignment of anything
which followed it back when obj structures were over-allocated to
append extra information.  It had a comment about being used for
temporary gold but whatever that was, temporary gold was gone long
before obj->oextra got introduced.

Bump EDITLEVEL since this invalidates existing 3.7 save files.

Remove a bunch of tabs from obj.h and save.c.
This commit is contained in:
PatR
2020-04-24 09:29:52 -07:00
parent 6b2fcd7d73
commit e63fed627c
9 changed files with 98 additions and 160 deletions

View File

@@ -3718,6 +3718,11 @@ register struct obj *otmp, *obj;
if (obj->unpaid && !same_price(obj, otmp))
return FALSE;
/* some additional information is always incompatible */
if (has_omonst(obj) || has_omid(obj)
|| has_omonst(otmp) || has_omid(otmp))
return FALSE;
/* if they have names, make sure they're the same */
objnamelth = strlen(safe_oname(obj));
otmpnamelth = strlen(safe_oname(otmp));
@@ -3727,11 +3732,12 @@ register struct obj *otmp, *obj;
&& strncmp(ONAME(obj), ONAME(otmp), objnamelth)))
return FALSE;
/* for the moment, any additional information is incompatible */
if (has_omonst(obj) || has_omid(obj) || has_olong(obj) || has_omonst(otmp)
|| has_omid(otmp) || has_olong(otmp))
/* if one has an attached mail command, other must have same command */
if (!has_omailcmd(obj) ? has_omailcmd(otmp)
: (!has_omailcmd(otmp) || strcmp(OMAILCMD(obj), OMAILCMD(otmp)) != 0))
return FALSE;
/* should be moot since matching artifacts wouldn't be unique */
if (obj->oartifact != otmp->oartifact)
return FALSE;