From: nhmall Date: Sat, 24 Nov 2018 03:16:35 +0000 (-0500) Subject: Revert "objnam.c globals moved to instance globals." X-Git-Tag: NetHack-3.6.2_Released~161^2~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=734a6c2ddbcba19188cd0b4f63884a037bc7fd86;p=nethack Revert "objnam.c globals moved to instance globals." This reverts commit 041e55467aecbecdc40539df38daafddbcc09acd. --- diff --git a/include/decl.h b/include/decl.h index 50f015fd5..3359542ef 100644 --- a/include/decl.h +++ b/include/decl.h @@ -461,13 +461,6 @@ struct instance_globals { /* muse.c */ 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 */ int oldcap; /* last encumberance */ /* current_container is set in use_container(), to be used by the diff --git a/src/decl.c b/src/decl.c index fde96e40b..0fb2cd1d1 100644 --- a/src/decl.c +++ b/src/decl.c @@ -345,9 +345,6 @@ const struct instance_globals g_init = { /* mused.c */ FALSE, /* m_using */ - /* objname.c */ - 0, /* distantname */ - /* pickup.c */ 0, /* oldcap */ UNDEFINED_PTR, /* current_container */ diff --git a/src/objnam.c b/src/objnam.c index fe9a77c29..e91f0fb4a 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -210,6 +210,11 @@ struct obj *obj; 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, * we don't want to set dknown if it's not set already. */ @@ -228,9 +233,9 @@ char *FDECL((*func), (OBJ_P)); * object is within X-ray radius and only treat it as distant when * beyond that radius. Logic is iffy but result might be interesting. */ - ++g.distantname; + ++distantname; str = (*func)(obj); - --g.distantname; + --distantname; return str; } @@ -420,7 +425,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */ */ if (!nn && ocl->oc_uses_known && ocl->oc_unique) obj->known = 0; - if (!Blind && !g.distantname) + if (!Blind && !distantname) obj->dknown = TRUE; if (Role_if(PM_PRIEST)) obj->bknown = TRUE;