]> git.deb.at Git - pkg/netris.git/commitdiff
Imported Upstream version 0.5 upstream/0.5
authorGerfried Fuchs <rhonda@debian.at>
Wed, 14 Jul 2010 19:37:37 +0000 (21:37 +0200)
committerGerfried Fuchs <rhonda@debian.at>
Wed, 14 Jul 2010 19:37:37 +0000 (21:37 +0200)
Configure
FAQ
README
VERSION
board.c
curses.c
game.c
netris.h
robot_desc
shapes.c
util.c

index 7fe293ee71df458b7a55a0cff0c80378274614cb..fbc57a816bdf864ac39d4cd7c2c394dfae2859b0 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1,7 +1,7 @@
 :
 #
 # Netris -- A free networked version of T*tris
 :
 #
 # Netris -- A free networked version of T*tris
-# Copyright (C) 1994,1995,1996  Mark H. Weaver <mhw@netris.org>
+# Copyright (C) 1994-1996,1999  Mark H. Weaver <mhw@netris.org>
 # 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
-# $Id: Configure,v 1.17 1996/02/09 08:22:03 mhw Exp $
+# $Id: Configure,v 1.18 1999/05/16 06:56:19 mhw Exp $
 #
 
 CC="gcc"
 COPT="-g -O"
 CEXTRA=""
 LEXTRA=""
 #
 
 CC="gcc"
 COPT="-g -O"
 CEXTRA=""
 LEXTRA=""
+CURSES_HACK=false
 
 while [ $# -ge 1 ]; do
        opt="$1"
 
 while [ $# -ge 1 ]; do
        opt="$1"
@@ -53,6 +54,9 @@ while [ $# -ge 1 ]; do
                        LEXTRA="$1"
                        shift
                        ;;
                        LEXTRA="$1"
                        shift
                        ;;
+               --curses-hack)
+                       CURSES_HACK=true
+                       ;;
                *)
                        cat << "END"
 Usage: ./Configure [options...]
                *)
                        cat << "END"
 Usage: ./Configure [options...]
@@ -62,6 +66,7 @@ Usage: ./Configure [options...]
     --copt <opt>: Set C optimization flags
     --cextra <opt>: Set extra C flags
     --lextra <opt>: Set extra linker flags
     --copt <opt>: Set C optimization flags
     --cextra <opt>: Set extra C flags
     --lextra <opt>: Set extra linker flags
+    --curses-hack: Disable scroll-optimization for broken curses
 END
                        exit 1
                        ;;
 END
                        exit 1
                        ;;
@@ -73,8 +78,12 @@ CFLAGS="$COPT $CEXTRA"
 echo "Checking for libraries"
 echo 'main(){}' > test.c
 LFLAGS=""
 echo "Checking for libraries"
 echo 'main(){}' > test.c
 LFLAGS=""
-for lib in -lsocket -lnsl -lcurses -ltermcap
-do
+for lib in -lcurses -lncurses; do
+       if $CC $CFLAGS $LEXTRA test.c $lib > /dev/null 2>&1; then
+               LFLAGS="$lib"
+       fi
+done
+for lib in -lsocket -lnsl -ltermcap; do 
        if $CC $CFLAGS $LEXTRA test.c $lib > /dev/null 2>&1; then
                LFLAGS="$LFLAGS $lib"
        fi
        if $CC $CFLAGS $LEXTRA test.c $lib > /dev/null 2>&1; then
                LFLAGS="$LFLAGS $lib"
        fi
@@ -144,7 +153,8 @@ echo "Creating Makefile"
 sed -e "s/-LFLAGS-/$LFLAGS/g" -e "s/-SRCS-/$SRCS/g" \
        -e "s/-OBJS-/$OBJS/g" -e "s/-DISTFILES-/$DISTFILES/g" \
        -e "s/-COPT-/$COPT/g" -e "s/-CEXTRA-/$CEXTRA/g" \
 sed -e "s/-LFLAGS-/$LFLAGS/g" -e "s/-SRCS-/$SRCS/g" \
        -e "s/-OBJS-/$OBJS/g" -e "s/-DISTFILES-/$DISTFILES/g" \
        -e "s/-COPT-/$COPT/g" -e "s/-CEXTRA-/$CEXTRA/g" \
