objnam.c globals moved to instance globals.

This commit is contained in:
Bart House
2018-11-23 13:37:30 -08:00
parent 01596f1660
commit 041e55467a
3 changed files with 13 additions and 8 deletions

View File

@@ -461,6 +461,13 @@ struct instance_globals {
/* muse.c */ /* muse.c */
boolean m_using; /* kludge to use mondided instead of killed */ boolean m_using; /* kludge to use mondided instead of killed */
/* objname.c */
/* distantname used by distant_name() to pass extra information to
xname_flags(); it would be much cleaner if this were a parameter,
but that would require all of the xname() and doname() calls to be
modified */
int distantname;
/* pickup.c */ /* pickup.c */
int oldcap; /* last encumberance */ int oldcap; /* last encumberance */
/* current_container is set in use_container(), to be used by the /* current_container is set in use_container(), to be used by the

View File

@@ -345,6 +345,9 @@ const struct instance_globals g_init = {
/* mused.c */ /* mused.c */
FALSE, /* m_using */ FALSE, /* m_using */
/* objname.c */
0, /* distantname */
/* pickup.c */ /* pickup.c */
0, /* oldcap */ 0, /* oldcap */
UNDEFINED_PTR, /* current_container */ UNDEFINED_PTR, /* current_container */

View File

@@ -210,11 +210,6 @@ struct obj *obj;
return TRUE; return TRUE;
} }
/* used by distant_name() to pass extra information to xname_flags();
it would be much cleaner if this were a parameter, but that would
require all of the xname() and doname() calls to be modified */
static int distantname = 0;
/* Give the name of an object seen at a distance. Unlike xname/doname, /* Give the name of an object seen at a distance. Unlike xname/doname,
* we don't want to set dknown if it's not set already. * we don't want to set dknown if it's not set already.
*/ */
@@ -233,9 +228,9 @@ char *FDECL((*func), (OBJ_P));
* object is within X-ray radius and only treat it as distant when * object is within X-ray radius and only treat it as distant when
* beyond that radius. Logic is iffy but result might be interesting. * beyond that radius. Logic is iffy but result might be interesting.
*/ */
++distantname; ++g.distantname;
str = (*func)(obj); str = (*func)(obj);
--distantname; --g.distantname;
return str; return str;
} }
@@ -425,7 +420,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
*/ */
if (!nn && ocl->oc_uses_known && ocl->oc_unique) if (!nn && ocl->oc_uses_known && ocl->oc_unique)
obj->known = 0; obj->known = 0;
if (!Blind && !distantname) if (!Blind && !g.distantname)
obj->dknown = TRUE; obj->dknown = TRUE;
if (Role_if(PM_PRIEST)) if (Role_if(PM_PRIEST))
obj->bknown = TRUE; obj->bknown = TRUE;