]> Pileus Git - ~andy/spades/commitdiff
Fix null pointers and pile parsing
authorAndy Spencer <andy753421@gmail.com>
Wed, 24 Apr 2013 08:48:19 +0000 (08:48 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 24 Apr 2013 08:48:19 +0000 (08:48 +0000)
src/org/pileus/spades/Cards.java
src/org/pileus/spades/Spades.java

index 1cf4c3e0542bce9c3e20f26c7489e854d0c659d1..8703c87a4b0b67df59359b3176abd6171195a4e3 100644 (file)
@@ -429,6 +429,8 @@ public class Cards extends GLSurfaceView implements GLSurfaceView.Renderer
 
        private void drawCard(String name)
        {
+               if (!this.index.containsKey(name))
+                       return;
                int idx   = this.index.get(name);
                int front = this.face[idx];
                int back  = this.red;
index 3c023c99b307580cbfbd1d7fa1d53d8d57476475..17eacfaa99259d8073d799e1a613d831751ebc82 100644 (file)
@@ -41,8 +41,8 @@ public class Spades
                        this.cards.hand = Spades.getCards(txt, "You have: (.*)");
                        this.cards.requestRender();
                }
-               if (txt.matches("turn!")) {
-                       this.cards.pile = Spades.getCards(txt, ".*turn! (.*)");
+               if (txt.matches(".*turn!.*")) {
+                       this.cards.pile = Spades.getCards(txt, ".*turn! \\((.*)\\)");
                        this.cards.requestRender();
                }
        }