Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource into paxed-new_lev_comp

Conflicts:
	doc/fixes35.0
	include/extern.h
	include/ntconf.h
	include/obj.h
	include/patchlevel.h
	src/dig.c
	src/do.c
	src/files.c
	src/fountain.c
	src/mklev.c
	src/objnam.c
	src/options.c
	src/potion.c
	src/rumors.c
	src/save.c
	src/topten.c
	src/trap.c
	src/wield.c
	sys/share/pcmain.c
	sys/unix/unixmain.c
	sys/winnt/Makefile.msc
	util/lev_main.c
	util/makedefs.c
This commit is contained in:
Pasi Kallinen
2015-03-24 19:46:38 +02:00
58 changed files with 1957 additions and 481 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 lev_main.c $NHDT-Date: 1427161270 2015/03/24 01:41:10 $ $NHDT-Branch: paxed-new_lev_comp-B $:$NHDT-Revision: 1.30 $ */
/* NetHack 3.5 lev_main.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 lev_main.c $Date: 2012/01/12 04:48:12 $ $Revision: 1.20 $ */
/* SCCS Id: @(#)lev_main.c 3.5 2007/01/17 */
/* Copyright (c) 1989 by Jean-Christophe Collet */

View File

@@ -169,6 +169,7 @@ static char *FDECL(bannerc_string, (char *,const char *));
static char *FDECL(xcrypt, (const char *));
static unsigned long FDECL(read_rumors_file,
(const char *,int *,long *,unsigned long));
static void FDECL(do_rnd_access_file, (const char *));
static boolean FDECL(d_filter, (char *));
static boolean FDECL(h_filter, (char *));
static boolean FDECL(ranged_attk,(struct permonst*));
@@ -213,7 +214,7 @@ extern unsigned _stklen = STKSIZ;
int
main(void)
{
const char *def_options = "odemvpqrhz";
const char *def_options = "odemvpqrshz";
char buf[100];
int len;
@@ -329,6 +330,11 @@ char *options;
case 'r':
case 'R': do_rumors();
break;
case 's':
case 'S': do_rnd_access_file(EPITAPHFILE);
do_rnd_access_file(ENGRAVEFILE);
do_rnd_access_file(BOGUSMONFILE);
break;
case 'h':
case 'H': do_oracles();
break;
@@ -870,6 +876,44 @@ unsigned long old_rumor_offset;
return rumor_offset;
}
void
do_rnd_access_file(fname)
const char *fname;
{
Sprintf(filename, DATA_IN_TEMPLATE, fname);
Strcat(filename, ".txt");
if (!(ifp = fopen(filename, RDTMODE))) {
perror(filename);
exit(EXIT_FAILURE);
}
filename[0]='\0';
#ifdef FILE_PREFIX
Strcat(filename, file_prefix);
#endif
Sprintf(eos(filename), DATA_TEMPLATE, fname);
if (!(ofp = fopen(filename, WRTMODE))) {
perror(filename);
exit(EXIT_FAILURE);
}
Fprintf(ofp,"%s",Dont_Edit_Data);
tfp = getfp(DATA_TEMPLATE, "grep.tmp", WRTMODE);
grep0(ifp, tfp);
ifp = getfp(DATA_TEMPLATE, "grep.tmp", RDTMODE);
while (fgets(in_line, sizeof in_line, ifp) != 0) {
if (in_line[0] == '#') continue; /* discard comments */
if (in_line[0] == '\n') continue; /* and empty lines */
(void) fputs(xcrypt(in_line), ofp);
}
Fclose(ifp);
Fclose(ofp);
delete_file(DATA_TEMPLATE, "grep.tmp");
return;
}
void
do_rumors()
{