Package: xmille
Version: 2.0-13
Severity: important

I've had loads of crashes with xmille lately on i386, but not on
amd64.  Finally it annoyed enough to take a look.  The problem was
that onecard was doing Numseen[safety(bat)] with bat == C_INIT,
which safety did not handle.

This is easily fixed by making safety treat C_INIT the same way
as if STOP had been played.  I've checked the other callers of
safety and none of them will use the C_INIT value so this is a
noop for them.

I've also found onecard's logic to be broken where

1) It tries to check S_RIGHT_WAY in Numseen, when Numseen is
indexed by card number, so it was checking C_100 instead.
2) It checks Numseen != 0, where it should really be Numseen == 0
since we're trying to determine whether the human can play a
safety followed immediately by another card to finish the game.

Attached patch should fix all these issues:

diff --git a/comp.c b/comp.c
index 3d98ee4..dbc1f27 100644
--- a/comp.c
+++ b/comp.c
@@ -327,8 +327,8 @@ reg PLAY    *pp; {
        spd = pp->speed;
        card = -1;
        if (pp->can_go || ((isrepair(bat) || bat == C_STOP
-           || spd == C_LIMIT) && Numseen[S_RIGHT_WAY] != 0)
-           || Numseen[safety(bat)] != 0)
+           || spd == C_LIMIT) && Numseen[C_RIGHT_WAY] == 0)
+           || Numseen[safety(bat)] == 0)
                switch (End - pp->mileage) {
                  case 200:
                        if (pp->nummiles[C_200] == 2)
diff --git a/types.c b/types.c
index 13a8f97..d1149ab 100644
--- a/types.c
+++ b/types.c
@@ -31,6 +31,7 @@ reg CARD      card; {
          case C_RIGHT_WAY:
          case C_LIMIT:
          case C_END_LIMIT:
+         case C_INIT:
                return C_RIGHT_WAY;
        }
        /* NOTREACHED */

-- System Information
Debian Release: lenny/sid
Kernel Version: Linux gondolin 2.6.17-rc4 #1 SMP PREEMPT Wed May 17 17:28:00 
EST 2006 i686 GNU/Linux

Versions of the packages xmille depends on:
ii  libc6                                                   2.7-16              
        GNU C Library: Shared libraries
ii  libx11-6                                                2:1.1.5-2           
        X11 client-side library
ii  libxext6                                                2:1.0.4-1           
        X11 miscellaneous extension library



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to