Merge lp:~tino79/widelands/opengl_win32 into lp:~nha/widelands/opengl

Proposed by Tino
Status: Merged
Merged at revision: 6512
Proposed branch: lp:~tino79/widelands/opengl_win32
Merge into: lp:~nha/widelands/opengl
Diff against target: 202 lines (+38/-39)
2 files modified
src/graphic/render/gamerenderer_gl.cc (+28/-28)
src/graphic/render/gamerenderer_gl.h (+10/-11)
To merge this branch: bzr merge lp:~tino79/widelands/opengl_win32
Reviewer Review Type Date Requested Status
Nicolai Hähnle Approve
Review via email: mp+147042@code.launchpad.net

Description of the change

Mingw can't handle uint

To post a comment you must log in.
Revision history for this message
Nicolai Hähnle (nha) wrote :

Thanks, I will keep that in mind. I'll merge this later today.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/graphic/render/gamerenderer_gl.cc'
2--- src/graphic/render/gamerenderer_gl.cc 2013-02-06 20:31:53 +0000
3+++ src/graphic/render/gamerenderer_gl.cc 2013-02-07 08:55:31 +0000
4@@ -36,7 +36,7 @@
5
6 using namespace Widelands;
7
8-static const uint PatchSize = 4;
9+static const uint32_t PatchSize = 4;
10
11 GameRendererGL::GameRendererGL() :
12 m_patch_vertices_size(0),
13@@ -85,18 +85,18 @@
14 draw();
15 }
16
17-uint GameRendererGL::patch_index(int32_t fx, int32_t fy) const
18+uint32_t GameRendererGL::patch_index(int32_t fx, int32_t fy) const
19 {
20- uint x = fx - m_patch_size.x;
21- uint y = fy - m_patch_size.y;
22+ uint32_t x = fx - m_patch_size.x;
23+ uint32_t y = fy - m_patch_size.y;
24
25 assert(x < m_patch_size.w);
26 assert(y < m_patch_size.h);
27
28- uint outerx = x / PatchSize;
29- uint outery = y / PatchSize;
30- uint innerx = x % PatchSize;
31- uint innery = y % PatchSize;
32+ uint32_t outerx = x / PatchSize;
33+ uint32_t outery = y / PatchSize;
34+ uint32_t innerx = x % PatchSize;
35+ uint32_t innery = y % PatchSize;
36
37 return
38 (outery * (m_patch_size.w / PatchSize) + outerx) * (PatchSize * PatchSize) +
39@@ -196,7 +196,7 @@
40
41 Map const & map = m_egbase->map();
42
43- uint reqsize = m_patch_size.w * m_patch_size.h;
44+ uint32_t reqsize = m_patch_size.w * m_patch_size.h;
45 if (reqsize > 0x10000)
46 throw wexception("Too many vertices; decrease screen resolution");
47
48@@ -209,11 +209,11 @@
49 m_terrain_freq.resize(16);
50 m_terrain_freq.assign(m_terrain_freq.size(), 0);
51
52- uint index = 0;
53- for (uint outery = 0; outery < m_patch_size.h / PatchSize; ++outery) {
54- for (uint outerx = 0; outerx < m_patch_size.w / PatchSize; ++outerx) {
55- for (uint innery = 0; innery < PatchSize; ++innery) {
56- for (uint innerx = 0; innerx < PatchSize; ++innerx) {
57+ uint32_t index = 0;
58+ for (uint32_t outery = 0; outery < m_patch_size.h / PatchSize; ++outery) {
59+ for (uint32_t outerx = 0; outerx < m_patch_size.w / PatchSize; ++outerx) {
60+ for (uint32_t innery = 0; innery < PatchSize; ++innery) {
61+ for (uint32_t innerx = 0; innerx < PatchSize; ++innerx) {
62 Coords coords
63 (m_patch_size.x + outerx * PatchSize + innerx,
64 m_patch_size.y + outery * PatchSize + innery);
65@@ -243,8 +243,8 @@
66 }
67
68 m_terrain_freq_cum.resize(m_terrain_freq.size());
69- uint nrtriangles = 0;
70- for (uint idx = 0; idx < m_terrain_freq.size(); ++idx) {
71+ uint32_t nrtriangles = 0;
72+ for (uint32_t idx = 0; idx < m_terrain_freq.size(); ++idx) {
73 m_terrain_freq_cum[idx] = nrtriangles;
74 nrtriangles += m_terrain_freq[idx];
75 }
76@@ -257,10 +257,10 @@
77 index = 0;
78 for (Terrain_Index ter = 0; ter < m_terrain_freq.size(); ++ter) {
79 assert(index == 3 * m_terrain_freq_cum[ter]);
80- for (uint outery = 0; outery < m_patch_size.h / PatchSize; ++outery) {
81- for (uint outerx = 0; outerx < m_patch_size.w / PatchSize; ++outerx) {
82- for (uint innery = 0; innery < PatchSize; ++innery) {
83- for (uint innerx = 0; innerx < PatchSize; ++innerx) {
84+ for (uint32_t outery = 0; outery < m_patch_size.h / PatchSize; ++outery) {
85+ for (uint32_t outerx = 0; outerx < m_patch_size.w / PatchSize; ++outerx) {
86+ for (uint32_t innery = 0; innery < PatchSize; ++innery) {
87+ for (uint32_t innerx = 0; innerx < PatchSize; ++innerx) {
88 Coords coords
89 (m_patch_size.x + PatchSize * outerx + innerx,
90 m_patch_size.y + PatchSize * outery + innery);
91@@ -410,7 +410,7 @@
92 }
93 }
94
95- uint nrtriangles = 0;
96+ uint32_t nrtriangles = 0;
97 m_terrain_edge_freq_cum.resize(m_terrain_edge_freq.size());
98 for (Terrain_Index ter = 0; ter < m_terrain_edge_freq.size(); ++ter) {
99 m_terrain_edge_freq_cum[ter] = nrtriangles;
100@@ -422,7 +422,7 @@
101 m_edge_vertices_size = 3 * nrtriangles;
102 }
103
104- std::vector<uint> indexs;
105+ std::vector<uint32_t> indexs;
106 indexs.resize(m_terrain_edge_freq_cum.size());
107 for (Terrain_Index ter = 0; ter < m_terrain_edge_freq.size(); ++ter)
108 indexs[ter] = 3 * m_terrain_edge_freq_cum[ter];
109@@ -455,7 +455,7 @@
110 static const float TyZero = 1.0 / TEXTURE_HEIGHT;
111 static const float TyOne = 1.0 - TyZero;
112
113- uint index;
114+ uint32_t index;
115 if (lyr_r > lyr_d) {
116 index = indexs[ter_r];
117 compute_basevertex(f, m_edge_vertices[index]);
118@@ -653,13 +653,13 @@
119 }
120 }
121
122- uint nrquads = m_road_freq[0] + m_road_freq[1];
123+ uint32_t nrquads = m_road_freq[0] + m_road_freq[1];
124 if (4 * nrquads > m_road_vertices_size) {
125 m_road_vertices.reset(new basevertex[4 * nrquads]);
126 m_road_vertices_size = 4 * nrquads;
127 }
128
129- uint indexs[2];
130+ uint32_t indexs[2];
131 indexs[0] = 0;
132 indexs[1] = 4 * m_road_freq[0];
133
134@@ -672,7 +672,7 @@
135
136 uint8_t road = (roads >> Road_East) & Road_Mask;
137 if (road >= Road_Normal && road <= Road_Busy) {
138- uint index = indexs[road - Road_Normal];
139+ uint32_t index = indexs[road - Road_Normal];
140 basevertex start, end;
141 compute_basevertex(Coords(fx, fy), start);
142 compute_basevertex(Coords(fx + 1, fy), end);
143@@ -697,7 +697,7 @@
144
145 road = (roads >> Road_SouthEast) & Road_Mask;
146 if (road >= Road_Normal && road <= Road_Busy) {
147- uint index = indexs[road - Road_Normal];
148+ uint32_t index = indexs[road - Road_Normal];
149 basevertex start, end;
150 compute_basevertex(Coords(fx, fy), start);
151 compute_basevertex(Coords(fx + (fy & 1), fy + 1), end);
152@@ -722,7 +722,7 @@
153
154 road = (roads >> Road_SouthWest) & Road_Mask;
155 if (road >= Road_Normal && road <= Road_Busy) {
156- uint index = indexs[road - Road_Normal];
157+ uint32_t index = indexs[road - Road_Normal];
158 basevertex start, end;
159 compute_basevertex(Coords(fx, fy), start);
160 compute_basevertex(Coords(fx + (fy & 1) - 1, fy + 1), end);
161
162=== modified file 'src/graphic/render/gamerenderer_gl.h'
163--- src/graphic/render/gamerenderer_gl.h 2013-02-06 20:31:53 +0000
164+++ src/graphic/render/gamerenderer_gl.h 2013-02-07 08:55:31 +0000
165@@ -81,7 +81,7 @@
166 void draw_roads();
167 void draw_objects();
168
169- uint patch_index(int32_t fx, int32_t fy) const;
170+ uint32_t patch_index(int32_t fx, int32_t fy) const;
171 uint8_t field_brightness(const Widelands::FCoords & coords) const;
172 uint8_t field_roads(const Widelands::FCoords & coords) const;
173 template<typename vertex>
174@@ -109,20 +109,19 @@
175 int32_t m_maxfy;
176 Rect m_patch_size;
177 boost::scoped_array<basevertex> m_patch_vertices;
178- uint m_patch_vertices_size;
179+ uint32_t m_patch_vertices_size;
180 boost::scoped_array<uint16_t> m_patch_indices;
181- uint m_patch_indices_size;
182- std::vector<uint> m_terrain_freq;
183- std::vector<uint> m_terrain_freq_cum;
184-
185+ uint32_t m_patch_indices_size;
186+ std::vector<uint32_t> m_terrain_freq;
187+ std::vector<uint32_t> m_terrain_freq_cum;
188 boost::scoped_array<dithervertex> m_edge_vertices;
189- uint m_edge_vertices_size;
190- std::vector<uint> m_terrain_edge_freq;
191- std::vector<uint> m_terrain_edge_freq_cum;
192+ uint32_t m_edge_vertices_size;
193+ std::vector<uint32_t> m_terrain_edge_freq;
194+ std::vector<uint32_t> m_terrain_edge_freq_cum;
195
196- uint m_road_freq[2];
197+ uint32_t m_road_freq[2];
198 boost::scoped_array<basevertex> m_road_vertices;
199- uint m_road_vertices_size;
200+ uint32_t m_road_vertices_size;
201 /*@}*/
202 };
203

Subscribers

People subscribed via source and target branches

to all changes: