Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-01-31 19:48:51 -05:00
10 changed files with 93 additions and 97 deletions

View File

@@ -111,15 +111,6 @@ static const char SCCS_Id[] UNUSED = "@(#)makedefs.c\t3.6\t2018/03/02";
#endif /* else !MAC */
#endif /* else !AMIGA */
#if !defined(STATUS_HILITES) && defined(WIN32)
#define FIX_SAMPLECONFIG
#endif
#ifdef WIN32
#define SAMPLE_CONFIGFILE "../sys/winnt/defaults.nh"
#define FIXED_CONFIGFILE "./fixed_defaults.nh"
#endif
static const char
*Dont_Edit_Code =
"/* This source file is generated by 'makedefs'. Do not edit. */\n",
@@ -145,7 +136,9 @@ static char xclear[MAX_ROW][MAX_COL];
#endif
/*-end of vision defs-*/
static char filename[600];
#define MAXFNAMELEN 600
static char filename[MAXFNAMELEN];
#ifdef FILE_PREFIX
/* if defined, a first argument not starting with - is
@@ -171,9 +164,6 @@ void NDECL(do_questtxt);
void NDECL(do_rumors);
void NDECL(do_oracles);
void NDECL(do_vision);
#ifdef WIN32
void NDECL(do_fix_sampleconfig);
#endif
extern void NDECL(monst_globals_init); /* monst.c */
extern void NDECL(objects_globals_init); /* objects.c */
@@ -365,12 +355,7 @@ char *options;
case 'Z':
do_vision();
break;
#ifdef WIN32
case 'c':
case 'C':
do_fix_sampleconfig();
break;
#endif
default:
Fprintf(stderr, "Unknown option '%c'.\n", *options);
(void) fflush(stderr);
@@ -891,7 +876,7 @@ int *rumor_count;
long *rumor_size;
unsigned long old_rumor_offset;
{
char infile[600];
char infile[MAXFNAMELEN];
char *line;
unsigned long rumor_offset;
@@ -990,7 +975,7 @@ do_rumors()
char *line;
static const char rumors_header[] =
"%s%04d,%06ld,%06lx;%04d,%06ld,%06lx;0,0,%06lx\n";
char tempfile[600];
char tempfile[MAXFNAMELEN];
int true_rumor_count, false_rumor_count;
long true_rumor_size, false_rumor_size;
unsigned long true_rumor_offset, false_rumor_offset, eof_offset;
@@ -1033,7 +1018,7 @@ do_rumors()
goto rumors_failure;
/* get ready to transfer the contents of temp file to output file */
line = malloc(256);
line = malloc(BUFSZ + MAXFNAMELEN);
Sprintf(line, "rewind of \"%s\"", tempfile);
if (rewind(tfp) != 0) {
perror(line);
@@ -1408,7 +1393,7 @@ char *githash, *gitbranch;
{
FILE *gifp;
size_t len;
char infile[600];
char infile[MAXFNAMELEN];
char *line, *strval, *opt, *c, *end;
boolean havebranch = FALSE, havehash = FALSE;
@@ -1461,45 +1446,6 @@ char *githash, *gitbranch;
return FALSE;
}
#ifdef WIN32
void
do_fix_sampleconfig()
{
FILE *scfp, *ofcfp;
char fixedline[600];
char *line;
if (!(scfp = fopen(SAMPLE_CONFIGFILE, RDTMODE))) {
return;
}
if (!(ofcfp = fopen(FIXED_CONFIGFILE, WRTMODE))) {
return;
}
/* read the sample config file */
while ((line = fgetline(scfp)) != 0) {
/* comment out the STATUS_HILITES related lines */
if (strlen(line) < (600 - 1)) {
if (strstr(line, "statushilites") || strstr(line, "hilite_status:")) {
#ifdef FIX_SAMPLECONFIG
fixedline[0] = '#';
Strcpy(&fixedline[1], line);
#else
Strcpy(fixedline, line);
#endif
fputs(fixedline, ofcfp);
} else {
fputs(line, ofcfp);
}
}
free(line);
}
Fclose(scfp);
Fclose(ofcfp);
return;
}
#endif /* WIN32 */
static int
case_insensitive_comp(s1, s2)
const char *s1;
@@ -1970,7 +1916,7 @@ do_data()
Fclose(ifp); /* all done with original input file */
/* reprocess the scratch file; 1st format an error msg, just in case */
line = malloc(256);
line = malloc(BUFSZ + MAXFNAMELEN);
Sprintf(line, "rewind of \"%s\"", tempfile);
if (rewind(tfp) != 0)
goto dead_data;
@@ -1986,7 +1932,7 @@ do_data()
Unlink(tempfile); /* remove it */
/* update the first record of the output file; prepare error msg 1st */
line = malloc(256);
line = malloc(BUFSZ + MAXFNAMELEN);
Sprintf(line, "rewind of \"%s\"", filename);
ok = (rewind(ofp) == 0);
if (ok) {
@@ -2143,7 +2089,7 @@ do_oracles()
Fclose(ifp); /* all done with original input file */
/* reprocess the scratch file; 1st format an error msg, just in case */
line = malloc(256);
line = malloc(BUFSZ + MAXFNAMELEN);
Sprintf(line, "rewind of \"%s\"", tempfile);
if (rewind(tfp) != 0)
goto dead_data;
@@ -2159,7 +2105,7 @@ do_oracles()
Unlink(tempfile); /* remove it */
/* update the first record of the output file; prepare error msg 1st */
line = malloc(256);
line = malloc(BUFSZ + MAXFNAMELEN);
Sprintf(line, "rewind of \"%s\"", filename);
ok = (rewind(ofp) == 0);
if (ok) {