summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2016-02-27 12:48:14 +0000
committertb <tb@openbsd.org>2016-02-27 12:48:14 +0000
commitc3139318879ab03d2287030c56a3d6b1ea8ad82d (patch)
tree95da0648716ba67a9778de218c9d32ff83028030
parentCleanup the list of usernames that are rejected during installation. (diff)
downloadwireguard-openbsd-c3139318879ab03d2287030c56a3d6b1ea8ad82d.tar.xz
wireguard-openbsd-c3139318879ab03d2287030c56a3d6b1ea8ad82d.zip
Untangle a mess of nested ternary operators.
ok mestre@
-rw-r--r--games/worms/worms.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/games/worms/worms.c b/games/worms/worms.c
index 566439ecfe8..6056f562ce3 100644
--- a/games/worms/worms.c
+++ b/games/worms/worms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: worms.c,v 1.25 2016/01/07 16:00:34 tb Exp $ */
+/* $OpenBSD: worms.c,v 1.26 2016/02/27 12:48:14 tb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -308,7 +308,30 @@ main(int argc, char *argv[])
if (--ref[y1][x1] == 0)
mvaddch(y1, x1, trail);
}
- op = &(!x ? (!y ? upleft : (y == bottom ? lowleft : left)) : (x == last ? (!y ? upright : (y == bottom ? lowright : right)) : (!y ? upper : (y == bottom ? lower : normal))))[w->orientation];
+
+ if (x == 0) {
+ if (y == 0)
+ op = &upleft[w->orientation];
+ else if (y == bottom)
+ op = &lowleft[w->orientation];
+ else
+ op = &left[w->orientation];
+ } else if (x == last) {
+ if (y == 0)
+ op = &upright[w->orientation];
+ else if (y == bottom)
+ op = &lowright[w->orientation];
+ else
+ op = &right[w->orientation];
+ } else {
+ if (y == 0)
+ op = &upper[w->orientation];
+ else if (y == bottom)
+ op = &lower[w->orientation];
+ else
+ op = &normal[w->orientation];
+ }
+
switch (op->nopts) {
case 0:
endwin();