summaryrefslogtreecommitdiffstats
path: root/games/tetrinet/patches
diff options
context:
space:
mode:
Diffstat (limited to 'games/tetrinet/patches')
-rw-r--r--games/tetrinet/patches/check_term_size.diff19
-rw-r--r--games/tetrinet/patches/compilefix.diff93
-rw-r--r--games/tetrinet/patches/gcc10.diff25
-rw-r--r--games/tetrinet/patches/tab_key.diff52
-rw-r--r--games/tetrinet/patches/vikeys.diff35
5 files changed, 224 insertions, 0 deletions
diff --git a/games/tetrinet/patches/check_term_size.diff b/games/tetrinet/patches/check_term_size.diff
new file mode 100644
index 0000000000..31c1896ec4
--- /dev/null
+++ b/games/tetrinet/patches/check_term_size.diff
@@ -0,0 +1,19 @@
+diff -Naur tetrinet-0.11/tty.c tetrinet-0.11.patched/tty.c
+--- tetrinet-0.11/tty.c 2003-09-11 16:26:53.000000000 -0400
++++ tetrinet-0.11.patched/tty.c 2020-11-21 00:53:04.798758121 -0500
+@@ -237,6 +237,15 @@
+ if ((has_color = has_colors()))
+ start_color();
+ getmaxyx(stdscr, scrheight, scrwidth);
++
++ if(scrheight < 50 || scrwidth < 80) {
++ screen_cleanup();
++ fprintf(stderr,
++ "Terminal size %dx%d is too small. Minimum is 80x50.\n",
++ scrwidth, scrheight);
++ exit(-1);
++ }
++
+ scrwidth--; /* Don't draw in last column--this can cause scroll */
+
+ /* Cancel all this when we exit. */
diff --git a/games/tetrinet/patches/compilefix.diff b/games/tetrinet/patches/compilefix.diff
new file mode 100644
index 0000000000..868e55aa3b
--- /dev/null
+++ b/games/tetrinet/patches/compilefix.diff
@@ -0,0 +1,93 @@
+diff -Naur tetrinet-0.11/server.c tetrinet-0.11.patched/server.c
+--- tetrinet-0.11/server.c 2003-09-07 12:29:29.000000000 -0400
++++ tetrinet-0.11.patched/server.c 2020-11-20 22:06:44.851665337 -0500
+@@ -839,7 +839,7 @@
+
+ if (listen_sock >= 0 && FD_ISSET(listen_sock, &fds)) {
+ struct sockaddr_in sin;
+- int len = sizeof(sin);
++ socklen_t len = sizeof(sin);
+ fd = accept(listen_sock, (struct sockaddr *)&sin, &len);
+ if (fd >= 0) {
+ for (i = 0; i < 6 && player_socks[i] != -1; i++)
+@@ -857,7 +857,7 @@
+ #ifdef HAVE_IPV6
+ if (listen_sock6 >= 0 && FD_ISSET(listen_sock6, &fds)) {
+ struct sockaddr_in6 sin6;
+- int len = sizeof(sin6);
++ socklen_t len = sizeof(sin6);
+ fd = accept(listen_sock6, (struct sockaddr *)&sin6, &len);
+ if (fd >= 0) {
+ for (i = 0; i < 6 && player_socks[i] != -1; i++)
+diff -Naur tetrinet-0.11/sockets.c tetrinet-0.11.patched/sockets.c
+--- tetrinet-0.11/sockets.c 2003-09-09 15:15:04.000000000 -0400
++++ tetrinet-0.11.patched/sockets.c 2020-11-20 22:06:44.852665337 -0500
+@@ -66,7 +66,7 @@
+ if (c == 0xFF)
+ ptr--;
+ *ptr = 0;
+- if (log) {
++ if (logging) {
+ if (!logfile)
+ logfile = fopen(logname, "a");
+ if (logfile) {
+@@ -89,7 +89,7 @@
+ unsigned char c = 0xFF;
+ int n = 0;
+
+- if (log) {
++ if (logging) {
+ if (!logfile)
+ logfile = fopen(logname, "a");
+ if (logfile) {
+diff -Naur tetrinet-0.11/tetrinet.c tetrinet-0.11.patched/tetrinet.c
+--- tetrinet-0.11/tetrinet.c 2003-09-07 12:29:29.000000000 -0400
++++ tetrinet-0.11.patched/tetrinet.c 2020-11-20 22:09:01.677652899 -0500
+@@ -21,7 +21,7 @@
+ /*************************************************************************/
+
+ int fancy = 0; /* Fancy TTY graphics? */
+-int log = 0; /* Log network traffic to file? */
++int logging = 0; /* Log network traffic to file? */
+ char *logname; /* Log filename */
+ int windows_mode = 0; /* Try to be just like the Windows version? */
+ int noslide = 0; /* Disallow piece sliding? */
+@@ -83,7 +83,7 @@
+ winlist[i].team = 0;
+ s++;
+ strncpy(winlist[i].name, s, sizeof(winlist[i].name)-1);
+- winlist[i].name[sizeof(winlist[i].name)] = 0;
++ winlist[i].name[sizeof(winlist[i].name)-1] = 0;
+ winlist[i].points = atoi(t);
+ if ((t = strchr(t, ';')) != NULL)
+ winlist[i].games = atoi(t+1);
+@@ -560,7 +560,7 @@
+ char *nick = NULL, *server = NULL;
+ char buf[1024];
+ char nickmsg[1024];
+- unsigned char ip[4];
++ char ip[4];
+ char iphashbuf[32];
+ int len;
+ #ifdef BUILTIN_SERVER
+@@ -590,7 +590,7 @@
+ if (strcmp(av[i], "-fancy") == 0) {
+ fancy = 1;
+ } else if (strcmp(av[i], "-log") == 0) {
+- log = 1;
++ logging = 1;
+ i++;
+ if (i >= ac) {
+ fprintf(stderr, "Option -log requires an argument\n");
+diff -Naur tetrinet-0.11/tetrinet.h tetrinet-0.11.patched/tetrinet.h
+--- tetrinet-0.11/tetrinet.h 2003-09-07 12:12:51.000000000 -0400
++++ tetrinet-0.11.patched/tetrinet.h 2020-11-20 22:06:44.852665337 -0500
+@@ -74,7 +74,7 @@
+ /* Externs */
+
+ extern int fancy;
+-extern int log;
++extern int logging;
+ extern char *logname;
+ extern int windows_mode;
+ extern int noslide;
diff --git a/games/tetrinet/patches/gcc10.diff b/games/tetrinet/patches/gcc10.diff
new file mode 100644
index 0000000000..d71d5a2fbb
--- /dev/null
+++ b/games/tetrinet/patches/gcc10.diff
@@ -0,0 +1,25 @@
+Author: Reiner Herrmann <reiner@reiner-h.de>
+Description: Fix FTBFS with GCC 10
+Bug-Debian: https://bugs.debian.org/957872
+
+--- a/tetris.c
++++ b/tetris.c
+@@ -32,6 +32,7 @@
+ signed char specials[MAX_SPECIALS] = {-1}; /* Special block inventory */
+ int next_piece; /* Next piece to fall */
+
++PieceData piecedata[7][4];
+ static struct timeval timeout; /* Time of next action */
+ int current_piece; /* Current piece number */
+ int current_rotation; /* Current rotation value */
+--- a/tetris.h
++++ b/tetris.h
+@@ -50,7 +50,7 @@
+ char shape[4][4]; /* Shape data for the piece */
+ } PieceData;
+
+-PieceData piecedata[7][4];
++extern PieceData piecedata[7][4];
+
+ extern int current_piece, current_rotation;
+
diff --git a/games/tetrinet/patches/tab_key.diff b/games/tetrinet/patches/tab_key.diff
new file mode 100644
index 0000000000..d938330640
--- /dev/null
+++ b/games/tetrinet/patches/tab_key.diff
@@ -0,0 +1,52 @@
+diff -Naur tetrinet-0.11/tetrinet.c tetrinet-0.11.patched/tetrinet.c
+--- tetrinet-0.11/tetrinet.c 2003-09-07 12:29:29.000000000 -0400
++++ tetrinet-0.11.patched/tetrinet.c 2020-11-21 00:43:40.956809377 -0500
+@@ -688,6 +688,18 @@
+ else
+ timeout = -1;
+ i = io->wait_for_input(timeout);
++
++/* 20201121 bkw: make the Tab key cycle between windows. It's 2020
++ and we *still* can't get F-keys working in all terminals. */
++ if(i == 9) {
++ if(dispmode == MODE_FIELDS)
++ i = K_F2;
++ else if(dispmode == MODE_PARTYLINE)
++ i = K_F3;
++ else
++ i = K_F1;
++ }
++
+ if (i == -1) {
+ char buf[1024];
+ if (sgets(buf, sizeof(buf), server_sock))
+diff -Naur tetrinet-0.11/tty.c tetrinet-0.11.patched/tty.c
+--- tetrinet-0.11/tty.c 2003-09-11 16:26:53.000000000 -0400
++++ tetrinet-0.11.patched/tty.c 2020-11-21 00:46:25.038794461 -0500
+@@ -534,7 +534,7 @@
+ hline(MY_HLINE2, scrwidth);
+ attrset(MY_BOLD);
+ move(scrheight-1, 0);
+- addstr("F1=Show Fields F2=Partyline F3=Winlist");
++ addstr("F1=Show Fields F2=Partyline F3=Winlist Tab=Next Window");
+ move(scrheight-1, scrwidth-8);
+ addstr("F10=Quit");
+ attrset(A_NORMAL);
+@@ -978,7 +978,7 @@
+ hline(MY_HLINE2, scrwidth);
+ attrset(MY_BOLD);
+ move(scrheight-1, 0);
+- addstr("F1=Show Fields F2=Partyline F3=Winlist");
++ addstr("F1=Show Fields F2=Partyline F3=Winlist Tab=Next Window");
+ move(scrheight-1, scrwidth-8);
+ addstr("F10=Quit");
+ attrset(A_NORMAL);
+@@ -1057,7 +1057,7 @@
+ hline(MY_HLINE2, scrwidth);
+ attrset(MY_BOLD);
+ move(scrheight-1, 0);
+- addstr("F1=Show Fields F2=Partyline F3=Winlist");
++ addstr("F1=Show Fields F2=Partyline F3=Winlist Tab=Next Window");
+ move(scrheight-1, scrwidth-8);
+ addstr("F10=Quit");
+ attrset(A_NORMAL);
diff --git a/games/tetrinet/patches/vikeys.diff b/games/tetrinet/patches/vikeys.diff
new file mode 100644
index 0000000000..c69d186c6d
--- /dev/null
+++ b/games/tetrinet/patches/vikeys.diff
@@ -0,0 +1,35 @@
+diff -Naur tetrinet-0.11/tetris.c tetrinet-0.11.patched/tetris.c
+--- tetrinet-0.11/tetris.c 2003-09-07 12:29:29.000000000 -0400
++++ tetrinet-0.11.patched/tetris.c 2020-11-21 00:32:56.473867963 -0500
+@@ -902,6 +902,7 @@
+ switch (c) {
+ case K_UP: /* Rotate clockwise */
+ case 'x':
++ case 'k':
+ if (piece_waiting)
+ break;
+ rnew = (current_rotation+1) % 4;
+@@ -942,6 +943,7 @@
+ break;
+
+ case K_LEFT: /* Move left */
++ case 'h':
+ if (piece_waiting)
+ break;
+ if (x + pd->left > 0) {
+@@ -957,6 +959,7 @@
+ break;
+
+ case K_RIGHT: /* Move right */
++ case 'l':
+ if (piece_waiting)
+ break;
+ if (x + pd->right < FIELD_WIDTH-1) {
+@@ -972,6 +975,7 @@
+ break;
+
+ case K_DOWN: /* Down one space */
++ case 'j':
+ if (piece_waiting)
+ break;
+ step_down();