Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/gomoku gomoku: properly center the player's names
details: https://anonhg.NetBSD.org/src/rev/c4bf6d2b8a00
branches: trunk
changeset: 366236:c4bf6d2b8a00
user: rillig <rillig%NetBSD.org@localhost>
date: Thu May 19 19:16:38 2022 +0000
description:
gomoku: properly center the player's names
diffstat:
games/gomoku/bdisp.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diffs (42 lines):
diff -r e7483c000f45 -r c4bf6d2b8a00 games/gomoku/bdisp.c
--- a/games/gomoku/bdisp.c Thu May 19 18:58:59 2022 +0000
+++ b/games/gomoku/bdisp.c Thu May 19 19:16:38 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bdisp.c,v 1.31 2022/05/19 18:58:59 rillig Exp $ */
+/* $NetBSD: bdisp.c,v 1.32 2022/05/19 19:16:38 rillig Exp $ */
/*
* Copyright (c) 1994
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: bdisp.c,v 1.31 2022/05/19 18:58:59 rillig Exp $");
+__RCSID("$NetBSD: bdisp.c,v 1.32 2022/05/19 19:16:38 rillig Exp $");
#endif
#endif /* not lint */
@@ -138,9 +138,9 @@
printw(" ");
i = (int)strlen(plyr[BLACK]);
j = (int)strlen(plyr[WHITE]);
- if (i + j <= 20) {
- /* TODO: properly center the text when i + j is even. */
- move(BSZ + 2, 10 - (i + j) / 2);
+ int sx = (scr_x(BSZ) + scr_x(1)) / 2 - (25 + i + j) / 2;
+ if (sx >= 0) {
+ move(BSZ + 2, sx);
printw("BLACK/%s (*) vs. WHITE/%s (O)",
plyr[BLACK], plyr[WHITE]);
} else {
@@ -345,9 +345,8 @@
nx = curx;
ny = cury;
for (;;) {
- /* TODO: replace with 'letters[curx + 1]' */
mvprintw(BSZ + 3, (BSZ - 6) / 2, "(%c %d) ",
- 'A' + ((curx > 7) ? (curx + 1) : curx), cury + 1);
+ letters[curx + 1], cury + 1);
move(scr_y(cury + 1), scr_x(curx + 1));
ch = getch();
Home |
Main Index |
Thread Index |
Old Index