summaryrefslogtreecommitdiff
path: root/games/xu4/gcc7.patch
blob: 29f2cceee4394b838d7dbfe88b7a5d3fd1a0f1fe (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
85
86
87
88
89
90
--- xu4-20130612_svn/src/image_sdl.cpp.orig	2017-07-07 05:16:49.443617174 +0700
+++ xu4-20130612_svn/src/image_sdl.cpp	2017-07-07 05:25:40.763657058 +0700
@@ -349,7 +349,7 @@
     		unsigned int y_finish = std::min(int(bottom), oy + span + 1);
         	for (y = y_start; y < y_finish; ++y) {
 
-        		int divisor = 1 + span * 2 - abs(ox - x) - abs(oy - y);
+        		int divisor = 1 + span * 2 - std::abs((long int) (ox - x)) - std::abs((long int) (oy - y));
 
                 unsigned int r, g, b, a;
                 getPixel(x, y, r, g, b, a);
--- xu4-20130612_svn/src/map.cpp.orig	2017-07-07 05:26:04.108658810 +0700
+++ xu4-20130612_svn/src/map.cpp	2017-07-07 05:28:17.857668850 +0700
@@ -123,14 +123,14 @@
     if (map && map->border_behavior == Map::BORDER_WRAP) {
         MapCoords me = *this;            
         
-        if (abs(me.x - c.x) > abs(me.x + map->width - c.x))
+        if (std::abs((long int) (me.x - c.x)) > std::abs((long int) (me.x + map->width - c.x)))
             me.x += map->width;
-        else if (abs(me.x - c.x) > abs(me.x - map->width - c.x))
+        else if (std::abs((long int) (me.x - c.x)) > std::abs((long int) (me.x - map->width - c.x)))
             me.x -= map->width;
 
-        if (abs(me.y - c.y) > abs(me.y + map->width - c.y))
+        if (std::abs((long int) (me.y - c.y)) > std::abs((long int) (me.y + map->width - c.y)))
             me.y += map->height;
-        else if (abs(me.y - c.y) > abs(me.y - map->width - c.y))
+        else if (std::abs((long int) (me.y - c.y)) > std::abs((long int) (me.y - map->width - c.y)))
             me.y -= map->height;
 
         dx = me.x - c.x;
--- xu4-20130612_svn/src/person.cpp.orig	2017-07-07 05:28:34.604670107 +0700
+++ xu4-20130612_svn/src/person.cpp	2017-07-07 05:29:29.432674223 +0700
@@ -221,7 +221,7 @@
                         eventHandler->pushController(&getPlayerCtrl);
                         int player = getPlayerCtrl.waitFor();
                         if (player != -1) {                            
-                            string player_str = to_string(player+1);
+                            string player_str = to_string((long int) player+1);
                             script->setVar(script->getInputName(), player_str);
                         }
                         else script->unsetVar(script->getInputName());
--- xu4-20130612_svn/src/script.cpp.orig	2017-07-07 05:29:46.242675485 +0700
+++ xu4-20130612_svn/src/script.cpp	2017-07-07 05:31:00.015681023 +0700
@@ -44,7 +44,7 @@
 
 Script::Variable::Variable(const int &v) : set(true) {
     i_val = v;
-    s_val = to_string(v);
+    s_val = to_string((long int) v);
 }
 
 int&    Script::Variable::getInt()      { return i_val; }
@@ -503,7 +503,7 @@
         }        
         // Get the current iterator for our loop
         else if (item == "iterator")
-            prop = to_string(this->iterator);        
+            prop = to_string((long int) this->iterator);        
         else if ((pos = item.find("show_inventory:")) < item.length()) {
             pos = item.find(":");
             string itemScript = item.substr(pos+1);
@@ -611,7 +611,7 @@
                     if (content.empty())
                         errorWarning("Error: empty math() function");
 
-                    prop = to_string(mathValue(content));
+                    prop = to_string((long int) mathValue(content));
                 }
 
                 /**
@@ -643,7 +643,7 @@
                 
                 /* generate a random number */
                 else if (funcName == "random")
-                    prop = to_string(xu4_random((int)strtol(content.c_str(), NULL, 10)));
+                    prop = to_string((long int) xu4_random((int)strtol(content.c_str(), NULL, 10)));
                 
                 /* replaced with "true" if content is empty, or "false" if not */
                 else if (funcName == "isempty") {                    
@@ -1391,7 +1391,7 @@
             string children_results;            
             
             mathParseChildren(current, &children_results);
-            *result = to_string(mathValue(children_results));            
+            *result = to_string((long int) mathValue(children_results));            
         }
     }    
 }