Package: ace-of-penguins
Version: 1.2-9
Severity: wishlist
Tags: patch

Over the time paches have been accumulate to Debian. The changes include:

    - *files .c: compiling fixes (original Debian code changes from day "1")
    - files *.am: libtoolize autoreconf fixes
    - lib/stack.c: Bug#543120 segfault
    - games/taipei*.html: Documentation changes

Files included in this single patchset:

    http://patch-tracker.debian.org/package/ace-of-penguins/1.2-9

    debian/patches/01-code-changes.dpatch
    debian/patches/30-documentation-changes.dpatch
    debian/patches/40-bug-543120-segfault.dpatch
    debian/patches/90-autoreconf-ldflags-am_ldflags.dpatch

Hope they could be integrated in the original sources.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ace-of-penguins depends on:
ii  libc6                  2.10.2-2          GNU C Library: Shared libraries
ii  libpng12-0             1.2.40-1          PNG library - runtime
ii  libx11-6               2:1.3.2-1         X11 client-side library
ii  zlib1g                 1:1.2.3.3.dfsg-15 compression library - runtime

ace-of-penguins recommends no packages.

ace-of-penguins suggests no packages.

-- no debconf information
>From 2b7dbbae531ea4eb06de4e53f7472b9ad26b2114 Mon Sep 17 00:00:00 2001
From: Jari Aalto <[email protected]>
Date: Sun, 13 Dec 2009 13:25:02 +0200
Subject: [PATCH] Debian merged patches 01 30 40 90

Signed-off-by: Jari Aalto <[email protected]>
---
 games/Makefile.am   |    2 +-
 games/freecell.c    |    1 +
 games/golf.c        |    2 +-
 games/mastermind.c  |    2 +-
 games/solitaire.c   |   15 +++++++++++++++
 games/taipedit.html |    2 +-
 games/taipei.html   |    9 ++++++++-
 games/thornq.c      |    3 ++-
 lib/Makefile.am     |    2 +-
 lib/stack.c         |    3 +++
 lib/table.c         |    3 ++-
 lib/xwin.c          |    8 +++++++-
 lib/xwin.h          |    2 +-
 tests/Makefile.am   |    2 +-
 14 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/games/Makefile.am b/games/Makefile.am
index a66a48e..bbeb537 100644
--- a/games/Makefile.am
+++ b/games/Makefile.am
@@ -29,7 +29,7 @@ CLEANFILES = \
 STRIP = @STRIP@
 
 INCLUDES = -I$(srcdir)/../lib $(X_CFLAGS) @PDA@
-LDFLAGS = $(X_LIBS)
+AM_LDFLAGS = $(X_LIBS)
 
 canfield_SOURCES = canfield.c canfield-img.c
 freecell_SOURCES = freecell.c freecell-help.c freecell-img.c
diff --git a/games/freecell.c b/games/freecell.c
index ac3bf51..3ea53d9 100644
--- a/games/freecell.c
+++ b/games/freecell.c
@@ -18,6 +18,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include "cards.h"
+#include "imagelib.h"
 
 #define W CARD_WIDTH
 #define H CARD_HEIGHT
diff --git a/games/golf.c b/games/golf.c
index 88e100d..632c746 100644
--- a/games/golf.c
+++ b/games/golf.c
@@ -31,7 +31,7 @@ Picture *arrow, *no_arrow;
 
 Stack *deck, *discard, *stacks[7];
 
-static int table_width, table_height;
+int table_width, table_height;
 
 int supress_arrows = 0;
 
diff --git a/games/mastermind.c b/games/mastermind.c
index 2521b44..152e215 100644
--- a/games/mastermind.c
+++ b/games/mastermind.c
@@ -257,7 +257,7 @@ key(int k, int x, int y)
   }
   if (k == 3 || k == 27 || k == 'q')
     exit(0);