-       -e "s/-LEXTRA-/$LEXTRA/g" -e "s/-CC-/$CC/g" << "END" > Makefile
+       -e "s/-LEXTRA-/$LEXTRA/g" -e "s/-CC-/$CC/g" \
+       << "END" > Makefile
 #
 # Automatically generated by ./Configure -- DO NOT EDIT!
 #
 #
 # Automatically generated by ./Configure -- DO NOT EDIT!
 #
@@ -244,6 +254,9 @@ fi
 if [ "$HAS_SIGPROCMASK" = "true" ]; then
        echo "#define HAS_SIGPROCMASK" >> config.h
 fi
 if [ "$HAS_SIGPROCMASK" = "true" ]; then
        echo "#define HAS_SIGPROCMASK" >> config.h
 fi
+if [ "$CURSES_HACK" = "true" ]; then
+       echo "#define CURSES_HACK" >> config.h
+fi
 
 echo "Running 'make depend'"
 if make depend; then :; else cat << END; fi
 
 echo "Running 'make depend'"
 if make depend; then :; else cat << END; fi
diff --git a/FAQ b/FAQ
index 18a203c37b49497c105e27f566764df305b22442..4148983c4e22f5b90199842fe071a057005f4174 100644 (file)
--- a/FAQ
+++ b/FAQ
@@ -2,7 +2,7 @@
 # Netris
 # Frequently asked questions
 #
 # Netris
 # Frequently asked questions
 #
-# $Id: FAQ,v 1.3 1996/02/09 08:47:23 mhw Exp $
+# $Id: FAQ,v 1.4 1999/05/16 06:56:21 mhw Exp $
 #
 
 Questions
 #
 
 Questions
@@ -18,6 +18,8 @@ Questions
 [6] I'm using a slow terminal, and the game response is sluggish.
     What can I do?
 [7] Why can't my terminal hide the cursor?
 [6] I'm using a slow terminal, and the game response is sluggish.
     What can I do?
 [7] Why can't my terminal hide the cursor?
+[8] Occasionally when clearing a line, the display jerks, scrolling
+    very awkwardly.  How can I fix it?
 
 Answers
 =======
 
 Answers
 =======
@@ -109,4 +111,19 @@ Answers
     before running Netris.  If that doesn't work, your terminal
     probably doesn't support cursor invisibility.
 
     before running Netris.  If that doesn't work, your terminal
     probably doesn't support cursor invisibility.
 
+[8] Occasionally when clearing a line, the display jerks, scrolling
+    very awkwardly.  How can I fix it?
+
+    You can try running ./Configure with the "--curses-hack" option
+    and recompile.  This utilizes a non-portable hack which will only
+    work with certain curses libraries, so it's disabled by default.
+
+    All screen updating is done by your curses library, which means
+    it's not something that Netris can control.  Netris never tells
+    curses to scroll, but curses does so automatically in order to
+    optimize screen updates.  This hack modifies curses's internal
+    variables, making it think that your terminal doesn't know how to
+    region-scroll.
+
+
 # vi: tw=70 ai
 # vi: tw=70 ai
diff --git a/README b/README
index fc7d1558be58b92f24717e99e7d010e7ca19b400..9420e208f9b917ddbcf1cbdd2c257ea1b2244441 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 #
 # Netris -- A free networked version of T*tris
 #
 # Netris -- A free networked version of T*tris
-# Copyright (C) 1994,1995,1996  Mark H. Weaver <mhw@netris.org>
+# Copyright (C) 1994-1996,1999  Mark H. Weaver <mhw@netris.org>
 # 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
-# $Id: README,v 1.20 1996/02/09 08:22:06 mhw Exp $
+# $Id: README,v 1.21 1999/05/16 06:56:22 mhw Exp $
 #
 
 This is an unfinished developmental version of Netris, a free
 networked version of T*tris.  It is distributed under the terms
 of the GNU General Public License, which is described in the
 #
 
 This is an unfinished developmental version of Netris, a free
 networked version of T*tris.  It is distributed under the terms
 of the GNU General Public License, which is described in the
