userea = &argv[i][1];
}
match = match_optname(userea, earlyopts[idx].name,
- earlyopts[idx].minlength, earlyopts[idx].valallowed);
+ earlyopts[idx].minlength,
+ earlyopts[idx].valallowed);
if (match) break;
}
if (match) {
- const char *extended_opt = index(userea,':');
+ const char *extended_opt = index(userea, ':');
if (!extended_opt)
extended_opt = index(userea, '=');
switch(e_arg) {
- case ARG_DEBUG:
- if (extended_opt) {
- extended_opt++;
- debug_fields(extended_opt);
- }
- return 1;
- break;
- case ARG_VERSION: {
- boolean insert_into_pastebuf = FALSE;
-
- if (extended_opt) {
- extended_opt++;
- if (match_optname(extended_opt, "paste",
- 5, FALSE)) {
- insert_into_pastebuf = TRUE;
- } else {
- raw_printf(
- "-%sversion can only be extended with -%sversion:paste.\n",
- dashdash, dashdash);
- return TRUE;
- }
- }
- early_version_info(insert_into_pastebuf);
- return 2;
- break;
+ case ARG_DEBUG:
+ if (extended_opt) {
+ extended_opt++;
+ debug_fields(extended_opt);
}
- default:
- break;
+ return 1;
+ case ARG_VERSION: {
+ boolean insert_into_pastebuf = FALSE;
+
+ if (extended_opt) {
+ extended_opt++;
+ if (match_optname(extended_opt, "paste", 5, FALSE)) {
+ insert_into_pastebuf = TRUE;
+ } else {
+ raw_printf(
+ "-%sversion can only be extended with -%sversion:paste.\n",
+ dashdash, dashdash);
+ return TRUE;
+ }
+ }
+ early_version_info(insert_into_pastebuf);
+ return 2;
+ }
+ default:
+ break;
}
};
return FALSE;
* are documented is right here. No gameplay is altered.
*
* test - test whether this parser is working
- * ttystatus - TTY:
+ * ttystatus - TTY:
* immediateflips - WIN32: turn off display performance
* optimization so that display output
* can be debugged without buffering.
* all of the fields when context.botlx is set. The tty port in
* particular has a problem if that isn't done, since the core sets
* context.botlx when a menu or text display obliterates the status
- * line.
+ * line.
*
* For those situations, to trigger the full update of every field
* whether changed or not, call status_update() with BL_RESET.
else if ((windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
status_update(BL_FLUSH, (genericptr_t) 0, 0, 0,
NO_COLOR, &cond_hilites[0]);
-
+
context.botl = context.botlx = 0;
update_all = FALSE;
}
}
/* disgusting hack; the alternate selection characters work for any
getpos call, but only matter for dowhatis (and doquickwhatis) */
- doing_what_is = (goal == what_is_an_unknown_object);
+ doing_what_is = (goal == what_is_an_unknown_object);
if (doing_what_is) {
Sprintf(kbuf, "'%s' or '%s' or '%s' or '%s'",
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK]),
rndorcname(s)
char *s;
{
- int i;
- const char *v[] = {"a", "ai", "og", "u"};
- const char *snd[] = {"gor", "gris", "un", "bane", "ruk",
- "oth","ul", "z", "thos","akh","hai"};
- int vstart = rn2(2);
-
+ static const char *v[] = { "a", "ai", "og", "u" };
+ static const char *snd[] = { "gor", "gris", "un", "bane", "ruk",
+ "oth","ul", "z", "thos","akh","hai" };
+ int i, iend = rn1(2, 3), vstart = rn2(2);
+
if (s) {
*s = '\0';
- for (i = 0; i < rn2(2) + 3; ++i) {
+ for (i = 0; i < iend; ++i) {
vstart = 1 - vstart; /* 0 -> 1, 1 -> 0 */
- if (!rn2(30) && i > 0)
- (void) strcat(s, "-");
- (void) sprintf(eos(s), "%s", vstart ? v[rn2(SIZE(v))] :
- snd[rn2(SIZE(snd))]);
+ Sprintf(eos(s), "%s%s", (i > 0 && !rn2(30)) ? "-" : "",
+ vstart ? v[rn2(SIZE(v))] : snd[rn2(SIZE(snd))]);
}
}
return s;
if (migrating_objs)
deliver_obj_to_mon(mtmp, 0, DF_ALL);
}
-
+
if (xlocale && wander) {
/* monster moved a bit; pick a nearby location */
/* mnearto() deals w/stone, et al */
where = (int) (otmp->owornmask & 0x7fffL); /* destination code */
if ((where & MIGR_TO_SPECIES) == 0)
continue;
-
+
if ((mtmp->data->mflags2 & otmp->corpsenm) != 0) {
obj_extract_self(otmp);
otmp->owornmask = 0L;
if ((obj->oartifact == ART_MJOLLNIR && Role_if(PM_VALKYRIE))
|| tethered_weapon) {
if (rn2(100)) {
- if (tethered_weapon)
+ if (tethered_weapon)
tmp_at(DISP_END, BACKTRACK);
else
sho_obj_return_to_u(obj); /* display its flight */
xcrypt(blengr(), buf);
}
dengr = TRUE;
- }
+ }
break;
case WAN_NOTHING:
case WAN_UNDEAD_TURNING:
really_close()
{
int fd;
-
+
if (lftrack.init) {
fd = lftrack.fd;
return (char *) 0;
while (*str) {
- if (*str == sep) nsep++;
- str++;
+ if (*str == sep)
+ nsep++;
+ str++;
}
csep = rn2(nsep);
str = begin;
while ((csep > 0) && *str) {
- str++;
- if (*str == sep) csep--;
+ str++;
+ if (*str == sep)
+ csep--;
}
if (*str) {
- if (*str == sep) str++;
- begin = str;
- while (*str && *str != sep) {
- str++;
- len++;
- }
- *str = '\0';
- if (len)
+ if (*str == sep)
+ str++;
+ begin = str;
+ while (*str && *str != sep) {
+ str++;
+ len++;
+ }
+ *str = '\0';
+ if (len)
return begin;
}
return (char *) 0;
void
testinglog(filenm, type, reason)
const char *filenm; /* ad hoc file name */
-const char *type;
+const char *type;
const char *reason; /* explanation */
{
FILE *lfile;
int unid_cnt;
char prompt[QBUFSZ];
- unid_cnt = count_unidentified(invent);
+ unid_cnt = count_unidentified(invent);
Sprintf(prompt, "Debug Identify"); /* 'title' rather than 'prompt' */
if (unid_cnt)
Sprintf(eos(prompt),
}
if (allow_minvent && migrating_objs)
- deliver_obj_to_mon(mtmp, 1, DF_NONE); /* in case there's waiting items */
-
+ deliver_obj_to_mon(mtmp, 1, DF_NONE); /* in case of waiting items */
+
if (!in_mklev)
newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */
/* Kill off aggressor if it didn't die. */
if (!(result & MM_AGR_DIED)) {
- boolean was_leashed = (magr->mleashed);
+ boolean was_leashed = (magr->mleashed != 0);
mondead(magr);
if (!DEADMONSTER(magr))
return result; /* life saved */
result |= MM_AGR_DIED;
-
+
/* mondead() -> m_detach() -> m_unleash() always suppresses
the m_unleash() slack message, so deliver it here instead */
if (was_leashed)
mtyp = rn2((PM_ORC_SHAMAN - PM_ORC) + 1) + PM_ORC;
mtmp = makemon(&mons[mtyp], 0, 0, MM_NONAME);
if (mtmp) {
- shiny_orc_stuff(mtmp);
+ shiny_orc_stuff(mtmp);
migrate_orc(mtmp, 0UL);
}
}
-
ransacked = 0;
}
* underneath it, you could be told the corpse type of a
* monster that you never knew was there without this.
* The code in hitmu() substitutes the word "something"
- * if the corpses obj->dknown is 0.
+ * if the corpse's obj->dknown is 0.
*/
if (Blind && !sensemon(mtmp))
obj->dknown = 0;
}
}
-#define flees_light(mon) ((mon)->data == &mons[PM_GREMLIN] && \
- (uwep && artifact_light(uwep) && uwep->lamplit))
-
+#define flees_light(mon) ((mon)->data == &mons[PM_GREMLIN] \
+ && (uwep && artifact_light(uwep) && uwep->lamplit))
/* we could include this in the above macro, but probably overkill/overhead */
-/* (!((which_armor((mon), W_ARMC) != 0) && ((which_armor((mon), W_ARMH) != 0))) && */
-
+/* && (!(which_armor((mon), W_ARMC) != 0 */
+/* && which_armor((mon), W_ARMH) != 0)) */
-
/* monster begins fleeing for the specified time, 0 means untimed flee
* if first, only adds fleetime if monster isn't already fleeing
* if fleemsg, prints a message about new flight, otherwise, caller should */
}
display_nhwindow(datawin, FALSE);
destroy_nhwindow(datawin), datawin = WIN_ERR;
- }
+ }
}
}
commands: basic letters vs digits, 'g' vs 'G' for '5', phone
keypad vs normal layout of digits, and QWERTZ keyboard swap between
y/Y/^Y/M-y/M-Y/M-^Y and z/Z/^Z/M-z/M-Z/M-^Z.)
-
+
The interpretor understands
'&#' for comment,
'&? option' for 'if' (also '&? !option'
'&:' for 'else' (also '&: #comment';
0 or 1 instance for a given 'if'), and
'&.' for 'endif' (also '&. #comment'; required for each 'if').
-
+
The option handling is a bit of a mess, with no generality for
which options to deal with and only a comma separated list of
integer values for the '=value' part. number_pad is the only
Sprintf(eos(buf), " (");
#if defined(RUNTIME_PORT_ID)
- tmp = get_port_id(tmpbuf);
+ tmp = get_port_id(tmpbuf);
if (tmp)
Sprintf(eos(buf), "%s%s", c++ ? "," : "", tmp);
#endif