summaryrefslogtreecommitdiff
path: root/games-puzzle/flobopuyo/files/flobopuyo-0.20-segfault.patch
blob: 2edf49c03c11568ab7d7d299cb8f48707831abbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Fatch adjusted from Fedora to fix segfault when using optimizations.
https://bugs.gentoo.org/815262
--- a/PuyoGame.cpp
+++ b/PuyoGame.cpp
@@ -639,3 +639,3 @@
                             PuyoPuyo *markedPuyo = getPuyoAt(u, v);
-                            if (markedPuyo->getPuyoState() == PUYO_MARKED) {
+                            if (markedPuyo && markedPuyo->getPuyoState() == PUYO_MARKED) {
                                 // mark the puyo so we wont'do the job twice
--- a/PuyoGame.h
+++ b/PuyoGame.h
@@ -112,6 +112,18 @@
   PuyoState getCompanionState() const { return companionPuyo->getPuyoState(); }
-  PuyoState getFallingState() const { return fallingPuyo->getPuyoState(); }
+  PuyoState getFallingState() const {
+    if (fallingPuyo)
+      return fallingPuyo->getPuyoState();
+    return PUYO_EMPTY;
+  }
 
-  int getFallingX() const { return fallingPuyo->getPuyoX(); }
-  int getFallingY() const { return fallingPuyo->getPuyoY(); }
+  int getFallingX() const {
+    if (fallingPuyo)
+      return fallingPuyo->getPuyoX();
+    return 0;
+  }
+  int getFallingY() const {
+    if (fallingPuyo)
+      return fallingPuyo->getPuyoY();
+    return 0;
+  }
   int getCompanionX() const { return companionPuyo->getPuyoX(); }
--- a/PuyoIA.cpp
+++ b/PuyoIA.cpp
@@ -111,6 +111,6 @@
     {
-      if ((c_x<(PUYODIMX - 1)) && (c_color == (game->getPuyoAt(c_x+1,c_y))->getPuyoState())) /* Test du pattern a droite */
+      if ((c_x<(PUYODIMX - 1)) && (c_color == (game->getPuyoCellAt(c_x+1,c_y))))
       {
-        PuyoState cColorA = (game->getPuyoAt(c_x+1,c_y+1))->getPuyoState();
-        if ((c_color!=cColorA) && (cColorA>5) && (cColorA<11) && (cColorA == (game->getPuyoAt(c_x+1,c_y-1))->getPuyoState()))
+        PuyoState cColorA = (game->getPuyoCellAt(c_x+1,c_y+1));
+        if ((c_color!=cColorA) && (cColorA>5) && (cColorA<11) && (cColorA == (game->getPuyoCellAt(c_x+1,c_y-1))))
         {
@@ -120,6 +120,6 @@
                     
-      if ((c_x>0) && (c_color == (game->getPuyoAt(c_x-1,c_y))->getPuyoState())) /* Test du pattern a gauche */
+      if ((c_x>0) && (c_color == (game->getPuyoCellAt(c_x-1,c_y))))
       {
-        PuyoState cColorB = (game->getPuyoAt(c_x-1,c_y+1))->getPuyoState();
-        if ((c_color!=cColorB) && (cColorB>5) && (cColorB<11) && (cColorB == (game->getPuyoAt(c_x-1,c_y-1))->getPuyoState()))
+        PuyoState cColorB = (game->getPuyoCellAt(c_x-1,c_y+1));
+        if ((c_color!=cColorB) && (cColorB>5) && (cColorB<11) && (cColorB == (game->getPuyoCellAt(c_x-1,c_y-1))))
         {
@@ -131,3 +131,3 @@
     {
-      if (c_color == (game->getPuyoAt(c_x,c_y+2))->getPuyoState())
+      if (c_color == (game->getPuyoCellAt(c_x,c_y+2)))
       {
@@ -140,6 +140,6 @@
     {
-      if ((f_x<(PUYODIMX - 1)) && (f_color == (game->getPuyoAt(f_x+1,f_y))->getPuyoState())) /* Test du pattern a droite */
+      if ((f_x<(PUYODIMX - 1)) && (f_color == (game->getPuyoCellAt(f_x+1,f_y))))
       {
-        PuyoState fColorA = (game->getPuyoAt(f_x+1,f_y+1))->getPuyoState();
-        if ((f_color!=fColorA) && (fColorA>5) && (fColorA<11) && (fColorA == (game->getPuyoAt(f_x+1,f_y-1))->getPuyoState()))
+        PuyoState fColorA = (game->getPuyoCellAt(f_x+1,f_y+1));
+        if ((f_color!=fColorA) && (fColorA>5) && (fColorA<11) && (fColorA == (game->getPuyoCellAt(f_x+1,f_y-1))))
         {
@@ -149,6 +149,6 @@
                                   
-      if ((f_x>0) && (f_color == (game->getPuyoAt(f_x-1,f_y))->getPuyoState())) /* Test du pattern a gauche */
+      if ((f_x>0) && (f_color == (game->getPuyoCellAt(f_x-1,f_y))))
       {
         PuyoState fColorB = (game->getPuyoAt(f_x-1,f_y+1))->getPuyoState();
-        if ((f_color!=fColorB) && (fColorB>5) && (fColorB<11) && (fColorB == (game->getPuyoAt(f_x-1,f_y-1))->getPuyoState()))
+        if ((f_color!=fColorB) && (fColorB>5) && (fColorB<11) && (fColorB == (game->getPuyoCellAt(f_x-1,f_y-1))))
         {
@@ -160,3 +160,3 @@
     {
-      if (f_color == (game->getPuyoAt(f_x,f_y+2))->getPuyoState())
+      if (f_color == (game->getPuyoCellAt(f_x,f_y+2)))
       {