-file "COPYING" included with this distribution.
+file "COPYING" included with this distribution.  For more
+information about GNU and the Free Software Foundation,
+check out <http://www.gnu.org/>.
 
 In order to compile Netris you will need gcc.  You may be able to
 compile it with another ANSI C compiler, but if you attempt this
 
 In order to compile Netris you will need gcc.  You may be able to
 compile it with another ANSI C compiler, but if you attempt this
@@ -30,8 +32,9 @@ you are on your own.
 
 It's been built and tested on at least the following systems:
 
 
 It's been built and tested on at least the following systems:
 
+    GNU/Linux
+    FreeBSD 2.1.5, 2.1.6, 2.2
     NetBSD 1.0, 1.1
     NetBSD 1.0, 1.1
-    Linux
     SunOS 4.1.1, 4.1.3
     Solaris 2.3, 2.4
     HP-UX
     SunOS 4.1.1, 4.1.3
     Solaris 2.3, 2.4
     HP-UX
@@ -48,12 +51,12 @@ how it goes, and send me diffs if needed!
 See the FAQ in this directory if you have any problems.
 
 
 See the FAQ in this directory if you have any problems.
 
 
-NEW IN VERSION 0.4
+NEW IN VERSION 0.5
 ==================
 ==================
-- Netris now attempts to make the cursor invisible for terminals that
-  support it.  Xterm no, vt220 yes, vt100 maybe?
-- Ctrl-L (by default) will now redraw the screen.
-- Various cleanup and documentation changes.
+Netris now specifically looks for ncurses and uses color if it's
+available, unless the -C option is given.  Thanks to A.P.J. van Loo
+<cobra@multiweb.nl> for providing code which these changes are
+based on.
 
 
 INSTALLATION
 
 
 INSTALLATION
@@ -97,7 +100,7 @@ The keys are:
  'm'    down faster
  's'   toggle spying on the other player
  'p'   pause
  'm'    down faster
  's'   toggle spying on the other player
  'p'   pause
- 'f'   make game faster (irreversable)
+ 'f'   make game faster (irreversible)
  Ctrl-L        redraw the screen
 
 To see usage information, type "netris -h".
  Ctrl-L        redraw the screen
 
 To see usage information, type "netris -h".
diff --git a/VERSION b/VERSION
index bd73f47072b1fe4b9914ec14a7f6d47fcc8f816a..2eb3c4fe4eebcdea3da0790cc0ba74cb286ec4f4 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.4
+0.5
diff --git a/board.c b/board.c
index 125cdd0000768d3e519b9a34d4b07bd49fc7f194..d1cb66bb2b12caadc07fa176a788e5e1dc245012 100644 (file)
--- a/board.c
+++ b/board.c
@@ -1,6 +1,6 @@
 /*
  * Netris -- A free networked version of T*tris
 /*
  * Netris -- A free networked version of T*tris
- * Copyright (C) 1994,1995,1996  Mark H. Weaver <mhw@netris.org>
+ * Copyright (C) 1994-1996,1999  Mark H. Weaver <mhw@netris.org>
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: board.c,v 1.14 1996/02/09 08:22:08 mhw Exp $
+ * $Id: board.c,v 1.15 1999/05/16 06:56:24 mhw Exp $
  */
 
 #include "netris.h"
  */
 
 #include "netris.h"
@@ -237,7 +237,7 @@ ExtFunc void InsertJunk(int scr, int count, int column)
                CopyLine(scr, y, y + count);
        for (y = 0; y < count; ++y)
                for (x = 0; x < boardWidth[scr]; ++x)
                CopyLine(scr, y, y + count);
        for (y = 0; y < count; ++y)
                for (x = 0; x < boardWidth[scr]; ++x)
-                       SetBlock(scr, y, x, (x == column) ? BT_none : BT_piece1);
+                       SetBlock(scr, y, x, (x == column) ? BT_none : BT_white);
        curY[scr] += count;
 }
 
        curY[scr] += count;
 }
 
