curses lint

'orient' is the name of an enum defined in wincurs.h so don't use it
as a variable name in cursstat.c.  My compiler didn't complain using
'-Wshadow' but apparently some other one does.

Make the same change in the dead code located in the second half of
that file, plus a couple of formatting tweaks.
This commit is contained in:
PatR
2019-11-16 10:03:57 -08:00
parent cdbad827fe
commit 4d3828f6ec
+11 -13
View File
@@ -209,8 +209,8 @@ static void
draw_status() draw_status()
{ {
WINDOW *win = curses_get_nhwin(STATUS_WIN); WINDOW *win = curses_get_nhwin(STATUS_WIN);
int orient = curses_get_window_orientation(STATUS_WIN); orient statorient = (orient) curses_get_window_orientation(STATUS_WIN);
boolean horiz = (orient != ALIGN_RIGHT && orient != ALIGN_LEFT); boolean horiz = (statorient != ALIGN_RIGHT && statorient != ALIGN_LEFT);
boolean border = curses_window_has_border(STATUS_WIN); boolean border = curses_window_has_border(STATUS_WIN);
/* Figure out if we have proper window dimensions for horizontal /* Figure out if we have proper window dimensions for horizontal
@@ -1722,18 +1722,14 @@ void
curses_update_stats(void) curses_update_stats(void)
{ {
WINDOW *win = curses_get_nhwin(STATUS_WIN); WINDOW *win = curses_get_nhwin(STATUS_WIN);
orient statorient = (orient) curses_get_window_orientation(STATUS_WIN);
boolean horiz = (statorient != ALIGN_RIGHT && statorient != ALIGN_LEFT);
boolean border = curses_window_has_border(STATUS_WIN);
/* Clear the window */ /* Clear the window */
werase(win); werase(win);
int orient = curses_get_window_orientation(STATUS_WIN); /* Figure out if we have proper window dimensions for horizontal status */
boolean horiz = FALSE;
if ((orient != ALIGN_RIGHT) && (orient != ALIGN_LEFT))
horiz = TRUE;
boolean border = curses_window_has_border(STATUS_WIN);
/* Figure out if we have proper window dimensions for horizontal statusbar. */
if (horiz) { if (horiz) {
/* correct y */ /* correct y */
int cy = 3; int cy = 3;
@@ -1752,7 +1748,8 @@ curses_update_stats(void)
curses_last_messages(); curses_last_messages();
doredraw(); doredraw();
/* Reset XP highlight (since classic_status and new show different numbers) */ /* Reset XP highlight (since classic_status and new show
different numbers) */
prevexp.highlight_turns = 0; prevexp.highlight_turns = 0;
curses_update_stats(); curses_update_stats();
return; return;
@@ -1778,7 +1775,7 @@ curses_update_stats(void)
hpmax = u.mhmax; hpmax = u.mhmax;
} }
if (orient != ALIGN_RIGHT && orient != ALIGN_LEFT) if (horiz)
draw_horizontal(x, y, hp, hpmax); draw_horizontal(x, y, hp, hpmax);
else else
draw_vertical(x, y, hp, hpmax); draw_vertical(x, y, hp, hpmax);
@@ -1791,7 +1788,8 @@ curses_update_stats(void)
if (first) { if (first) {
first = FALSE; first = FALSE;
/* Zero highlight timers. This will call curses_update_status again if needed */ /* Zero highlight timers. This will call curses_update_status again
if needed */
curses_decrement_highlights(TRUE); curses_decrement_highlights(TRUE);
} }
} }