split some code into separate files

new .h files: hacklib.h selvar.h stairs.h

new .c files: calendar.c, getpos.c, report.c, selvar.c, stairs.c,
              strutil.c, wizcmds.c

cleanup of hacklib.c and mdlib.c

hacklib contains functions that do not have to link with the core

relocate wiz commands from cmd.c to wizcmds.c

relocate CRASHREPORT stuff to report.c

relocate getpos stuff from do_name.c to getpos.c

remove temporary struct definition from extern.h

cross-compile PRE-section split into cross-pre1.370 and cross-pre2.370

Windows sys/windows/Makefile.nmake and sys/windows/Makefile.mingw32 and
visual studio project file updates

Unix sys/unix/Makefile.src, sys/unix/Makefile.utl

populate selvar.c and selvar.h

build on MS-DOS (not cross-compile) Makefile updates
for sys/msdos/Makefile.GCC (untested)

vms updates for above (untested)
This commit is contained in:
nhmall
2024-03-07 11:01:04 -05:00
parent c22900fb63
commit 50811037f3
43 changed files with 5913 additions and 5677 deletions

View File

@@ -15,6 +15,8 @@
#endif
#include "config.h"
#include "hacklib.h"
#include "tile.h"
extern void monst_globals_init(void);
extern void objects_globals_init(void);

View File

@@ -18,10 +18,14 @@
#include "rm.h"
#else
#include "hack.h"
#include "display.h"
#include <stdarg.h>
#endif
#ifdef Snprintf
#undef Snprintf
#endif
#define Snprintf(str, size, ...) \
nh_snprintf(__func__, __LINE__, str, size, __VA_ARGS__)
#ifdef MONITOR_HEAP
/* with heap monitoring enabled, free(ptr) is a macro which expands to
nhfree(ptr,__FILE__,__LINE__); since tilemap doesn't link with
@@ -30,10 +34,6 @@
#endif
#define Fprintf (void) fprintf
#define Snprintf(str, size, ...) \
nh_snprintf(__func__, __LINE__, str, size, __VA_ARGS__)
void nh_snprintf(const char *func, int line, char *str, size_t size,
const char *fmt, ...);
/*
* Defining OBTAIN_TILEMAP to get a listing of the tile-mappings
@@ -118,14 +118,14 @@ struct tilemap_t {
#endif
} tilemap[MAX_GLYPH];
#define MAX_TILENAM 30
#define MAX_TILENAM 256
/* List of tiles encountered and their usage */
struct tiles_used {
int tilenum;
enum tilesrc src;
int file_entry;
char tilenam[MAX_TILENAM];
char references[120];
char references[1024];
};
struct tiles_used *tilelist[2500] = { 0 };
@@ -1484,7 +1484,8 @@ precheck(int offset, const char *glyphtype)
glyphtype);
}
void add_tileref(
void
add_tileref(
int n,
int glyphref,
enum tilesrc src,
@@ -1548,28 +1549,4 @@ free_tilerefs(void)
#endif
DISABLE_WARNING_FORMAT_NONLITERAL
void
nh_snprintf(
const char *func UNUSED,
int line UNUSED,
char *str, size_t size,
const char *fmt, ...)
{
va_list ap;
int n;
va_start(ap, fmt);
n = vsnprintf(str, size, fmt, ap);
va_end(ap);
if (n < 0 || (size_t) n >= size) { /* is there a problem? */
str[size - 1] = 0; /* make sure it is nul terminated */
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
/*tilemap.c*/