index 047efa4bc496de98ca707516db7cc60d53fb8c07..14e9ce47e32b796ab3c61732d65e5b18a366974f 100644 (file)
--- a/curses.c
+++ b/curses.c
@@ -1,6 +1,6 @@
 /*
  * Netris -- A free networked version of T*tris
 /*
  * Netris -- A free networked version of T*tris
- * Copyright (C) 1994,1995,1996  Mark H. Weaver <mhw@netris.org>
+ * Copyright (C) 1994-1996,1999  Mark H. Weaver <mhw@netris.org>
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: curses.c,v 1.32 1996/02/09 08:47:25 mhw Exp $
+ * $Id: curses.c,v 1.33 1999/05/16 06:56:25 mhw Exp $
  */
 
 #include "netris.h"
  */
 
 #include "netris.h"
 #include <string.h>
 #include <stdlib.h>
 
 #include <string.h>
 #include <stdlib.h>
 
+#ifdef NCURSES_VERSION
+# define HAVE_NCURSES
+#endif
+
+#ifdef HAVE_NCURSES
+static struct
+{
+       BlockType type;
+       short color;
+} myColorTable[] =
+{
+       { BT_white,             COLOR_WHITE },
+       { BT_blue,              COLOR_BLUE },
+       { BT_magenta,   COLOR_MAGENTA },
+       { BT_cyan,              COLOR_CYAN },
+       { BT_yellow,    COLOR_YELLOW },
+       { BT_green,             COLOR_GREEN },
+       { BT_red,               COLOR_RED },
+       { BT_none, 0 }
+};
+#endif
+
 static void PlotBlock1(int scr, int y, int x, BlockType type);
 static MyEventType KeyGenFunc(EventGenRec *gen, MyEvent *event);
 
 static void PlotBlock1(int scr, int y, int x, BlockType type);
 static MyEventType KeyGenFunc(EventGenRec *gen, MyEvent *event);
 
@@ -34,6 +56,7 @@ static EventGenRec keyGen =
 
 static int boardYPos[MAX_SCREENS], boardXPos[MAX_SCREENS];
 static int statusYPos, statusXPos;
 
 static int boardYPos[MAX_SCREENS], boardXPos[MAX_SCREENS];
 static int statusYPos, statusXPos;
+static int haveColor;
 
 static char *term_vi;  /* String to make cursor invisible */
 static char *term_ve;  /* String to make cursor visible */
 
 static char *term_vi;  /* String to make cursor invisible */
 static char *term_ve;  /* String to make cursor visible */
@@ -45,11 +68,35 @@ ExtFunc void InitScreens(void)
        GetTermcapInfo();
 
        /*
        GetTermcapInfo();
 
        /*
-        * Do this atomically.  Otherwise a badly timed Ctrl-C during
-        * initialization will leave your terminal in a bad state.
+        * Block signals while initializing curses.  Otherwise a badly timed
+        * Ctrl-C during initialization might leave the terminal in a bad state.
         */
        BlockSignals(&oldMask, SIGINT, 0);
        initscr();
         */
        BlockSignals(&oldMask, SIGINT, 0);
        initscr();
+
+#ifdef CURSES_HACK
+       {
+               extern char *CS;
+
+               CS = 0;
+       }
+#endif
+
+#ifdef HAVE_NCURSES
+       haveColor = colorEnable && has_colors();
+       if (haveColor)
+       {
+               int i = 0;
+
+               start_color();
+               for (i = 0; myColorTable[i].type != BT_none; ++i)
+                       init_pair(myColorTable[i].type, COLOR_BLACK,
+                                       myColorTable[i].color);
+       }
+#else
+       haveColor = 0;
+#endif
+
        AtExit(CleanupScreens);
        RestoreSignals(NULL, &oldMask);
 
        AtExit(CleanupScreens);
        RestoreSignals(NULL, &oldMask);
 
@@ -61,7 +108,7 @@ ExtFunc void InitScreens(void)
        move(0, 0);
        addstr("Netris ");
        addstr(version_string);
        move(0, 0);
        addstr("Netris ");
        addstr(version_string);
