formatting cleanup src/*.c
Remove trailing spaces, and remove tabs from the files that had trailing spaces. Also, rndorcname() was using a random value to terminate a loop and was recalculating a new one each iteration.
This commit is contained in:
+28
-30
@@ -793,44 +793,42 @@ enum earlyarg e_arg;
|
|||||||
userea = &argv[i][1];
|
userea = &argv[i][1];
|
||||||
}
|
}
|
||||||
match = match_optname(userea, earlyopts[idx].name,
|
match = match_optname(userea, earlyopts[idx].name,
|
||||||
earlyopts[idx].minlength, earlyopts[idx].valallowed);
|
earlyopts[idx].minlength,
|
||||||
|
earlyopts[idx].valallowed);
|
||||||
if (match) break;
|
if (match) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
const char *extended_opt = index(userea,':');
|
const char *extended_opt = index(userea, ':');
|
||||||
|
|
||||||
if (!extended_opt)
|
if (!extended_opt)
|
||||||
extended_opt = index(userea, '=');
|
extended_opt = index(userea, '=');
|
||||||
switch(e_arg) {
|
switch(e_arg) {
|
||||||
case ARG_DEBUG:
|
case ARG_DEBUG:
|
||||||
if (extended_opt) {
|
if (extended_opt) {
|
||||||
extended_opt++;
|
extended_opt++;
|
||||||
debug_fields(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;
|
|
||||||
}
|
}
|
||||||
default:
|
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;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -843,7 +841,7 @@ enum earlyarg e_arg;
|
|||||||
* are documented is right here. No gameplay is altered.
|
* are documented is right here. No gameplay is altered.
|
||||||
*
|
*
|
||||||
* test - test whether this parser is working
|
* test - test whether this parser is working
|
||||||
* ttystatus - TTY:
|
* ttystatus - TTY:
|
||||||
* immediateflips - WIN32: turn off display performance
|
* immediateflips - WIN32: turn off display performance
|
||||||
* optimization so that display output
|
* optimization so that display output
|
||||||
* can be debugged without buffering.
|
* can be debugged without buffering.
|
||||||
|
|||||||
+2
-2
@@ -799,7 +799,7 @@ boolean *valsetlist;
|
|||||||
* all of the fields when context.botlx is set. The tty port in
|
* 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
|
* particular has a problem if that isn't done, since the core sets
|
||||||
* context.botlx when a menu or text display obliterates the status
|
* context.botlx when a menu or text display obliterates the status
|
||||||
* line.
|
* line.
|
||||||
*
|
*
|
||||||
* For those situations, to trigger the full update of every field
|
* For those situations, to trigger the full update of every field
|
||||||
* whether changed or not, call status_update() with BL_RESET.
|
* whether changed or not, call status_update() with BL_RESET.
|
||||||
@@ -817,7 +817,7 @@ boolean *valsetlist;
|
|||||||
else if ((windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
|
else if ((windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
|
||||||
status_update(BL_FLUSH, (genericptr_t) 0, 0, 0,
|
status_update(BL_FLUSH, (genericptr_t) 0, 0, 0,
|
||||||
NO_COLOR, &cond_hilites[0]);
|
NO_COLOR, &cond_hilites[0]);
|
||||||
|
|
||||||
context.botl = context.botlx = 0;
|
context.botl = context.botlx = 0;
|
||||||
update_all = FALSE;
|
update_all = FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-12
@@ -175,7 +175,7 @@ const char *goal;
|
|||||||
}
|
}
|
||||||
/* disgusting hack; the alternate selection characters work for any
|
/* disgusting hack; the alternate selection characters work for any
|
||||||
getpos call, but only matter for dowhatis (and doquickwhatis) */
|
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) {
|
if (doing_what_is) {
|
||||||
Sprintf(kbuf, "'%s' or '%s' or '%s' or '%s'",
|
Sprintf(kbuf, "'%s' or '%s' or '%s' or '%s'",
|
||||||
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK]),
|
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK]),
|
||||||
@@ -2071,20 +2071,17 @@ char *
|
|||||||
rndorcname(s)
|
rndorcname(s)
|
||||||
char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
int i;
|
static const char *v[] = { "a", "ai", "og", "u" };
|
||||||
const char *v[] = {"a", "ai", "og", "u"};
|
static const char *snd[] = { "gor", "gris", "un", "bane", "ruk",
|
||||||
const char *snd[] = {"gor", "gris", "un", "bane", "ruk",
|
"oth","ul", "z", "thos","akh","hai" };
|
||||||
"oth","ul", "z", "thos","akh","hai"};
|
int i, iend = rn1(2, 3), vstart = rn2(2);
|
||||||
int vstart = rn2(2);
|
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
for (i = 0; i < rn2(2) + 3; ++i) {
|
for (i = 0; i < iend; ++i) {
|
||||||
vstart = 1 - vstart; /* 0 -> 1, 1 -> 0 */
|
vstart = 1 - vstart; /* 0 -> 1, 1 -> 0 */
|
||||||
if (!rn2(30) && i > 0)
|
Sprintf(eos(s), "%s%s", (i > 0 && !rn2(30)) ? "-" : "",
|
||||||
(void) strcat(s, "-");
|
vstart ? v[rn2(SIZE(v))] : snd[rn2(SIZE(snd))]);
|
||||||
(void) sprintf(eos(s), "%s", vstart ? v[rn2(SIZE(v))] :
|
|
||||||
snd[rn2(SIZE(snd))]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ boolean with_you;
|
|||||||
if (migrating_objs)
|
if (migrating_objs)
|
||||||
deliver_obj_to_mon(mtmp, 0, DF_ALL);
|
deliver_obj_to_mon(mtmp, 0, DF_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xlocale && wander) {
|
if (xlocale && wander) {
|
||||||
/* monster moved a bit; pick a nearby location */
|
/* monster moved a bit; pick a nearby location */
|
||||||
/* mnearto() deals w/stone, et al */
|
/* mnearto() deals w/stone, et al */
|
||||||
|
|||||||
+1
-1
@@ -1694,7 +1694,7 @@ unsigned long deliverflags;
|
|||||||
where = (int) (otmp->owornmask & 0x7fffL); /* destination code */
|
where = (int) (otmp->owornmask & 0x7fffL); /* destination code */
|
||||||
if ((where & MIGR_TO_SPECIES) == 0)
|
if ((where & MIGR_TO_SPECIES) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((mtmp->data->mflags2 & otmp->corpsenm) != 0) {
|
if ((mtmp->data->mflags2 & otmp->corpsenm) != 0) {
|
||||||
obj_extract_self(otmp);
|
obj_extract_self(otmp);
|
||||||
otmp->owornmask = 0L;
|
otmp->owornmask = 0L;
|
||||||
|
|||||||
+1
-1
@@ -1292,7 +1292,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
|||||||
if ((obj->oartifact == ART_MJOLLNIR && Role_if(PM_VALKYRIE))
|
if ((obj->oartifact == ART_MJOLLNIR && Role_if(PM_VALKYRIE))
|
||||||
|| tethered_weapon) {
|
|| tethered_weapon) {
|
||||||
if (rn2(100)) {
|
if (rn2(100)) {
|
||||||
if (tethered_weapon)
|
if (tethered_weapon)
|
||||||
tmp_at(DISP_END, BACKTRACK);
|
tmp_at(DISP_END, BACKTRACK);
|
||||||
else
|
else
|
||||||
sho_obj_return_to_u(obj); /* display its flight */
|
sho_obj_return_to_u(obj); /* display its flight */
|
||||||
|
|||||||
+1
-1
@@ -690,7 +690,7 @@ doengrave()
|
|||||||
xcrypt(blengr(), buf);
|
xcrypt(blengr(), buf);
|
||||||
}
|
}
|
||||||
dengr = TRUE;
|
dengr = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WAN_NOTHING:
|
case WAN_NOTHING:
|
||||||
case WAN_UNDEAD_TURNING:
|
case WAN_UNDEAD_TURNING:
|
||||||
|
|||||||
+17
-14
@@ -666,7 +666,7 @@ void
|
|||||||
really_close()
|
really_close()
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (lftrack.init) {
|
if (lftrack.init) {
|
||||||
fd = lftrack.fd;
|
fd = lftrack.fd;
|
||||||
|
|
||||||
@@ -2156,24 +2156,27 @@ char sep;
|
|||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
|
|
||||||
while (*str) {
|
while (*str) {
|
||||||
if (*str == sep) nsep++;
|
if (*str == sep)
|
||||||
str++;
|
nsep++;
|
||||||
|
str++;
|
||||||
}
|
}
|
||||||
csep = rn2(nsep);
|
csep = rn2(nsep);
|
||||||
str = begin;
|
str = begin;
|
||||||
while ((csep > 0) && *str) {
|
while ((csep > 0) && *str) {
|
||||||
str++;
|
str++;
|
||||||
if (*str == sep) csep--;
|
if (*str == sep)
|
||||||
|
csep--;
|
||||||
}
|
}
|
||||||
if (*str) {
|
if (*str) {
|
||||||
if (*str == sep) str++;
|
if (*str == sep)
|
||||||
begin = str;
|
str++;
|
||||||
while (*str && *str != sep) {
|
begin = str;
|
||||||
str++;
|
while (*str && *str != sep) {
|
||||||
len++;
|
str++;
|
||||||
}
|
len++;
|
||||||
*str = '\0';
|
}
|
||||||
if (len)
|
*str = '\0';
|
||||||
|
if (len)
|
||||||
return begin;
|
return begin;
|
||||||
}
|
}
|
||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
@@ -3582,7 +3585,7 @@ const char *reason; /* explanation */
|
|||||||
void
|
void
|
||||||
testinglog(filenm, type, reason)
|
testinglog(filenm, type, reason)
|
||||||
const char *filenm; /* ad hoc file name */
|
const char *filenm; /* ad hoc file name */
|
||||||
const char *type;
|
const char *type;
|
||||||
const char *reason; /* explanation */
|
const char *reason; /* explanation */
|
||||||
{
|
{
|
||||||
FILE *lfile;
|
FILE *lfile;
|
||||||
|
|||||||
+1
-1
@@ -2592,7 +2592,7 @@ long *out_cnt;
|
|||||||
int unid_cnt;
|
int unid_cnt;
|
||||||
char prompt[QBUFSZ];
|
char prompt[QBUFSZ];
|
||||||
|
|
||||||
unid_cnt = count_unidentified(invent);
|
unid_cnt = count_unidentified(invent);
|
||||||
Sprintf(prompt, "Debug Identify"); /* 'title' rather than 'prompt' */
|
Sprintf(prompt, "Debug Identify"); /* 'title' rather than 'prompt' */
|
||||||
if (unid_cnt)
|
if (unid_cnt)
|
||||||
Sprintf(eos(prompt),
|
Sprintf(eos(prompt),
|
||||||
|
|||||||
+2
-2
@@ -1391,8 +1391,8 @@ int mmflags;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (allow_minvent && migrating_objs)
|
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)
|
if (!in_mklev)
|
||||||
newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */
|
newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -782,13 +782,13 @@ struct attack *mattk;
|
|||||||
|
|
||||||
/* Kill off aggressor if it didn't die. */
|
/* Kill off aggressor if it didn't die. */
|
||||||
if (!(result & MM_AGR_DIED)) {
|
if (!(result & MM_AGR_DIED)) {
|
||||||
boolean was_leashed = (magr->mleashed);
|
boolean was_leashed = (magr->mleashed != 0);
|
||||||
|
|
||||||
mondead(magr);
|
mondead(magr);
|
||||||
if (!DEADMONSTER(magr))
|
if (!DEADMONSTER(magr))
|
||||||
return result; /* life saved */
|
return result; /* life saved */
|
||||||
result |= MM_AGR_DIED;
|
result |= MM_AGR_DIED;
|
||||||
|
|
||||||
/* mondead() -> m_detach() -> m_unleash() always suppresses
|
/* mondead() -> m_detach() -> m_unleash() always suppresses
|
||||||
the m_unleash() slack message, so deliver it here instead */
|
the m_unleash() slack message, so deliver it here instead */
|
||||||
if (was_leashed)
|
if (was_leashed)
|
||||||
|
|||||||
+1
-2
@@ -801,11 +801,10 @@ stolen_booty(VOID_ARGS)
|
|||||||
mtyp = rn2((PM_ORC_SHAMAN - PM_ORC) + 1) + PM_ORC;
|
mtyp = rn2((PM_ORC_SHAMAN - PM_ORC) + 1) + PM_ORC;
|
||||||
mtmp = makemon(&mons[mtyp], 0, 0, MM_NONAME);
|
mtmp = makemon(&mons[mtyp], 0, 0, MM_NONAME);
|
||||||
if (mtmp) {
|
if (mtmp) {
|
||||||
shiny_orc_stuff(mtmp);
|
shiny_orc_stuff(mtmp);
|
||||||
migrate_orc(mtmp, 0UL);
|
migrate_orc(mtmp, 0UL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ransacked = 0;
|
ransacked = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -462,7 +462,7 @@ unsigned corpseflags;
|
|||||||
* underneath it, you could be told the corpse type of a
|
* underneath it, you could be told the corpse type of a
|
||||||
* monster that you never knew was there without this.
|
* monster that you never knew was there without this.
|
||||||
* The code in hitmu() substitutes the word "something"
|
* 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))
|
if (Blind && !sensemon(mtmp))
|
||||||
obj->dknown = 0;
|
obj->dknown = 0;
|
||||||
|
|||||||
+4
-6
@@ -255,14 +255,12 @@ struct monst *mon;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define flees_light(mon) ((mon)->data == &mons[PM_GREMLIN] && \
|
#define flees_light(mon) ((mon)->data == &mons[PM_GREMLIN] \
|
||||||
(uwep && artifact_light(uwep) && uwep->lamplit))
|
&& (uwep && artifact_light(uwep) && uwep->lamplit))
|
||||||
|
|
||||||
/* we could include this in the above macro, but probably overkill/overhead */
|
/* 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
|
/* monster begins fleeing for the specified time, 0 means untimed flee
|
||||||
* if first, only adds fleetime if monster isn't already fleeing
|
* if first, only adds fleetime if monster isn't already fleeing
|
||||||
* if fleemsg, prints a message about new flight, otherwise, caller should */
|
* if fleemsg, prints a message about new flight, otherwise, caller should */
|
||||||
|
|||||||
+3
-3
@@ -1390,7 +1390,7 @@ boolean without_asking;
|
|||||||
}
|
}
|
||||||
display_nhwindow(datawin, FALSE);
|
display_nhwindow(datawin, FALSE);
|
||||||
destroy_nhwindow(datawin), datawin = WIN_ERR;
|
destroy_nhwindow(datawin), datawin = WIN_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1470,7 +1470,7 @@ doidtrap()
|
|||||||
commands: basic letters vs digits, 'g' vs 'G' for '5', phone
|
commands: basic letters vs digits, 'g' vs 'G' for '5', phone
|
||||||
keypad vs normal layout of digits, and QWERTZ keyboard swap between
|
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.)
|
y/Y/^Y/M-y/M-Y/M-^Y and z/Z/^Z/M-z/M-Z/M-^Z.)
|
||||||
|
|
||||||
The interpretor understands
|
The interpretor understands
|
||||||
'&#' for comment,
|
'&#' for comment,
|
||||||
'&? option' for 'if' (also '&? !option'
|
'&? option' for 'if' (also '&? !option'
|
||||||
@@ -1481,7 +1481,7 @@ doidtrap()
|
|||||||
'&:' for 'else' (also '&: #comment';
|
'&:' for 'else' (also '&: #comment';
|
||||||
0 or 1 instance for a given 'if'), and
|
0 or 1 instance for a given 'if'), and
|
||||||
'&.' for 'endif' (also '&. #comment'; required for each 'if').
|
'&.' for 'endif' (also '&. #comment'; required for each 'if').
|
||||||
|
|
||||||
The option handling is a bit of a mess, with no generality for
|
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
|
which options to deal with and only a comma separated list of
|
||||||
integer values for the '=value' part. number_pad is the only
|
integer values for the '=value' part. number_pad is the only
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ char *buf;
|
|||||||
|
|
||||||
Sprintf(eos(buf), " (");
|
Sprintf(eos(buf), " (");
|
||||||
#if defined(RUNTIME_PORT_ID)
|
#if defined(RUNTIME_PORT_ID)
|
||||||
tmp = get_port_id(tmpbuf);
|
tmp = get_port_id(tmpbuf);
|
||||||
if (tmp)
|
if (tmp)
|
||||||
Sprintf(eos(buf), "%s%s", c++ ? "," : "", tmp);
|
Sprintf(eos(buf), "%s%s", c++ ? "," : "", tmp);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user