summaryrefslogtreecommitdiffstats
path: root/dab
diff options
context:
space:
mode:
authorjdc <jdc@NetBSD.org>2005-07-02 15:48:03 +0000
committerjdc <jdc@NetBSD.org>2005-07-02 15:48:03 +0000
commit170a9d818250f12e611b00634d1bfc397bd29909 (patch)
tree435e582205c6ee223296f80de297b433fe2cd0c9 /dab
parent323797ae07ccaae5d6e60685e0e1307fabfa551d (diff)
downloadbsdgames-darwin-170a9d818250f12e611b00634d1bfc397bd29909.tar.gz
bsdgames-darwin-170a9d818250f12e611b00634d1bfc397bd29909.tar.zst
bsdgames-darwin-170a9d818250f12e611b00634d1bfc397bd29909.zip
Tidy up curses state when we quit, instead of just doing exit().
Diffstat (limited to 'dab')
-rw-r--r--dab/human.cc9
-rw-r--r--dab/main.cc8
2 files changed, 12 insertions, 5 deletions
diff --git a/dab/human.cc b/dab/human.cc
index 79ceeb74..9ad042c9 100644
--- a/dab/human.cc
+++ b/dab/human.cc
@@ -1,4 +1,4 @@
-/* $NetBSD: human.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
+/* $NetBSD: human.cc,v 1.2 2005/07/02 15:48:03 jdc Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -40,14 +40,17 @@
* human.C: Human interface for dots, using rogue-like keys.
*/
#include "defs.h"
-RCSID("$NetBSD: human.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
+RCSID("$NetBSD: human.cc,v 1.2 2005/07/02 15:48:03 jdc Exp $")
#include "human.h"
#include "board.h"
#include "box.h"
+#include "ttyscrn.h"
#define CONTROL(a) ((a) & 037)
+extern GAMESCREEN *sc;
+
HUMAN::HUMAN(const char c) :
PLAYER(c),
_curx(0),
@@ -99,6 +102,8 @@ void HUMAN::play(const BOARD& b, size_t& y, size_t& x, int& dir)
break;
case 'q': case 'Q':
+ // Cleanup
+ delete sc;
exit(0);
case CONTROL('L'): case CONTROL('R'):
diff --git a/dab/main.cc b/dab/main.cc
index 399aa83f..73250709 100644
--- a/dab/main.cc
+++ b/dab/main.cc
@@ -1,4 +1,4 @@
-/* $NetBSD: main.cc,v 1.2 2003/12/28 17:53:48 thorpej Exp $ */
+/* $NetBSD: main.cc,v 1.3 2005/07/02 15:48:03 jdc Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
* main.C: Main dots program
*/
#include "defs.h"
-RCSID("$NetBSD: main.cc,v 1.2 2003/12/28 17:53:48 thorpej Exp $")
+RCSID("$NetBSD: main.cc,v 1.3 2005/07/02 15:48:03 jdc Exp $")
#include <iostream>
#include <unistd.h>
@@ -52,6 +52,8 @@ RCSID("$NetBSD: main.cc,v 1.2 2003/12/28 17:53:48 thorpej Exp $")
#include "human.h"
#include "ttyscrn.h"
+GAMESCREEN *sc;
+
// Print the command line usage
static void usage(char* pname)
{
@@ -173,7 +175,7 @@ int main(int argc, char** argv)
}
}
- GAMESCREEN *sc = TTYSCRN::create(acs, ny, nx);
+ sc = TTYSCRN::create(acs, ny, nx);
if (sc == NULL)
::errx(1, "Dimensions too large for current screen.");