eliminate implicit concatenation of strings

Explicitly combine adjacent string literals so that pre-ANSI compilers
still have a chance to compile the code.  I thought these had already
been dealt with, but I kept stumbling across them while reformatting,
so am trying to get them all out of the way now.
This commit is contained in:
PatR
2015-11-06 15:57:23 -08:00
parent 99925ff155
commit 449084fa6c
10 changed files with 216 additions and 198 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 eat.c $NHDT-Date: 1446808443 2015/11/06 11:14:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.151 $ */ /* NetHack 3.6 eat.c $NHDT-Date: 1446854226 2015/11/06 23:57:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.152 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2997,8 +2997,8 @@ struct obj *obj;
? (long) mons[obj->corpsenm].cnutrit ? (long) mons[obj->corpsenm].cnutrit
: (long) objects[obj->otyp].oc_nutrition; : (long) objects[obj->otyp].oc_nutrition;
if (uneaten_amt > full_amount) { if (uneaten_amt > full_amount) {
impossible("partly eaten food (%ld) more nutritious than untouched " impossible(
"food (%ld)", "partly eaten food (%ld) more nutritious than untouched food (%ld)",
uneaten_amt, full_amount); uneaten_amt, full_amount);
uneaten_amt = full_amount; uneaten_amt = full_amount;
} }
+112 -85
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 files.c $NHDT-Date: 1441753940 2015/09/08 23:12:20 $ $NHDT-Branch: master $:$NHDT-Revision: 1.183 $ */ /* NetHack 3.6 files.c $NHDT-Date: 1446854228 2015/11/06 23:57:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.185 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -171,13 +171,13 @@ extern int n_dgns; /* from dungeon.c */
#endif #endif
#ifdef SELECTSAVED #ifdef SELECTSAVED
STATIC_DCL int FDECL(strcmp_wrap, (const void *, const void *)); STATIC_DCL int FDECL(CFDECLSPEC strcmp_wrap, (const void *, const void *));
#endif #endif
STATIC_DCL char *FDECL(set_bonesfile_name, (char *, d_level *)); STATIC_DCL char *FDECL(set_bonesfile_name, (char *, d_level *));
STATIC_DCL char *NDECL(set_bonestemp_name); STATIC_DCL char *NDECL(set_bonestemp_name);
#ifdef COMPRESS #ifdef COMPRESS
STATIC_DCL void FDECL(redirect, STATIC_DCL void FDECL(redirect, (const char *, const char *, FILE *,
(const char *, const char *, FILE *, BOOLEAN_P)); BOOLEAN_P));
#endif #endif
#if defined(COMPRESS) || defined(ZLIB_COMP) #if defined(COMPRESS) || defined(ZLIB_COMP)
STATIC_DCL void FDECL(docompress_file, (const char *, BOOLEAN_P)); STATIC_DCL void FDECL(docompress_file, (const char *, BOOLEAN_P));
@@ -208,25 +208,24 @@ STATIC_DCL int FDECL(open_levelfile_exclusively, (const char *, int, int));
* fname_encode() * fname_encode()
* *
* Args: * Args:
* legal zero-terminated list of acceptable file name * legal zero-terminated list of acceptable file name characters
*characters * quotechar lead-in character used to quote illegal characters as
* quotechar lead-in character used to quote illegal characters as * hex digits
*hex digits * s string to encode
* s string to encode * callerbuf buffer to house result
* callerbuf buffer to house result * bufsz size of callerbuf
* bufsz size of callerbuf
* *
* Notes: * Notes:
* The hex digits 0-9 and A-F are always part of the legal set due to * The hex digits 0-9 and A-F are always part of the legal set due to
* their use in the encoding scheme, even if not explicitly included in * their use in the encoding scheme, even if not explicitly included in
*'legal'. * 'legal'.
* *
* Sample: * Sample:
* The following call: * The following call:
* (void)fname_encode("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", * (void)fname_encode("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
* '%', "This is a % test!", buf, 512); * '%', "This is a % test!", buf, 512);
* results in this encoding: * results in this encoding:
* "This%20is%20a%20%25%20test%21" * "This%20is%20a%20%25%20test%21"
*/ */
char * char *
fname_encode(legal, quotechar, s, callerbuf, bufsz) fname_encode(legal, quotechar, s, callerbuf, bufsz)
@@ -270,11 +269,11 @@ int bufsz;
* fname_decode() * fname_decode()
* *
* Args: * Args:
* quotechar lead-in character used to quote illegal characters as * quotechar lead-in character used to quote illegal characters as
*hex digits * hex digits
* s string to decode * s string to decode
* callerbuf buffer to house result * callerbuf buffer to house result
* bufsz size of callerbuf * bufsz size of callerbuf
*/ */
char * char *
fname_decode(quotechar, s, callerbuf, bufsz) fname_decode(quotechar, s, callerbuf, bufsz)
@@ -596,7 +595,8 @@ clearlocks()
} }
#if defined(SELECTSAVED) #if defined(SELECTSAVED)
STATIC_OVL int /* qsort comparison routine */
STATIC_OVL int CFDECLSPEC
strcmp_wrap(p, q) strcmp_wrap(p, q)
const void *p; const void *p;
const void *q; const void *q;
@@ -649,6 +649,7 @@ void
really_close() really_close()
{ {
int fd = lftrack.fd; int fd = lftrack.fd;
lftrack.nethack_thinks_it_is_open = FALSE; lftrack.nethack_thinks_it_is_open = FALSE;
lftrack.fd = -1; lftrack.fd = -1;
lftrack.oflag = 0; lftrack.oflag = 0;
@@ -670,6 +671,7 @@ int fd;
return close(fd); return close(fd);
} }
#else #else
int int
nhclose(fd) nhclose(fd)
int fd; int fd;
@@ -768,7 +770,7 @@ char errbuf[];
denies some or all access to world. denies some or all access to world.
*/ */
(void) chmod(file, FCMASK | 007); /* allow other users full access */ (void) chmod(file, FCMASK | 007); /* allow other users full access */
#endif /* VMS && !SECURE */ #endif /* VMS && !SECURE */
return fd; return fd;
} }
@@ -923,6 +925,7 @@ set_error_savefile()
#ifdef VMS #ifdef VMS
{ {
char *semi_colon = rindex(SAVEF, ';'); char *semi_colon = rindex(SAVEF, ';');
if (semi_colon) if (semi_colon)
*semi_colon = '\0'; *semi_colon = '\0';
} }
@@ -954,11 +957,11 @@ create_savefile()
fd = creat(fq_save, FCMASK); fd = creat(fq_save, FCMASK);
#endif #endif
#if defined(VMS) && !defined(SECURE) #if defined(VMS) && !defined(SECURE)
/* /*
Make sure the save file is owned by the current process. That's Make sure the save file is owned by the current process. That's
the default for non-privileged users, but for priv'd users the the default for non-privileged users, but for priv'd users the
file will be owned by the directory's owner instead of the user. file will be owned by the directory's owner instead of the user.
*/ */
#undef getuid #undef getuid
(void) chown(fq_save, getuid(), getgid()); (void) chown(fq_save, getuid(), getgid());
#define getuid() vms_getuid() #define getuid() vms_getuid()
@@ -1056,17 +1059,18 @@ const char *filename;
#else #else
#define EXTSTR "" #define EXTSTR ""
#endif #endif
if ( sscanf( filename, "%*[^/]/%d%63[^.]" EXTSTR, &uid, name ) == 2 ) { if ( sscanf( filename, "%*[^/]/%d%63[^.]" EXTSTR, &uid, name ) == 2 ) {
#undef EXTSTR #undef EXTSTR
/* "_" most likely means " ", which certainly looks nicer */ /* "_" most likely means " ", which certainly looks nicer */
for (k=0; name[k]; k++) for (k=0; name[k]; k++)
if ( name[k]=='_' ) if ( name[k] == '_' )
name[k]=' '; name[k] = ' ';
return dupstr(name); return dupstr(name);
} else } else
#endif /* UNIX && QT_GRAPHICS */ #endif /* UNIX && QT_GRAPHICS */
{ {
return 0; return 0;
} }
/* --------- end of obsolete code ----*/ /* --------- end of obsolete code ----*/
#endif /* 0 - WAS STORE_PLNAME_IN_FILE*/ #endif /* 0 - WAS STORE_PLNAME_IN_FILE*/
@@ -1125,6 +1129,7 @@ get_saved_games()
closedir(dir); closedir(dir);
if (n > 0) { if (n > 0) {
int i; int i;
if (!(dir = opendir(fqname("save", SAVEPREFIX, 0)))) if (!(dir = opendir(fqname("save", SAVEPREFIX, 0))))
return 0; return 0;
result = (char **) alloc((n + 1) * sizeof(char *)); /* at most */ result = (char **) alloc((n + 1) * sizeof(char *)); /* at most */
@@ -1133,12 +1138,14 @@ get_saved_games()
int uid; int uid;
char name[64]; /* more than PL_NSIZ */ char name[64]; /* more than PL_NSIZ */
struct dirent *entry = readdir(dir); struct dirent *entry = readdir(dir);
if (!entry) if (!entry)
break; break;
if (sscanf(entry->d_name, "%d%63s", &uid, name) == 2) { if (sscanf(entry->d_name, "%d%63s", &uid, name) == 2) {
if (uid == myuid) { if (uid == myuid) {
char filename[BUFSZ]; char filename[BUFSZ];
char *r; char *r;
Sprintf(filename, "save/%d%s", uid, name); Sprintf(filename, "save/%d%s", uid, name);
r = plname_from_file(filename); r = plname_from_file(filename);
if (r) if (r)
@@ -1158,7 +1165,7 @@ get_saved_games()
if (j > 0) { if (j > 0) {
if (j > 1) if (j > 1)
qsort(result, j, sizeof(char *), strcmp_wrap); qsort(result, j, sizeof (char *), strcmp_wrap);
result[j] = 0; result[j] = 0;
return result; return result;
} else if (result) { /* could happen if save files are obsolete */ } else if (result) { /* could happen if save files are obsolete */
@@ -1174,6 +1181,7 @@ char **saved;
{ {
if (saved) { if (saved) {
int i = 0; int i = 0;
while (saved[i]) while (saved[i])
free((genericptr_t) saved[i++]); free((genericptr_t) saved[i++]);
free((genericptr_t) saved); free((genericptr_t) saved);
@@ -1404,6 +1412,7 @@ char *cfn;
#else #else
#ifdef SAVE_EXTENSION #ifdef SAVE_EXTENSION
char *bp = (char *) 0; char *bp = (char *) 0;
strcpy(cfn, filename); strcpy(cfn, filename);
if ((bp = strstri(cfn, SAVE_EXTENSION))) { if ((bp = strstri(cfn, SAVE_EXTENSION))) {
strsubst(bp, SAVE_EXTENSION, ".saz"); strsubst(bp, SAVE_EXTENSION, ".saz");
@@ -1707,8 +1716,8 @@ int retryct;
/* take a wild guess at the underlying cause */ /* take a wild guess at the underlying cause */
HUP perror(lockname); HUP perror(lockname);
HUP raw_printf("Cannot lock %s.", filename); HUP raw_printf("Cannot lock %s.", filename);
HUP raw_printf("(Perhaps you are running NetHack from inside the " HUP raw_printf(
"distribution package?)."); "(Perhaps you are running NetHack from inside the distribution package?).");
nesting--; nesting--;
return FALSE; return FALSE;
default: default:
@@ -1884,9 +1893,9 @@ int src;
(void) strncpy(lastconfigfile, filename, BUFSZ - 1); (void) strncpy(lastconfigfile, filename, BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0'; lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0) if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0)
return (fp); return fp;
if ((fp = fopenp(filename, "r")) != (FILE *) 0) { if ((fp = fopenp(filename, "r")) != (FILE *) 0) {
return (fp); return fp;
#if defined(UNIX) || defined(VMS) #if defined(UNIX) || defined(VMS)
} else { } else {
/* access() above probably caught most problems for UNIX */ /* access() above probably caught most problems for UNIX */
@@ -1900,15 +1909,15 @@ int src;
#if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32) #if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32)
if ((fp = fopenp(fqname(configfile, CONFIGPREFIX, 0), "r")) != (FILE *) 0) if ((fp = fopenp(fqname(configfile, CONFIGPREFIX, 0), "r")) != (FILE *) 0)
return (fp); return fp;
if ((fp = fopenp(configfile, "r")) != (FILE *) 0) if ((fp = fopenp(configfile, "r")) != (FILE *) 0)
return (fp); return fp;
#ifdef MSDOS #ifdef MSDOS
if ((fp = fopenp(fqname(backward_compat_configfile, CONFIGPREFIX, 0), if ((fp = fopenp(fqname(backward_compat_configfile, CONFIGPREFIX, 0),
"r")) != (FILE *) 0) "r")) != (FILE *) 0)
return (fp); return fp;
if ((fp = fopenp(backward_compat_configfile, "r")) != (FILE *) 0) if ((fp = fopenp(backward_compat_configfile, "r")) != (FILE *) 0)
return (fp); return fp;
#endif #endif
#else #else
/* constructed full path names don't need fqname() */ /* constructed full path names don't need fqname() */
@@ -1917,12 +1926,12 @@ int src;
BUFSZ - 1); BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0'; lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0) { if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0) {
return (fp); return fp;
} }
(void) strncpy(lastconfigfile, "sys$login:nethack.ini", BUFSZ - 1); (void) strncpy(lastconfigfile, "sys$login:nethack.ini", BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0'; lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0) { if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0) {
return (fp); return fp;
} }
envp = nh_getenv("HOME"); envp = nh_getenv("HOME");
@@ -1934,7 +1943,7 @@ int src;
(void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1); (void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0'; lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(tmp_config, "r")) != (FILE *) 0) if ((fp = fopenp(tmp_config, "r")) != (FILE *) 0)
return (fp); return fp;
#else /* should be only UNIX left */ #else /* should be only UNIX left */
envp = nh_getenv("HOME"); envp = nh_getenv("HOME");
if (!envp) if (!envp)
@@ -1945,7 +1954,7 @@ int src;
(void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1); (void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0'; lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0) if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0)
return (fp); return fp;
#if defined(__APPLE__) #if defined(__APPLE__)
/* try an alternative */ /* try an alternative */
if (envp) { if (envp) {
@@ -1954,13 +1963,13 @@ int src;
(void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1); (void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0'; lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0) if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0)
return (fp); return fp;
Sprintf(tmp_config, "%s/%s", envp, Sprintf(tmp_config, "%s/%s", envp,
"Library/Preferences/NetHack Defaults.txt"); "Library/Preferences/NetHack Defaults.txt");
(void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1); (void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0'; lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0) if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0)
return (fp); return fp;
} }
#endif #endif
if (errno != ENOENT) { if (errno != ENOENT) {
@@ -2135,7 +2144,7 @@ int src;
} else if (match_varname(buf, "AUTOPICKUP_EXCEPTION", 5)) { } else if (match_varname(buf, "AUTOPICKUP_EXCEPTION", 5)) {
add_autopickup_exception(bufp); add_autopickup_exception(bufp);
} else if (match_varname(buf, "MSGTYPE", 7)) { } else if (match_varname(buf, "MSGTYPE", 7)) {
(void) msgtype_parse_add(bufp); (void) msgtype_parse_add(bufp);
#ifdef NOCWD_ASSUMPTIONS #ifdef NOCWD_ASSUMPTIONS
} else if (match_varname(buf, "HACKDIR", 4)) { } else if (match_varname(buf, "HACKDIR", 4)) {
adjust_prefix(bufp, HACKPREFIX); adjust_prefix(bufp, HACKPREFIX);
@@ -2398,11 +2407,13 @@ int src;
} else if (match_varname(buf, "DEPTH", 5)) { } else if (match_varname(buf, "DEPTH", 5)) {
extern int amii_numcolors; extern int amii_numcolors;
int val = atoi(bufp); int val = atoi(bufp);
amii_numcolors = 1L << min(DEPTH, val); amii_numcolors = 1L << min(DEPTH, val);
#ifdef SYSFLAGS #ifdef SYSFLAGS
} else if (match_varname(buf, "DRIPENS", 7)) { } else if (match_varname(buf, "DRIPENS", 7)) {
int i, val; int i, val;
char *t; char *t;
for (i = 0, t = strtok(bufp, ",/"); t != (char *) 0; for (i = 0, t = strtok(bufp, ",/"); t != (char *) 0;
i < 20 && (t = strtok((char *) 0, ",/")), ++i) { i < 20 && (t = strtok((char *) 0, ",/")), ++i) {
sscanf(t, "%d", &val); sscanf(t, "%d", &val);
@@ -2411,6 +2422,7 @@ int src;
#endif #endif
} else if (match_varname(buf, "SCREENMODE", 10)) { } else if (match_varname(buf, "SCREENMODE", 10)) {
extern long amii_scrnmode; extern long amii_scrnmode;
if (!stricmp(bufp, "req")) if (!stricmp(bufp, "req"))
amii_scrnmode = 0xffffffff; /* Requester */ amii_scrnmode = 0xffffffff; /* Requester */
else if (sscanf(bufp, "%x", &amii_scrnmode) != 1) else if (sscanf(bufp, "%x", &amii_scrnmode) != 1)
@@ -2418,6 +2430,7 @@ int src;
} else if (match_varname(buf, "MSGPENS", 7)) { } else if (match_varname(buf, "MSGPENS", 7)) {
extern int amii_msgAPen, amii_msgBPen; extern int amii_msgAPen, amii_msgBPen;
char *t = strtok(bufp, ",/"); char *t = strtok(bufp, ",/");
if (t) { if (t) {
sscanf(t, "%d", &amii_msgAPen); sscanf(t, "%d", &amii_msgAPen);
if (t = strtok((char *) 0, ",/")) if (t = strtok((char *) 0, ",/"))
@@ -2426,6 +2439,7 @@ int src;
} else if (match_varname(buf, "TEXTPENS", 8)) { } else if (match_varname(buf, "TEXTPENS", 8)) {
extern int amii_textAPen, amii_textBPen; extern int amii_textAPen, amii_textBPen;
char *t = strtok(bufp, ",/"); char *t = strtok(bufp, ",/");
if (t) { if (t) {
sscanf(t, "%d", &amii_textAPen); sscanf(t, "%d", &amii_textAPen);
if (t = strtok((char *) 0, ",/")) if (t = strtok((char *) 0, ",/"))
@@ -2434,6 +2448,7 @@ int src;
} else if (match_varname(buf, "MENUPENS", 8)) { } else if (match_varname(buf, "MENUPENS", 8)) {
extern int amii_menuAPen, amii_menuBPen; extern int amii_menuAPen, amii_menuBPen;
char *t = strtok(bufp, ",/"); char *t = strtok(bufp, ",/");
if (t) { if (t) {
sscanf(t, "%d", &amii_menuAPen); sscanf(t, "%d", &amii_menuAPen);
if (t = strtok((char *) 0, ",/")) if (t = strtok((char *) 0, ",/"))
@@ -2442,6 +2457,7 @@ int src;
} else if (match_varname(buf, "STATUSPENS", 10)) { } else if (match_varname(buf, "STATUSPENS", 10)) {
extern int amii_statAPen, amii_statBPen; extern int amii_statAPen, amii_statBPen;
char *t = strtok(bufp, ",/"); char *t = strtok(bufp, ",/");
if (t) { if (t) {
sscanf(t, "%d", &amii_statAPen); sscanf(t, "%d", &amii_statAPen);
if (t = strtok((char *) 0, ",/")) if (t = strtok((char *) 0, ",/"))
@@ -2450,6 +2466,7 @@ int src;
} else if (match_varname(buf, "OTHERPENS", 9)) { } else if (match_varname(buf, "OTHERPENS", 9)) {
extern int amii_otherAPen, amii_otherBPen; extern int amii_otherAPen, amii_otherBPen;
char *t = strtok(bufp, ",/"); char *t = strtok(bufp, ",/");
if (t) { if (t) {
sscanf(t, "%d", &amii_otherAPen); sscanf(t, "%d", &amii_otherAPen);
if (t = strtok((char *) 0, ",/")) if (t = strtok((char *) 0, ",/"))
@@ -2497,18 +2514,22 @@ int src;
/* These should move to wc_ options */ /* These should move to wc_ options */
} else if (match_varname(buf, "QT_TILEWIDTH", 12)) { } else if (match_varname(buf, "QT_TILEWIDTH", 12)) {
extern char *qt_tilewidth; extern char *qt_tilewidth;
if (qt_tilewidth == NULL) if (qt_tilewidth == NULL)
qt_tilewidth = dupstr(bufp); qt_tilewidth = dupstr(bufp);
} else if (match_varname(buf, "QT_TILEHEIGHT", 13)) { } else if (match_varname(buf, "QT_TILEHEIGHT", 13)) {
extern char *qt_tileheight; extern char *qt_tileheight;
if (qt_tileheight == NULL) if (qt_tileheight == NULL)
qt_tileheight = dupstr(bufp); qt_tileheight = dupstr(bufp);
} else if (match_varname(buf, "QT_FONTSIZE", 11)) { } else if (match_varname(buf, "QT_FONTSIZE", 11)) {
extern char *qt_fontsize; extern char *qt_fontsize;
if (qt_fontsize == NULL) if (qt_fontsize == NULL)
qt_fontsize = dupstr(bufp); qt_fontsize = dupstr(bufp);
} else if (match_varname(buf, "QT_COMPACT", 10)) { } else if (match_varname(buf, "QT_COMPACT", 10)) {
extern int qt_compact_mode; extern int qt_compact_mode;
qt_compact_mode = atoi(bufp); qt_compact_mode = atoi(bufp);
#endif #endif
} else } else
@@ -2521,7 +2542,7 @@ boolean
can_read_file(filename) can_read_file(filename)
const char *filename; const char *filename;
{ {
return (access(filename, 4) == 0); return (boolean) (access(filename, 4) == 0);
} }
#endif /* USER_SOUNDS */ #endif /* USER_SOUNDS */
@@ -2544,8 +2565,7 @@ int src;
#ifdef notyet #ifdef notyet
/* /*
XXX Don't call read() in parse_config_line, read as callback or reassemble XXX Don't call read() in parse_config_line, read as callback or reassemble
line line at this level.
at this level.
OR: Forbid multiline stuff for alternate config sources. OR: Forbid multiline stuff for alternate config sources.
*/ */
#endif #endif
@@ -2591,7 +2611,7 @@ fopen_wizkit_file()
} else } else
#endif #endif
if ((fp = fopenp(wizkit, "r")) != (FILE *) 0) { if ((fp = fopenp(wizkit, "r")) != (FILE *) 0) {
return (fp); return fp;
#if defined(UNIX) || defined(VMS) #if defined(UNIX) || defined(VMS)
} else { } else {
/* access() above probably caught most problems for UNIX */ /* access() above probably caught most problems for UNIX */
@@ -2603,7 +2623,7 @@ fopen_wizkit_file()
#if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32) #if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32)
if ((fp = fopenp(fqname(wizkit, CONFIGPREFIX, 0), "r")) != (FILE *) 0) if ((fp = fopenp(fqname(wizkit, CONFIGPREFIX, 0), "r")) != (FILE *) 0)
return (fp); return fp;
#else #else
#ifdef VMS #ifdef VMS
envp = nh_getenv("HOME"); envp = nh_getenv("HOME");
@@ -2612,7 +2632,7 @@ fopen_wizkit_file()
else else
Sprintf(tmp_wizkit, "%s%s", "sys$login:", wizkit); Sprintf(tmp_wizkit, "%s%s", "sys$login:", wizkit);
if ((fp = fopenp(tmp_wizkit, "r")) != (FILE *) 0) if ((fp = fopenp(tmp_wizkit, "r")) != (FILE *) 0)
return (fp); return fp;
#else /* should be only UNIX left */ #else /* should be only UNIX left */
envp = nh_getenv("HOME"); envp = nh_getenv("HOME");
if (envp) if (envp)
@@ -2620,7 +2640,7 @@ fopen_wizkit_file()
else else
Strcpy(tmp_wizkit, wizkit); Strcpy(tmp_wizkit, wizkit);
if ((fp = fopenp(tmp_wizkit, "r")) != (FILE *) 0) if ((fp = fopenp(tmp_wizkit, "r")) != (FILE *) 0)
return (fp); return fp;
else if (errno != ENOENT) { else if (errno != ENOENT) {
/* e.g., problems when setuid NetHack can't search home /* e.g., problems when setuid NetHack can't search home
* directory restricted to user */ * directory restricted to user */
@@ -2808,10 +2828,11 @@ int which_set;
values from the file, so only do that */ values from the file, so only do that */
if (symp->range == SYM_CONTROL) { if (symp->range == SYM_CONTROL) {
struct symsetentry *tmpsp; struct symsetentry *tmpsp;
switch (symp->idx) { switch (symp->idx) {
case 0: case 0:
tmpsp = tmpsp =
(struct symsetentry *) alloc(sizeof(struct symsetentry)); (struct symsetentry *) alloc(sizeof (struct symsetentry));
tmpsp->next = (struct symsetentry *) 0; tmpsp->next = (struct symsetentry *) 0;
if (!symset_list) { if (!symset_list) {
symset_list = tmpsp; symset_list = tmpsp;
@@ -2911,6 +2932,7 @@ int which_set;
case 5: /* restrictions: xxxx*/ case 5: /* restrictions: xxxx*/
if (chosen_symset_start) { if (chosen_symset_start) {
int n = 0; int n = 0;
while (known_restrictions[n]) { while (known_restrictions[n]) {
if (!strcmpi(known_restrictions[n], bufp)) { if (!strcmpi(known_restrictions[n], bufp)) {
switch (n) { switch (n) {
@@ -3107,12 +3129,12 @@ recover_savefile()
processed[lev] = 0; processed[lev] = 0;
/* level 0 file contains: /* level 0 file contains:
* pid of creating process (ignored here) * pid of creating process (ignored here)
* level number for current level of save file * level number for current level of save file
* name of save file nethack would have created * name of save file nethack would have created
* savefile info * savefile info
* player name * player name
* and game state * and game state
*/ */
gfd = open_levelfile(0, errbuf); gfd = open_levelfile(0, errbuf);
if (gfd < 0) { if (gfd < 0) {
@@ -3120,15 +3142,16 @@ recover_savefile()
return FALSE; return FALSE;
} }
if (read(gfd, (genericptr_t) &hpid, sizeof hpid) != sizeof hpid) { if (read(gfd, (genericptr_t) &hpid, sizeof hpid) != sizeof hpid) {
raw_printf("\nCheckpoint data incompletely written or subsequently " raw_printf("\n%s\n%s\n",
"clobbered. Recovery impossible."); "Checkpoint data incompletely written or subsequently clobbered.",
"Recovery impossible.");
(void) nhclose(gfd); (void) nhclose(gfd);
return FALSE; return FALSE;
} }
if (read(gfd, (genericptr_t) &savelev, sizeof(savelev)) if (read(gfd, (genericptr_t) &savelev, sizeof(savelev))
!= sizeof(savelev)) { != sizeof(savelev)) {
raw_printf("\nCheckpointing was not in effect for %s -- recovery " raw_printf(
"impossible.\n", "\nCheckpointing was not in effect for %s -- recovery impossible.\n",
lock); lock);
(void) nhclose(gfd); (void) nhclose(gfd);
return FALSE; return FALSE;
@@ -3147,12 +3170,12 @@ recover_savefile()
} }
/* save file should contain: /* save file should contain:
* version info * version info
* savefile info * savefile info
* player name * player name
* current level (including pets) * current level (including pets)
* (non-level-based) game state * (non-level-based) game state
* other levels * other levels
*/ */
set_savefile_name(TRUE); set_savefile_name(TRUE);
sfd = create_savefile(); sfd = create_savefile();
@@ -3445,14 +3468,14 @@ char *nowin_buf;
/* /*
* Syntax (not case-sensitive): * Syntax (not case-sensitive):
* %section books * %section books
* *
* In the books section: * In the books section:
* %title booktitle(n) * %title booktitle (n)
* where booktitle=book title * where booktitle=book title without quotes
* (n)= total number of passages present for this title * (n)= total number of passages present for this title
* %passage n * %passage k
* where n=sequential passage number * where k=sequential passage number
* *
* %e ends the passage/book/section * %e ends the passage/book/section
* If in a passage, it marks the end of that passage. * If in a passage, it marks the end of that passage.
@@ -3471,6 +3494,7 @@ char *nowin_buf;
case '%': case '%':
if (!strncmpi(&line[1], "section ", sizeof("section ") - 1)) { if (!strncmpi(&line[1], "section ", sizeof("section ") - 1)) {
char *st = &line[9]; /* 9 from "%section " */ char *st = &line[9]; /* 9 from "%section " */
scope = SECTIONSCOPE; scope = SECTIONSCOPE;
if (!strcmpi(st, tribsection)) if (!strcmpi(st, tribsection))
matchedsection = TRUE; matchedsection = TRUE;
@@ -3479,6 +3503,7 @@ char *nowin_buf;
} else if (!strncmpi(&line[1], "title ", sizeof("title ") - 1)) { } else if (!strncmpi(&line[1], "title ", sizeof("title ") - 1)) {
char *st = &line[7]; /* 7 from "%title " */ char *st = &line[7]; /* 7 from "%title " */
char *p1, *p2; char *p1, *p2;
if ((p1 = index(st, '(')) != 0) { if ((p1 = index(st, '(')) != 0) {
*p1++ = '\0'; *p1++ = '\0';
(void) mungspaces(st); (void) mungspaces(st);
@@ -3508,6 +3533,7 @@ char *nowin_buf;
sizeof("passage ") - 1)) { sizeof("passage ") - 1)) {
int passagenum = 0; int passagenum = 0;
char *st = &line[9]; /* 9 from "%passage " */ char *st = &line[9]; /* 9 from "%passage " */
while (*st == ' ' || *st == '\t') while (*st == ' ' || *st == '\t')
st++; st++;
if (*st && digit(*st) && (strlen(st) < 3)) if (*st && digit(*st) && (strlen(st) < 3))
@@ -3522,8 +3548,9 @@ char *nowin_buf;
} }
} }
} else if (!strncmpi(&line[1], "e ", sizeof("e ") - 1)) { } else if (!strncmpi(&line[1], "e ", sizeof("e ") - 1)) {
if (matchedtitle && (scope == PASSAGESCOPE) if (matchedtitle && scope == PASSAGESCOPE
&& ((!nowin_buf && tribwin != WIN_ERR) || (nowin_buf && foundpassage))) && ((!nowin_buf && tribwin != WIN_ERR)
|| (nowin_buf && foundpassage)))
goto cleanup; goto cleanup;
if (scope == TITLESCOPE) if (scope == TITLESCOPE)
matchedtitle = FALSE; matchedtitle = FALSE;
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mhitm.c $NHDT-Date: 1446604113 2015/11/04 02:28:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.82 $ */ /* NetHack 3.6 mhitm.c $NHDT-Date: 1446854229 2015/11/06 23:57:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.83 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -568,8 +568,8 @@ struct attack *mattk;
} }
if (mdef->minvis && !perceives(magr->data)) { if (mdef->minvis && !perceives(magr->data)) {
if (canseemon(magr)) { if (canseemon(magr)) {
pline("%s doesn't seem to notice that %s gaze was " pline(
"reflected.", "%s doesn't seem to notice that %s gaze was reflected.",
Monnam(magr), mhis(magr)); Monnam(magr), mhis(magr));
} }
return MM_MISS; return MM_MISS;
+50 -53
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mhitu.c $NHDT-Date: 1445556872 2015/10/22 23:34:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.129 $ */ /* NetHack 3.6 mhitu.c $NHDT-Date: 1446854230 2015/11/06 23:57:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.130 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -114,11 +114,9 @@ struct attack *mattk;
it's better than "sting" when not a stinging attack... */ it's better than "sting" when not a stinging attack... */
return (!mwep || !mwep->opoisoned) ? "attack" : "weapon"; return (!mwep || !mwep->opoisoned) ? "attack" : "weapon";
} else { } else {
return (mattk->aatyp == AT_TUCH) return (mattk->aatyp == AT_TUCH) ? "contact"
? "contact" : (mattk->aatyp == AT_GAZE) ? "gaze"
: (mattk->aatyp == AT_GAZE) : (mattk->aatyp == AT_BITE) ? "bite" : "sting";
? "gaze"
: (mattk->aatyp == AT_BITE) ? "bite" : "sting";
} }
} }
@@ -281,12 +279,12 @@ struct attack *alt_attk_buf;
/* /*
* mattacku: monster attacks you * mattacku: monster attacks you
* returns 1 if monster dies (e.g. "yellow light"), 0 otherwise * returns 1 if monster dies (e.g. "yellow light"), 0 otherwise
* Note: if you're displaced or invisible the monster might attack the * Note: if you're displaced or invisible the monster might attack the
* wrong position... * wrong position...
* Assumption: it's attacking you or an empty square; if there's another * Assumption: it's attacking you or an empty square; if there's another
* monster which it attacks by mistake, the caller had better * monster which it attacks by mistake, the caller had better
* take care of it... * take care of it...
*/ */
int int
mattacku(mtmp) mattacku(mtmp)
@@ -323,9 +321,8 @@ register struct monst *mtmp;
foundyou = 1; foundyou = 1;
if (u.uinvulnerable) if (u.uinvulnerable)
return 0; /* stomachs can't hurt you! */ return 0; /* stomachs can't hurt you! */
}
else if (u.usteed) { } else if (u.usteed) {
if (mtmp == u.usteed) if (mtmp == u.usteed)
/* Your steed won't attack you */ /* Your steed won't attack you */
return 0; return 0;
@@ -410,9 +407,9 @@ register struct monst *mtmp;
} else { } else {
/* surface hider */ /* surface hider */
if (!youseeit) if (!youseeit) {
pline("It tries to move where you are hiding."); pline("It tries to move where you are hiding.");
else { } else {
/* Ugly kludge for eggs. The message is phrased so as /* Ugly kludge for eggs. The message is phrased so as
* to be directed at the monster, not the player, * to be directed at the monster, not the player,
* which makes "laid by you" wrong. For the * which makes "laid by you" wrong. For the
@@ -425,6 +422,7 @@ register struct monst *mtmp;
|| (youmonst.data->mlet == S_EEL || (youmonst.data->mlet == S_EEL
&& is_pool(u.ux, u.uy))) { && is_pool(u.ux, u.uy))) {
int save_spe = 0; /* suppress warning */ int save_spe = 0; /* suppress warning */
if (obj) { if (obj) {
save_spe = obj->spe; save_spe = obj->spe;
if (obj->otyp == EGG) if (obj->otyp == EGG)
@@ -433,11 +431,11 @@ register struct monst *mtmp;
if (youmonst.data->mlet == S_EEL if (youmonst.data->mlet == S_EEL
|| u.umonnum == PM_TRAPPER) || u.umonnum == PM_TRAPPER)
pline( pline(
"Wait, %s! There's a hidden %s named %s there!", "Wait, %s! There's a hidden %s named %s there!",
m_monnam(mtmp), youmonst.data->mname, plname); m_monnam(mtmp), youmonst.data->mname, plname);
else else
pline("Wait, %s! There's a %s named %s hiding under " pline(
"%s!", "Wait, %s! There's a %s named %s hiding under %s!",
m_monnam(mtmp), youmonst.data->mname, plname, m_monnam(mtmp), youmonst.data->mname, plname,
doname(level.objects[u.ux][u.uy])); doname(level.objects[u.ux][u.uy]));
if (obj) if (obj)
@@ -486,6 +484,7 @@ register struct monst *mtmp;
plname); plname);
if (multi < 0) { /* this should always be the case */ if (multi < 0) { /* this should always be the case */
char buf[BUFSZ]; char buf[BUFSZ];
Sprintf(buf, "You appear to be %s again.", Sprintf(buf, "You appear to be %s again.",
Upolyd ? (const char *) an(youmonst.data->mname) Upolyd ? (const char *) an(youmonst.data->mname)
: (const char *) "yourself"); : (const char *) "yourself");
@@ -494,7 +493,7 @@ register struct monst *mtmp;
return 0; return 0;
} }
/* Work out the armor class differential */ /* Work out the armor class differential */
tmp = AC_VALUE(u.uac) + 10; /* tmp ~= 0 - 20 */ tmp = AC_VALUE(u.uac) + 10; /* tmp ~= 0 - 20 */
tmp += mtmp->m_lev; tmp += mtmp->m_lev;
if (multi < 0) if (multi < 0)
@@ -512,14 +511,14 @@ register struct monst *mtmp;
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
} }
/* Special demon handling code */ /* Special demon handling code */
if ((mtmp->cham == NON_PM) && is_demon(mdat) && !range2 if ((mtmp->cham == NON_PM) && is_demon(mdat) && !range2
&& mtmp->data != &mons[PM_BALROG] && mtmp->data != &mons[PM_SUCCUBUS] && mtmp->data != &mons[PM_BALROG] && mtmp->data != &mons[PM_SUCCUBUS]
&& mtmp->data != &mons[PM_INCUBUS]) && mtmp->data != &mons[PM_INCUBUS])
if (!mtmp->mcan && !rn2(13)) if (!mtmp->mcan && !rn2(13))
(void) msummon(mtmp); (void) msummon(mtmp);
/* Special lycanthrope handling code */ /* Special lycanthrope handling code */
if ((mtmp->cham == NON_PM) && is_were(mdat) && !range2) { if ((mtmp->cham == NON_PM) && is_were(mdat) && !range2) {
if (is_human(mdat)) { if (is_human(mdat)) {
if (!rn2(5 - (night() * 2)) && !mtmp->mcan) if (!rn2(5 - (night() * 2)) && !mtmp->mcan)
@@ -838,9 +837,9 @@ struct monst *mon;
/* /*
* hitmu: monster hits you * hitmu: monster hits you
* returns 2 if monster dies (e.g. "yellow light"), 1 otherwise * returns 2 if monster dies (e.g. "yellow light"), 1 otherwise
* 3 if the monster lives but teleported/paralyzed, so it can't keep * 3 if the monster lives but teleported/paralyzed, so it can't keep
* attacking you * attacking you
*/ */
STATIC_OVL int STATIC_OVL int
hitmu(mtmp, mattk) hitmu(mtmp, mattk)
@@ -857,8 +856,8 @@ register struct attack *mattk;
if (!canspotmon(mtmp)) if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my); map_invisible(mtmp->mx, mtmp->my);
/* If the monster is undetected & hits you, you should know where /* If the monster is undetected & hits you, you should know where
* the attack came from. * the attack came from.
*/ */
if (mtmp->mundetected && (hides_under(mdat) || mdat->mlet == S_EEL)) { if (mtmp->mundetected && (hides_under(mdat) || mdat->mlet == S_EEL)) {
mtmp->mundetected = 0; mtmp->mundetected = 0;
@@ -880,21 +879,20 @@ register struct attack *mattk;
} }
} }
/* First determine the base damage done */ /* First determine the base damage done */
dmg = d((int) mattk->damn, (int) mattk->damd); dmg = d((int) mattk->damn, (int) mattk->damd);
if ((is_undead(mdat) || is_vampshifter(mtmp)) && midnight()) if ((is_undead(mdat) || is_vampshifter(mtmp)) && midnight())
dmg += d((int) mattk->damn, (int) mattk->damd); /* extra damage */ dmg += d((int) mattk->damn, (int) mattk->damd); /* extra damage */
/* Next a cancellation factor */ /* Next a cancellation factor.
/* Use uncancelled when the cancellation factor takes into account * Use uncancelled when cancellation factor takes into account certain
*certain * armor's special magic protection. Otherwise just use !mtmp->mcan.
* armor's special magic protection. Otherwise just use !mtmp->mcan.
*/ */
armpro = magic_negation(&youmonst); armpro = magic_negation(&youmonst);
uncancelled = !mtmp->mcan && (rn2(10) >= 3 * armpro); uncancelled = !mtmp->mcan && (rn2(10) >= 3 * armpro);
permdmg = 0; permdmg = 0;
/* Now, adjust damages via resistances or specific attacks */ /* Now, adjust damages via resistances or specific attacks */
switch (mattk->adtyp) { switch (mattk->adtyp) {
case AD_PHYS: case AD_PHYS:
if (mattk->aatyp == AT_HUGS && !sticks(youmonst.data)) { if (mattk->aatyp == AT_HUGS && !sticks(youmonst.data)) {
@@ -1262,8 +1260,7 @@ register struct attack *mattk;
pline("%s %s.", Monnam(mtmp), pline("%s %s.", Monnam(mtmp),
mtmp->minvent mtmp->minvent
? "brags about the goods some dungeon explorer provided" ? "brags about the goods some dungeon explorer provided"
: "makes some remarks about how difficult theft is " : "makes some remarks about how difficult theft is lately");
"lately");
if (!tele_restrict(mtmp)) if (!tele_restrict(mtmp))
(void) rloc(mtmp, TRUE); (void) rloc(mtmp, TRUE);
return 3; return 3;
@@ -1440,7 +1437,7 @@ register struct attack *mattk;
pline("You're covered in acid, but it seems harmless."); pline("You're covered in acid, but it seems harmless.");
dmg = 0; dmg = 0;
} else { } else {
pline("You're covered in acid! It burns!"); pline("You're covered in acid! It burns!");
exercise(A_STR, FALSE); exercise(A_STR, FALSE);
} }
else else
@@ -1551,8 +1548,8 @@ register struct attack *mattk;
if (u.uhp < 1) if (u.uhp < 1)
done_in_by(mtmp, DIED); done_in_by(mtmp, DIED);
/* Negative armor class reduces damage done instead of fully protecting /* Negative armor class reduces damage done instead of fully protecting
* against hits. * against hits.
*/ */
if (dmg && u.uac < 0) { if (dmg && u.uac < 0) {
dmg -= rnd(-u.uac); dmg -= rnd(-u.uac);
@@ -1572,11 +1569,11 @@ register struct attack *mattk;
int lowerlimit, *hpmax_p; int lowerlimit, *hpmax_p;
/* /*
* Apply some of the damage to permanent hit points: * Apply some of the damage to permanent hit points:
* polymorphed 100% against poly'd hpmax * polymorphed 100% against poly'd hpmax
* hpmax > 25*lvl 100% against normal hpmax * hpmax > 25*lvl 100% against normal hpmax
* hpmax > 10*lvl 50..100% * hpmax > 10*lvl 50..100%
* hpmax > 5*lvl 25..75% * hpmax > 5*lvl 25..75%
* otherwise 0..50% * otherwise 0..50%
* Never reduces hpmax below 1 hit point per level. * Never reduces hpmax below 1 hit point per level.
*/ */
permdmg = rn2(dmg / 2 + 1); permdmg = rn2(dmg / 2 + 1);
@@ -2026,8 +2023,8 @@ register struct attack *mattk;
break; break;
if (!m_canseeu(mtmp)) { /* probably you're invisible */ if (!m_canseeu(mtmp)) { /* probably you're invisible */
if (useeit) if (useeit)
pline("%s doesn't seem to notice that %s gaze was " pline(
"reflected.", "%s doesn't seem to notice that %s gaze was reflected.",
Monnam(mtmp), mhis(mtmp)); Monnam(mtmp), mhis(mtmp));
break; break;
} }
@@ -2202,13 +2199,14 @@ register int n;
} }
} }
/* returns 0 if seduction impossible,
* 1 if fine,
* 2 if wrong gender for nymph
*/
int int
could_seduce(magr, mdef, mattk) could_seduce(magr, mdef, mattk)
struct monst *magr, *mdef; struct monst *magr, *mdef;
struct attack *mattk; struct attack *mattk;
/* returns 0 if seduction impossible,
* 1 if fine,
* 2 if wrong gender for nymph */
{ {
register struct permonst *pagr; register struct permonst *pagr;
boolean agrinvis, defperc; boolean agrinvis, defperc;
@@ -2327,10 +2325,9 @@ register struct monst *mon;
break; /* no point trying further rings */ break; /* no point trying further rings */
} }
if (rn2(20) < ACURR(A_CHA)) { if (rn2(20) < ACURR(A_CHA)) {
(void) safe_qbuf( (void) safe_qbuf(qbuf, "\"That ",
qbuf, "\"That ", " looks pretty. Would you wear it for me?\"",
" looks pretty. Would you wear it for me?\"", ring, ring, xname, simpleonames, "ring");
xname, simpleonames, "ring");
makeknown(RIN_ADORNMENT); makeknown(RIN_ADORNMENT);
if (yn(qbuf) == 'n') if (yn(qbuf) == 'n')
continue; continue;
+3 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1446808448 2015/11/06 11:14:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.235 $ */ /* NetHack 3.6 options.c $NHDT-Date: 1446854231 2015/11/06 23:57:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.236 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -4084,7 +4084,7 @@ boolean setinitial, setfromfile;
mttyp = query_msgtype(); mttyp = query_msgtype();
if (mttyp == -1) if (mttyp == -1)
goto msgtypes_again; goto msgtypes_again;
if (!msgtype_add(mttyp, mtbuf)) { if (!msgtype_add(mttyp, mtbuf)) {
pline("Error adding the message type."); pline("Error adding the message type.");
wait_synch(); wait_synch();
goto msgtypes_again; goto msgtypes_again;
@@ -5017,8 +5017,7 @@ static const char *opt_intro[] = {
"-- for example, $ DEFINE NETHACKOPTIONS \"noautopickup,fruit:kumquat\"", "-- for example, $ DEFINE NETHACKOPTIONS \"noautopickup,fruit:kumquat\"",
#endif #endif
"or press \"O\" while playing and use the menu.", "", "or press \"O\" while playing and use the menu.", "",
"Boolean options (which can be negated by prefixing them with '!' or " "Boolean options (which can be negated by prefixing them with '!' or \"no\"):",
"\"no\"):",
(char *) 0 (char *) 0
}; };
+11 -11
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 pray.c $NHDT-Date: 1446191091 2015/10/30 07:44:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.86 $ */ /* NetHack 3.6 pray.c $NHDT-Date: 1446854232 2015/11/06 23:57:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.87 $ */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1017,8 +1017,8 @@ aligntyp g_align;
verbalize("Hark, %s!", youmonst.data->mlet == S_HUMAN verbalize("Hark, %s!", youmonst.data->mlet == S_HUMAN
? "mortal" ? "mortal"
: "creature"); : "creature");
verbalize("To enter the castle, thou must play the right " verbalize(
"tune!"); "To enter the castle, thou must play the right tune!");
u.uevent.uheard_tune++; u.uevent.uheard_tune++;
break; break;
} else if (u.uevent.uheard_tune < 2) { } else if (u.uevent.uheard_tune < 2) {
@@ -1236,8 +1236,8 @@ register struct obj *otmp;
Your("sacrifice puffs up, swelling bigger and bigger, and pops!"); Your("sacrifice puffs up, swelling bigger and bigger, and pops!");
break; break;
case 2: case 2:
Your("sacrifice collapses into a cloud of dancing particles and " Your(
"fades away!"); "sacrifice collapses into a cloud of dancing particles and fades away!");
break; break;
} }
else if (Blind && u.ualign.type == A_LAWFUL) else if (Blind && u.ualign.type == A_LAWFUL)
@@ -1328,8 +1328,8 @@ dosacrifice()
/* Human sacrifice on a chaotic or unaligned altar */ /* Human sacrifice on a chaotic or unaligned altar */
/* is equivalent to demon summoning */ /* is equivalent to demon summoning */
if (altaralign == A_CHAOTIC && u.ualign.type != A_CHAOTIC) { if (altaralign == A_CHAOTIC && u.ualign.type != A_CHAOTIC) {
pline("The blood floods the altar, which vanishes in %s " pline(
"cloud!", "The blood floods the altar, which vanishes in %s cloud!",
an(hcolor(NH_BLACK))); an(hcolor(NH_BLACK)));
levl[u.ux][u.uy].typ = ROOM; levl[u.ux][u.uy].typ = ROOM;
levl[u.ux][u.uy].altarmask = 0; levl[u.ux][u.uy].altarmask = 0;
@@ -1484,12 +1484,12 @@ dosacrifice()
} else { /* super big win */ } else { /* super big win */
adjalign(10); adjalign(10);
u.uachieve.ascended = 1; u.uachieve.ascended = 1;
pline("An invisible choir sings, and you are bathed in " pline(
"radiance..."); "An invisible choir sings, and you are bathed in radiance...");
godvoice(altaralign, "Congratulations, mortal!"); godvoice(altaralign, "Congratulations, mortal!");
display_nhwindow(WIN_MESSAGE, FALSE); display_nhwindow(WIN_MESSAGE, FALSE);
verbalize("In return for thy service, I grant thee the gift " verbalize(
"of Immortality!"); "In return for thy service, I grant thee the gift of Immortality!");
You("ascend to the status of Demigod%s...", You("ascend to the status of Demigod%s...",
flags.female ? "dess" : ""); flags.female ? "dess" : "");
done(ASCENDED); done(ASCENDED);
+11 -13
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 read.c $NHDT-Date: 1446777536 2015/11/06 02:38:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.120 $ */ /* NetHack 3.6 read.c $NHDT-Date: 1446854233 2015/11/06 23:57:13 $ $NHDT-Branch: master $:$NHDT-Revision: 1.121 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -72,11 +72,9 @@ char *buf;
{ {
static const char *shirt_msgs[] = { static const char *shirt_msgs[] = {
/* Scott Bigham */ /* Scott Bigham */
"I explored the Dungeons of Doom and all I got was this lousy " "I explored the Dungeons of Doom and all I got was this lousy T-shirt!",
"T-shirt!",
"Is that Mjollnir in your pocket or are you just happy to see me?", "Is that Mjollnir in your pocket or are you just happy to see me?",
"It's not the size of your sword, it's how #enhance'd you are with " "It's not the size of your sword, it's how #enhance'd you are with it.",
"it.",
"Madame Elvira's House O' Succubi Lifetime Customer", "Madame Elvira's House O' Succubi Lifetime Customer",
"Madame Elvira's House O' Succubi Employee of the Month", "Madame Elvira's House O' Succubi Employee of the Month",
"Ludios Vault Guards Do It In Small, Dark Rooms", "Ludios Vault Guards Do It In Small, Dark Rooms",
@@ -104,8 +102,7 @@ char *buf;
"I want to live forever or die in the attempt.", "Lichen Park", "I want to live forever or die in the attempt.", "Lichen Park",
"LOST IN THOUGHT - please send search party", "Meat is Mordor", "LOST IN THOUGHT - please send search party", "Meat is Mordor",
"Minetown Better Business Bureau", "Minetown Watch", "Minetown Better Business Bureau", "Minetown Watch",
"Ms. Palm's House of Negotiable Affection -- A Very Reputable House " "Ms. Palm's House of Negotiable Affection -- A Very Reputable House Of Disrepute",
"Of Disrepute",
"Protection Racketeer", "Real men love Crom", "Protection Racketeer", "Real men love Crom",
"Somebody stole my Mojo!", "The Hellhound Gang", "The Werewolves", "Somebody stole my Mojo!", "The Hellhound Gang", "The Werewolves",
"They Might Be Storm Giants", "They Might Be Storm Giants",
@@ -292,8 +289,9 @@ doread()
maintained illiterate conduct so far, and this mail maintained illiterate conduct so far, and this mail
scroll didn't come from bones, ask for confirmation */ scroll didn't come from bones, ask for confirmation */
if (!u.uconduct.literate) { if (!u.uconduct.literate) {
if (!scroll->spe && yn("Reading mail will violate \"illiterate\" " if (!scroll->spe && yn(
"conduct. Read anyway?") != 'y') "Reading mail will violate \"illiterate\" conduct. Read anyway?"
) != 'y')
return 0; return 0;
} }
} }
@@ -937,8 +935,8 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
case SCR_MAIL: case SCR_MAIL:
known = TRUE; known = TRUE;
if (sobj->spe) if (sobj->spe)
pline("This seems to be junk mail addressed to the finder of the " pline(
"Eye of Larn."); "This seems to be junk mail addressed to the finder of the Eye of Larn.");
/* note to the puzzled: the game Larn actually sends you junk /* note to the puzzled: the game Larn actually sends you junk
* mail if you win! * mail if you win!
*/ */
@@ -1494,8 +1492,8 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
if (Hallucination) /* Ommmmmm! */ if (Hallucination) /* Ommmmmm! */
Your("mind releases itself from mundane concerns."); Your("mind releases itself from mundane concerns.");
else if (!strncmpi(plname, "Maud", 4)) else if (!strncmpi(plname, "Maud", 4))
pline("As your mind turns inward on itself, you forget " pline(
"everything else."); "As your mind turns inward on itself, you forget everything else.");
else if (rn2(2)) else if (rn2(2))
pline("Who was that Maud person anyway?"); pline("Who was that Maud person anyway?");
else else
+10 -13
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 shk.c $NHDT-Date: 1446713640 2015/11/05 08:54:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.115 $ */ /* NetHack 3.6 shk.c $NHDT-Date: 1446854234 2015/11/06 23:57:14 $ $NHDT-Branch: master $:$NHDT-Revision: 1.116 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2834,8 +2834,8 @@ xchar x, y;
if ((eshkp->robbed -= offer < 0L)) if ((eshkp->robbed -= offer < 0L))
eshkp->robbed = 0L; eshkp->robbed = 0L;
if (offer && !muteshk(shkp)) if (offer && !muteshk(shkp))
verbalize("Thank you for your contribution to restock this " verbalize(
"recently plundered shop."); "Thank you for your contribution to restock this recently plundered shop.");
subfrombill(obj, shkp); subfrombill(obj, shkp);
return; return;
} }
@@ -3012,16 +3012,13 @@ xchar x, y;
obj->no_charge = 1; obj->no_charge = 1;
subfrombill(obj, shkp); subfrombill(obj, shkp);
pay(-offer, shkp); pay(-offer, shkp);
shk_names_obj( shk_names_obj(shkp, obj,
shkp, obj, (sell_how != SELL_NORMAL)
(sell_how != SELL_NORMAL) ? ((!ltmp && cltmp && only_partially_your_contents)
? (!ltmp && cltmp && only_partially_your_contents) ? "sold some items inside %s for %ld gold piece%s.%s"
? "sold some items inside %s for %ld gold " : "sold %s for %ld gold piece%s.%s")
"piece%s.%s" : "relinquish %s and receive %ld gold piece%s in compensation.%s",
: "sold %s for %ld gold piece%s.%s" offer, "");
: "relinquish %s and receive %ld gold piece%s in "
"compensation.%s",
offer, "");
break; break;
default: default:
impossible("invalid sell response"); impossible("invalid sell response");
+5 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 sp_lev.c $NHDT-Date: 1446713642 2015/11/05 08:54:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */ /* NetHack 3.6 sp_lev.c $NHDT-Date: 1446854235 2015/11/06 23:57:15 $ $NHDT-Branch: master $:$NHDT-Revision: 1.69 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */ /* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1652,8 +1652,8 @@ struct mkroom *croom;
break; break;
} }
default: default:
impossible("create_monster: unimplemented mon appear type " impossible(
"[%d,\"%s\"]", "create_monster: unimplemented mon appear type [%d,\"%s\"]",
m->appear, m->appear_as.str); m->appear, m->appear_as.str);
break; break;
} }
@@ -1841,8 +1841,8 @@ struct mkroom *croom;
remove_object(otmp); remove_object(otmp);
if (mpickobj(invent_carrying_monster, otmp)) { if (mpickobj(invent_carrying_monster, otmp)) {
if (inuse > -1) { if (inuse > -1) {
impossible("container given to monster was merged or " impossible(
"deallocated."); "container given to monster was merged or deallocated.");
for (ci = inuse; ci < container_idx - 1; ci++) for (ci = inuse; ci < container_idx - 1; ci++)
container_obj[ci] = container_obj[ci + 1]; container_obj[ci] = container_obj[ci + 1];
container_obj[container_idx] = NULL; container_obj[container_idx] = NULL;
+8 -8
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 spell.c $NHDT-Date: 1446632870 2015/11/04 10:27:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.68 $ */ /* NetHack 3.6 spell.c $NHDT-Date: 1446854236 2015/11/06 23:57:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.70 $ */
/* Copyright (c) M. Stephenson 1988 */ /* Copyright (c) M. Stephenson 1988 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -182,8 +182,8 @@ struct obj *spellbook;
if (!rn2(3) && spellbook->otyp != SPE_BOOK_OF_THE_DEAD) { if (!rn2(3) && spellbook->otyp != SPE_BOOK_OF_THE_DEAD) {
spellbook->in_use = TRUE; /* in case called from learn */ spellbook->in_use = TRUE; /* in case called from learn */
pline("Being confused you have difficulties in controlling your " pline(
"actions."); "Being confused you have difficulties in controlling your actions.");
display_nhwindow(WIN_MESSAGE, FALSE); display_nhwindow(WIN_MESSAGE, FALSE);
You("accidentally tear the spellbook to pieces."); You("accidentally tear the spellbook to pieces.");
if (!objects[spellbook->otyp].oc_name_known if (!objects[spellbook->otyp].oc_name_known
@@ -387,9 +387,9 @@ learn(VOID_ARGS)
known, in case amnesia made you forget the book */ known, in case amnesia made you forget the book */
makeknown((int) booktype); makeknown((int) booktype);
} else { /* (spellid(i) == NO_SPELL) */ } else { /* (spellid(i) == NO_SPELL) */
/* for a normal book, spestudied will be zero, but for /* for a normal book, spestudied will be zero, but for
a polymorphed one, spestudied will be non-zero and a polymorphed one, spestudied will be non-zero and
one less reading is available than when re-learning */ one less reading is available than when re-learning */
if (book->spestudied >= MAX_SPELL_STUDY) { if (book->spestudied >= MAX_SPELL_STUDY) {
/* pre-used due to being the product of polymorph */ /* pre-used due to being the product of polymorph */
pline("This spellbook is too faint to read even once."); pline("This spellbook is too faint to read even once.");
@@ -520,8 +520,8 @@ register struct obj *spellbook;
/* only wizards know if a spell is too difficult */ /* only wizards know if a spell is too difficult */
if (Role_if(PM_WIZARD) && read_ability < 20 && !confused) { if (Role_if(PM_WIZARD) && read_ability < 20 && !confused) {
char qbuf[QBUFSZ]; char qbuf[QBUFSZ];
Sprintf(qbuf, "This spellbook is %sdifficult to " Sprintf(qbuf,
"comprehend. Continue?", "This spellbook is %sdifficult to comprehend. Continue?",
(read_ability < 12 ? "very " : "")); (read_ability < 12 ? "very " : ""));
if (yn(qbuf) != 'y') { if (yn(qbuf) != 'y') {
spellbook->in_use = FALSE; spellbook->in_use = FALSE;