-       addstr(" (C) 1994,1995,1996  Mark H. Weaver     "
+       addstr(" (C) 1994-1996,1999  Mark H. Weaver     "
                        "\"netris -h\" for more info");
        statusYPos = 22;
        statusXPos = 0;
                        "\"netris -h\" for more info");
        statusYPos = 22;
        statusXPos = 0;
@@ -172,27 +219,26 @@ ExtFunc void CleanupScreen(int scr)
 
 static void PlotBlock1(int scr, int y, int x, BlockType type)
 {
 
 static void PlotBlock1(int scr, int y, int x, BlockType type)
 {
+       int colorIndex = abs(type);
+
        move(boardYPos[scr] - y, boardXPos[scr] + 2 * x);
        move(boardYPos[scr] - y, boardXPos[scr] + 2 * x);
-       switch (type) {
-               case BT_none:
-                       addstr("  ");
-                       break;
-               case -BT_piece1:
-                       if (standoutEnable)
-                               standout();
-                       addstr("$$");
-                       if (standoutEnable)
-                               standend();
-                       break;
-               case BT_piece1:
-                       if (standoutEnable)
+
+       if (type == BT_none)
+               addstr("  ");
+       else
+       {
+               if (standoutEnable)
+               {
+#ifdef HAVE_NCURSES
+                       if (haveColor)
+                               attrset(COLOR_PAIR(colorIndex));
+                       else
+#endif
                                standout();
                                standout();
-                       addstr("[]");
-                       if (standoutEnable)
-                               standend();
-                       break;
-               default:
-                       assert(0);
+               }
+
+               addstr(type > 0 ? "[]" : "$$");
+               standend();
        }
 }
 
        }
 }
 
diff --git a/game.c b/game.c
index 26ab6a8f72496f0e20f8a2fff416bc2a44c84da3..b40c12948035f365d4fc7a5a5463bd57c33577dc 100644 (file)
--- a/game.c
+++ b/game.c
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: game.c,v 1.38 1996/02/09 08:22:11 mhw Exp $
+ * $Id: game.c,v 1.39 1999/05/16 06:56:27 mhw Exp $
  */
 
 #define NOEXT
  */
 
 #define NOEXT
@@ -359,10 +359,10 @@ ExtFunc int main(int argc, char **argv)
        int initConn = 0, waitConn = 0, ch;
        char *hostStr = NULL, *portStr = NULL;
 
        int initConn = 0, waitConn = 0, ch;
        char *hostStr = NULL, *portStr = NULL;
 
-       standoutEnable = 1;
+       standoutEnable = colorEnable = 1;
        stepDownInterval = DEFAULT_INTERVAL;
        MapKeys(DEFAULT_KEYS);
        stepDownInterval = DEFAULT_INTERVAL;
        MapKeys(DEFAULT_KEYS);
