-/* 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. */
/* NetHack may be freely redistributed. See license for details. */
? (long) mons[obj->corpsenm].cnutrit
: (long) objects[obj->otyp].oc_nutrition;
if (uneaten_amt > full_amount) {
- impossible("partly eaten food (%ld) more nutritious than untouched "
- "food (%ld)",
+ impossible(
+ "partly eaten food (%ld) more nutritious than untouched food (%ld)",
uneaten_amt, full_amount);
uneaten_amt = full_amount;
}
-/* 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. */
/* NetHack may be freely redistributed. See license for details. */
#endif
#ifdef SELECTSAVED
-STATIC_DCL int FDECL(strcmp_wrap, (const void *, const void *));
+STATIC_DCL int FDECL(CFDECLSPEC strcmp_wrap, (const void *, const void *));
#endif
STATIC_DCL char *FDECL(set_bonesfile_name, (char *, d_level *));
STATIC_DCL char *NDECL(set_bonestemp_name);
#ifdef COMPRESS
-STATIC_DCL void FDECL(redirect,
- (const char *, const char *, FILE *, BOOLEAN_P));
+STATIC_DCL void FDECL(redirect, (const char *, const char *, FILE *,
+ BOOLEAN_P));
#endif
#if defined(COMPRESS) || defined(ZLIB_COMP)
STATIC_DCL void FDECL(docompress_file, (const char *, BOOLEAN_P));
* fname_encode()
*
* Args:
- * legal zero-terminated list of acceptable file name
- *characters
- * quotechar lead-in character used to quote illegal characters as
- *hex digits
- * s string to encode
- * callerbuf buffer to house result
- * bufsz size of callerbuf
+ * legal zero-terminated list of acceptable file name characters
+ * quotechar lead-in character used to quote illegal characters as
+ * hex digits
+ * s string to encode
+ * callerbuf buffer to house result
+ * bufsz size of callerbuf
*
* Notes:
- * 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
- *'legal'.
+ * 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
+ * 'legal'.
*
* Sample:
- * The following call:
- * (void)fname_encode("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- * '%', "This is a % test!", buf, 512);
- * results in this encoding:
- * "This%20is%20a%20%25%20test%21"
+ * The following call:
+ * (void)fname_encode("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
+ * '%', "This is a % test!", buf, 512);
+ * results in this encoding:
+ * "This%20is%20a%20%25%20test%21"
*/
char *
fname_encode(legal, quotechar, s, callerbuf, bufsz)
* fname_decode()
*
* Args:
- * quotechar lead-in character used to quote illegal characters as
- *hex digits
- * s string to decode
- * callerbuf buffer to house result
- * bufsz size of callerbuf
+ * quotechar lead-in character used to quote illegal characters as
+ * hex digits
+ * s string to decode
+ * callerbuf buffer to house result
+ * bufsz size of callerbuf
*/
char *
fname_decode(quotechar, s, callerbuf, bufsz)
}
#if defined(SELECTSAVED)
-STATIC_OVL int
+/* qsort comparison routine */
+STATIC_OVL int CFDECLSPEC
strcmp_wrap(p, q)
const void *p;
const void *q;
really_close()
{
int fd = lftrack.fd;
+
lftrack.nethack_thinks_it_is_open = FALSE;
lftrack.fd = -1;
lftrack.oflag = 0;
return close(fd);
}
#else
+
int
nhclose(fd)
int fd;
denies some or all access to world.
*/
(void) chmod(file, FCMASK | 007); /* allow other users full access */
-#endif /* VMS && !SECURE */
+#endif /* VMS && !SECURE */
return fd;
}
#ifdef VMS
{
char *semi_colon = rindex(SAVEF, ';');
+
if (semi_colon)
*semi_colon = '\0';
}
fd = creat(fq_save, FCMASK);
#endif
#if defined(VMS) && !defined(SECURE)
-/*
- 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
- file will be owned by the directory's owner instead of the user.
- */
+ /*
+ 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
+ file will be owned by the directory's owner instead of the user.
+ */
#undef getuid
(void) chown(fq_save, getuid(), getgid());
#define getuid() vms_getuid()
#else
#define EXTSTR ""
#endif
+
if ( sscanf( filename, "%*[^/]/%d%63[^.]" EXTSTR, &uid, name ) == 2 ) {
#undef EXTSTR
- /* "_" most likely means " ", which certainly looks nicer */
- for (k=0; name[k]; k++)
- if ( name[k]=='_' )
- name[k]=' ';
- return dupstr(name);
+ /* "_" most likely means " ", which certainly looks nicer */
+ for (k=0; name[k]; k++)
+ if ( name[k] == '_' )
+ name[k] = ' ';
+ return dupstr(name);
} else
#endif /* UNIX && QT_GRAPHICS */
{
- return 0;
+ return 0;
}
/* --------- end of obsolete code ----*/
#endif /* 0 - WAS STORE_PLNAME_IN_FILE*/
closedir(dir);
if (n > 0) {
int i;
+
if (!(dir = opendir(fqname("save", SAVEPREFIX, 0))))
return 0;
result = (char **) alloc((n + 1) * sizeof(char *)); /* at most */
int uid;
char name[64]; /* more than PL_NSIZ */
struct dirent *entry = readdir(dir);
+
if (!entry)
break;
if (sscanf(entry->d_name, "%d%63s", &uid, name) == 2) {
if (uid == myuid) {
char filename[BUFSZ];
char *r;
+
Sprintf(filename, "save/%d%s", uid, name);
r = plname_from_file(filename);
if (r)
if (j > 0) {
if (j > 1)
- qsort(result, j, sizeof(char *), strcmp_wrap);
+ qsort(result, j, sizeof (char *), strcmp_wrap);
result[j] = 0;
return result;
} else if (result) { /* could happen if save files are obsolete */
{
if (saved) {
int i = 0;
+
while (saved[i])
free((genericptr_t) saved[i++]);
free((genericptr_t) saved);
#else
#ifdef SAVE_EXTENSION
char *bp = (char *) 0;
+
strcpy(cfn, filename);
if ((bp = strstri(cfn, SAVE_EXTENSION))) {
strsubst(bp, SAVE_EXTENSION, ".saz");
/* take a wild guess at the underlying cause */
HUP perror(lockname);
HUP raw_printf("Cannot lock %s.", filename);
- HUP raw_printf("(Perhaps you are running NetHack from inside the "
- "distribution package?).");
+ HUP raw_printf(
+ "(Perhaps you are running NetHack from inside the distribution package?).");
nesting--;
return FALSE;
default:
(void) strncpy(lastconfigfile, filename, BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0)
- return (fp);
+ return fp;
if ((fp = fopenp(filename, "r")) != (FILE *) 0) {
- return (fp);
+ return fp;
#if defined(UNIX) || defined(VMS)
} else {
/* access() above probably caught most problems for UNIX */
#if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32)
if ((fp = fopenp(fqname(configfile, CONFIGPREFIX, 0), "r")) != (FILE *) 0)
- return (fp);
+ return fp;
if ((fp = fopenp(configfile, "r")) != (FILE *) 0)
- return (fp);
+ return fp;
#ifdef MSDOS
if ((fp = fopenp(fqname(backward_compat_configfile, CONFIGPREFIX, 0),
"r")) != (FILE *) 0)
- return (fp);
+ return fp;
if ((fp = fopenp(backward_compat_configfile, "r")) != (FILE *) 0)
- return (fp);
+ return fp;
#endif
#else
/* constructed full path names don't need fqname() */
BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0) {
- return (fp);
+ return fp;
}
(void) strncpy(lastconfigfile, "sys$login:nethack.ini", BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0) {
- return (fp);
+ return fp;
}
envp = nh_getenv("HOME");
(void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(tmp_config, "r")) != (FILE *) 0)
- return (fp);
+ return fp;
#else /* should be only UNIX left */
envp = nh_getenv("HOME");
if (!envp)
(void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0)
- return (fp);
+ return fp;
#if defined(__APPLE__)
/* try an alternative */
if (envp) {
(void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0)
- return (fp);
+ return fp;
Sprintf(tmp_config, "%s/%s", envp,
"Library/Preferences/NetHack Defaults.txt");
(void) strncpy(lastconfigfile, tmp_config, BUFSZ - 1);
lastconfigfile[BUFSZ - 1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *) 0)
- return (fp);
+ return fp;
}
#endif
if (errno != ENOENT) {
} else if (match_varname(buf, "AUTOPICKUP_EXCEPTION", 5)) {
add_autopickup_exception(bufp);
} else if (match_varname(buf, "MSGTYPE", 7)) {
- (void) msgtype_parse_add(bufp);
+ (void) msgtype_parse_add(bufp);
#ifdef NOCWD_ASSUMPTIONS
} else if (match_varname(buf, "HACKDIR", 4)) {
adjust_prefix(bufp, HACKPREFIX);
} else if (match_varname(buf, "DEPTH", 5)) {
extern int amii_numcolors;
int val = atoi(bufp);
+
amii_numcolors = 1L << min(DEPTH, val);
#ifdef SYSFLAGS
} else if (match_varname(buf, "DRIPENS", 7)) {
int i, val;
char *t;
+
for (i = 0, t = strtok(bufp, ",/"); t != (char *) 0;
i < 20 && (t = strtok((char *) 0, ",/")), ++i) {
sscanf(t, "%d", &val);
#endif
} else if (match_varname(buf, "SCREENMODE", 10)) {
extern long amii_scrnmode;
+
if (!stricmp(bufp, "req"))
amii_scrnmode = 0xffffffff; /* Requester */
else if (sscanf(bufp, "%x", &amii_scrnmode) != 1)
} else if (match_varname(buf, "MSGPENS", 7)) {
extern int amii_msgAPen, amii_msgBPen;
char *t = strtok(bufp, ",/");
+
if (t) {
sscanf(t, "%d", &amii_msgAPen);
if (t = strtok((char *) 0, ",/"))
} else if (match_varname(buf, "TEXTPENS", 8)) {
extern int amii_textAPen, amii_textBPen;
char *t = strtok(bufp, ",/");
+
if (t) {
sscanf(t, "%d", &amii_textAPen);
if (t = strtok((char *) 0, ",/"))
} else if (match_varname(buf, "MENUPENS", 8)) {
extern int amii_menuAPen, amii_menuBPen;
char *t = strtok(bufp, ",/");
+
if (t) {
sscanf(t, "%d", &amii_menuAPen);
if (t = strtok((char *) 0, ",/"))
} else if (match_varname(buf, "STATUSPENS", 10)) {
extern int amii_statAPen, amii_statBPen;
char *t = strtok(bufp, ",/");
+
if (t) {
sscanf(t, "%d", &amii_statAPen);
if (t = strtok((char *) 0, ",/"))
} else if (match_varname(buf, "OTHERPENS", 9)) {
extern int amii_otherAPen, amii_otherBPen;
char *t = strtok(bufp, ",/");
+
if (t) {
sscanf(t, "%d", &amii_otherAPen);
if (t = strtok((char *) 0, ",/"))
/* These should move to wc_ options */
} else if (match_varname(buf, "QT_TILEWIDTH", 12)) {
extern char *qt_tilewidth;
+
if (qt_tilewidth == NULL)
qt_tilewidth = dupstr(bufp);
} else if (match_varname(buf, "QT_TILEHEIGHT", 13)) {
extern char *qt_tileheight;
+
if (qt_tileheight == NULL)
qt_tileheight = dupstr(bufp);
} else if (match_varname(buf, "QT_FONTSIZE", 11)) {
extern char *qt_fontsize;
+
if (qt_fontsize == NULL)
qt_fontsize = dupstr(bufp);
} else if (match_varname(buf, "QT_COMPACT", 10)) {
extern int qt_compact_mode;
+
qt_compact_mode = atoi(bufp);
#endif
} else
can_read_file(filename)
const char *filename;
{
- return (access(filename, 4) == 0);
+ return (boolean) (access(filename, 4) == 0);
}
#endif /* USER_SOUNDS */
#ifdef notyet
/*
XXX Don't call read() in parse_config_line, read as callback or reassemble
-line
-at this level.
+line at this level.
OR: Forbid multiline stuff for alternate config sources.
*/
#endif
} else
#endif
if ((fp = fopenp(wizkit, "r")) != (FILE *) 0) {
- return (fp);
+ return fp;
#if defined(UNIX) || defined(VMS)
} else {
/* access() above probably caught most problems for UNIX */
#if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32)
if ((fp = fopenp(fqname(wizkit, CONFIGPREFIX, 0), "r")) != (FILE *) 0)
- return (fp);
+ return fp;
#else
#ifdef VMS
envp = nh_getenv("HOME");
else
Sprintf(tmp_wizkit, "%s%s", "sys$login:", wizkit);
if ((fp = fopenp(tmp_wizkit, "r")) != (FILE *) 0)
- return (fp);
+ return fp;
#else /* should be only UNIX left */
envp = nh_getenv("HOME");
if (envp)
else
Strcpy(tmp_wizkit, wizkit);
if ((fp = fopenp(tmp_wizkit, "r")) != (FILE *) 0)
- return (fp);
+ return fp;
else if (errno != ENOENT) {
/* e.g., problems when setuid NetHack can't search home
* directory restricted to user */
values from the file, so only do that */
if (symp->range == SYM_CONTROL) {
struct symsetentry *tmpsp;
+
switch (symp->idx) {
case 0:
tmpsp =
- (struct symsetentry *) alloc(sizeof(struct symsetentry));
+ (struct symsetentry *) alloc(sizeof (struct symsetentry));
tmpsp->next = (struct symsetentry *) 0;
if (!symset_list) {
symset_list = tmpsp;
case 5: /* restrictions: xxxx*/
if (chosen_symset_start) {
int n = 0;
+
while (known_restrictions[n]) {
if (!strcmpi(known_restrictions[n], bufp)) {
switch (n) {
processed[lev] = 0;
/* level 0 file contains:
- * pid of creating process (ignored here)
- * level number for current level of save file
- * name of save file nethack would have created
- * savefile info
- * player name
- * and game state
+ * pid of creating process (ignored here)
+ * level number for current level of save file
+ * name of save file nethack would have created
+ * savefile info
+ * player name
+ * and game state
*/
gfd = open_levelfile(0, errbuf);
if (gfd < 0) {
return FALSE;
}
if (read(gfd, (genericptr_t) &hpid, sizeof hpid) != sizeof hpid) {
- raw_printf("\nCheckpoint data incompletely written or subsequently "
- "clobbered. Recovery impossible.");
+ raw_printf("\n%s\n%s\n",
+ "Checkpoint data incompletely written or subsequently clobbered.",
+ "Recovery impossible.");
(void) nhclose(gfd);
return FALSE;
}
if (read(gfd, (genericptr_t) &savelev, sizeof(savelev))
!= sizeof(savelev)) {
- raw_printf("\nCheckpointing was not in effect for %s -- recovery "
- "impossible.\n",
+ raw_printf(
+ "\nCheckpointing was not in effect for %s -- recovery impossible.\n",
lock);
(void) nhclose(gfd);
return FALSE;
}
/* save file should contain:
- * version info
- * savefile info
- * player name
- * current level (including pets)
- * (non-level-based) game state
- * other levels
+ * version info
+ * savefile info
+ * player name
+ * current level (including pets)
+ * (non-level-based) game state
+ * other levels
*/
set_savefile_name(TRUE);
sfd = create_savefile();
/*
* Syntax (not case-sensitive):
- * %section books
+ * %section books
*
* In the books section:
- * %title booktitle(n)
- * where booktitle=book title
- * (n)= total number of passages present for this title
- * %passage n
- * where n=sequential passage number
+ * %title booktitle (n)
+ * where booktitle=book title without quotes
+ * (n)= total number of passages present for this title
+ * %passage k
+ * where k=sequential passage number
*
* %e ends the passage/book/section
* If in a passage, it marks the end of that passage.
case '%':
if (!strncmpi(&line[1], "section ", sizeof("section ") - 1)) {
char *st = &line[9]; /* 9 from "%section " */
+
scope = SECTIONSCOPE;
if (!strcmpi(st, tribsection))
matchedsection = TRUE;
} else if (!strncmpi(&line[1], "title ", sizeof("title ") - 1)) {
char *st = &line[7]; /* 7 from "%title " */
char *p1, *p2;
+
if ((p1 = index(st, '(')) != 0) {
*p1++ = '\0';
(void) mungspaces(st);
sizeof("passage ") - 1)) {
int passagenum = 0;
char *st = &line[9]; /* 9 from "%passage " */
+
while (*st == ' ' || *st == '\t')
st++;
if (*st && digit(*st) && (strlen(st) < 3))
}
}
} else if (!strncmpi(&line[1], "e ", sizeof("e ") - 1)) {
- if (matchedtitle && (scope == PASSAGESCOPE)
- && ((!nowin_buf && tribwin != WIN_ERR) || (nowin_buf && foundpassage)))
+ if (matchedtitle && scope == PASSAGESCOPE
+ && ((!nowin_buf && tribwin != WIN_ERR)
+ || (nowin_buf && foundpassage)))
goto cleanup;
if (scope == TITLESCOPE)
matchedtitle = FALSE;
-/* 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. */
/* NetHack may be freely redistributed. See license for details. */
}
if (mdef->minvis && !perceives(magr->data)) {
if (canseemon(magr)) {
- pline("%s doesn't seem to notice that %s gaze was "
- "reflected.",
+ pline(
+ "%s doesn't seem to notice that %s gaze was reflected.",
Monnam(magr), mhis(magr));
}
return MM_MISS;
-/* 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. */
/* NetHack may be freely redistributed. See license for details. */
it's better than "sting" when not a stinging attack... */
return (!mwep || !mwep->opoisoned) ? "attack" : "weapon";
} else {
- return (mattk->aatyp == AT_TUCH)
- ? "contact"
- : (mattk->aatyp == AT_GAZE)
- ? "gaze"
- : (mattk->aatyp == AT_BITE) ? "bite" : "sting";
+ return (mattk->aatyp == AT_TUCH) ? "contact"
+ : (mattk->aatyp == AT_GAZE) ? "gaze"
+ : (mattk->aatyp == AT_BITE) ? "bite" : "sting";
}
}
/*
* mattacku: monster attacks you
- * returns 1 if monster dies (e.g. "yellow light"), 0 otherwise
- * Note: if you're displaced or invisible the monster might attack the
- * wrong position...
- * Assumption: it's attacking you or an empty square; if there's another
- * monster which it attacks by mistake, the caller had better
- * take care of it...
+ * returns 1 if monster dies (e.g. "yellow light"), 0 otherwise
+ * Note: if you're displaced or invisible the monster might attack the
+ * wrong position...
+ * Assumption: it's attacking you or an empty square; if there's another
+ * monster which it attacks by mistake, the caller had better
+ * take care of it...
*/
int
mattacku(mtmp)
foundyou = 1;
if (u.uinvulnerable)
return 0; /* stomachs can't hurt you! */
- }
- else if (u.usteed) {
+ } else if (u.usteed) {
if (mtmp == u.usteed)
/* Your steed won't attack you */
return 0;
} else {
/* surface hider */
- if (!youseeit)
+ if (!youseeit) {
pline("It tries to move where you are hiding.");
- else {
+ } else {
/* Ugly kludge for eggs. The message is phrased so as
* to be directed at the monster, not the player,
* which makes "laid by you" wrong. For the
|| (youmonst.data->mlet == S_EEL
&& is_pool(u.ux, u.uy))) {
int save_spe = 0; /* suppress warning */
+
if (obj) {
save_spe = obj->spe;
if (obj->otyp == EGG)
if (youmonst.data->mlet == S_EEL
|| u.umonnum == PM_TRAPPER)
pline(
- "Wait, %s! There's a hidden %s named %s there!",
- m_monnam(mtmp), youmonst.data->mname, plname);
+ "Wait, %s! There's a hidden %s named %s there!",
+ m_monnam(mtmp), youmonst.data->mname, plname);
else
- pline("Wait, %s! There's a %s named %s hiding under "
- "%s!",
+ pline(
+ "Wait, %s! There's a %s named %s hiding under %s!",
m_monnam(mtmp), youmonst.data->mname, plname,
doname(level.objects[u.ux][u.uy]));
if (obj)
plname);
if (multi < 0) { /* this should always be the case */
char buf[BUFSZ];
+
Sprintf(buf, "You appear to be %s again.",
Upolyd ? (const char *) an(youmonst.data->mname)
: (const char *) "yourself");
return 0;
}
- /* Work out the armor class differential */
+ /* Work out the armor class differential */
tmp = AC_VALUE(u.uac) + 10; /* tmp ~= 0 - 20 */
tmp += mtmp->m_lev;
if (multi < 0)
newsym(mtmp->mx, mtmp->my);
}
- /* Special demon handling code */
+ /* Special demon handling code */
if ((mtmp->cham == NON_PM) && is_demon(mdat) && !range2
&& mtmp->data != &mons[PM_BALROG] && mtmp->data != &mons[PM_SUCCUBUS]
&& mtmp->data != &mons[PM_INCUBUS])
if (!mtmp->mcan && !rn2(13))
(void) msummon(mtmp);
- /* Special lycanthrope handling code */
+ /* Special lycanthrope handling code */
if ((mtmp->cham == NON_PM) && is_were(mdat) && !range2) {
if (is_human(mdat)) {
if (!rn2(5 - (night() * 2)) && !mtmp->mcan)
/*
* hitmu: monster hits you
- * returns 2 if monster dies (e.g. "yellow light"), 1 otherwise
- * 3 if the monster lives but teleported/paralyzed, so it can't keep
- * attacking you
+ * returns 2 if monster dies (e.g. "yellow light"), 1 otherwise
+ * 3 if the monster lives but teleported/paralyzed, so it can't keep
+ * attacking you
*/
STATIC_OVL int
hitmu(mtmp, mattk)
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
- /* If the monster is undetected & hits you, you should know where
- * the attack came from.
+ /* If the monster is undetected & hits you, you should know where
+ * the attack came from.
*/
if (mtmp->mundetected && (hides_under(mdat) || mdat->mlet == S_EEL)) {
mtmp->mundetected = 0;
}
}
- /* First determine the base damage done */
+ /* First determine the base damage done */
dmg = d((int) mattk->damn, (int) mattk->damd);
if ((is_undead(mdat) || is_vampshifter(mtmp)) && midnight())
dmg += d((int) mattk->damn, (int) mattk->damd); /* extra damage */
- /* Next a cancellation factor */
- /* Use uncancelled when the cancellation factor takes into account
- *certain
- * armor's special magic protection. Otherwise just use !mtmp->mcan.
+ /* Next a cancellation factor.
+ * Use uncancelled when cancellation factor takes into account certain
+ * armor's special magic protection. Otherwise just use !mtmp->mcan.
*/
armpro = magic_negation(&youmonst);
uncancelled = !mtmp->mcan && (rn2(10) >= 3 * armpro);
permdmg = 0;
- /* Now, adjust damages via resistances or specific attacks */
+ /* Now, adjust damages via resistances or specific attacks */
switch (mattk->adtyp) {
case AD_PHYS:
if (mattk->aatyp == AT_HUGS && !sticks(youmonst.data)) {
pline("%s %s.", Monnam(mtmp),
mtmp->minvent
? "brags about the goods some dungeon explorer provided"
- : "makes some remarks about how difficult theft is "
- "lately");
+ : "makes some remarks about how difficult theft is lately");
if (!tele_restrict(mtmp))
(void) rloc(mtmp, TRUE);
return 3;
pline("You're covered in acid, but it seems harmless.");
dmg = 0;
} else {
- pline("You're covered in acid! It burns!");
+ pline("You're covered in acid! It burns!");
exercise(A_STR, FALSE);
}
else
if (u.uhp < 1)
done_in_by(mtmp, DIED);
- /* Negative armor class reduces damage done instead of fully protecting
- * against hits.
+ /* Negative armor class reduces damage done instead of fully protecting
+ * against hits.
*/
if (dmg && u.uac < 0) {
dmg -= rnd(-u.uac);
int lowerlimit, *hpmax_p;
/*
* Apply some of the damage to permanent hit points:
- * polymorphed 100% against poly'd hpmax
- * hpmax > 25*lvl 100% against normal hpmax
- * hpmax > 10*lvl 50..100%
- * hpmax > 5*lvl 25..75%
- * otherwise 0..50%
+ * polymorphed 100% against poly'd hpmax
+ * hpmax > 25*lvl 100% against normal hpmax
+ * hpmax > 10*lvl 50..100%
+ * hpmax > 5*lvl 25..75%
+ * otherwise 0..50%
* Never reduces hpmax below 1 hit point per level.
*/
permdmg = rn2(dmg / 2 + 1);
break;
if (!m_canseeu(mtmp)) { /* probably you're invisible */
if (useeit)
- pline("%s doesn't seem to notice that %s gaze was "
- "reflected.",
+ pline(
+ "%s doesn't seem to notice that %s gaze was reflected.",
Monnam(mtmp), mhis(mtmp));
break;
}
}
}
+/* returns 0 if seduction impossible,
+ * 1 if fine,
+ * 2 if wrong gender for nymph
+ */
int
could_seduce(magr, mdef, mattk)
struct monst *magr, *mdef;
struct attack *mattk;
-/* returns 0 if seduction impossible,
- * 1 if fine,
- * 2 if wrong gender for nymph */
{
register struct permonst *pagr;
boolean agrinvis, defperc;
break; /* no point trying further rings */
}
if (rn2(20) < ACURR(A_CHA)) {
- (void) safe_qbuf(
- qbuf, "\"That ",
- " looks pretty. Would you wear it for me?\"", ring,
- xname, simpleonames, "ring");
+ (void) safe_qbuf(qbuf, "\"That ",
+ " looks pretty. Would you wear it for me?\"",
+ ring, xname, simpleonames, "ring");
makeknown(RIN_ADORNMENT);
if (yn(qbuf) == 'n')
continue;
-/* 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. */
/* NetHack may be freely redistributed. See license for details. */
mttyp = query_msgtype();
if (mttyp == -1)
goto msgtypes_again;
- if (!msgtype_add(mttyp, mtbuf)) {
+ if (!msgtype_add(mttyp, mtbuf)) {
pline("Error adding the message type.");
wait_synch();
goto msgtypes_again;
"-- for example, $ DEFINE NETHACKOPTIONS \"noautopickup,fruit:kumquat\"",
#endif
"or press \"O\" while playing and use the menu.", "",
- "Boolean options (which can be negated by prefixing them with '!' or "
- "\"no\"):",
+ "Boolean options (which can be negated by prefixing them with '!' or \"no\"):",
(char *) 0
};
-/* 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. */
/* NetHack may be freely redistributed. See license for details. */
verbalize("Hark, %s!", youmonst.data->mlet == S_HUMAN
? "mortal"
: "creature");
- verbalize("To enter the castle, thou must play the right "
- "tune!");
+ verbalize(
+ "To enter the castle, thou must play the right tune!");
u.uevent.uheard_tune++;
break;
} else if (u.uevent.uheard_tune < 2) {
Your("sacrifice puffs up, swelling bigger and bigger, and pops!");
break;
case 2:
- Your("sacrifice collapses into a cloud of dancing particles and "
- "fades away!");
+ Your(
+ "sacrifice collapses into a cloud of dancing particles and fades away!");
break;
}
else if (Blind && u.ualign.type == A_LAWFUL)
/* Human sacrifice on a chaotic or unaligned altar */
/* is equivalent to demon summoning */
if (altaralign == A_CHAOTIC && u.ualign.type != A_CHAOTIC) {
- pline("The blood floods the altar, which vanishes in %s "
- "cloud!",
+ pline(
+ "The blood floods the altar, which vanishes in %s cloud!",
an(hcolor(NH_BLACK)));
levl[u.ux][u.uy].typ = ROOM;
levl[u.ux][u.uy].altarmask = 0;
} else { /* super big win */
adjalign(10);
u.uachieve.ascended = 1;
- pline("An invisible choir sings, and you are bathed in "
- "radiance...");
+ pline(
+ "An invisible choir sings, and you are bathed in radiance...");
godvoice(altaralign, "Congratulations, mortal!");
display_nhwindow(WIN_MESSAGE, FALSE);
- verbalize("In return for thy service, I grant thee the gift "
- "of Immortality!");
+ verbalize(
+ "In return for thy service, I grant thee the gift of Immortality!");
You("ascend to the status of Demigod%s...",
flags.female ? "dess" : "");
done(ASCENDED);
-/* 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. */
/* NetHack may be freely redistributed. See license for details. */
{
static const char *shirt_msgs[] = {
/* Scott Bigham */
- "I explored the Dungeons of Doom and all I got was this lousy "
- "T-shirt!",
+ "I explored the Dungeons of Doom and all I got was this lousy T-shirt!",
"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.",
+ "It's not the size of your sword, it's how #enhance'd you are with it.",
"Madame Elvira's House O' Succubi Lifetime Customer",
"Madame Elvira's House O' Succubi Employee of the Month",
"Ludios Vault Guards Do It In Small, Dark Rooms",
"I want to live forever or die in the attempt.", "Lichen Park",
"LOST IN THOUGHT - please send search party", "Meat is Mordor",
"Minetown Better Business Bureau", "Minetown Watch",
- "Ms. Palm's House of Negotiable Affection -- A Very Reputable House "
- "Of Disrepute",
+ "Ms. Palm's House of Negotiable Affection -- A Very Reputable House Of Disrepute",
"Protection Racketeer", "Real men love Crom",
"Somebody stole my Mojo!", "The Hellhound Gang", "The Werewolves",
"They Might Be Storm Giants",
maintained illiterate conduct so far, and this mail
scroll didn't come from bones, ask for confirmation */
if (!u.uconduct.literate) {
- if (!scroll->spe && yn("Reading mail will violate \"illiterate\" "
- "conduct. Read anyway?") != 'y')
+ if (!scroll->spe && yn(
+ "Reading mail will violate \"illiterate\" conduct. Read anyway?"
+ ) != 'y')
return 0;
}
}
case SCR_MAIL:
known = TRUE;
if (sobj->spe)
- pline("This seems to be junk mail addressed to the finder of the "
- "Eye of Larn.");
+ pline(
+ "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
* mail if you win!
*/
if (Hallucination) /* Ommmmmm! */
Your("mind releases itself from mundane concerns.");
else if (!strncmpi(plname, "Maud", 4))
- pline("As your mind turns inward on itself, you forget "
- "everything else.");
+ pline(
+ "As your mind turns inward on itself, you forget everything else.");
else if (rn2(2))
pline("Who was that Maud person anyway?");
else
-/* 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. */
/* NetHack may be freely redistributed. See license for details. */
if ((eshkp->robbed -= offer < 0L))
eshkp->robbed = 0L;
if (offer && !muteshk(shkp))
- verbalize("Thank you for your contribution to restock this "
- "recently plundered shop.");
+ verbalize(
+ "Thank you for your contribution to restock this recently plundered shop.");
subfrombill(obj, shkp);
return;
}
obj->no_charge = 1;
subfrombill(obj, shkp);
pay(-offer, shkp);
- shk_names_obj(
- shkp, obj,
- (sell_how != SELL_NORMAL)
- ? (!ltmp && cltmp && only_partially_your_contents)
- ? "sold some items inside %s for %ld gold "
- "piece%s.%s"
- : "sold %s for %ld gold piece%s.%s"
- : "relinquish %s and receive %ld gold piece%s in "
- "compensation.%s",
- offer, "");
+ shk_names_obj(shkp, obj,
+ (sell_how != SELL_NORMAL)
+ ? ((!ltmp && cltmp && only_partially_your_contents)
+ ? "sold some items inside %s for %ld gold piece%s.%s"
+ : "sold %s for %ld gold piece%s.%s")
+ : "relinquish %s and receive %ld gold piece%s in compensation.%s",
+ offer, "");
break;
default:
impossible("invalid sell response");
-/* 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 */
/* NetHack may be freely redistributed. See license for details. */
break;
}
default:
- impossible("create_monster: unimplemented mon appear type "
- "[%d,\"%s\"]",
+ impossible(
+ "create_monster: unimplemented mon appear type [%d,\"%s\"]",
m->appear, m->appear_as.str);
break;
}
remove_object(otmp);
if (mpickobj(invent_carrying_monster, otmp)) {
if (inuse > -1) {
- impossible("container given to monster was merged or "
- "deallocated.");
+ impossible(
+ "container given to monster was merged or deallocated.");
for (ci = inuse; ci < container_idx - 1; ci++)
container_obj[ci] = container_obj[ci + 1];
container_obj[container_idx] = NULL;
-/* 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 */
/* NetHack may be freely redistributed. See license for details. */
if (!rn2(3) && spellbook->otyp != SPE_BOOK_OF_THE_DEAD) {
spellbook->in_use = TRUE; /* in case called from learn */
- pline("Being confused you have difficulties in controlling your "
- "actions.");
+ pline(
+ "Being confused you have difficulties in controlling your actions.");
display_nhwindow(WIN_MESSAGE, FALSE);
You("accidentally tear the spellbook to pieces.");
if (!objects[spellbook->otyp].oc_name_known
known, in case amnesia made you forget the book */
makeknown((int) booktype);
} else { /* (spellid(i) == NO_SPELL) */
- /* for a normal book, spestudied will be zero, but for
- a polymorphed one, spestudied will be non-zero and
- one less reading is available than when re-learning */
+ /* for a normal book, spestudied will be zero, but for
+ a polymorphed one, spestudied will be non-zero and
+ one less reading is available than when re-learning */
if (book->spestudied >= MAX_SPELL_STUDY) {
/* pre-used due to being the product of polymorph */
pline("This spellbook is too faint to read even once.");
/* only wizards know if a spell is too difficult */
if (Role_if(PM_WIZARD) && read_ability < 20 && !confused) {
char qbuf[QBUFSZ];
- Sprintf(qbuf, "This spellbook is %sdifficult to "
- "comprehend. Continue?",
+ Sprintf(qbuf,
+ "This spellbook is %sdifficult to comprehend. Continue?",
(read_ability < 12 ? "very " : ""));
if (yn(qbuf) != 'y') {
spellbook->in_use = FALSE;