summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2002-10-26 14:05:11 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2002-10-26 14:05:11 +0000
commitf8f04af8cae40a244ede4a3db744dee28c32a02a (patch)
treed7972e07690f0808e673c29177a612a5d2f62b58 /games
parentCorrect RUN_DEPENDS. (diff)
Makes games/znibbles compiling again with gcc 3.2.1.
The patch has become somebody bigger than I was hoping for. And the original author is MIA... Approved by: Yin-Jieh Chen <yinjieh@csie.nctu.edu.tw> (maintainer)
Notes
Notes: svn path=/head/; revision=68869
Diffstat (limited to 'games')
-rw-r--r--games/znibbles/files/patch-aa55
-rw-r--r--games/znibbles/files/patch-src::Base.H31
-rw-r--r--games/znibbles/files/patch-src::DLList.cc11
-rw-r--r--games/znibbles/files/patch-src::GTK::ClientGtk.C11
-rw-r--r--games/znibbles/files/patch-src::GTK::GtkInterface.C344
-rw-r--r--games/znibbles/files/patch-src::GTK::NibblesArea.C11
-rw-r--r--games/znibbles/files/patch-src::LongObject.C33
-rw-r--r--games/znibbles/files/patch-src::Map.C89
-rw-r--r--games/znibbles/files/patch-src::Map.H11
-rw-r--r--games/znibbles/files/patch-src::Movable.C71
-rw-r--r--games/znibbles/files/patch-src::Niblle.C25
-rw-r--r--games/znibbles/files/patch-src::Object.C20
-rw-r--r--games/znibbles/files/patch-src::Options.C114
-rw-r--r--games/znibbles/files/patch-src::Player.C33
-rw-r--r--games/znibbles/files/patch-src::ServerInterface.C215
-rw-r--r--games/znibbles/files/patch-src::Trame.C124
-rw-r--r--games/znibbles/files/patch-src::Trame.H11
-rw-r--r--games/znibbles/files/patch-src::World.C227
-rw-r--r--games/znibbles/files/patch-src::X11::X11Interface.C285
-rw-r--r--games/znibbles/files/patch-src::X11::textarea.C20
-rw-r--r--games/znibbles/files/patch-src::getopt.c10
21 files changed, 1696 insertions, 55 deletions
diff --git a/games/znibbles/files/patch-aa b/games/znibbles/files/patch-aa
deleted file mode 100644
index c74f800d8b65..000000000000
--- a/games/znibbles/files/patch-aa
+++ /dev/null
@@ -1,55 +0,0 @@
---- src/ServerInterface.C.orig Sun Feb 27 12:09:00 2000
-+++ src/ServerInterface.C Sun Feb 27 12:13:13 2000
-@@ -48,6 +48,9 @@
- #include <errno.h>
-
- #include <sys/times.h>
-+#ifdef __FreeBSD__
-+#include <sys/param.h>
-+#endif
-
- #include "DLList.h" // Doubly linked lists
-
-@@ -230,9 +233,15 @@
- socket_service = -1;
- while (socket_service == -1) {
- // wait for connection
-+#if defined(__FreeBSD__) && (__FreeBSD_version >= 400013)
-+ socket_service = accept(socket_ecoute,
-+ (struct sockaddr *) &address,
-+ (socklen_t *) &lg_address);
-+#else
- socket_service = accept(socket_ecoute,
- (struct sockaddr *) &address,
- &lg_address);
-+#endif
-
- // Reception d'un signal (probablement SIGCHLD)
- if(socket_service == -1 && errno == EINTR) {
-@@ -305,8 +314,8 @@
- } else if (strcmp(line, "p") == 0) { // pause
- xpaused = !xpaused;
- display_system_message(((xpaused)
-- ? "Pausing...\n"
-- : "Running...\n"));
-+ ? (char *)"Pausing...\n"
-+ : (char *)"Running...\n"));
- continue;
- } else if (strcmp(line, "-") == 0) { // slower...
- if (debug) {
-@@ -433,9 +442,15 @@
-
- while (read_ready(socketnum)) {
-
-+#if defined(__FreeBSD__) && (__FreeBSD_version >= 400013)
-+ socket_service = accept(socketnum,
-+ (struct sockaddr *) &address,
-+ (socklen_t *) &lg_address);
-+#else
- socket_service = accept(socketnum,
- (struct sockaddr *) &address,
- &lg_address);
-+#endif
-
- // s'il y a une erreur, ce n'est pas une EINTR (cf appel a read_ready())
- if(socket_service == -1) {
diff --git a/games/znibbles/files/patch-src::Base.H b/games/znibbles/files/patch-src::Base.H
new file mode 100644
index 000000000000..0ca0d53c5be2
--- /dev/null
+++ b/games/znibbles/files/patch-src::Base.H
@@ -0,0 +1,31 @@
+--- src/Base.H Wed May 12 11:40:22 1999
++++ src/Base.H Sat Oct 26 00:30:09 2002
+@@ -32,7 +32,7 @@
+ #define __H_BASE__
+
+
+-#include <iostream.h>
++#include <iostream>
+
+
+ // #define DEBUG
+@@ -55,8 +55,8 @@
+ inline ~Base()
+ {
+ total--;
+- cout << " <" << id << "/" << global_id
+- << " deleted><left=" << total << "> " << endl;
++ std::cout << " <" << id << "/" << global_id
++ << " deleted><left=" << total << "> " << std::endl;
+ }
+ #else
+
+@@ -65,7 +65,7 @@
+
+ #endif
+
+- void display() { cout << "ID: " << id << endl; }
++ void display() { std::cout << "ID: " << id << std::endl; }
+
+ private:
+ static int global_id;
diff --git a/games/znibbles/files/patch-src::DLList.cc b/games/znibbles/files/patch-src::DLList.cc
new file mode 100644
index 000000000000..2a77a97430ce
--- /dev/null
+++ b/games/znibbles/files/patch-src::DLList.cc
@@ -0,0 +1,11 @@
+--- src/DLList.cc Sun Apr 4 06:03:04 1999
++++ src/DLList.cc Sat Oct 26 00:48:24 2002
+@@ -21,7 +21,7 @@
+ //#pragma implementation
+ #endif
+ #include <limits.h>
+-#include <stream.h>
++//#include <stream>
+ #include <stdio.h>
+ #include <errno.h>
+ //#include <builtin.h>
diff --git a/games/znibbles/files/patch-src::GTK::ClientGtk.C b/games/znibbles/files/patch-src::GTK::ClientGtk.C
new file mode 100644
index 000000000000..b9633a81ecfd
--- /dev/null
+++ b/games/znibbles/files/patch-src::GTK::ClientGtk.C
@@ -0,0 +1,11 @@
+--- src/GTK/ClientGtk.C Sat Apr 24 02:47:47 1999
++++ src/GTK/ClientGtk.C Sat Oct 26 00:38:02 2002
+@@ -51,7 +51,7 @@
+
+ world.run(); // start the client
+
+- cout << "Yeah !\n" << endl;
++ std::cout << "Yeah !\n" << std::endl;
+ return 0;
+ }
+
diff --git a/games/znibbles/files/patch-src::GTK::GtkInterface.C b/games/znibbles/files/patch-src::GTK::GtkInterface.C
new file mode 100644
index 000000000000..85f00cc4d961
--- /dev/null
+++ b/games/znibbles/files/patch-src::GTK::GtkInterface.C
@@ -0,0 +1,344 @@
+--- src/GTK/GtkInterface.C Wed May 12 21:43:29 1999
++++ src/GTK/GtkInterface.C Sat Oct 26 00:36:57 2002
+@@ -37,7 +37,7 @@
+ #include <gtk/gtk.h>
+ #include <gdk/gdkkeysyms.h>
+
+-#include <iostream.h>
++#include <iostream>
+
+ #include <unistd.h>
+ #include <stdlib.h>
+@@ -138,7 +138,7 @@
+ display_version();
+
+ if (_two_key)
+- cout << "Two-key mode enabled" << endl;
++ std::cout << "Two-key mode enabled" << std::endl;
+
+
+ // connect pipe_handler to SIGPIPE signal
+@@ -154,9 +154,9 @@
+ exit(2);
+ }
+
+- cout << "Connecting to ZNibbles server: " \
++ std::cout << "Connecting to ZNibbles server: " \
+ << options.get_host_name() << ":" \
+- << options.get_port() << "... " << endl;
++ << options.get_port() << "... " << std::endl;
+
+ // create and bind socket to any port
+ port = 0;
+@@ -168,8 +168,8 @@
+ }
+
+ if (_debug)
+- cout << "Client socket created on port: " \
+- << ntohs(client_address.sin_port) << endl;
++ std::cout << "Client socket created on port: " \
++ << ntohs(client_address.sin_port) << std::endl;
+
+ // Build server address
+ server_address.sin_family = AF_INET;
+@@ -186,7 +186,7 @@
+
+ display_play_help();
+
+- cout << "Connection accepted\n" << endl;
++ std::cout << "Connection accepted\n" << std::endl;
+
+ _hack_socket_client = _socket_client; // hack for signal handling
+ action.sa_handler = stop_handler;
+@@ -196,7 +196,7 @@
+
+ init_messages(options.get_message_file());
+
+- cout << "initializing interface..." << endl;
++ std::cout << "initializing interface..." << std::endl;
+ make(argc, argv);
+ }
+
+@@ -294,7 +294,7 @@
+ case 'z':
+ {
+ // if (_debug)
+- cout << "Sending welcome message..." << endl;
++ std::cout << "Sending welcome message..." << std::endl;
+
+ Trame tzz;
+ tzz.reset();
+@@ -315,7 +315,7 @@
+
+ default:
+ if (mythis._debug)
+- cout << "key=" << event->keyval << endl;
++ std::cout << "key=" << event->keyval << std::endl;
+ return FALSE;
+ }
+
+@@ -337,7 +337,7 @@
+ GtkInterface *pthis)
+ {
+ if (pthis->_debug)
+- cerr << "GtkInterface:::configure_event()"<<endl;
++ std::cerr << "GtkInterface:::configure_event()"<<std::endl;
+
+ return FALSE;
+ }
+@@ -349,7 +349,7 @@
+ GtkInterface *pthis)
+ {
+ if (pthis->_debug)
+- cerr << "GtkInterface:::expose_event()"<<endl;
++ std::cerr << "GtkInterface:::expose_event()"<<std::endl;
+
+ return FALSE;
+ }
+@@ -476,7 +476,7 @@
+ // GTK, the proper way to do this would be to use the
+ // gdk_input_add() function.
+
+- gtk_idle_add(myWorkProc, this);
++ gtk_idle_add((GtkFunction)myWorkProc, this);
+
+ gdk_input_add(_socket_client,
+ GDK_INPUT_READ,
+@@ -487,57 +487,57 @@
+ // display version numbers (long format)
+ void GtkInterface::display_version()
+ {
+- cerr << "ZNibbles v" VERSION " - A little silly game - "
++ std::cerr << "ZNibbles v" VERSION " - A little silly game - "
+ << "(c) Vincent Mallet 1997, 1998, 1999 - vmallet@enst.fr"
+- << endl << endl;
++ << std::endl << std::endl;
+ }
+
+ // display version number (short format)
+ void GtkInterface::display_version_short()
+ {
+- cout << "ZNibbles Gtk Client " VERSION << endl;
++ std::cout << "ZNibbles Gtk Client " VERSION << std::endl;
+ }
+
+ // display small help
+ void GtkInterface::display_help(char *name)
+ {
+- cout << "Usage: " << name << " [OPTION].. PLAYERNAME" << endl;
+- cout << endl;
+- cout << "Start a ZNibbles Gtk client and connect to the specified nibbles server." << endl;
+- cout << endl;
+- cout << " -n, --host-name=HOST connect to server HOST [default is localhost]" << endl;
+- cout << " -p, --port=NUM connect to port NUM of server [default is 5051]" << endl;
+- cout << " -m, --message-file=FILE load predefined messages from file FILE" << endl;
+- cout << " -t, --twokey control worm with only two keys, LEFT and RIGHT" << endl;
+- cout << " -i, --enable-stdin enable standard input for sending messages" << endl;
+- cout << " -d, --debug enable debug output" << endl;
+- cout << " -V, --version print version number, then exit" \
+- << endl;
+- cout << " -h, --help show this message and exit" << endl;
+- cout << endl;
+- cout << "Report bugs to <vmallet@enst.fr>." << endl;
++ std::cout << "Usage: " << name << " [OPTION].. PLAYERNAME" << std::endl;
++ std::cout << std::endl;
++ std::cout << "Start a ZNibbles Gtk client and connect to the specified nibbles server." << std::endl;
++ std::cout << std::endl;
++ std::cout << " -n, --host-name=HOST connect to server HOST [default is localhost]" << std::endl;
++ std::cout << " -p, --port=NUM connect to port NUM of server [default is 5051]" << std::endl;
++ std::cout << " -m, --message-file=FILE load predefined messages from file FILE" << std::endl;
++ std::cout << " -t, --twokey control worm with only two keys, LEFT and RIGHT" << std::endl;
++ std::cout << " -i, --enable-stdin enable standard input for sending messages" << std::endl;
++ std::cout << " -d, --debug enable debug output" << std::endl;
++ std::cout << " -V, --version print version number, then exit" \
++ << std::endl;
++ std::cout << " -h, --help show this message and exit" << std::endl;
++ std::cout << std::endl;
++ std::cout << "Report bugs to <vmallet@enst.fr>." << std::endl;
+ }
+
+
+
+ void GtkInterface::display_play_help()
+ {
+- cout << endl;
+- cout << "Welcome to ZNibbles!" << endl;
+- cout << endl;
+- cout << "Valid keys while playing:" << endl
+- << endl
+- << " Up, Down, Left, Right: move worm 1" << endl
+- << endl
+- << " p/u : pause/unpause game" << endl
+- << endl
+- << " P/U : pause/unpause _your_ worm" << endl
+- << endl
+- << " 1, 2, ... 0 : send predefined messages to other players" << endl
+- << endl
+- << " Ctrl+Q : quit game" << endl
+- << endl
+- << " Have fun!" << endl;
++ std::cout << std::endl;
++ std::cout << "Welcome to ZNibbles!" << std::endl;
++ std::cout << std::endl;
++ std::cout << "Valid keys while playing:" << std::endl
++ << std::endl
++ << " Up, Down, Left, Right: move worm 1" << std::endl
++ << std::endl
++ << " p/u : pause/unpause game" << std::endl
++ << std::endl
++ << " P/U : pause/unpause _your_ worm" << std::endl
++ << std::endl
++ << " 1, 2, ... 0 : send predefined messages to other players" << std::endl
++ << std::endl
++ << " Ctrl+Q : quit game" << std::endl
++ << std::endl
++ << " Have fun!" << std::endl;
+ }
+
+
+@@ -547,7 +547,7 @@
+
+ void GtkInterface::pipe_handler(int sig)
+ {
+- cerr << "--- Lost Server Connection! ---" << endl;
++ std::cerr << "--- Lost Server Connection! ---" << std::endl;
+ sig++; // warnings..
+ _dead_server = 1;
+ }
+@@ -555,7 +555,7 @@
+
+ void GtkInterface::stop_handler(int sig)
+ {
+- cerr << "--- Quitting game! ---" << endl;
++ std::cerr << "--- Quitting game! ---" << std::endl;
+
+ if (_hack_socket_client) {
+ struct timeval tv;
+@@ -647,11 +647,11 @@
+ char buf[300];
+
+ if (priv) {
+- // cout << "Got *private* Message: '" << msg << "'" << endl;
++ // std::cout << "Got *private* Message: '" << msg << "'" << std::endl;
+ sprintf(buf, "[Private] %s> %s\n", from.get_name(), msg);
+ }
+ else {
+- // cout << "Message: " << from.get_name() << "> " << msg << endl;
++ // std::cout << "Message: " << from.get_name() << "> " << msg << std::endl;
+ sprintf(buf, "%s> %s\n", from.get_name(), msg);
+ }
+
+@@ -707,7 +707,7 @@
+ void GtkInterface::join_game()
+ {
+ if (_debug)
+- cout << "Sending welcome message..." << endl;
++ std::cout << "Sending welcome message..." << std::endl;
+
+ t.put_char(JOIN_GAME);
+ t.put_string(_own_name);
+@@ -740,21 +740,21 @@
+ gint source,
+ GdkInputCondition cond)
+ {
+-//DBG cerr << "!" ;
++//DBG std::cerr << "!" ;
+ ((GtkInterface *)pthis)->handle_server_input();
+ }
+
+
+ void GtkInterface::handle_server_input()
+ {
+-//DBG cerr << nnn << " " ;
++//DBG std::cerr << nnn << " " ;
+ //DBG nnn = 0;
+
+ static int done = 0;
+-//DBG cerr<<"<";
++//DBG std::cerr<<"<";
+ if (t.receive_from(_socket_client)) {
+ _errors++;
+- cerr << "GtkInterface::handle_server_input(): read error" << endl;
++ std::cerr << "GtkInterface::handle_server_input(): read error" << std::endl;
+ if (_errors >= 5) {
+ pipe_handler(SIGPIPE);
+ }
+@@ -762,9 +762,9 @@
+ }
+
+ _errors = 0;
+-//DBG cerr<<">";
++//DBG std::cerr<<">";
+
+-//DBG cerr << "X";
++//DBG std::cerr << "X";
+
+ switch(t.peek_char()) {
+ case TRAME_ERROR:
+@@ -802,14 +802,14 @@
+
+ case QUIT_GAME:
+ if (_debug)
+- cout << "Got QUIT_GAME" << endl;
+- cout << "Client shutting down.... " << endl;
++ std::cout << "Got QUIT_GAME" << std::endl;
++ std::cout << "Client shutting down.... " << std::endl;
+ done = 1;
+ break;
+
+ default:
+ if (_debug)
+- cout << "got unknown frame type: " << (int) t.peek_char() << endl;
++ std::cout << "got unknown frame type: " << (int) t.peek_char() << std::endl;
+ break;
+ }
+ }
+@@ -840,7 +840,7 @@
+ int my_other_player_id = t.get_int();
+
+ if (_debug)
+- cout << "my new player: " << my_other_player_id << endl;
++ std::cout << "my new player: " << my_other_player_id << std::endl;
+
+ Player& p = world.lookup_player(my_other_player_id);
+
+@@ -848,8 +848,8 @@
+
+ if (_other_player == NULL) {
+ if (_debug)
+- cout << "GtkInterface::do_your_other_player(): bad id: " \
+- << my_other_player_id << endl;
++ std::cout << "GtkInterface::do_your_other_player(): bad id: " \
++ << my_other_player_id << std::endl;
+ return;
+ }
+
+@@ -870,7 +870,7 @@
+ void GtkInterface::do_void_trame()
+ {
+ if (_debug)
+- cout << "got VOID_TRAME " << endl;
++ std::cout << "got VOID_TRAME " << std::endl;
+ t.get_char();
+ char *p = t.get_string();
+ if (p && strcmp(p, "w") == 0)
+@@ -978,8 +978,8 @@
+
+ if (gtk_player == NULL) {
+ if (_debug)
+- cerr << "GtkInterface::set_own_player(): SERIOUS: player not found !" \
+- << endl;
++ std::cerr << "GtkInterface::set_own_player(): SERIOUS: player not found !" \
++ << std::endl;
+ return;
+ }
+
+@@ -999,7 +999,7 @@
+ {
+ if (_other_player == NULL) {
+ if (_debug)
+- cout << "Sending welcome message..." << endl;
++ std::cout << "Sending welcome message..." << std::endl;
+
+ Trame tzz;
+ char s[100];
diff --git a/games/znibbles/files/patch-src::GTK::NibblesArea.C b/games/znibbles/files/patch-src::GTK::NibblesArea.C
new file mode 100644
index 000000000000..d85f655a2dd7
--- /dev/null
+++ b/games/znibbles/files/patch-src::GTK::NibblesArea.C
@@ -0,0 +1,11 @@
+--- src/GTK/NibblesArea.C Wed May 12 11:48:25 1999
++++ src/GTK/NibblesArea.C Sat Oct 26 00:37:26 2002
+@@ -323,7 +323,7 @@
+ GdkEventExpose *event,
+ NibblesArea *mythis)
+ {
+- cout << "expose !" << endl;
++ std::cout << "expose !" << std::endl;
+
+ if (!mythis->joined) {
+ mythis->gif.join_game();
diff --git a/games/znibbles/files/patch-src::LongObject.C b/games/znibbles/files/patch-src::LongObject.C
new file mode 100644
index 000000000000..b0b6b4cae0f6
--- /dev/null
+++ b/games/znibbles/files/patch-src::LongObject.C
@@ -0,0 +1,33 @@
+--- src/LongObject.C Mon May 10 08:59:45 1999
++++ src/LongObject.C Sat Oct 26 00:39:11 2002
+@@ -128,7 +128,7 @@
+ void LongObject::read_description(Trame &t)
+ {
+ if (t.get_char() != NEW_LONGOBJ) {
+- cerr << "LongObject::read_description(): ohhh le bordel!\n";
++ std::cerr << "LongObject::read_description(): ohhh le bordel!\n";
+ exit(1);
+ }
+
+@@ -161,17 +161,17 @@
+
+ void LongObject::display()
+ {
+- cout << " ID:"<< id;
++ std::cout << " ID:"<< id;
+ printf(" %04x", classtype);
+- cout << " LongObj " << pos.x << "x" \
++ std::cout << " LongObj " << pos.x << "x" \
+ << pos.y << " len=" << length << " q=[ " ;
+
+ Pix pix = queue.first();
+ for (int i = length - 1; i > 0; i--) {
+- cout << queue(pix) << " ";
++ std::cout << queue(pix) << " ";
+ queue.next(pix);
+ }
+- cout << "]" << endl;
++ std::cout << "]" << std::endl;
+ }
+
+
diff --git a/games/znibbles/files/patch-src::Map.C b/games/znibbles/files/patch-src::Map.C
new file mode 100644
index 000000000000..365e115f01b7
--- /dev/null
+++ b/games/znibbles/files/patch-src::Map.C
@@ -0,0 +1,89 @@
+--- src/Map.C Mon May 10 13:39:48 1999
++++ src/Map.C Sat Oct 26 00:40:04 2002
+@@ -32,7 +32,7 @@
+ #endif
+
+ #include <stdio.h>
+-#include <iostream.h>
++#include <iostream>
+ #include <string.h>
+
+ #include "Map.H"
+@@ -61,7 +61,7 @@
+
+ // @@ do something appropriate here
+ if (_types == NULL)
+- cerr << "Map::make(): malloc failed. Everything should crash." << endl;
++ std::cerr << "Map::make(): malloc failed. Everything should crash." << std::endl;
+
+ clear();
+ }
+@@ -112,39 +112,39 @@
+ // Text based display of this map (debug purposes)
+ void Map::display()
+ {
+- cout << endl;
++ std::cout << std::endl;
+
+ for (int i = 0; i < _y; i++) {
+ for (int j = 0; j < _x; j++)
+- cout << _map[i][j] << " ";
+- cout << endl;
++ std::cout << _map[i][j] << " ";
++ std::cout << std::endl;
+ }
+ }
+
+ // Text based display of the types in the map (debug purposes)
+ void Map::display_t()
+ {
+- cout << endl;
++ std::cout << std::endl;
+
+ for (int i = 0; i < _y; i++) {
+ for (int j = 0; j < _x; j++) {
+- cout << "? " ;
+- // cout << _maptype[i][j].length() << " ";
++ std::cout << "? " ;
++ // std::cout << _maptype[i][j].length() << " ";
+ }
+- cout << endl;
++ std::cout << std::endl;
+ }
+ }
+
+ void Map::add_type(int x, int y, _Object& obj)
+ {
+ if (_types_index >= _types_size - 1) {
+-// cout << "Map::add_type(): realloc()" << endl;
++// std::cout << "Map::add_type(): realloc()" << std::endl;
+ // resize type array
+ _types_size += 200; // @@ computation has to be done correctly
+ _types = (MapType *) realloc(_types, _types_size * sizeof(MapType));
+ // @@ Do something in case of error !
+ if (_types == NULL)
+- cerr << "Map::add_type: realloc failed. Everything should crash." << endl;
++ std::cerr << "Map::add_type: realloc failed. Everything should crash." << std::endl;
+ }
+
+ _types[_types_index].object = &obj;
+@@ -170,15 +170,15 @@
+ MapType * mt = get_type(x, y);
+
+ if (mt == NULL)
+- cout << "<empty>";
++ std::cout << "<empty>";
+ else {
+- cout << "<" << mt->object;
++ std::cout << "<" << mt->object;
+ mt = mt->next;
+ while (mt != NULL) {
+- cout << "," << mt->object;
++ std::cout << "," << mt->object;
+ mt = mt->next;
+ }
+- cout << ">";
++ std::cout << ">";
+ }
+
+ }
diff --git a/games/znibbles/files/patch-src::Map.H b/games/znibbles/files/patch-src::Map.H
new file mode 100644
index 000000000000..27a21d684eea
--- /dev/null
+++ b/games/znibbles/files/patch-src::Map.H
@@ -0,0 +1,11 @@
+--- src/Map.H Mon May 10 13:39:38 1999
++++ src/Map.H Sat Oct 26 00:21:33 2002
+@@ -45,7 +45,7 @@
+
+ class Map {
+
+- friend NibblesArea;
++ friend class NibblesArea;
+
+ public:
+
diff --git a/games/znibbles/files/patch-src::Movable.C b/games/znibbles/files/patch-src::Movable.C
new file mode 100644
index 000000000000..7c59d6bfe455
--- /dev/null
+++ b/games/znibbles/files/patch-src::Movable.C
@@ -0,0 +1,71 @@
+--- src/Movable.C Tue May 11 12:15:20 1999
++++ src/Movable.C Sat Oct 26 00:40:14 2002
+@@ -51,7 +51,7 @@
+ void Movable::read_description(Trame& t)
+ {
+ if (t.get_char() != NEW_MOVABLE) {
+- cerr << "Movable::read_description(): ohhh le bordel!\n";
++ std::cerr << "Movable::read_description(): ohhh le bordel!\n";
+ exit(1);
+ }
+
+@@ -91,19 +91,19 @@
+ // for debug purposes
+ void Movable::display()
+ {
+- cout << " ID:"<< id;
++ std::cout << " ID:"<< id;
+ printf(" %04x", classtype);
+- cout <<" Movable " << pos.x << "x" << pos.y << " sp=" << speed
++ std::cout <<" Movable " << pos.x << "x" << pos.y << " sp=" << speed
+ << " dir=" << direction << " len=" << length
+ << " full=" << full_length << " pid=" << player_id
+ << " paused=" << paused << " q=[ " ;
+
+ Pix pix = queue.first();
+ for (int i = length - 1; i > 0; i--) {
+- cout << queue(pix) << " ";
++ std::cout << queue(pix) << " ";
+ queue.next(pix);
+ }
+- cout << "]" << endl;
++ std::cout << "]" << std::endl;
+ }
+
+
+@@ -282,7 +282,7 @@
+ && !update_pos(p = pos, D_RIGHT))
+ newdir = D_RIGHT;
+ // else
+-// cout << "Movable::auto_dir(): couldn't find a way to go!" << endl;
++// std::cout << "Movable::auto_dir(): couldn't find a way to go!" << std::endl;
+
+ if (direction != newdir) {
+ direction = newdir;
+@@ -401,7 +401,7 @@
+ _Position pos2 = pos;
+
+ if (length == 1) {
+- cerr << "getcut too short" << endl;
++ std::cerr << "getcut too short" << std::endl;
+ return;
+ }
+
+@@ -415,7 +415,7 @@
+
+ // should never happen. (should be an assertion)
+ if (!p) {
+- cerr << "Movable::cut(): reached end of queue!" << endl;
++ std::cerr << "Movable::cut(): reached end of queue!" << std::endl;
+ return;
+ }
+
+@@ -447,7 +447,7 @@
+ //evidemment ca bug! world.add_object(worm);
+ }
+ //else
+- // cerr << "petard de pas de p" << endl;
++ // std::cerr << "petard de pas de p" << std::endl;
+ }
+
+
diff --git a/games/znibbles/files/patch-src::Niblle.C b/games/znibbles/files/patch-src::Niblle.C
new file mode 100644
index 000000000000..36b809e701cf
--- /dev/null
+++ b/games/znibbles/files/patch-src::Niblle.C
@@ -0,0 +1,25 @@
+--- src/Nibble.C Tue Nov 17 19:36:32 1998
++++ src/Nibble.C Sat Oct 26 00:40:26 2002
+@@ -58,7 +58,7 @@
+ void Nibble:: read_description(Trame &t)
+ {
+ if (t.get_char() != NEW_NIBBLE) {
+- cerr << "Nibble::read_description(): ohhh le bordel!\n";
++ std::cerr << "Nibble::read_description(): ohhh le bordel!\n";
+ exit(1);
+ }
+
+@@ -81,10 +81,10 @@
+
+ void Nibble::display()
+ {
+- cout << " ID:"<< id;
++ std::cout << " ID:"<< id;
+ printf(" %04x", classtype);
+- cout << " Nibble " << pos.x << "x" << pos.y << " value=" << value
+- << " type=" << type << endl;
++ std::cout << " Nibble " << pos.x << "x" << pos.y << " value=" << value
++ << " type=" << type << std::endl;
+ }
+
+
diff --git a/games/znibbles/files/patch-src::Object.C b/games/znibbles/files/patch-src::Object.C
new file mode 100644
index 000000000000..c863a689a716
--- /dev/null
+++ b/games/znibbles/files/patch-src::Object.C
@@ -0,0 +1,20 @@
+--- src/Object.C Mon May 10 13:41:22 1999
++++ src/Object.C Sat Oct 26 00:40:49 2002
+@@ -28,7 +28,7 @@
+ */
+
+ #include <stdlib.h>
+-#include <iostream.h>
++#include <iostream>
+
+ #include "Object.H"
+ #include "World.H"
+@@ -89,7 +89,7 @@
+
+ do {
+ // if (yes)
+- // cout << "Object::auto_position(): collide #" << yes << endl;
++ // std::cout << "Object::auto_position(): collide #" << yes << std::endl;
+ // yes++;
+ pos.x = rand() % world.x_dim;
+ pos.y = rand() % world.y_dim;
diff --git a/games/znibbles/files/patch-src::Options.C b/games/znibbles/files/patch-src::Options.C
new file mode 100644
index 000000000000..9eee99273470
--- /dev/null
+++ b/games/znibbles/files/patch-src::Options.C
@@ -0,0 +1,114 @@
+--- src/Options.C Wed May 12 11:40:13 1999
++++ src/Options.C Sat Oct 26 00:41:03 2002
+@@ -35,7 +35,7 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include <iostream.h>
++#include <iostream>
+
+ #include "Options.H"
+
+@@ -150,7 +150,7 @@
+ case 'p':
+ _port = atoi(optarg);
+ if (_port == 0) { // cannot be 0
+- cerr << *argv << ": port: invalid argument: " << optarg << endl;
++ std::cerr << *argv << ": port: invalid argument: " << optarg << std::endl;
+ bad_params = true;
+ }
+ break;
+@@ -160,7 +160,7 @@
+ if (2 != (ooo = sscanf(optarg, "%dx%d", &_width, &_height)) ||
+ _height == 0 ||
+ _width == 0) {
+- cerr << *argv << ": size: invalid argument: " << optarg << endl;
++ std::cerr << *argv << ": size: invalid argument: " << optarg << std::endl;
+ bad_params = true;
+ }
+ break;
+@@ -168,8 +168,8 @@
+ case 'g': // height (server only)
+ _height = atoi(optarg);
+ if (_height == 0) { // cannot be 0
+- cerr << *argv << ": height: invalid argument: " << optarg \
+- << endl;
++ std::cerr << *argv << ": height: invalid argument: " << optarg \
++ << std::endl;
+ bad_params = true;
+ }
+ break;
+@@ -177,8 +177,8 @@
+ case 'w': // width (server only)
+ _width = atoi(optarg);
+ if (_width == 0) { // cannot be 0
+- cerr << *argv << ": width: invalid argument: " << optarg \
+- << endl;
++ std::cerr << *argv << ": width: invalid argument: " << optarg \
++ << std::endl;
+ bad_params = true;
+ }
+ break;
+@@ -194,7 +194,7 @@
+
+ if (_set == OPTIONS_CLIENT_SET) {
+ if (argv[optind] == NULL) {
+- cerr << *argv << ": missing player name" << endl;
++ std::cerr << *argv << ": missing player name" << std::endl;
+ bad_params = true;
+ }
+ else {
+@@ -208,7 +208,7 @@
+ if (p != 0)
+ _port = p;
+ else {
+- cerr << *argv << ": too many parameters: " << argv[optind] << endl;
++ std::cerr << *argv << ": too many parameters: " << argv[optind] << std::endl;
+ bad_params = true;
+ }
+ }
+@@ -227,34 +227,34 @@
+ options.set_option_set(0);
+
+ if (!options.parse(argc, argv)) {
+- cout << "usage: .... " << endl;
++ std::cout << "usage: .... " << std::endl;
+ delete &options;
+ return 1;
+ }
+
+ if (options.is_help()) {
+- cout << "help: ..." << endl;
++ std::cout << "help: ..." << std::endl;
+ delete &options;
+ return 0;
+ }
+
+ if (options.is_version()) {
+- cout << "... version ... " << endl;
++ std::cout << "... version ... " << std::endl;
+ delete &options;
+ return 0;
+ }
+
+- cout << "host: " << options.get_host_name() << ":" \
+- << options.get_port() << endl;
+- cout << "message_file: " << options.get_message_file() << endl;
+- cout << "twokey(" << options.is_twokey() << ") debug(" \
+- << options.is_debug() <<")" << endl;
++ std::cout << "host: " << options.get_host_name() << ":" \
++ << options.get_port() << std::endl;
++ std::cout << "message_file: " << options.get_message_file() << std::endl;
++ std::cout << "twokey(" << options.is_twokey() << ") debug(" \
++ << options.is_debug() <<")" << std::endl;
+
+ int i = options.get_nonoption_index();
+- cout << "argv left = " << endl;
++ std::cout << "argv left = " << std::endl;
+ argv += i;
+ while (*argv) {
+- cout << " " << *argv++ << endl;
++ std::cout << " " << *argv++ << std::endl;
+ }
+
+ delete &options;
diff --git a/games/znibbles/files/patch-src::Player.C b/games/znibbles/files/patch-src::Player.C
new file mode 100644
index 000000000000..2aad9f39d606
--- /dev/null
+++ b/games/znibbles/files/patch-src::Player.C
@@ -0,0 +1,33 @@
+--- src/Player.C Tue May 11 12:17:08 1999
++++ src/Player.C Sat Oct 26 00:41:14 2002
+@@ -36,7 +36,7 @@
+ #include <string.h>
+ #include <time.h>
+
+-#include <iostream.h>
++#include <iostream>
+
+ #include "Player.H"
+
+@@ -78,7 +78,7 @@
+ void Player::read_description(Trame &t)
+ {
+ if (t.get_char() != PLAYER_DESC) {
+- cerr << "Player::read_description(): ohhh le bordel!\n";
++ std::cerr << "Player::read_description(): ohhh le bordel!\n";
+ exit(1);
+ }
+
+@@ -98,10 +98,10 @@
+ // debug: print a brief representation of the player
+ void Player::display()
+ {
+- cout << " ID:" << id << " Player #" << _number \
++ std::cout << " ID:" << id << " Player #" << _number \
+ << " '" << _name << "' score=" << _score << " frags=" \
+ << _frag << " best=" << _best_length << " wid=" \
+- << worm_id<< endl;
++ << worm_id<< std::endl;
+ }
+
+
diff --git a/games/znibbles/files/patch-src::ServerInterface.C b/games/znibbles/files/patch-src::ServerInterface.C
new file mode 100644
index 000000000000..6c53f53106de
--- /dev/null
+++ b/games/znibbles/files/patch-src::ServerInterface.C
@@ -0,0 +1,215 @@
+--- src/ServerInterface.C Tue May 11 12:13:52 1999
++++ src/ServerInterface.C Sat Oct 26 00:50:26 2002
+@@ -48,6 +48,9 @@
+ #include <errno.h>
+
+ #include <sys/times.h>
++#ifdef __FreeBSD__
++#include <sys/param.h>
++#endif
+
+ #include "DLList.h" // Doubly linked lists
+
+@@ -118,9 +121,9 @@
+
+ display_version();
+
+- cerr << "ServerInterface(): experimental nibbles" \
++ std::cerr << "ServerInterface(): experimental nibbles" \
+ << "interface! Don't run it in background... " \
+- << endl << endl;
++ << std::endl << std::endl;
+
+ srand(time(NULL));
+
+@@ -144,12 +147,12 @@
+ sigaction(SIGCHLD, &action, NULL);
+ */
+
+- cout << "Starting ZNibbles Server on port: " << port << endl;
++ std::cout << "Starting ZNibbles Server on port: " << port << std::endl;
+
+ // Create and attach the listening socket
+ if((socket_ecoute = creer_socket(SOCK_STREAM, &port, &address)) == -1) {
+- cerr << "Unable to create socket. Try option `--help' to get some help."\
+- << endl;
++ std::cerr << "Unable to create socket. Try option `--help' to get some help."\
++ << std::endl;
+ exit(2);
+ }
+
+@@ -170,36 +173,36 @@
+ // display version numbers (long format)
+ void ServerInterface::display_version()
+ {
+- cerr << "ZNibbles Server v" VERSION " - A little silly game - "
++ std::cerr << "ZNibbles Server v" VERSION " - A little silly game - "
+ << "(c) Vincent Mallet 1997, 1998, 1999 - vmallet@enst.fr"
+- << endl << endl;
++ << std::endl << std::endl;
+ }
+
+
+ // display version number (short format)
+ void ServerInterface::display_version_short()
+ {
+- cout << "ZNibbles Server " VERSION << endl;
++ std::cout << "ZNibbles Server " VERSION << std::endl;
+ }
+
+
+ // display small help
+ void ServerInterface::display_help(char *name)
+ {
+- cout << "usage: " << name << " [OPTIONS].." << endl;
+- cout << endl;
+- cout << "Start a ZNibbles Server." << endl;
+- cout << endl;
+- cout << " -p, --port=NUM listen for clients on port NUM [default is 5051]" << endl;
+- cout << " -s, --size=NUMxNUM create a world of dimension NUMxNUM [default is 80x40]" << endl;
+- cout << " -w, --width=NUM create a world of width NUM [default is 80]" << endl;
+- cout << " -g, --height=NUM create a world of height NUM [default is 40]" << endl;
+- cout << " -c, --no-computer disable computer-controlled worms" << endl;
+- cout << " -d, --debug enable debug output" << endl;
+- cout << " -V, --version print version number, then exit" << endl;
+- cout << " -h, --help show this message and exit" << endl;
+- cout << endl;
+- cout << "Report bugs to <vmallet@enst.fr>." << endl;
++ std::cout << "usage: " << name << " [OPTIONS].." << std::endl;
++ std::cout << std::endl;
++ std::cout << "Start a ZNibbles Server." << std::endl;
++ std::cout << std::endl;
++ std::cout << " -p, --port=NUM listen for clients on port NUM [default is 5051]" << std::endl;
++ std::cout << " -s, --size=NUMxNUM create a world of dimension NUMxNUM [default is 80x40]" << std::endl;
++ std::cout << " -w, --width=NUM create a world of width NUM [default is 80]" << std::endl;
++ std::cout << " -g, --height=NUM create a world of height NUM [default is 40]" << std::endl;
++ std::cout << " -c, --no-computer disable computer-controlled worms" << std::endl;
++ std::cout << " -d, --debug enable debug output" << std::endl;
++ std::cout << " -V, --version print version number, then exit" << std::endl;
++ std::cout << " -h, --help show this message and exit" << std::endl;
++ std::cout << std::endl;
++ std::cout << "Report bugs to <vmallet@enst.fr>." << std::endl;
+ }
+
+
+@@ -230,9 +233,15 @@
+ socket_service = -1;
+ while (socket_service == -1) {
+ // wait for connection
++#if defined(__FreeBSD__) && (__FreeBSD_version >= 400013)
++ socket_service = accept(socket_ecoute,
++ (struct sockaddr *) &address,
++ (socklen_t *) &lg_address);
++#else
+ socket_service = accept(socket_ecoute,
+ (struct sockaddr *) &address,
+ &lg_address);
++#endif
+
+ // Reception d'un signal (probablement SIGCHLD)
+ if(socket_service == -1 && errno == EINTR) {
+@@ -277,7 +286,7 @@
+ char *peol;
+
+ if (debug) {
+- cout << "chaine: ";
++ std::cout << "chaine: ";
+ }
+
+ fgets(line, MAXLINE, stdin);
+@@ -305,28 +314,28 @@
+ } else if (strcmp(line, "p") == 0) { // pause
+ xpaused = !xpaused;
+ display_system_message(((xpaused)
+- ? "Pausing...\n"
+- : "Running...\n"));
++ ? (char *)"Pausing...\n"
++ : (char *)"Running...\n"));
+ continue;
+ } else if (strcmp(line, "-") == 0) { // slower...
+ if (debug) {
+- cout << "slower... ival=";
++ std::cout << "slower... ival=";
+ }
+ ival += 25000UL;
+ if (debug) {
+- cout << ival << endl;
++ std::cout << ival << std::endl;
+ }
+ continue;
+ } else if (strcmp(line, "+") == 0) { // faster!
+ if (ival > 0UL) {
+ if (debug) {
+- cout << "Faster! ival=";
++ std::cout << "Faster! ival=";
+ }
+ ival -= 25000UL;
+ if (ival > 10000000)
+ ival = 0;
+ if (debug) {
+- cout << ival << endl;
++ std::cout << ival << std::endl;
+ }
+ } else
+ display_system_message("Can't go faster :)\n");
+@@ -388,7 +397,7 @@
+ void ServerInterface::pipe_handler(int sig)
+ {
+ sig++;
+- // cerr << "got SIGPIPE!" << endl;
++ // std::cerr << "got SIGPIPE!" << std::endl;
+ // pipe_rw_error = 1;
+ }
+
+@@ -407,9 +416,9 @@
+ // void ServerInterface::alarm_handler(int sig)
+ // {
+ // if (curworld) {
+-// cout << "---- TIMED: " << (curworld->playcycle - startcycle)
++// std::cout << "---- TIMED: " << (curworld->playcycle - startcycle)
+ // << " cycles -------"
+-// << "(sig=" << sig << ")" << endl;
++// << "(sig=" << sig << ")" << std::endl;
+ // startcycle = curworld->playcycle;
+ // }
+ // }
+@@ -433,9 +442,15 @@
+
+ while (read_ready(socketnum)) {
+
++#if defined(__FreeBSD__) && (__FreeBSD_version >= 400013)
++ socket_service = accept(socketnum,
++ (struct sockaddr *) &address,
++ (socklen_t *) &lg_address);
++#else
+ socket_service = accept(socketnum,
+ (struct sockaddr *) &address,
+ &lg_address);
++#endif
+
+ // s'il y a une erreur, ce n'est pas une EINTR (cf appel a read_ready())
+ if(socket_service == -1) {
+@@ -475,9 +490,9 @@
+ return;
+
+ if (priv)
+- cout << "*private* Message: " << from.get_name() << "> " << msg << endl;
++ std::cout << "*private* Message: " << from.get_name() << "> " << msg << std::endl;
+ else
+- cout << "Message: " << from.get_name() << "> " << msg << endl;
++ std::cout << "Message: " << from.get_name() << "> " << msg << std::endl;
+ }
+
+ void ServerInterface::display_system_message(char * msg,
+@@ -488,8 +503,8 @@
+ return;
+
+ color++;
+- cout << "*** ";
++ std::cout << "*** ";
+ if (p)
+- cout << p->get_name() << " ";
+- cout << msg;
++ std::cout << p->get_name() << " ";
++ std::cout << msg;
+ }
diff --git a/games/znibbles/files/patch-src::Trame.C b/games/znibbles/files/patch-src::Trame.C
new file mode 100644
index 000000000000..93f29d9ed6dc
--- /dev/null
+++ b/games/znibbles/files/patch-src::Trame.C
@@ -0,0 +1,124 @@
+--- src/Trame.C Mon May 10 08:57:09 1999
++++ src/Trame.C Sat Oct 26 00:41:28 2002
+@@ -39,7 +39,7 @@
+ # include <config.h>
+ #endif
+
+-#include <iostream.h>
++#include <iostream>
+
+ #include <stdlib.h>
+ #include <stdio.h>
+@@ -93,11 +93,11 @@
+ #endif
+
+ #ifdef DEBUG_TRACE
+- cout << "sending: [";
++ std::cout << "sending: [";
+ printf("%02x %02x] ", rbuf[0], rbuf[1]);
+ for (int i = 0; i < len; i++)
+ printf("%02x ", (unsigned int) buf[i]);
+- cout << endl;
++ std::cout << std::endl;
+ #endif
+
+ // always write at least 4 bytes
+@@ -161,19 +161,19 @@
+ return -1;
+
+ if (retval <= 0) {
+- cerr << "trame.fuck. error=" << errno << endl;
++ std::cerr << "trame.fuck. error=" << errno << std::endl;
+ switch(errno) {
+ case EBADF:
+- cerr << " EBADF invalid file desc " << endl;
++ std::cerr << " EBADF invalid file desc " << std::endl;
+ break;
+ case EINTR:
+- cerr << " EINTR: signal was caught " << endl;
++ std::cerr << " EINTR: signal was caught " << std::endl;
+ break;
+ case EINVAL:
+- cerr << " EINVAL n is negative " << endl;
++ std::cerr << " EINVAL n is negative " << std::endl;
+ break;
+ case ENOMEM:
+- cerr << " ENOMEM unable to allocate memory " << endl;
++ std::cerr << " ENOMEM unable to allocate memory " << std::endl;
+ break;
+ }
+
+@@ -196,14 +196,14 @@
+
+ if (xx < 0) {
+ if (errno == 0)
+- cerr << "Trame::receive_from(): error #0!" << endl;
++ std::cerr << "Trame::receive_from(): error #0!" << std::endl;
+ else
+- cerr << "Trame::receive_from(): real error..." << endl;
++ std::cerr << "Trame::receive_from(): real error..." << std::endl;
+ return -1;
+ } else {
+ if (xx != len - 2) {
+- cerr << "Trame::receive_from(): short read (read "
+- << xx + 2 << " instead of " << len << ")" << endl;
++ std::cerr << "Trame::receive_from(): short read (read "
++ << xx + 2 << " instead of " << len << ")" << std::endl;
+ return -1;
+ }
+ }
+@@ -212,11 +212,11 @@
+ cursize = len;
+
+ #ifdef DEBUG_TRACE
+- cout << "receivd: [";
++ std::cout << "receivd: [";
+ printf("%02x %02x] ", rbuf[0], rbuf[1]);
+ for (int i = 0; i < len; i++)
+ printf("%02x ", (int) buf[i]);
+- cout << endl;
++ std::cout << std::endl;
+ #endif
+
+ #ifdef DEBUG_LOAD
+@@ -381,7 +381,7 @@
+ idx += 2;
+ }
+ else {
+- cerr << "bordel dans get_short()" << endl;
++ std::cerr << "bordel dans get_short()" << std::endl;
+ sh = -1;
+ }
+
+@@ -408,7 +408,7 @@
+ return val;
+ }
+ else
+- cerr << "bordel dans peek_int()" << endl;
++ std::cerr << "bordel dans peek_int()" << std::endl;
+
+ return -1;
+ }
+@@ -423,7 +423,7 @@
+ idx += 4;
+ }
+ else {
+- cerr << "bordel dans get_int()" << endl;
++ std::cerr << "bordel dans get_int()" << std::endl;
+ sh = -1;
+ }
+
+@@ -454,10 +454,10 @@
+
+ void Trame::dump_left()
+ {
+- cerr << "[ ";
++ std::cerr << "[ ";
+ while (idx < cursize)
+- cerr << (int) buf[idx++] << " ";
+- cerr << "]" << endl;
++ std::cerr << (int) buf[idx++] << " ";
++ std::cerr << "]" << std::endl;
+ }
+
+
diff --git a/games/znibbles/files/patch-src::Trame.H b/games/znibbles/files/patch-src::Trame.H
new file mode 100644
index 000000000000..6fe33b3c1f72
--- /dev/null
+++ b/games/znibbles/files/patch-src::Trame.H
@@ -0,0 +1,11 @@
+--- src/Trame.H Mon May 10 08:58:39 1999
++++ src/Trame.H Sat Oct 26 00:28:25 2002
+@@ -38,7 +38,7 @@
+ #ifndef __H_TRAME__
+ #define __H_TRAME__
+
+-#include <iostream.h>
++#include <iostream>
+
+ // some compilers consider char as unsigned by default.
+ typedef signed char schar;
diff --git a/games/znibbles/files/patch-src::World.C b/games/znibbles/files/patch-src::World.C
new file mode 100644
index 000000000000..e44be3b2f023
--- /dev/null
+++ b/games/znibbles/files/patch-src::World.C
@@ -0,0 +1,227 @@
+--- src/World.C Wed May 12 11:45:46 1999
++++ src/World.C Sat Oct 26 00:41:48 2002
+@@ -145,8 +145,8 @@
+
+ if (!p) { // here it's really bad. Have to raise an exception !
+ if (debug)
+- cerr << "World::lookup_object(): invalid object id=" << obj_id \
+- << " !!!" << endl;
++ std::cerr << "World::lookup_object(): invalid object id=" << obj_id \
++ << " !!!" << std::endl;
+ return * objects.front(); /// @@ NNNNOOOOOONNNNNNNNNNNNNNNNNNNNNNNN!
+ }
+
+@@ -182,7 +182,7 @@
+ break;
+ default:
+ if (debug)
+- cerr << "World::read_new_object(): unknown object!\n";
++ std::cerr << "World::read_new_object(): unknown object!\n";
+ break;
+ }
+
+@@ -201,7 +201,7 @@
+ remove_object0(p);
+ else {
+ if (debug)
+- cerr << "remove_object(): invalid object_id! id=" << obj_id << endl;
++ std::cerr << "remove_object(): invalid object_id! id=" << obj_id << std::endl;
+ }
+ }
+
+@@ -243,8 +243,8 @@
+
+ if (!p) { // la, c'est tres grave. Faut faire une exception!
+ if (debug)
+- cerr << "World::lookup_player(): invalid player id=" << player_id \
+- << " !!!" << endl;
++ std::cerr << "World::lookup_player(): invalid player id=" << player_id \
++ << " !!!" << std::endl;
+ return * new Player(*this); // <- en attendant mieux.
+ }
+
+@@ -269,7 +269,7 @@
+ /* unlimited number of players!
+ if (nbplayers >= maxplayers) {
+ close(socknum);
+- cerr << "Too many players ! \n";
++ std::cerr << "Too many players ! \n";
+ return;
+ }
+ */
+@@ -278,16 +278,16 @@
+ trame.set_timeout(5000);
+ if (-1 == trame.receive_from(socknum)) {
+ if (debug)
+- cerr << "World::server_add_player(): cannot read welcome packet " \
+- "from client" << endl;
++ std::cerr << "World::server_add_player(): cannot read welcome packet " \
++ "from client" << std::endl;
+ close(socknum);
+ return;
+ }
+
+ if (trame.peek_char() != JOIN_GAME) {
+ if (debug)
+- cerr << "World::server_add_player(): Should have got JOIN_GAME ( "
+- << (int) JOIN_GAME << "), got " << (int) trame.peek_char() << endl;
++ std::cerr << "World::server_add_player(): Should have got JOIN_GAME ( "
++ << (int) JOIN_GAME << "), got " << (int) trame.peek_char() << std::endl;
+ return;
+ }
+ trame.get_char();
+@@ -321,7 +321,7 @@
+ trameZ.set_timeout(1);
+
+ if (debug)
+- cout << "World::server_add_player_other(): adding a subplayer" << endl;
++ std::cout << "World::server_add_player_other(): adding a subplayer" << std::endl;
+
+ Player& p = * new Player(*this, socknum);
+
+@@ -357,8 +357,8 @@
+
+ if (!p) { // la, c'est tres grave. Faut faire une exception!
+ if (debug)
+- cerr << "World::remove_player(): invalid player id=" << player_id \
+- << " !!!" << endl;
++ std::cerr << "World::remove_player(): invalid player id=" << player_id \
++ << " !!!" << std::endl;
+ return;
+ }
+
+@@ -513,11 +513,11 @@
+ && ((Movable *) objects(p))->player_id == 0)
+ nbworm++;
+
+- // cout << "actually I have " << nbworm << " own worms..." << endl;
++ // std::cout << "actually I have " << nbworm << " own worms..." << std::endl;
+
+ // @@ 2: a mettre en parametre
+ if (nbworm < 2) {
+- // cout << "adding one.. heehe" << endl;
++ // std::cout << "adding one.. heehe" << std::endl;
+ Movable& worm = * new Movable(*this);
+ worm.auto_position(map);
+ worm.add_type(map);
+@@ -569,7 +569,7 @@
+ {
+ if (t.get_char() != WORLD_DESC) {
+ if (debug)
+- cerr << " petard le bordel geant! \n";
++ std::cerr << " petard le bordel geant! \n";
+ exit(1);
+ }
+
+@@ -708,11 +708,11 @@
+
+ default:
+ if (debug)
+- cerr<< "read_changes(): unexpected trame Id == " \
+- << (int) t.peek_char() << endl;
++ std::cerr<< "read_changes(): unexpected trame Id == " \
++ << (int) t.peek_char() << std::endl;
+ t.get_char();
+ if (debug)
+- cerr<< "read_changes(): left in trame = ";
++ std::cerr<< "read_changes(): left in trame = ";
+ t.dump_left();
+ break;
+ }
+@@ -743,16 +743,16 @@
+ // for debug purposes
+ void World::display()
+ {
+- cout << "ID: " << id << " WORLD";
+- cout << " dims=" << x_dim << "x" << y_dim;
+- cout << " cycle=" << playcycle << endl;
+- cout << " " << nbplayers << " players " << endl;
++ std::cout << "ID: " << id << " WORLD";
++ std::cout << " dims=" << x_dim << "x" << y_dim;
++ std::cout << " cycle=" << playcycle << std::endl;
++ std::cout << " " << nbplayers << " players " << std::endl;
+
+ // here we add if(1) to avoid bogus compilers problems
+ if (1) for (Pix p = players.first(); p; players.next(p))
+ players(p)->display();
+
+- cout << " " << nbobjects << " objects " << endl;
++ std::cout << " " << nbobjects << " objects " << std::endl;
+
+ for (Pix p = objects.first(); p; objects.next(p))
+ objects(p)->display();
+@@ -826,7 +826,7 @@
+
+ if (retval < 0) {
+ if (debug)
+- cerr << "World::get_client_responses(): bug quelque part!" << endl;
++ std::cerr << "World::get_client_responses(): bug quelque part!" << std::endl;
+ return; // bah violent comme d'hab.
+ }
+
+@@ -915,7 +915,7 @@
+ int newdir = t.get_char();
+
+ if (debug)
+- cout << "subplayer dir: ( " << worm_id << ") to " << newdir << endl;
++ std::cout << "subplayer dir: ( " << worm_id << ") to " << newdir << std::endl;
+
+ Movable & mv = (Movable &) lookup_object(worm_id);
+ Player * other_player = NULL;
+@@ -928,8 +928,8 @@
+ || other_player->socket_number != p.socket_number) {
+
+ if (debug)
+- cerr << "World::PLAYER_CHANGEDIR_OTHER: bad id: " << worm_id \
+- << endl;
++ std::cerr << "World::PLAYER_CHANGEDIR_OTHER: bad id: " << worm_id \
++ << std::endl;
+ }
+ else {
+ if (!paused) {
+@@ -954,12 +954,12 @@
+
+ case TEXT_MESSAGE:
+ {
+- // cout << "got TEXT_MESSAGE == '";
++ // std::cout << "got TEXT_MESSAGE == '";
+ t.get_char(); // skip msg id
+ int dest_id = t.get_int();
+ char *msg = t.get_string(); // warning: use it fast!
+
+- // cout << msg << "'" << endl;
++ // std::cout << msg << "'" << std::endl;
+
+ if (!dest_id) { // broadcast message
+ cycle_trame.put_char(TEXT_MESSAGE);
+@@ -1039,16 +1039,16 @@
+
+ case TRAME_ERROR:
+ if (debug)
+- cerr << "World::read_player_response(): id=" << p.id \
+- << " sent an error trame:! " << (int) t.peek_char() << endl;
++ std::cerr << "World::read_player_response(): id=" << p.id \
++ << " sent an error trame:! " << (int) t.peek_char() << std::endl;
+ done = 1;
+ break;
+
+ default:
+ if (debug) {
+- cerr << "World::read_player_response(): id=" << p.id \
+- << " sent an unknown message: " << (int) t.peek_char() << endl;
+- cerr << " ignoring rest of frame=";
++ std::cerr << "World::read_player_response(): id=" << p.id \
++ << " sent an unknown message: " << (int) t.peek_char() << std::endl;
++ std::cerr << " ignoring rest of frame=";
+ t.dump_left();
+ }
+ break;
+@@ -1117,7 +1117,7 @@
+
+ void World::remove_object0(Pix& p)
+ {
+- //FAST cout << "? killing id=" << objects(p)->id << endl;
++ //FAST std::cout << "? killing id=" << objects(p)->id << std::endl;
+ delete objects(p);
+ objects.del(p, -1);
+ nbobjects--;
diff --git a/games/znibbles/files/patch-src::X11::X11Interface.C b/games/znibbles/files/patch-src::X11::X11Interface.C
new file mode 100644
index 000000000000..db509a10727e
--- /dev/null
+++ b/games/znibbles/files/patch-src::X11::X11Interface.C
@@ -0,0 +1,285 @@
+--- src/X11/X11Interface.C Wed May 12 21:43:42 1999
++++ src/X11/X11Interface.C Sat Oct 26 00:32:49 2002
+@@ -38,7 +38,7 @@
+ # include <config.h>
+ #endif
+
+-#include <iostream.h>
++#include <iostream>
+
+ #include <unistd.h>
+ #include <stdlib.h>
+@@ -109,7 +109,7 @@
+ display_version();
+
+ if (_two_key)
+- cout << "Two-key mode enabled" << endl;
++ std::cout << "Two-key mode enabled" << std::endl;
+
+
+ // connect pipe_handler to SIGPIPE signal
+@@ -125,8 +125,8 @@
+ exit(2);
+ }
+
+- cout << "Connecting to ZNibbles server: " \
+- << options.get_host_name() << ":" << options.get_port() << "... " << endl;
++ std::cout << "Connecting to ZNibbles server: " \
++ << options.get_host_name() << ":" << options.get_port() << "... " << std::endl;
+
+ // create and bind socket to any port
+ port = 0;
+@@ -136,7 +136,7 @@
+ }
+
+ // if (debug)
+-// cout << "Client socket created on port: " << ntohs(client_address.sin_port) << endl;
++// std::cout << "Client socket created on port: " << ntohs(client_address.sin_port) << std::endl;
+
+ // Build server address
+ server_address.sin_family = AF_INET;
+@@ -153,7 +153,7 @@
+
+ display_play_help();
+
+- cout << "Connection accepted\n" << endl;
++ std::cout << "Connection accepted\n" << std::endl;
+
+ // hack_socket_client = socket_client; // hack for signal handling
+ // action.sa_handler = stop_handler;
+@@ -163,7 +163,7 @@
+
+ init_messages(options.get_message_file());
+
+- cout << "initializing interface..." << endl;
++ std::cout << "initializing interface..." << std::endl;
+ X11Init(argc, argv);
+ }
+
+@@ -201,56 +201,56 @@
+ // display version number (long format)
+ void X11Interface::display_version()
+ {
+- cerr << "ZNibbles v" VERSION " - A little silly game - "
++ std::cerr << "ZNibbles v" VERSION " - A little silly game - "
+ << "(c) Vincent Mallet 1997, 1998, 1999 - vmallet@enst.fr"
+- << endl << endl;
++ << std::endl << std::endl;
+ }
+
+ // display version number (short format)
+ void X11Interface::display_version_short()
+ {
+- cout << "ZNibbles X11 Client -experimental- " VERSION << endl;
++ std::cout << "ZNibbles X11 Client -experimental- " VERSION << std::endl;
+ }
+
+ //display small help for invocation
+ void X11Interface::display_help(char *name)
+ {
+- cout << "Usage: " << name << " [OPTION].. PLAYERNAME" << endl;
+- cout << endl;
+- cout << "Start a ZNibbles X11 client and connect to the specified nibbles server." << endl;
+- cout << endl;
+- cout << " -n, --host-name=HOST connect to server HOST [default is localhost]" << endl;
+- cout << " -p, --port=NUM connect to port NUM of server [default is 5051]" << endl;
+- cout << " -m, --message-file=FILE load predefined messages from file FILE" << endl;
+- cout << " -t, --twokey control worm with only two keys, LEFT and RIGHT" << endl;
+- cout << " -i, --enable-stdin enable standard input for sending messages" << endl;
+- cout << " -d, --debug enable debug output" << endl;
+- cout << " -V, --version print version number, then exit" << endl;
+- cout << " -h, --help show this message and exit" << endl;
+- cout << endl;
+- cout << "Report bugs to <vmallet@enst.fr>." << endl;
++ std::cout << "Usage: " << name << " [OPTION].. PLAYERNAME" << std::endl;
++ std::cout << std::endl;
++ std::cout << "Start a ZNibbles X11 client and connect to the specified nibbles server." << std::endl;
++ std::cout << std::endl;
++ std::cout << " -n, --host-name=HOST connect to server HOST [default is localhost]" << std::endl;
++ std::cout << " -p, --port=NUM connect to port NUM of server [default is 5051]" << std::endl;
++ std::cout << " -m, --message-file=FILE load predefined messages from file FILE" << std::endl;
++ std::cout << " -t, --twokey control worm with only two keys, LEFT and RIGHT" << std::endl;
++ std::cout << " -i, --enable-stdin enable standard input for sending messages" << std::endl;
++ std::cout << " -d, --debug enable debug output" << std::endl;
++ std::cout << " -V, --version print version number, then exit" << std::endl;
++ std::cout << " -h, --help show this message and exit" << std::endl;
++ std::cout << std::endl;
++ std::cout << "Report bugs to <vmallet@enst.fr>." << std::endl;
+ }
+
+
+ // display help on key used
+ void X11Interface::display_play_help()
+ {
+- cout << endl;
+- cout << "Welcome to ZNibbles!" << endl;
+- cout << endl;
+- cout << "Valid keys while playing:" << endl
+- << endl
+- << " Up, Down, Left, Right: move worm 1" << endl
+- << endl
+- << " p/u : pause/unpause game" << endl
+- << endl
+- << " P/U : pause/unpause _your_ worm" << endl
+- << endl
+- << " 1, 2, ... 0 : send predefined messages to other players" << endl
+- << endl
+- << " Ctrl+Q : quit game" << endl
+- << endl
+- << " Have fun!" << endl;
++ std::cout << std::endl;
++ std::cout << "Welcome to ZNibbles!" << std::endl;
++ std::cout << std::endl;
++ std::cout << "Valid keys while playing:" << std::endl
++ << std::endl
++ << " Up, Down, Left, Right: move worm 1" << std::endl
++ << std::endl
++ << " p/u : pause/unpause game" << std::endl
++ << std::endl
++ << " P/U : pause/unpause _your_ worm" << std::endl
++ << std::endl
++ << " 1, 2, ... 0 : send predefined messages to other players" << std::endl
++ << std::endl
++ << " Ctrl+Q : quit game" << std::endl
++ << std::endl
++ << " Have fun!" << std::endl;
+ }
+
+
+@@ -261,7 +261,7 @@
+
+ void X11Interface::pipe_handler(int sig)
+ {
+- cerr << "--- Lost Server Connection! ---" << endl;
++ std::cerr << "--- Lost Server Connection! ---" << std::endl;
+ sig++; // warnings..
+ dead_server = 1;
+ }
+@@ -285,7 +285,7 @@
+
+ z++;
+ if (t.receive_from(socket_client)) {
+- // cout << "receive error, errno=" << errno << endl;
++ // std::cout << "receive error, errno=" << errno << std::endl;
+
+ handle_Xevent();
+
+@@ -309,7 +309,7 @@
+ }
+
+ if (dir) {
+- cout << "Sending Direction ==" << dir << endl;
++ std::cout << "Sending Direction ==" << dir << std::endl;
+ tx.reset();
+ tx.put_char(PLAYER_CHANGEDIR);
+ tx.put_char(dir);
+@@ -323,7 +323,7 @@
+ break; // on verra ca plus tard.
+
+ case WORLD_DESC:
+- cout << endl << "got WORLD_DESC " << endl;
++ std::cout << std::endl << "got WORLD_DESC " << std::endl;
+ w.read_description(t);
+ tx.reset();
+ tx.put_char(CYCLE_ACK);
+@@ -333,14 +333,14 @@
+ break;
+
+ case CHANGE_NOTIFY:
+- //FAST cout << endl << "got CHANGE_NOTIFY " << endl;
++ //FAST std::cout << std::endl << "got CHANGE_NOTIFY " << std::endl;
+ t.get_char();
+ w.read_changes(t);
+ break;
+
+ case VOID_TRAME:
+ {
+- cout << "got VOID_TRAME " << endl;
++ std::cout << "got VOID_TRAME " << std::endl;
+ t.get_char();
+ char *p = t.get_string();
+ if (p && strcmp(p, "w") == 0)
+@@ -358,10 +358,10 @@
+
+ case TEXT_MESSAGE:
+ {
+- cout << "got *private* TEXT_MESSAGE == '";
++ std::cout << "got *private* TEXT_MESSAGE == '";
+ t.get_char(); // skip packet id
+ char *msg = t.get_string();
+- cout << msg << "'" << endl;
++ std::cout << msg << "'" << std::endl;
+ }
+ break;
+
+@@ -393,13 +393,13 @@
+ break;
+
+ case QUIT_GAME:
+- cout << "Got QUIT_GAME" << endl;
+- cout << "Client shutting down.... " << endl;
++ std::cout << "Got QUIT_GAME" << std::endl;
++ std::cout << "Client shutting down.... " << std::endl;
+ done = 1;
+ break;
+
+ default:
+- cout << "got unknown frame type: " << (int) t.peek_char() << endl;
++ std::cout << "got unknown frame type: " << (int) t.peek_char() << std::endl;
+ break;
+ }
+ }
+@@ -427,13 +427,13 @@
+ nibblesarea.redraw2();
+ break;
+ case ButtonPress:
+- cout << "ButtonPress" << endl;
++ std::cout << "ButtonPress" << std::endl;
+ break;
+ case KeyPress:
+ nibblesarea.handle_key(&report);
+ break;
+ case ConfigureNotify:
+- cout << "Configure" << endl;
++ std::cout << "Configure" << std::endl;
+ break;
+ }
+ }
+@@ -442,30 +442,30 @@
+
+ void X11Interface::add_player(Player& p)
+ {
+- cout << "Player <" << p.get_name() <<"> joined the game!" << endl;
++ std::cout << "Player <" << p.get_name() <<"> joined the game!" << std::endl;
+ }
+
+ void X11Interface::kill_player(Player& p, int reason)
+ {
+- cout << "Player <" << p.get_name() <<"> LEFT the game! (reason=" << reason << ")" << endl;
++ std::cout << "Player <" << p.get_name() <<"> LEFT the game! (reason=" << reason << ")" << std::endl;
+ }
+
+
+ void X11Interface::display_message(Player& from, char *msg, int priv)
+ {
+ if (priv)
+- cout << "*private* Message: " << from.get_name() << "> " << msg << endl;
++ std::cout << "*private* Message: " << from.get_name() << "> " << msg << std::endl;
+ else
+- cout << "Message: " << from.get_name() << "> " << msg << endl;
++ std::cout << "Message: " << from.get_name() << "> " << msg << std::endl;
+ }
+
+ void X11Interface::display_system_message(char *msg, Player *p, int color) // default p=NULL, color=0
+ {
+ color++;
+- cout << "*** ";
++ std::cout << "*** ";
+ if (p)
+- cout << p->get_name() << " ";
+- cout << msg;
++ std::cout << p->get_name() << " ";
++ std::cout << msg;
+ }
+
+
diff --git a/games/znibbles/files/patch-src::X11::textarea.C b/games/znibbles/files/patch-src::X11::textarea.C
new file mode 100644
index 000000000000..9a569c1462ee
--- /dev/null
+++ b/games/znibbles/files/patch-src::X11::textarea.C
@@ -0,0 +1,20 @@
+--- src/X11/textarea.C.orig Sat Oct 26 01:07:26 2002
++++ src/X11/textarea.C Sat Oct 26 01:07:28 2002
+@@ -32,7 +32,7 @@
+ #include <Xm/ScrollBar.h>
+ #include <Xm/Text.h>
+
+-#include <iostream.h>
++#include <iostream>
+ #include "string.h"
+
+ #include "motifutil.H"
+@@ -91,7 +91,7 @@
+ XmTextSetCursorPosition(widget, XmTextGetLastPosition(widget));
+ XmTextShowPosition(widget, XmTextGetLastPosition(widget));
+ if (length > 9500) {
+- cout << "textarea warning!" << endl;
++ std::cout << "textarea warning!" << std::endl;
+ bbuf[0] = '\0';
+ }
+ }
diff --git a/games/znibbles/files/patch-src::getopt.c b/games/znibbles/files/patch-src::getopt.c
new file mode 100644
index 000000000000..9ba3f2f0bcae
--- /dev/null
+++ b/games/znibbles/files/patch-src::getopt.c
@@ -0,0 +1,10 @@
+--- src/getopt.c Tue Apr 27 09:38:18 1999
++++ src/getopt.c Sat Oct 26 00:48:50 2002
+@@ -40,6 +40,7 @@
+ #endif
+
+ #include <stdio.h>
++#include <string.h>
+
+ /* Comment out all this code if we are using the GNU C Library, and are not
+ actually compiling the library itself. This code is part of the GNU C