-/* $NetBSD: ttyscrn.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
+/* $NetBSD: ttyscrn.cc,v 1.5 2012/10/06 19:39:51 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
*/
#include "defs.h"
-RCSID("$NetBSD: ttyscrn.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
+RCSID("$NetBSD: ttyscrn.cc,v 1.5 2012/10/06 19:39:51 christos Exp $")
#include <stdio.h>
#include <curses.h>
void TTYSCRN::score(size_t s, const PLAYER& p)
{
- mvwprintw(stdscr, _sy + s + TTYSCRN::offsscore, _sx, "S %c:%5d", p.getWho(),
+ mvwprintw(stdscr, _sy + s + TTYSCRN::offsscore, _sx, "S %c:%5zd", p.getWho(),
p.getScore());
}
void TTYSCRN::total(size_t s, const PLAYER& p)
{
- mvwprintw(stdscr, _sy + s + TTYSCRN::offstotal, _sx, "T %c:%5d", p.getWho(),
+ mvwprintw(stdscr, _sy + s + TTYSCRN::offstotal, _sx, "T %c:%5zd", p.getWho(),
p.getTotal());
}
void TTYSCRN::games(size_t s, const PLAYER& p)
{
- mvwprintw(stdscr, _sy + s + TTYSCRN::offsgames, _sx, "G %c:%5d", p.getWho(),
+ mvwprintw(stdscr, _sy + s + TTYSCRN::offsgames, _sx, "G %c:%5zd", p.getWho(),
p.getGames());
}
void TTYSCRN::ties(const PLAYER& p)
{
- mvwprintw(stdscr, _sy + TTYSCRN::offsties, _sx, "G =:%5d", p.getTies());
+ mvwprintw(stdscr, _sy + TTYSCRN::offsties, _sx, "G =:%5zd", p.getTies());
}
-TTYSCRN* TTYSCRN::create(int acs, size_t y, size_t x)
+TTYSCRN* TTYSCRN::create(int acs, size_t *y, size_t *x)
{
int tx, ty;
tx = getmaxx(stdscr);
ty = getmaxy(stdscr);
- if (tx == ERR || ty == ERR || (size_t)tx < x * 2 + TTYSCRN::offsx + 12
- || (size_t)ty < y * 2 + TTYSCRN::offsy) {
+ if (tx == ERR || ty == ERR
+ || static_cast<size_t>(tx) < *x * 2 + TTYSCRN::offsx + 14
+ || static_cast<size_t>(ty) < *y * 2 + TTYSCRN::offsy) {
endwin();
return NULL;
}
+ if (*x == 0)
+ *x = (tx - 14 - TTYSCRN::offsx) / 2;
+ if (*y == 0)
+ *y = (ty - TTYSCRN::offsy) / 2;
cbreak();
noecho();