code change - oextra
move oattached and oname and other things that vary the size of the obj structure into a separate non-adjacent oextra structure, similar to what has already been done for mextra. The obj structure itself becomes a fixed size. New macros: #define ONAME(o) ((o)->oextra->oname) #define OMID(o) ((o)->oextra->omid) #define OMONST(o) ((o)->oextra->omonst) #define OLONG(o) ((o)->oextra->olong) #define OMAILCMD(o) ((o)->oextra->omailcmd) #define has_oname(o) ((o)->oextra && ONAME(o)) #define has_omid(o) ((o)->oextra && OMID(o)) #define has_omonst(o) ((o)->oextra && OMONST(o)) #define has_olong(o) ((o)->oextra && OLONG(o)) #define has_omailcmd(o) ((o)->oextra && OMAILCMD(o)) changed macros: has_name(mon) becomes has_mname(mon) to correspond. The CVS repository was tagged with NETHACK_PRE_OEXTRA before commiting these, and tagged with NETHACK_POST_OEXTRA immediately after. The diff between those two tags is this oextra patch. The associated mail daemon changes to use an oextra structure instead of a hidden command located in the name after the terminating NUL, have not been tried or tested.
This commit is contained in:
14
src/trap.c
14
src/trap.c
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)trap.c 3.5 2006/04/05 */
|
||||
/* SCCS Id: @(#)trap.c 3.5 2006/04/14 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -432,8 +432,7 @@ int *fail_reason;
|
||||
mptr = &mons[PM_FLESH_GOLEM];
|
||||
use_saved_traits = FALSE;
|
||||
} else {
|
||||
use_saved_traits = (statue->oxlth &&
|
||||
statue->oattached == OATTACHED_MONST);
|
||||
use_saved_traits = has_omonst(statue);
|
||||
}
|
||||
|
||||
if (use_saved_traits) {
|
||||
@@ -475,7 +474,7 @@ int *fail_reason;
|
||||
else if (statue->spe & STATUE_FEMALE)
|
||||
mon->female = TRUE;
|
||||
/* if statue has been named, give same name to the monster */
|
||||
if (statue->onamelth)
|
||||
if (has_oname(statue))
|
||||
mon = christen_monst(mon, ONAME(statue));
|
||||
/* mimic statue becomes seen mimic; other hiders won't be hidden */
|
||||
if (mon->m_ap_type) seemimic(mon);
|
||||
@@ -600,9 +599,8 @@ struct obj *objchn, *saddle;
|
||||
{
|
||||
if (!saddle) return FALSE;
|
||||
while(objchn) {
|
||||
if(objchn->otyp == CORPSE &&
|
||||
objchn->oattached == OATTACHED_MONST && objchn->oxlth) {
|
||||
struct monst *mtmp = (struct monst *)objchn->oextra;
|
||||
if(objchn->otyp == CORPSE && has_omonst(objchn)) {
|
||||
struct monst *mtmp = OMONST(objchn);
|
||||
if (mtmp->m_id == steed_mid) {
|
||||
/* move saddle */
|
||||
xchar x,y;
|
||||
@@ -682,7 +680,7 @@ unsigned trflags;
|
||||
u.usteed->mtrapseen |= (1 << (ttype - 1));
|
||||
/* suppress article in various steed messages when using its
|
||||
name (which won't occur when hallucinating) */
|
||||
if (has_name(u.usteed) && !Hallucination)
|
||||
if (has_mname(u.usteed) && !Hallucination)
|
||||
steed_article = ARTICLE_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user