Gentoo Archives: gentoo-commits

From: "Azamat H. Hackimov" <winterheart@××××××.ru>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gamerlay:master commit in: games-sports/stuntrally/, games-sports/stuntrally/files/
Date: Sat, 01 Dec 2018 15:41:25
Message-Id: 1543671903.d55c0c3e014959829692300601108a1deb9e1a61.winterheart@gentoo
1 commit: d55c0c3e014959829692300601108a1deb9e1a61
2 Author: Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com>
3 AuthorDate: Sat Dec 1 13:45:03 2018 +0000
4 Commit: Azamat H. Hackimov <winterheart <AT> gentoo <DOT> ru>
5 CommitDate: Sat Dec 1 13:45:03 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/gamerlay.git/commit/?id=d55c0c3e
7
8 games-sports/stuntrally: fix build for gcc6
9
10 Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com>
11 Package-Manager: Portage-2.3.51, Repoman-2.3.11
12
13 .../stuntrally/files/stuntrally-2.6_gcc6-fix.patch | 153 +++++++++++++++++++++
14 games-sports/stuntrally/stuntrally-2.6.ebuild | 4 +
15 2 files changed, 157 insertions(+)
16
17 diff --git a/games-sports/stuntrally/files/stuntrally-2.6_gcc6-fix.patch b/games-sports/stuntrally/files/stuntrally-2.6_gcc6-fix.patch
18 new file mode 100644
19 index 0000000..88174fc
20 --- /dev/null
21 +++ b/games-sports/stuntrally/files/stuntrally-2.6_gcc6-fix.patch
22 @@ -0,0 +1,153 @@
23 +From f7703d8d3f30c34479e5ee0965bff8f8ed85c024 Mon Sep 17 00:00:00 2001
24 +From: Michael Straube <straubem@×××.de>
25 +Date: Thu, 17 Nov 2016 19:54:59 +0100
26 +Subject: [PATCH] Fix gcc6 build errors
27 +
28 +---
29 + source/ogre/CarModel_Create.cpp | 2 +-
30 + source/vdrift/cartire.cpp | 32 ++++++++++++++++----------------
31 + source/vdrift/model_obj.cpp | 2 +-
32 + source/vdrift/texture.h | 2 +-
33 + 4 files changed, 19 insertions(+), 19 deletions(-)
34 +
35 +diff --git a/source/ogre/CarModel_Create.cpp b/source/ogre/CarModel_Create.cpp
36 +index 834eac714..f53d88f85 100644
37 +--- a/source/ogre/CarModel_Create.cpp
38 ++++ b/source/ogre/CarModel_Create.cpp
39 +@@ -130,7 +130,7 @@ void CarModel::Load(int startId)
40 +
41 + /// load config .car
42 + string pathCar;
43 +- pApp->gui->GetCarPath(&pathCar, 0, 0, sDirname, pApp->mClient); // force orig for newtorked games
44 ++ pApp->gui->GetCarPath(&pathCar, 0, 0, sDirname, pApp->mClient.get() != 0); // force orig for newtorked games
45 + LoadConfig(pathCar);
46 +
47 +
48 +diff --git a/source/vdrift/cartire.cpp b/source/vdrift/cartire.cpp
49 +index dd6dd487d..253d098f7 100644
50 +--- a/source/vdrift/cartire.cpp
51 ++++ b/source/vdrift/cartire.cpp
52 +@@ -114,25 +114,25 @@ MATHVECTOR<Dbl,3> CARTIRE::GetForce(
53 + alpha = -atan2(hub_velocity[1], denom) * 180.0/PI_d;
54 +
55 + /*crash dyn obj--*/
56 +- if (isnan(alpha) || isnan(1.f/sigma_hat))
57 ++ if (std::isnan(alpha) || std::isnan(1.f/sigma_hat))
58 + {
59 + MATHVECTOR<Dbl,3> outvec(0, 0, 0);
60 + return outvec;
61 + }
62 +- assert(!isnan(alpha));
63 ++ assert(!std::isnan(alpha));
64 +
65 + Dbl gamma = current_camber * 180.0/PI_d;
66 +
67 + // beckman method for pre-combining longitudinal and lateral forces
68 +- Dbl s = sigma / sigma_hat; assert(!isnan(s));
69 +- Dbl a = alpha / alpha_hat; assert(!isnan(a));
70 ++ Dbl s = sigma / sigma_hat; assert(!std::isnan(s));
71 ++ Dbl a = alpha / alpha_hat; assert(!std::isnan(a));
72 +
73 + Dbl rho = std::max( sqrt( s*s+a*a ), 0.0001); //avoid divide by zero
74 +- assert(!isnan(rho));
75 ++ assert(!std::isnan(rho));
76 +
77 + Dbl max_Fx(0), max_Fy(0), max_Mz(0);
78 +- Dbl Fx = (s / rho) * Pacejka_Fx( rho*sigma_hat, Fz, friction_coeff, max_Fx ); assert(!isnan(Fx));
79 +- Dbl Fy = (a / rho) * Pacejka_Fy( rho*alpha_hat, Fz, gamma, friction_coeff, max_Fy ); assert(!isnan(Fy));
80 ++ Dbl Fx = (s / rho) * Pacejka_Fx( rho*sigma_hat, Fz, friction_coeff, max_Fx ); assert(!std::isnan(Fx));
81 ++ Dbl Fy = (a / rho) * Pacejka_Fy( rho*alpha_hat, Fz, gamma, friction_coeff, max_Fy ); assert(!std::isnan(Fy));
82 + Dbl Mz = Pacejka_Mz( sigma, alpha, Fz, gamma, friction_coeff, max_Mz );
83 +
84 + if (slips) // out vis
85 +@@ -158,8 +158,8 @@ MATHVECTOR<Dbl,3> CARTIRE::GetForce(
86 + {
87 + //scale down forces to fit into the maximum
88 + Dbl sc = maxforce / combforce;
89 +- Fx *= sc; assert(!isnan(Fx)); max_Fx *= sc; //vis only
90 +- Fy *= sc; assert(!isnan(Fy)); max_Fy *= sc;
91 ++ Fx *= sc; assert(!std::isnan(Fx)); max_Fx *= sc; //vis only
92 ++ Fy *= sc; assert(!std::isnan(Fy)); max_Fy *= sc;
93 + //std::cout << "Limiting " << combforce << " to " << maxforce << std::endl;
94 + }/**/
95 +
96 +@@ -180,14 +180,14 @@ MATHVECTOR<Dbl,3> CARTIRE::GetForce(
97 + Fx = 0;
98 + }else
99 + { Dbl scale = sqrt(1.0-(Fy/max_Fy)*(Fy/max_Fy));
100 +- if (isnan(scale))
101 ++ if (std::isnan(scale))
102 + Fx = 0;
103 + else
104 + Fx = Fx*scale;
105 + }/**/
106 +
107 +- assert(!isnan(Fx));
108 +- assert(!isnan(Fy));
109 ++ assert(!std::isnan(Fx));
110 ++ assert(!std::isnan(Fy));
111 +
112 + /*if ( hub_velocity.Magnitude () < 0.1 )
113 + {
114 +@@ -279,7 +279,7 @@ Dbl CARTIRE::Pacejka_Fx (Dbl sigma, Dbl Fz, Dbl friction_coeff, Dbl & maxforce_o
115 +
116 + maxforce_output = D;
117 +
118 +- assert(!isnan(Fx));
119 ++ assert(!std::isnan(Fx));
120 + return Fx;
121 + }
122 +
123 +@@ -290,7 +290,7 @@ Dbl CARTIRE::Pacejka_Fy (Dbl alpha, Dbl Fz, Dbl gamma, Dbl friction_coeff, Dbl &
124 +
125 + Dbl D = ( a[1]*Fz+a[2] ) *Fz*friction_coeff;
126 + Dbl B = a[3]*sin ( 2.0*atan ( Fz/a[4] ) ) * ( 1.0-a[5]*std::abs ( gamma ) ) / ( a[0]* ( a[1]*Fz+a[2] ) *Fz );
127 +- assert(!isnan(B));
128 ++ assert(!std::isnan(B));
129 + Dbl E = a[6]*Fz+a[7];
130 + Dbl S = alpha + a[8]*gamma+a[9]*Fz+a[10];
131 + Dbl Sv = ( ( a[11]*Fz+a[12] ) *gamma + a[13] ) *Fz+a[14];
132 +@@ -300,7 +300,7 @@ Dbl CARTIRE::Pacejka_Fy (Dbl alpha, Dbl Fz, Dbl gamma, Dbl friction_coeff, Dbl &
133 +
134 + //LogO("Fy: "+fToStr(alpha,4,6)+" "+fToStr(Fz,4,6)+" "+fToStr(gamma,4,6)+" "+fToStr(friction_coeff,4,6)+" "+fToStr(maxforce_output,4,6));
135 +
136 +- assert(!isnan(Fy));
137 ++ assert(!std::isnan(Fy));
138 + return Fy;
139 + }
140 +
141 +@@ -318,7 +318,7 @@ Dbl CARTIRE::Pacejka_Mz (Dbl sigma, Dbl alpha, Dbl Fz, Dbl gamma, Dbl friction_c
142 +
143 + maxforce_output = D+Sv;
144 +
145 +- assert(!isnan(Mz));
146 ++ assert(!std::isnan(Mz));
147 + return Mz;
148 + }
149 +
150 +diff --git a/source/vdrift/model_obj.cpp b/source/vdrift/model_obj.cpp
151 +index 338d12205..e67c1db0d 100644
152 +--- a/source/vdrift/model_obj.cpp
153 ++++ b/source/vdrift/model_obj.cpp
154 +@@ -205,7 +205,7 @@ bool MODEL_OBJ::Save(const std::string & strFileName, std::ostream & error_outpu
155 + std::ofstream f(strFileName.c_str());
156 + if (!f)
157 + {
158 +- error_output << "Error opening file for writing: " << error_output << endl;
159 ++ error_output << "Error opening file for writing: " << endl;
160 + return false;
161 + }
162 +
163 +diff --git a/source/vdrift/texture.h b/source/vdrift/texture.h
164 +index b21846a7b..eda00983a 100644
165 +--- a/source/vdrift/texture.h
166 ++++ b/source/vdrift/texture.h
167 +@@ -125,7 +125,7 @@ class TEXTURELIBRARY
168 + bool FileExists(const std::string & filename)
169 + {
170 + std::ifstream f(filename.c_str());
171 +- return f;
172 ++ return static_cast<bool>(f);
173 + }
174 +
175 + public:
176
177 diff --git a/games-sports/stuntrally/stuntrally-2.6.ebuild b/games-sports/stuntrally/stuntrally-2.6.ebuild
178 index 2352fba..49d0882 100644
179 --- a/games-sports/stuntrally/stuntrally-2.6.ebuild
180 +++ b/games-sports/stuntrally/stuntrally-2.6.ebuild
181 @@ -43,6 +43,10 @@ PDEPEND="${LIVE_PDEPEND}"
182
183 REQUIRED_USE="editor? ( game )"
184
185 +PATCHES=(
186 + "${FILESDIR}/${P}_gcc6-fix.patch"
187 +)
188 +
189 DOCS=(Readme.txt)
190
191 src_configure() {