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:
+4
-6
@@ -793,12 +793,13 @@ enum earlyarg e_arg;
|
||||
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, '=');
|
||||
@@ -809,14 +810,12 @@ enum earlyarg e_arg;
|
||||
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)) {
|
||||
if (match_optname(extended_opt, "paste", 5, FALSE)) {
|
||||
insert_into_pastebuf = TRUE;
|
||||
} else {
|
||||
raw_printf(
|
||||
@@ -827,7 +826,6 @@ enum earlyarg e_arg;
|
||||
}
|
||||
early_version_info(insert_into_pastebuf);
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
||||
+7
-10
@@ -2071,20 +2071,17 @@ char *
|
||||
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;
|
||||
|
||||
+6
-3
@@ -2156,17 +2156,20 @@ char sep;
|
||||
return (char *) 0;
|
||||
|
||||
while (*str) {
|
||||
if (*str == sep) nsep++;
|
||||
if (*str == sep)
|
||||
nsep++;
|
||||
str++;
|
||||
}
|
||||
csep = rn2(nsep);
|
||||
str = begin;
|
||||
while ((csep > 0) && *str) {
|
||||
str++;
|
||||
if (*str == sep) csep--;
|
||||
if (*str == sep)
|
||||
csep--;
|
||||
}
|
||||
if (*str) {
|
||||
if (*str == sep) str++;
|
||||
if (*str == sep)
|
||||
str++;
|
||||
begin = str;
|
||||
while (*str && *str != sep) {
|
||||
str++;
|
||||
|
||||
+1
-1
@@ -1391,7 +1391,7 @@ int mmflags;
|
||||
}
|
||||
|
||||
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 */
|
||||
|
||||
+1
-1
@@ -782,7 +782,7 @@ struct attack *mattk;
|
||||
|
||||
/* 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))
|
||||
|
||||
@@ -805,7 +805,6 @@ stolen_booty(VOID_ARGS)
|
||||
migrate_orc(mtmp, 0UL);
|
||||
}
|
||||
}
|
||||
|
||||
ransacked = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -462,7 +462,7 @@ unsigned corpseflags;
|
||||
* 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;
|
||||
|
||||
+4
-6
@@ -255,13 +255,11 @@ struct monst *mon;
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user