]> granicus.if.org Git - nethack/commitdiff
Revert "objnam.c globals moved to instance globals."
authornhmall <nhmall@nethack.org>
Sat, 24 Nov 2018 03:16:35 +0000 (22:16 -0500)
committernhmall <nhmall@nethack.org>
Sat, 24 Nov 2018 03:16:35 +0000 (22:16 -0500)
This reverts commit 041e55467aecbecdc40539df38daafddbcc09acd.

include/decl.h
src/decl.c
src/objnam.c

index 50f015fd5dd707e63ab75e11123b97553794b944..3359542efcdb416ea0d071893bb71f9c71f69d8e 100644 (file)
@@ -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
index fde96e40b27bfac4d36f440cb853ba6f34223d90..0fb2cd1d195f6553158594e92af26b044f75c070 100644 (file)
@@ -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 */
index fe9a77c29a1a7540e564038bb60555a549d8d96c..e91f0fb4a4a1716cbbc6cf0cffde145604c4cc90 100644 (file)
@@ -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;