more lint and formatting

Fix a C89/C90 complaint about a declaration following executable code.
The rest is formatting (of stuff I saw rather than systematic fixups).
This commit is contained in:
PatR
2016-10-13 12:08:06 -07:00
parent abb4f0fab2
commit 9f8f22ea4a
2 changed files with 45 additions and 36 deletions
+14 -8
View File
@@ -48,23 +48,26 @@ const char *const gloc_descr[NUM_GLOCS][4] = {
{ "any monsters", "monster", "next monster", "monsters" }, { "any monsters", "monster", "next monster", "monsters" },
{ "any items", "item", "next object", "objects" }, { "any items", "item", "next object", "objects" },
{ "any doors", "door", "next door or doorway", "doors or doorways" }, { "any doors", "door", "next door or doorway", "doors or doorways" },
{ "any unexplored areas", "unexplored area", "unexplored location", "unexplored locations" }, { "any unexplored areas", "unexplored area", "unexplored location",
{ "anything interesting", "interesting thing", "anything interesting", "anything interesting" } "unexplored locations" },
{ "anything interesting", "interesting thing", "anything interesting",
"anything interesting" }
}; };
void void
getpos_help_keyxhelp(tmpwin, k1,k2,gloc) getpos_help_keyxhelp(tmpwin, k1, k2, gloc)
winid tmpwin; winid tmpwin;
const char *k1; const char *k1;
const char *k2; const char *k2;
int gloc; int gloc;
{ {
char sbuf[BUFSZ]; char sbuf[BUFSZ];
Sprintf(sbuf, "Use '%s' or '%s' to %s%s%s.", Sprintf(sbuf, "Use '%s' or '%s' to %s%s%s.",
k1, k2, k1, k2,
iflags.getloc_usemenu ? "get a menu of " iflags.getloc_usemenu ? "get a menu of "
: "move the cursor to ", : "move the cursor to ",
gloc_descr[gloc][2 + iflags.getloc_usemenu], gloc_descr[gloc][2 + iflags.getloc_usemenu],
iflags.getloc_limitview ? " in view" : ""); iflags.getloc_limitview ? " in view" : "");
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
@@ -80,10 +83,12 @@ const char *goal;
boolean doing_what_is; boolean doing_what_is;
winid tmpwin = create_nhwindow(NHW_MENU); winid tmpwin = create_nhwindow(NHW_MENU);
Sprintf(sbuf, "Use '%c', '%c', '%c', '%c' to move the cursor to %s.", /* hjkl */ Sprintf(sbuf,
"Use '%c', '%c', '%c', '%c' to move the cursor to %s.", /* hjkl */
Cmd.move_W, Cmd.move_S, Cmd.move_N, Cmd.move_E, goal); Cmd.move_W, Cmd.move_S, Cmd.move_N, Cmd.move_E, goal);
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
putstr(tmpwin, 0, "Use 'H', 'J', 'K', 'L' to move the cursor 8 units at a time."); putstr(tmpwin, 0,
"Use 'H', 'J', 'K', 'L' to move the cursor 8 units at a time.");
putstr(tmpwin, 0, "Or enter a background symbol (ex. '<')."); putstr(tmpwin, 0, "Or enter a background symbol (ex. '<').");
Sprintf(sbuf, "Use '%s' to move the cursor on yourself.", Sprintf(sbuf, "Use '%s' to move the cursor on yourself.",
visctrl(Cmd.spkeys[NHKF_GETPOS_SELF])); visctrl(Cmd.spkeys[NHKF_GETPOS_SELF]));
@@ -119,7 +124,8 @@ const char *goal;
Sprintf(sbuf, "Use '%s' to toggle menu listing for possible targets.", Sprintf(sbuf, "Use '%s' to toggle menu listing for possible targets.",
visctrl(Cmd.spkeys[NHKF_GETPOS_MENU])); visctrl(Cmd.spkeys[NHKF_GETPOS_MENU]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
Sprintf(sbuf, "Use '%s' to toggle limiting possible targets to in view only.", Sprintf(sbuf,
"Use '%s' to toggle limiting possible targets to in view only.",
visctrl(Cmd.spkeys[NHKF_GETPOS_LIMITVIEW])); visctrl(Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
if (!iflags.terrainmode) { if (!iflags.terrainmode) {
@@ -155,7 +161,7 @@ const char *goal;
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
if (doing_what_is) { if (doing_what_is) {
Sprintf(sbuf, Sprintf(sbuf,
" '%s' describe current spot, show 'more info', move to another spot.", " '%s' describe current spot, show 'more info', move to another spot.",
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_V])); visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_V]));
putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, sbuf);
Sprintf(sbuf, Sprintf(sbuf,
+31 -28
View File
@@ -619,37 +619,38 @@ fixup_special()
} }
boolean boolean
maze_inbounds(x,y) maze_inbounds(x, y)
int x,y; int x, y;
{ {
return (x >= 2 && y >= 2 return (x >= 2 && y >= 2
&& x < x_maze_max && y < y_maze_max && isok(x,y)); && x < x_maze_max && y < y_maze_max && isok(x, y));
} }
void void
maze_remove_deadends(typ) maze_remove_deadends(typ)
xchar typ; xchar typ;
{ {
int x,y, dir; char dirok[4];
int x, y, dir, idx, idx2, dx, dy, dx2, dy2;
dirok[0] = 0; /* lint suppression */
for (x = 2; x < x_maze_max; x++) for (x = 2; x < x_maze_max; x++)
for (y = 2; y < y_maze_max; y++) for (y = 2; y < y_maze_max; y++)
if (ACCESSIBLE(levl[x][y].typ) && (x % 2) && (y % 2)) { if (ACCESSIBLE(levl[x][y].typ) && (x % 2) && (y % 2)) {
char dirok[4]; idx = idx2 = 0;
int idx = 0;
int idx2 = 0;
for (dir = 0; dir < 4; dir++) { for (dir = 0; dir < 4; dir++) {
int dx = x; /* note: mz_move() is a macro which modifies
int dy = y; one of its first two parameters */
int dx2 = x; dx = dx2 = x;
int dy2 = y; dy = dy2 = y;
mz_move(dx,dy, dir); mz_move(dx, dy, dir);
if (!maze_inbounds(dx,dy)) { if (!maze_inbounds(dx, dy)) {
idx2++; idx2++;
continue; continue;
} }
mz_move(dx2,dy2, dir); mz_move(dx2, dy2, dir);
mz_move(dx2,dy2, dir); mz_move(dx2, dy2, dir);
if (!maze_inbounds(dx2,dy2)) { if (!maze_inbounds(dx2, dy2)) {
idx2++; idx2++;
continue; continue;
} }
@@ -660,10 +661,10 @@ xchar typ;
} }
} }
if (idx2 >= 3 && idx > 0) { if (idx2 >= 3 && idx > 0) {
dx = x;
dy = y;
dir = dirok[rn2(idx)]; dir = dirok[rn2(idx)];
int dx = x; mz_move(dx, dy, dir);
int dy = y;
mz_move(dx,dy, dir);
levl[dx][dy].typ = typ; levl[dx][dy].typ = typ;
} }
} }
@@ -700,17 +701,17 @@ int wallthick;
rdy = (y_maze_max / scale); rdy = (y_maze_max / scale);
if (level.flags.corrmaze) if (level.flags.corrmaze)
for (x = 2; x < (rdx*2); x++) for (x = 2; x < (rdx * 2); x++)
for (y = 2; y < (rdy*2); y++) for (y = 2; y < (rdy * 2); y++)
levl[x][y].typ = STONE; levl[x][y].typ = STONE;
else else
for (x = 2; x <= (rdx*2); x++) for (x = 2; x <= (rdx * 2); x++)
for (y = 2; y <= (rdy*2); y++) for (y = 2; y <= (rdy * 2); y++)
levl[x][y].typ = ((x % 2) && (y % 2)) ? STONE : HWALL; levl[x][y].typ = ((x % 2) && (y % 2)) ? STONE : HWALL;
/* set upper bounds for maze0xy and walkfrom */ /* set upper bounds for maze0xy and walkfrom */
x_maze_max = (rdx*2); x_maze_max = (rdx * 2);
y_maze_max = (rdy*2); y_maze_max = (rdy * 2);
/* create maze */ /* create maze */
maze0xy(&mm); maze0xy(&mm);
@@ -726,7 +727,7 @@ int wallthick;
/* scale maze up if needed */ /* scale maze up if needed */
if (scale > 2) { if (scale > 2) {
char tmpmap[COLNO][ROWNO]; char tmpmap[COLNO][ROWNO];
int rx = 1,ry = 1; int rx = 1, ry = 1;
/* back up the existing smaller maze */ /* back up the existing smaller maze */
for (x = 1; x < x_maze_max; x++) for (x = 1; x < x_maze_max; x++)
@@ -738,12 +739,14 @@ int wallthick;
rx = x = 2; rx = x = 2;
while (rx < x_maze_max) { while (rx < x_maze_max) {
int mx = (x % 2) ? corrwid int mx = (x % 2) ? corrwid
: ((x == 2 || x == ((rdx*2))) ? 1 : wallthick); : ((x == 2 || x == (rdx * 2)) ? 1
: wallthick);
ry = y = 2; ry = y = 2;
while (ry < y_maze_max) { while (ry < y_maze_max) {
int dx = 0, dy = 0; int dx = 0, dy = 0;
int my = (y % 2) ? corrwid int my = (y % 2) ? corrwid
: ((y == 2 || y == ((rdy*2))) ? 1 : wallthick); : ((y == 2 || y == (rdy * 2)) ? 1
: wallthick);
for (dx = 0; dx < mx; dx++) for (dx = 0; dx < mx; dx++)
for (dy = 0; dy < my; dy++) { for (dy = 0; dy < my; dy++) {
if (rx+dx >= x_maze_max if (rx+dx >= x_maze_max