Coding style fixes, mostly indentation and whitespace
This commit is contained in:
parent
8a0d117d45
commit
373651359e
47 changed files with 131 additions and 130 deletions
|
@ -508,7 +508,7 @@ perform_mission_ship(int dam, struct shpstr *sp, coord x, coord y,
|
|||
}
|
||||
if (mcp->m_flags & M_SUB) {
|
||||
if (!targeting_ships)
|
||||
return dam; /* subs interdict only ships */
|
||||
return dam; /* subs interdict only ships */
|
||||
range = roundrange(torprange(sp));
|
||||
if (md > range)
|
||||
return dam;
|
||||
|
|
|
@ -199,8 +199,10 @@ static int
|
|||
strnncmp(char *s1, size_t sz1, char *s2, size_t sz2)
|
||||
{
|
||||
int res;
|
||||
if (sz1 == sz2) return strncmp(s1, s2, sz2);
|
||||
if (sz1 < sz2) return -strnncmp(s2, sz2, s1, sz1);
|
||||
if (sz1 == sz2)
|
||||
return strncmp(s1, s2, sz2);
|
||||
if (sz1 < sz2)
|
||||
return -strnncmp(s2, sz2, s1, sz1);
|
||||
res = strncmp(s1, s2, sz2);
|
||||
return res ? res : s1[sz2];
|
||||
}
|
||||
|
@ -278,7 +280,8 @@ nstr_parse_val(char *str, struct valstr *val)
|
|||
val->val_cat = NSC_VAL;
|
||||
val->val_as.str.base = str + 1;
|
||||
val->val_as.str.maxsz = tail - (str + 1);
|
||||
if (*tail) ++tail;
|
||||
if (*tail)
|
||||
++tail;
|
||||
/* FIXME else unclosed string */
|
||||
return tail;
|
||||
}
|
||||
|
@ -353,7 +356,7 @@ static int
|
|||
nstr_is_name_of_ca(struct valstr *val, struct castr *ca, int idx)
|
||||
{
|
||||
if (CANT_HAPPEN(val->val_cat != NSC_ID && idx >= 0))
|
||||
return 0;
|
||||
return 0;
|
||||
return idx >= 0 && strlen(ca[idx].ca_name) == val->val_as.str.maxsz;
|
||||
}
|
||||
|
||||
|
@ -487,11 +490,11 @@ nstr_optype(enum nsc_type lft, enum nsc_type rgt)
|
|||
lft = nstr_promote(lft);
|
||||
rgt = nstr_promote(rgt);
|
||||
if (lft == rgt)
|
||||
return lft;
|
||||
return lft;
|
||||
if (lft == NSC_DOUBLE && rgt == NSC_LONG)
|
||||
return NSC_DOUBLE;
|
||||
return NSC_DOUBLE;
|
||||
if (rgt == NSC_DOUBLE && lft == NSC_LONG)
|
||||
return NSC_DOUBLE;
|
||||
return NSC_DOUBLE;
|
||||
return NSC_NOTYPE;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ getpath(char *buf, char *arg, coord x, coord y, int onlyown,
|
|||
|
||||
getsect(x, y, §);
|
||||
|
||||
more:
|
||||
more:
|
||||
while (*p) {
|
||||
if (sarg_xy(p, &dx, &dy)) {
|
||||
bp = NULL;
|
||||
|
|
|
@ -544,7 +544,7 @@ copy_ascii_no_funny(char *dst, char *src)
|
|||
if ((ch < 0x20 && ch != '\t' && ch != '\n') || ch == 0x7f)
|
||||
; /* ignore funny control */
|
||||
else if (ch > 0x7f)
|
||||
*p++ = '?'; /* replace non-ASCII */
|
||||
*p++ = '?'; /* replace non-ASCII */
|
||||
else
|
||||
*p++ = ch;
|
||||
}
|
||||
|
@ -619,8 +619,7 @@ ufindpfx(char *s, int n)
|
|||
{
|
||||
int i = 0;
|
||||
|
||||
while (n && s[i])
|
||||
{
|
||||
while (n && s[i]) {
|
||||
if ((s[i++] & 0xc0) == 0xc0)
|
||||
while ((s[i] & 0xc0) == 0x80)
|
||||
i++;
|
||||
|
|
|
@ -85,7 +85,7 @@ sarg_xy(char *str, coord *xp, coord *yp)
|
|||
return 0;
|
||||
y = strtoy(str, &str);
|
||||
if (y < 0 || (*str != 0 && !isspace(*str)))
|
||||
return 0;
|
||||
return 0;
|
||||
if ((x ^ y) & 1)
|
||||
return 0;
|
||||
np = getnatp(player->cnum);
|
||||
|
|
|
@ -605,7 +605,7 @@ show_news(int tlev)
|
|||
if (rpt[i].r_newspage == N_NOTUSED)
|
||||
continue;
|
||||
pr("%-2d %-20.20s %4d\n", rpt[i].r_uid,
|
||||
page_headings[rpt[i].r_newspage].name, rpt[i].r_good_will);
|
||||
page_headings[rpt[i].r_newspage].name, rpt[i].r_good_will);
|
||||
for (j = 0; j < NUM_RPTS; j++)
|
||||
pr(" %s\n", rpt[i].r_newstory[j]);
|
||||
}
|
||||
|
@ -686,12 +686,12 @@ fmttime2822(time_t t)
|
|||
(time->tm_isdst ? tzi.DaylightBias : tzi.StandardBias));
|
||||
|
||||
nn = _snprintf(buf + n, sizeof(buf) - n, " %+03d%02d",
|
||||
time_offset/60, abs(time_offset) % 60);
|
||||
time_offset / 60, abs(time_offset) % 60);
|
||||
if (CANT_HAPPEN(nn <= 0 || nn + n >= sizeof(buf)))
|
||||
buf[0] = 0;
|
||||
#else
|
||||
size_t n = strftime(buf, sizeof(buf), "%a, %d %b %Y %T %z",
|
||||
localtime(&t));
|
||||
localtime(&t));
|
||||
if (CANT_HAPPEN(n == 0))
|
||||
buf[0] = 0;
|
||||
#endif
|
||||
|
|
|
@ -627,8 +627,7 @@ shp_fort_interdiction(struct emp_qelem *list, coord newx, coord newy,
|
|||
mpr(victim, "Incoming fire does %d damage!\n", dam);
|
||||
#if 0
|
||||
mpr(victim, "%s fires at you for %d!\n",
|
||||
xyas(fsect.sct_x,fsect.sct_y,victim),
|
||||
dam);
|
||||
xyas(fsect.sct_x, fsect.sct_y, victim), dam);
|
||||
#endif
|
||||
wu(0, fsect.sct_own,
|
||||
"%s fires at %s ships in %s for %d!\n",
|
||||
|
|
|
@ -161,7 +161,7 @@ unit_path(int together, struct empobj *unit, char *buf)
|
|||
d_sect.sct_x, d_sect.sct_y, player->cnum);
|
||||
if (!cp || unit->mobil <= 0) {
|
||||
pr("Can't get to '%s' right now.\n",
|
||||
xyas(d_sect.sct_x, d_sect.sct_y, player->cnum));
|
||||
xyas(d_sect.sct_x, d_sect.sct_y, player->cnum));
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
|
@ -201,8 +201,8 @@ unit_view(struct emp_qelem *list)
|
|||
pr("[oil:%d] ", sect.sct_oil);
|
||||
}
|
||||
pr("%s @ %s %d%% %s\n", obj_nameof(&ulp->unit.gen),
|
||||
xyas(ulp->unit.gen.x, ulp->unit.gen.y, player->cnum),
|
||||
sect.sct_effic, dchr[sect.sct_type].d_name);
|
||||
xyas(ulp->unit.gen.x, ulp->unit.gen.y, player->cnum),
|
||||
sect.sct_effic, dchr[sect.sct_type].d_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue