From 041e55467aecbecdc40539df38daafddbcc09acd Mon Sep 17 00:00:00 2001 From: Bart House Date: Fri, 23 Nov 2018 13:37:30 -0800 Subject: [PATCH] objnam.c globals moved to instance globals. --- include/decl.h | 7 +++++++ src/decl.c | 3 +++ src/objnam.c | 11 +++-------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/decl.h b/include/decl.h index 3359542ef..50f015fd5 100644 --- a/include/decl.h +++ b/include/decl.h @@ -461,6 +461,13 @@ 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 0fb2cd1d1..fde96e40b 100644 --- a/src/decl.c +++ b/src/decl.c @@ -345,6 +345,9 @@ 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 e91f0fb4a..fe9a77c29 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -210,11 +210,6 @@ 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. */ @@ -233,9 +228,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. */ - ++distantname; + ++g.distantname; str = (*func)(obj); - --distantname; + --g.distantname; return str; } @@ -425,7 +420,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */ */ if (!nn && ocl->oc_uses_known && ocl->oc_unique) obj->known = 0; - if (!Blind && !distantname) + if (!Blind && !g.distantname) obj->dknown = TRUE; if (Role_if(PM_PRIEST)) obj->bknown = TRUE;