-  if (k == KEY_F(2) || k == 'r')
+  if (k == KEY_F(2))
   {
     start_again();
     invalidate(0, 0, table_width, table_height);
diff --git a/games/solitaire.c b/games/solitaire.c
index a2bf83f..772a29c 100644
--- a/games/solitaire.c
+++ b/games/solitaire.c
@@ -19,6 +19,7 @@
 #include <time.h>
 #include <math.h>
 #include "cards.h"
+#include "imagelib.h"
 
 #define W CARD_WIDTH
 #define H CARD_HEIGHT
@@ -31,6 +32,8 @@ Stack *deck, *hole;
 Stack *outcells[4];
 Stack *maincells[7];
 
+static int drag_active = 0;
+
 static int auto_move();
 
 int
@@ -153,6 +156,8 @@ redraw()
   stack_redraw();
 }
 
+static void check_for_end_of_game();
+
 extern char solitaire_help[];
 
 void
@@ -357,6 +362,13 @@ click(int x, int y, int b)
   Picture *cp = get_centered_pic();
   src_stack = 0;
 
+  // we are in a drag and annother mouse-button is pressed: abort drag
+  if (drag_active) {
+    stack_drop(dest_stack, last_n);
+    drag_active = 0;
+    return;
+  };
+  
   if ((cp == youlose || cp == youwin)
       && (x > table_width/2-cp->w/2
 	  && x < table_width/2+cp->w/2
@@ -504,6 +516,7 @@ double_click(int x, int y, int b)
 void
 drag(int x, int y, int b)
 {
+  drag_active = 1;
   if (b > 1) return;
   last_n = n_droppable(x, y);
   stack_continue_drag(last_n, x, y);
@@ -521,6 +534,8 @@ drop(int x, int y, int b)
     return;
   }
 
+  drag_active = 0;
+  
   stack_drop(dest_stack, last_n);
 
   check_for_end_of_game();
diff --git a/games/taipedit.html b/games/taipedit.html
index f8da299..7e53d7a 100644
--- a/games/taipedit.html
+++ b/games/taipedit.html
@@ -38,7 +38,7 @@ built-in layouts.</p>
 <img align=center src=taipedit-bs> Layers that are shown but not editable. </p>
 
 <p>Tiles:<br>
-<img align=center src=t/n1> . . . <img align=center src=t/n8>
+<img align=center src=n1> . . . <img align=center src=n8>
 Tiles are numbered according to the layer they're on</p>
 
 <p>You'll also see a count of the number of tiles above the layer
diff --git a/games/taipei.html b/games/taipei.html
index d324721..fb22b39 100644
--- a/games/taipei.html
+++ b/games/taipei.html
@@ -21,7 +21,14 @@ Delorie.  See http://www.delorie.com/donations.html for details.</p>
 
 <p>The goal of <tt>taipei</tt> is to remove all the tiles.  Every game
 can be won - there is no such thing as "losing" at Taipei.  Either you
-remove all the tiles, or you give up before you figure it out.</p>
+remove all the tiles, or you give up before you figure it out.
+
+If you get to the end and find a 'catch-22' in your tiles, that means
+you made a mistake earlier on - but that's your fault, not mine ;-)
+The software builds each starting game by 'undoing' a game randomly,
+guaranteeing that there is at least one way of solving it.
+
+</p>
 
 <p>My personal goal is to make money and have fun! <tt>:-)</tt></p>
 
diff --git a/games/thornq.c b/games/thornq.c
index 5a4f485..c5216de 100644
--- a/games/thornq.c
+++ b/games/thornq.c
@@ -19,6 +19,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "cards.h"
+#include "imagelib.h"
 
 #define W CARD_WIDTH
 #define H CARD_HEIGHT
@@ -571,7 +572,7 @@ try_moving_to(int i)
 	int f = stack_get_card(maincells[i], j);
 	if (SUIT(f) == SUIT(c)
 	    && VALUE(c) == VALUE(f) - 1
-	    && ! FACEDOWNP(f)) {
+	    && ! FACEDOWNP(c)) {
 	  clear_arrows();
 	  stack_move_cards(src_stack, src_n, maincells[i]);
 	  while (auto_move()) ;
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 28e6eed..385a9ab 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -6,7 +6,7 @@ noinst_HEADERS = cards.h
 CLEANFILES = images.c images.d
 
 INCLUDES = $(X_CFLAGS) @PDA@
-LDFLAGS = $(X_LIBS)
+AM_LDFLAGS = $(X_LIBS)
 
 BUILD_CC = @BUILD_CC@
 AR = @AR@
diff --git a/lib/stack.c b/lib/stack.c
index 3a54465..b26575b 100644
--- a/lib/stack.c
+++ b/lib/stack.c
@@ -16,6 +16,7 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -550,6 +551,7 @@ stack_move_cards(Stack *src, int n, Stack *dest)
 void
 stack_flip_card(Stack *src, Stack *dest)
 {
+  if (src->num_cards < 1) return; // used as an index in an array
   stack_note_undo(src, src->num_cards-1, dest);
   doing_undo = 1;
   if (src != dest)
@@ -589,6 +591,7 @@ stack_note_undo(Stack *src, int n, Stack *dest)
     else
       undo = (Undo *)malloc(max_undo * sizeof(Undo));
   }
+  if (src->num_cards < 1) return; // used as an index in an array
   undo[num_undo].src = src;
   undo[num_undo].dest = dest;
   undo[num_undo].count = stack_count_cards(src) - n + 1;
diff --git a/lib/table.c b/lib/table.c
index 0ae77c3..3f2f33e 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -118,7 +118,8 @@ init_ace(int argc, char **argv)
     argv[i++] = argv[a++];
   argv[i] = 0;
 
-  xwin_init(argc, argv);
+  if (xwin_init(argc, argv))
+    exit(1);
 }
 
 void
diff --git a/lib/xwin.c b/lib/xwin.c
index ebeebcf..8e040c2 100644
--- a/lib/xwin.c
+++ b/lib/xwin.c
@@ -125,7 +125,7 @@ void break_here(){}
 
 static char *name;
 
-void
+int
 xwin_init(int argc, char **argv)
 {
   char *sl;
@@ -140,6 +140,10 @@ xwin_init(int argc, char **argv)
   if (sl) name = sl+1;
 
   display = XOpenDisplay(0);
+  if (display == NULL) {
+    fprintf(stderr, "Error: Can't open display!\n");
+    return 1;
+  };
   screen = XDefaultScreen(display);
   rootwin = XDefaultRootWindow(display);
 
@@ -215,6 +219,8 @@ xwin_init(int argc, char **argv)
   if (!font) font = XLoadQueryFont(display, "fixed");
   font_width = font->max_bounds.width;
   font_height = font->ascent + font->descent;
+
+  return 0;
 }
 
 void
diff --git a/lib/xwin.h b/lib/xwin.h
index e29ba70..9b60e40 100644
--- a/lib/xwin.h
+++ b/lib/xwin.h
@@ -27,7 +27,7 @@ typedef struct {
 } XWin_Event;
 
 /* sets display_width, display_height, table_width/height to preferred */
-void xwin_init (int argc, char **argv);
+int xwin_init (int argc, char **argv);
 /* sets table_width, table_height to actual */
 void xwin_create (int width, int height);
 int xwin_nextevent (XWin_Event *event);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cef7a6e..530b037 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,7 +3,7 @@ bin_PROGRAMS = penguins
 test6_SOURCES = test6.c test6c.c
 
 INCLUDES = -I$(srcdir)/../lib $(X_CFLAGS) @PDA@
-LDFLAGS = $(X_LIBS)
+AM_LDFLAGS = $(X_LIBS)
 LDADD = ../lib/libcards.la -lpng -lz -lX11 -lm
 
 EXTRA_DIST = test6.png
-- 
1.6.5

Reply via email to