summaryrefslogtreecommitdiffstats
path: root/games/magiccube4d/files/patch-EventHandler.cpp
blob: 057e0a9b05324e3e3bc51d4dc7ed67f1ef608633 (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
diff --git EventHandler.cpp EventHandler.cpp
index 398fcb7..f5fe00a 100644
--- EventHandler.cpp
+++ EventHandler.cpp
@@ -31,6 +31,9 @@ DESCRIPTION:
 #include "MacroManager.h"
 #include "PostScriptWriter.h"
 
+#include <stdint.h>
+static intptr_t ptr2int(const void* p) { return reinterpret_cast<intptr_t>(p); }
+
 float const EventHandler::DEF_TWIST_INCREMENT = 0.5;
 
 EventHandler::EventHandler(int argc, char **argv, char const* machine_type) :
@@ -326,7 +329,7 @@ EventHandler::getAReferenceSticker(Event *event, void *)
         number_of_reference_stickers_needed--;
         reference_stickers_needed++;
         if (number_of_reference_stickers_needed == 0)
-            (this->*what_to_do_after_got_reference_stickers)();
+            (this->*what_to_do_after_got_reference_stickers)(NULL);
     }
 }
 
@@ -415,7 +418,7 @@ EventHandler::buttonDown_handler(Event *event, void *arg)
 void
 EventHandler::undo_cb(void* argp)
 {
-    int arg = (int) argp;
+    int arg = ptr2int(argp);
     struct stickerspec grip;
     int         dir;
     int         slicesmask;
@@ -461,7 +464,7 @@ EventHandler::undo_cb(void* argp)
 void
 EventHandler::redo_cb(void* argp)
 {
-    int arg = (int) argp;
+    int arg = ptr2int(argp);
     struct stickerspec grip;
     int         dir;
     int         slicesmask;
@@ -507,7 +510,7 @@ EventHandler::redo_cb(void* argp)
 void
 EventHandler::scramble_cb(void *arg = NULL)
 {
-    int n = (int)arg;
+    int n = ptr2int(arg);
     struct stickerspec grip;
     int i, previous_face = -1;
     int ngrips = NFACES * 3 * 3 * 3;
@@ -855,12 +858,12 @@ EventHandler::toggleFast_cb(void *)
 void
 EventHandler::newPuzzle_cb(void* arg)
 {
-    if ((int)arg == preferences.getLength())
+    if (ptr2int(arg) == preferences.getLength())
     {
         reset_cb(0);
         return;
     }
-    preferences.setLength((int)arg);
+    preferences.setLength(ptr2int(arg));
     int length = preferences.getLength();
 
     polymgr->reset(length);
OpenPOWER on IntegriCloud