-       while ((ch = getopt(argc, argv, "hHRs:r:Fk:c:woDSp:i:")) != -1)
+       while ((ch = getopt(argc, argv, "hHRs:r:Fk:c:woDSCp:i:")) != -1)
                switch (ch) {
                        case 'c':
                                initConn = 1;
                switch (ch) {
                        case 'c':
                                initConn = 1;
@@ -393,6 +393,9 @@ ExtFunc int main(int argc, char **argv)
                        case 'D':
                                dropModeEnable = 1;
                                break;
                        case 'D':
                                dropModeEnable = 1;
                                break;
+                       case 'C':
+                               colorEnable = 0;
+                               break;
                        case 'S':
                                standoutEnable = 0;
                                break;
                        case 'S':
                                standoutEnable = 0;
                                break;
index 5864cf775872fbebb4f6a398632b53501ea99317..45d61bf1764f9ab2d32e1181e6ba2c44bb0670cb 100644 (file)
--- a/netris.h
+++ b/netris.h
@@ -1,6 +1,6 @@
 /*
  * Netris -- A free networked version of T*tris
 /*
  * Netris -- A free networked version of T*tris
- * Copyright (C) 1994,1995,1996  Mark H. Weaver <mhw@netris.org>
+ * Copyright (C) 1994-1996,1999  Mark H. Weaver <mhw@netris.org>
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: netris.h,v 1.27 1996/02/09 08:22:14 mhw Exp $
+ * $Id: netris.h,v 1.28 1999/05/16 06:56:29 mhw Exp $
  */
 
 #ifndef NETRIS_H
  */
 
 #ifndef NETRIS_H
@@ -91,7 +91,9 @@ typedef long netint4;
 #define EM_any                         000777
 
 typedef enum _GameType { GT_onePlayer, GT_classicTwo, GT_len } GameType;
 #define EM_any                         000777
 
 typedef enum _GameType { GT_onePlayer, GT_classicTwo, GT_len } GameType;
-typedef enum _BlockTypeA { BT_none, BT_piece1, BT_wall, BT_len } BlockTypeA;
+typedef enum _BlockTypeA { BT_none, BT_white, BT_blue, BT_magenta,
+                                                       BT_cyan, BT_yellow, BT_green, BT_red,
+                                                       BT_wall, BT_len } BlockTypeA;
 typedef enum _Dir { D_down, D_right, D_up, D_left } Dir;
 typedef enum _Cmd { C_end, C_forw, C_back, C_left, C_right, C_plot } Cmd;
 typedef enum _FDType { FT_read, FT_write, FT_except, FT_len } FDType;
 typedef enum _Dir { D_down, D_right, D_up, D_left } Dir;
 typedef enum _Cmd { C_end, C_forw, C_back, C_left, C_right, C_plot } Cmd;
 typedef enum _FDType { FT_read, FT_write, FT_except, FT_len } FDType;
@@ -156,7 +158,7 @@ EXT int boardVisible[MAX_SCREENS], boardWidth[MAX_SCREENS];
 EXT Shape *curShape[MAX_SCREENS];
 EXT int curY[MAX_SCREENS], curX[MAX_SCREENS];
 EXT char opponentName[16], opponentHost[256];
 EXT Shape *curShape[MAX_SCREENS];
 EXT int curY[MAX_SCREENS], curX[MAX_SCREENS];
 EXT char opponentName[16], opponentHost[256];
-EXT int standoutEnable;
+EXT int standoutEnable, colorEnable;
 EXT int robotEnable, robotVersion, fairRobot;
 EXT int protocolVersion;
 
 EXT int robotEnable, robotVersion, fairRobot;
 EXT int protocolVersion;
 
index 01c697002a89b5db72576f33dceeafd12243375e..53415b25d013e12b329a5117be893eb3a2c6e818 100644 (file)
@@ -1,4 +1,4 @@
-$Id: robot_desc,v 1.3 1996/02/09 08:22:16 mhw Exp $
+$Id: robot_desc,v 1.4 1999/05/16 06:56:30 mhw Exp $
 
 
 GENERAL PROTOCOL
 
 
 GENERAL PROTOCOL
@@ -12,7 +12,7 @@ spaces.  The first token in a line is the name of the command.
 
 The robot should ignore commands which it doesn't recognize.  The protocol
 may be extended by adding extra commands without incrementing the version
 
 The robot should ignore commands which it doesn't recognize.  The protocol
 may be extended by adding extra commands without incrementing the version
-number.  The version number will only be increased when the command cannot
+number.  The version number will only be increased when a command cannot
 be safely ignored.
 
 Netris will also ignore commands which it doesn't recognize, for the same
 be safely ignored.
 
 Netris will also ignore commands which it doesn't recognize, for the same
@@ -61,7 +61,7 @@ NewPiece <num>
 --------------
 This command is never sent in "fair" robot mode.
 
 --------------
 This command is never sent in "fair" robot mode.
 
-Everytime a new piece is created, this command is sent to the robot.
+Every time a new piece is created, this command is sent to the robot.
 <num> is a positive integer uniquely identifying the piece.  <num> should
 be sent as a parameter to each movement command (sent to Netris) in
 order to prevent accidental movement of the wrong piece.
 <num> is a positive integer uniquely identifying the piece.  <num> should
 be sent as a parameter to each movement command (sent to Netris) in
 order to prevent accidental movement of the wrong piece.
@@ -116,7 +116,7 @@ Pause <pausedByMe> <pausedByThem>
 our side.  <pausedByThem> is 0 or 1, indicating whether any player other
 than our side has paused the game.  If either is 1, the game is paused.
 
 our side.  <pausedByThem> is 0 or 1, indicating whether any player other
 than our side has paused the game.  If either is 1, the game is paused.
 
-You may actually receive this command even when none of the flags change.
+You may actually receive this command even when neither of the flags change.
 
 
 NORMAL GAME (robot --> Netris)
 
 
 NORMAL GAME (robot --> Netris)
index c62f69b2d827af4e45df5c0f0d381293fc41f1ce..5ae8ac920da50518dc7b753091b6a51e50be96d0 100644 (file)
--- a/shapes.c
+++ b/shapes.c
@@ -1,6 +1,6 @@
 /*
  * Netris -- A free networked version of T*tris
 /*
  * Netris -- A free networked version of T*tris
- * Copyright (C) 1994,1995,1996  Mark H. Weaver <mhw@netris.org>
+ * Copyright (C) 1994-1996,1999  Mark H. Weaver <mhw@netris.org>
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: shapes.c,v 1.15 1996/02/09 08:22:17 mhw Exp $
+ * $Id: shapes.c,v 1.16 1999/05/16 06:56:31 mhw Exp $
  */
 
 #include "netris.h"
  */
 
 #include "netris.h"
 
 static Cmd cmds_long[] = { C_back, C_plot, C_forw, C_plot, C_forw, C_plot,
        C_forw, C_plot, C_end };
 
 static Cmd cmds_long[] = { C_back, C_plot, C_forw, C_plot, C_forw, C_plot,
        C_forw, C_plot, C_end };
-TwoWayDecl(long, long, 0, BT_piece1);
+TwoWayDecl(long, long, 0, BT_blue);
 
 static Cmd cmds_square[] = { C_plot, C_forw, C_left, C_plot, C_forw, C_left,
        C_plot, C_forw, C_left, C_plot, C_end };
 
 static Cmd cmds_square[] = { C_plot, C_forw, C_left, C_plot, C_forw, C_left,
        C_plot, C_forw, C_left, C_plot, C_end };
-static Shape shape_square = { &shape_square, 0, 0, D_up, 0, BT_piece1,
+static Shape shape_square = { &shape_square, 0, 0, D_up, 0, BT_magenta,
        cmds_square };
 
 static Cmd cmds_l[] = { C_right, C_back, C_plot, C_forw, C_plot, C_forw,
        C_plot, C_left, C_forw, C_plot, C_end };
        cmds_square };
 
 static Cmd cmds_l[] = { C_right, C_back, C_plot, C_forw, C_plot, C_forw,
        C_plot, C_left, C_forw, C_plot, C_end };
-FourWayDecl(l, l, 0, BT_piece1);
-FourWayDecl(l1, l, 1, BT_piece1);
+FourWayDecl(l, l, 0, BT_cyan);
+FourWayDecl(l1, l, 1, BT_yellow);
 
 static Cmd cmds_t[] = { C_plot, C_forw, C_plot, C_back, C_right, C_forw,
        C_plot, C_back, C_back, C_plot, C_end };
 
 static Cmd cmds_t[] = { C_plot, C_forw, C_plot, C_back, C_right, C_forw,
        C_plot, C_back, C_back, C_plot, C_end };
-FourWayDecl(t, t, 0, BT_piece1);
+FourWayDecl(t, t, 0, BT_white);
 
 static Cmd cmds_s[] = { C_back, C_plot, C_forw, C_plot, C_left, C_forw,
        C_plot, C_right, C_forw, C_plot, C_end };
 
 static Cmd cmds_s[] = { C_back, C_plot, C_forw, C_plot, C_left, C_forw,
        C_plot, C_right, C_forw, C_plot, C_end };
-TwoWayDecl(s, s, 0, BT_piece1);
-TwoWayDecl(s1, s, 1, BT_piece1);
+TwoWayDecl(s, s, 0, BT_green);
+TwoWayDecl(s1, s, 1, BT_red);
 
 ShapeOption stdOptions[] = {
        {1, &shape_long_horiz},
 
 ShapeOption stdOptions[] = {
        {1, &shape_long_horiz},
diff --git a/util.c b/util.c
index 98248ed64e3ab11d625e6fa514325e2ae9c63146..cb7f4211dc1d2cd966da27f97ebfaca5e3e6422b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: util.c,v 1.27 1996/02/09 08:22:23 mhw Exp $
+ * $Id: util.c,v 1.29 1999/05/16 06:56:33 mhw Exp $
  */
 
 #include "netris.h"
  */
 
 #include "netris.h"
@@ -66,7 +66,7 @@ ExtFunc void AtExit(void (*handler)(void))
 ExtFunc void Usage(void)
 {
        fprintf(stderr,
 ExtFunc void Usage(void)
 {
        fprintf(stderr,
-         "Netris version %s (C) 1994,1995,1996  Mark H. Weaver <mhw@netris.org>\n"
+         "Netris version %s (C) 1994-1996,1999  Mark H. Weaver <mhw@netris.org>\n"
          "Usage: netris <options>\n"
          "  -h         Print usage information\n"
          "  -w         Wait for connection\n"
          "Usage: netris <options>\n"
          "  -h         Print usage information\n"
          "  -w         Wait for connection\n"
@@ -84,7 +84,8 @@ ExtFunc void Usage(void)
          "  -D         Drops go into drop mode\n"
          "               This means that sliding off a cliff after a drop causes\n"
          "               another drop automatically\n"
          "  -D         Drops go into drop mode\n"
          "               This means that sliding off a cliff after a drop causes\n"
          "               another drop automatically\n"
-         "  -S         Disable standout mode (inverse/bold) for slow terminals\n"
+         "  -S         Disable inverse/bold/color for slow terminals\n"
+         "  -C         Disable color\n"
          "  -H         Show distribution and warranty information\n"
          "  -R         Show rules\n",
          version_string, DEFAULT_PORT, DEFAULT_KEYS);
          "  -H         Show distribution and warranty information\n"
          "  -R         Show rules\n",
          version_string, DEFAULT_PORT, DEFAULT_KEYS);
@@ -93,7 +94,7 @@ ExtFunc void Usage(void)
 ExtFunc void DistInfo(void)
 {
        fprintf(stderr,
 ExtFunc void DistInfo(void)
 {
        fprintf(stderr,
-         "Netris version %s (C) 1994,1995,1996  Mark H. Weaver <mhw@netris.org>\n"
+         "Netris version %s (C) 1994-1996,1999  Mark H. Weaver <mhw@netris.org>\n"
          "\n"
          "This program is free software; you can redistribute it and/or modify\n"
          "it under the terms of the GNU General Public License as published by\n"
          "\n"
          "This program is free software; you can redistribute it and/or modify\n"
          "it under the terms of the GNU General Public License as published by\n"
@@ -318,11 +319,13 @@ ExtFunc void AddEventGen(EventGenRec *gen)
 
 ExtFunc void RemoveEventGen(EventGenRec *gen)
 {
 
 ExtFunc void RemoveEventGen(EventGenRec *gen)
 {
-       assert(gen->next != NULL);
-       while (nextGen->next != gen)
-               nextGen = nextGen->next;
-       nextGen->next = gen->next;
-       gen->next = NULL;
+       /* assert(gen->next != NULL);   /* Be more forgiving, for SIGINTs */
+       if (gen->next) {
+               while (nextGen->next != gen)
+                       nextGen = nextGen->next;
+               nextGen->next = gen->next;
+               gen->next = NULL;
+       }
 }
 
 ExtFunc MyEventType WaitMyEvent(MyEvent *event, int mask)
 }
 
 ExtFunc MyEventType WaitMyEvent(MyEvent *event, int mask)