more 'onefile' tweaks

Undefine some macros when the file that uses them is done so that
they won't be seen by any other source files if combined into one
huge source file.  I only looked at the few files where an #undef was
needed, not all the files, but in those few files I used #undef for
[almost] all their local macros instead of just the troublesome one.
display.c is the exception; it still has lots of macros which persist
through end of file.  nhlobj.c is another exception; I misremembered
the fixup for lua's lobject.c at the time and decided to include the
one #undef for nhlobj.c anyway even though 'onefile' isn't affected.

monst.c includes some reformatting.  display.c's sign() macro was
redone; it's intended for efficiency compared to calling hacklib.c's
sgn() function so streamline it.

[Keni, most of the file-specific #undef fixups in genonefile.pl can
now be removed.  It'll still need one for lua source file lobject.c;
addstr() there conflicts with curses.h, not with nethack's own code.]
This commit is contained in:
PatR
2023-04-21 14:32:43 -07:00
parent 8ec274bf2b
commit 861fcdf9c4
5 changed files with 74 additions and 11 deletions

View File

@@ -655,3 +655,8 @@ l_obj_register(lua_State *L)
return 0;
}
/* for 'onefile' processing where end of this file isn't necessarily the
end of the source code seen by the compiler */
#undef lobj_is_ok
/*nhlobj.c*/