Merge lp:~widelands-dev/widelands/fix_name_collision into lp:widelands
- fix_name_collision
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 8154 |
Proposed branch: | lp:~widelands-dev/widelands/fix_name_collision |
Merge into: | lp:widelands |
Diff against target: |
540 lines (+53/-53) 27 files modified
src/economy/flag.h (+1/-1) src/economy/portdock.cc (+1/-1) src/economy/portdock.h (+1/-1) src/economy/road.h (+1/-1) src/graphic/game_renderer.cc (+9/-9) src/graphic/game_renderer.h (+3/-3) src/logic/map_objects/bob.cc (+1/-1) src/logic/map_objects/bob.h (+1/-1) src/logic/map_objects/draw_text.h (+3/-3) src/logic/map_objects/immovable.cc (+2/-2) src/logic/map_objects/immovable.h (+3/-3) src/logic/map_objects/map_object.cc (+4/-4) src/logic/map_objects/map_object.h (+1/-1) src/logic/map_objects/tribes/building.cc (+3/-3) src/logic/map_objects/tribes/building.h (+2/-2) src/logic/map_objects/tribes/constructionsite.cc (+1/-1) src/logic/map_objects/tribes/constructionsite.h (+1/-1) src/logic/map_objects/tribes/dismantlesite.cc (+1/-1) src/logic/map_objects/tribes/dismantlesite.h (+1/-1) src/logic/map_objects/tribes/ship.cc (+2/-2) src/logic/map_objects/tribes/ship.h (+1/-1) src/logic/map_objects/tribes/soldier.cc (+1/-1) src/logic/map_objects/tribes/soldier.h (+1/-1) src/logic/map_objects/tribes/worker.cc (+1/-1) src/logic/map_objects/tribes/worker.h (+1/-1) src/wui/mapview.cc (+4/-4) src/wui/transport_draw.cc (+2/-2) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/fix_name_collision |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tino | Needs Resubmitting | ||
Review via email: mp+309320@code.launchpad.net |
Commit message
Description of the change
It was not possible to compile current trunk on windows, because of a name collision with a MSDN function DrawText : https:/
I've renamed the function to WLDrawText, but perhaps there is also a better fix by using namespaces?
GunChleoc (gunchleoc) wrote : | # |
GunChleoc (gunchleoc) wrote : | # |
Or we could call it TextToDraw?
GunChleoc (gunchleoc) wrote : | # |
Third idea: Move it into the MapObject class, because it's an instruction to them.
SirVer (sirver) wrote : | # |
I am all for namespaces! Do not move it into the class, because that tightly couples the units (.h/.cc) files. If it is a separate struct, we can more nimbly move the struct around and have less dependencies.
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 1499. State: passed. Details: https:/
Appveyor build 1342. State: success. Details: https:/
Tino (tino79) wrote : | # |
Sorry, this is the best i can come up with.
Tried declaring the Widelands namespace in draw_text.h, but then always the enum was invalid (duplicate declaration).
Tried using "enum class DrawText"...
GunChleoc (gunchleoc) wrote : | # |
Sounds like this was a *headdesk* excercise :(
@bunnybot merge
Preview Diff
1 | === modified file 'src/economy/flag.h' | |||
2 | --- src/economy/flag.h 2016-10-22 11:20:33 +0000 | |||
3 | +++ src/economy/flag.h 2016-10-26 19:44:13 +0000 | |||
4 | @@ -146,7 +146,7 @@ | |||
5 | 146 | void cleanup(EditorGameBase&) override; | 146 | void cleanup(EditorGameBase&) override; |
6 | 147 | 147 | ||
7 | 148 | void draw(uint32_t gametime, | 148 | void draw(uint32_t gametime, |
9 | 149 | DrawText draw_text, | 149 | TextToDraw draw_text, |
10 | 150 | const Vector2f& point_on_dst, | 150 | const Vector2f& point_on_dst, |
11 | 151 | float scale, | 151 | float scale, |
12 | 152 | RenderTarget* dst) override; | 152 | RenderTarget* dst) override; |
13 | 153 | 153 | ||
14 | === modified file 'src/economy/portdock.cc' | |||
15 | --- src/economy/portdock.cc 2016-10-24 14:04:00 +0000 | |||
16 | +++ src/economy/portdock.cc 2016-10-26 19:44:13 +0000 | |||
17 | @@ -141,7 +141,7 @@ | |||
18 | 141 | expedition_bootstrap_->set_economy(e); | 141 | expedition_bootstrap_->set_economy(e); |
19 | 142 | } | 142 | } |
20 | 143 | 143 | ||
22 | 144 | void PortDock::draw(uint32_t, const DrawText, const Vector2f&, float, RenderTarget*) { | 144 | void PortDock::draw(uint32_t, const TextToDraw, const Vector2f&, float, RenderTarget*) { |
23 | 145 | // do nothing | 145 | // do nothing |
24 | 146 | } | 146 | } |
25 | 147 | 147 | ||
26 | 148 | 148 | ||
27 | === modified file 'src/economy/portdock.h' | |||
28 | --- src/economy/portdock.h 2016-10-22 11:20:33 +0000 | |||
29 | +++ src/economy/portdock.h 2016-10-26 19:44:13 +0000 | |||
30 | @@ -97,7 +97,7 @@ | |||
31 | 97 | Flag& base_flag() override; | 97 | Flag& base_flag() override; |
32 | 98 | PositionList get_positions(const EditorGameBase&) const override; | 98 | PositionList get_positions(const EditorGameBase&) const override; |
33 | 99 | void draw(uint32_t gametime, | 99 | void draw(uint32_t gametime, |
35 | 100 | DrawText draw_text, | 100 | TextToDraw draw_text, |
36 | 101 | const Vector2f& point_on_dst, | 101 | const Vector2f& point_on_dst, |
37 | 102 | float scale, | 102 | float scale, |
38 | 103 | RenderTarget* dst) override; | 103 | RenderTarget* dst) override; |
39 | 104 | 104 | ||
40 | === modified file 'src/economy/road.h' | |||
41 | --- src/economy/road.h 2016-10-22 11:20:33 +0000 | |||
42 | +++ src/economy/road.h 2016-10-26 19:44:13 +0000 | |||
43 | @@ -119,7 +119,7 @@ | |||
44 | 119 | void cleanup(EditorGameBase&) override; | 119 | void cleanup(EditorGameBase&) override; |
45 | 120 | 120 | ||
46 | 121 | void draw(uint32_t gametime, | 121 | void draw(uint32_t gametime, |
48 | 122 | DrawText draw_text, | 122 | TextToDraw draw_text, |
49 | 123 | const Vector2f& point_on_dst, | 123 | const Vector2f& point_on_dst, |
50 | 124 | float scale, | 124 | float scale, |
51 | 125 | RenderTarget* dst) override; | 125 | RenderTarget* dst) override; |
52 | 126 | 126 | ||
53 | === modified file 'src/graphic/game_renderer.cc' | |||
54 | --- src/graphic/game_renderer.cc 2016-10-24 20:07:22 +0000 | |||
55 | +++ src/graphic/game_renderer.cc 2016-10-26 19:44:13 +0000 | |||
56 | @@ -100,29 +100,29 @@ | |||
57 | 100 | void draw_objects_for_visible_field(const EditorGameBase& egbase, | 100 | void draw_objects_for_visible_field(const EditorGameBase& egbase, |
58 | 101 | const FieldsToDraw::Field& field, | 101 | const FieldsToDraw::Field& field, |
59 | 102 | const float zoom, | 102 | const float zoom, |
61 | 103 | const DrawText draw_text, | 103 | const TextToDraw draw_text, |
62 | 104 | const Player* player, | 104 | const Player* player, |
63 | 105 | RenderTarget* dst) { | 105 | RenderTarget* dst) { |
64 | 106 | BaseImmovable* const imm = field.fcoords.field->get_immovable(); | 106 | BaseImmovable* const imm = field.fcoords.field->get_immovable(); |
65 | 107 | if (imm != nullptr && imm->get_positions(egbase).front() == field.fcoords) { | 107 | if (imm != nullptr && imm->get_positions(egbase).front() == field.fcoords) { |
67 | 108 | DrawText draw_text_for_this_immovable = draw_text; | 108 | TextToDraw draw_text_for_this_immovable = draw_text; |
68 | 109 | const Player* owner = imm->get_owner(); | 109 | const Player* owner = imm->get_owner(); |
69 | 110 | if (player != nullptr && owner != nullptr && !player->see_all() && | 110 | if (player != nullptr && owner != nullptr && !player->see_all() && |
70 | 111 | player->is_hostile(*owner)) { | 111 | player->is_hostile(*owner)) { |
71 | 112 | draw_text_for_this_immovable = | 112 | draw_text_for_this_immovable = |
73 | 113 | static_cast<DrawText>(draw_text_for_this_immovable & ~DrawText::kStatistics); | 113 | static_cast<TextToDraw>(draw_text_for_this_immovable & ~TextToDraw::kStatistics); |
74 | 114 | } | 114 | } |
75 | 115 | 115 | ||
76 | 116 | imm->draw( | 116 | imm->draw( |
77 | 117 | egbase.get_gametime(), draw_text_for_this_immovable, field.rendertarget_pixel, zoom, dst); | 117 | egbase.get_gametime(), draw_text_for_this_immovable, field.rendertarget_pixel, zoom, dst); |
78 | 118 | } | 118 | } |
79 | 119 | for (Bob* bob = field.fcoords.field->get_first_bob(); bob; bob = bob->get_next_bob()) { | 119 | for (Bob* bob = field.fcoords.field->get_first_bob(); bob; bob = bob->get_next_bob()) { |
81 | 120 | DrawText draw_text_for_this_bob = draw_text; | 120 | TextToDraw draw_text_for_this_bob = draw_text; |
82 | 121 | const Player* owner = bob->get_owner(); | 121 | const Player* owner = bob->get_owner(); |
83 | 122 | if (player != nullptr && owner != nullptr && !player->see_all() && | 122 | if (player != nullptr && owner != nullptr && !player->see_all() && |
84 | 123 | player->is_hostile(*owner)) { | 123 | player->is_hostile(*owner)) { |
85 | 124 | draw_text_for_this_bob = | 124 | draw_text_for_this_bob = |
87 | 125 | static_cast<DrawText>(draw_text_for_this_bob & ~DrawText::kStatistics); | 125 | static_cast<TextToDraw>(draw_text_for_this_bob & ~TextToDraw::kStatistics); |
88 | 126 | } | 126 | } |
89 | 127 | bob->draw(egbase, draw_text_for_this_bob, field.rendertarget_pixel, zoom, dst); | 127 | bob->draw(egbase, draw_text_for_this_bob, field.rendertarget_pixel, zoom, dst); |
90 | 128 | } | 128 | } |
91 | @@ -215,7 +215,7 @@ | |||
92 | 215 | const float zoom, | 215 | const float zoom, |
93 | 216 | const FieldsToDraw& fields_to_draw, | 216 | const FieldsToDraw& fields_to_draw, |
94 | 217 | const Player* player, | 217 | const Player* player, |
96 | 218 | const DrawText draw_text, | 218 | const TextToDraw draw_text, |
97 | 219 | RenderTarget* dst) { | 219 | RenderTarget* dst) { |
98 | 220 | std::vector<FieldOverlayManager::OverlayInfo> overlay_info; | 220 | std::vector<FieldOverlayManager::OverlayInfo> overlay_info; |
99 | 221 | for (size_t current_index = 0; current_index < fields_to_draw.size(); ++current_index) { | 221 | for (size_t current_index = 0; current_index < fields_to_draw.size(); ++current_index) { |
100 | @@ -319,7 +319,7 @@ | |||
101 | 319 | const Vector2f& viewpoint, | 319 | const Vector2f& viewpoint, |
102 | 320 | const float zoom, | 320 | const float zoom, |
103 | 321 | const Widelands::Player& player, | 321 | const Widelands::Player& player, |
105 | 322 | const DrawText draw_text, | 322 | const TextToDraw draw_text, |
106 | 323 | RenderTarget* dst) { | 323 | RenderTarget* dst) { |
107 | 324 | draw(egbase, viewpoint, zoom, draw_text, &player, dst); | 324 | draw(egbase, viewpoint, zoom, draw_text, &player, dst); |
108 | 325 | } | 325 | } |
109 | @@ -327,7 +327,7 @@ | |||
110 | 327 | void GameRenderer::rendermap(const Widelands::EditorGameBase& egbase, | 327 | void GameRenderer::rendermap(const Widelands::EditorGameBase& egbase, |
111 | 328 | const Vector2f& viewpoint, | 328 | const Vector2f& viewpoint, |
112 | 329 | const float zoom, | 329 | const float zoom, |
114 | 330 | const DrawText draw_text, | 330 | const TextToDraw draw_text, |
115 | 331 | RenderTarget* dst) { | 331 | RenderTarget* dst) { |
116 | 332 | draw(egbase, viewpoint, zoom, draw_text, nullptr, dst); | 332 | draw(egbase, viewpoint, zoom, draw_text, nullptr, dst); |
117 | 333 | } | 333 | } |
118 | @@ -335,7 +335,7 @@ | |||
119 | 335 | void GameRenderer::draw(const EditorGameBase& egbase, | 335 | void GameRenderer::draw(const EditorGameBase& egbase, |
120 | 336 | const Vector2f& viewpoint, | 336 | const Vector2f& viewpoint, |
121 | 337 | const float zoom, | 337 | const float zoom, |
123 | 338 | const DrawText draw_text, | 338 | const TextToDraw draw_text, |
124 | 339 | const Player* player, | 339 | const Player* player, |
125 | 340 | RenderTarget* dst) { | 340 | RenderTarget* dst) { |
126 | 341 | assert(viewpoint.x >= 0); // divisions involving negative numbers are bad | 341 | assert(viewpoint.x >= 0); // divisions involving negative numbers are bad |
127 | 342 | 342 | ||
128 | === modified file 'src/graphic/game_renderer.h' | |||
129 | --- src/graphic/game_renderer.h 2016-10-22 11:20:33 +0000 | |||
130 | +++ src/graphic/game_renderer.h 2016-10-26 19:44:13 +0000 | |||
131 | @@ -47,7 +47,7 @@ | |||
132 | 47 | const Vector2f& viewpoint, | 47 | const Vector2f& viewpoint, |
133 | 48 | float scale, | 48 | float scale, |
134 | 49 | const Widelands::Player& player, | 49 | const Widelands::Player& player, |
136 | 50 | DrawText draw_text, | 50 | TextToDraw draw_text, |
137 | 51 | RenderTarget* dst); | 51 | RenderTarget* dst); |
138 | 52 | 52 | ||
139 | 53 | // Renders the map from an omniscient perspective. This is used | 53 | // Renders the map from an omniscient perspective. This is used |
140 | @@ -55,7 +55,7 @@ | |||
141 | 55 | void rendermap(const Widelands::EditorGameBase& egbase, | 55 | void rendermap(const Widelands::EditorGameBase& egbase, |
142 | 56 | const Vector2f& viewpoint, | 56 | const Vector2f& viewpoint, |
143 | 57 | float scale, | 57 | float scale, |
145 | 58 | DrawText draw_text, | 58 | TextToDraw draw_text, |
146 | 59 | RenderTarget* dst); | 59 | RenderTarget* dst); |
147 | 60 | 60 | ||
148 | 61 | private: | 61 | private: |
149 | @@ -64,7 +64,7 @@ | |||
150 | 64 | void draw(const Widelands::EditorGameBase& egbase, | 64 | void draw(const Widelands::EditorGameBase& egbase, |
151 | 65 | const Vector2f& viewpoint, | 65 | const Vector2f& viewpoint, |
152 | 66 | float scale, | 66 | float scale, |
154 | 67 | DrawText draw_text, | 67 | TextToDraw draw_text, |
155 | 68 | const Widelands::Player* player, | 68 | const Widelands::Player* player, |
156 | 69 | RenderTarget* dst); | 69 | RenderTarget* dst); |
157 | 70 | 70 | ||
158 | 71 | 71 | ||
159 | === modified file 'src/logic/map_objects/bob.cc' | |||
160 | --- src/logic/map_objects/bob.cc 2016-10-22 11:20:33 +0000 | |||
161 | +++ src/logic/map_objects/bob.cc 2016-10-26 19:44:13 +0000 | |||
162 | @@ -756,7 +756,7 @@ | |||
163 | 756 | /// Note that the current node is actually the node that we are walking to, not | 756 | /// Note that the current node is actually the node that we are walking to, not |
164 | 757 | /// the the one that we start from. | 757 | /// the the one that we start from. |
165 | 758 | void Bob::draw(const EditorGameBase& egbase, | 758 | void Bob::draw(const EditorGameBase& egbase, |
167 | 759 | const DrawText&, | 759 | const TextToDraw&, |
168 | 760 | const Vector2f& field_on_dst, | 760 | const Vector2f& field_on_dst, |
169 | 761 | const float scale, | 761 | const float scale, |
170 | 762 | RenderTarget* dst) const { | 762 | RenderTarget* dst) const { |
171 | 763 | 763 | ||
172 | === modified file 'src/logic/map_objects/bob.h' | |||
173 | --- src/logic/map_objects/bob.h 2016-10-22 11:20:33 +0000 | |||
174 | +++ src/logic/map_objects/bob.h 2016-10-26 19:44:13 +0000 | |||
175 | @@ -264,7 +264,7 @@ | |||
176 | 264 | // starting field) in pixel space of 'dst' (including scale). The 'scale' is | 264 | // starting field) in pixel space of 'dst' (including scale). The 'scale' is |
177 | 265 | // required to draw the bob in the right size. | 265 | // required to draw the bob in the right size. |
178 | 266 | virtual void draw(const EditorGameBase&, | 266 | virtual void draw(const EditorGameBase&, |
180 | 267 | const DrawText& draw_text, | 267 | const TextToDraw& draw_text, |
181 | 268 | const Vector2f& field_on_dst, | 268 | const Vector2f& field_on_dst, |
182 | 269 | float scale, | 269 | float scale, |
183 | 270 | RenderTarget* dst) const; | 270 | RenderTarget* dst) const; |
184 | 271 | 271 | ||
185 | === modified file 'src/logic/map_objects/draw_text.h' | |||
186 | --- src/logic/map_objects/draw_text.h 2016-10-24 20:07:22 +0000 | |||
187 | +++ src/logic/map_objects/draw_text.h 2016-10-26 19:44:13 +0000 | |||
188 | @@ -20,14 +20,14 @@ | |||
189 | 20 | #ifndef WL_LOGIC_MAP_OBJECTS_DRAW_TEXT_H | 20 | #ifndef WL_LOGIC_MAP_OBJECTS_DRAW_TEXT_H |
190 | 21 | #define WL_LOGIC_MAP_OBJECTS_DRAW_TEXT_H | 21 | #define WL_LOGIC_MAP_OBJECTS_DRAW_TEXT_H |
191 | 22 | 22 | ||
193 | 23 | enum DrawText { | 23 | enum TextToDraw { |
194 | 24 | kNone = 0, | 24 | kNone = 0, |
195 | 25 | kCensus = 1, | 25 | kCensus = 1, |
196 | 26 | kStatistics = 2, | 26 | kStatistics = 2, |
197 | 27 | }; | 27 | }; |
198 | 28 | 28 | ||
201 | 29 | inline DrawText operator|(DrawText a, DrawText b) { | 29 | inline TextToDraw operator|(TextToDraw a, TextToDraw b) { |
202 | 30 | return static_cast<DrawText>(static_cast<int>(a) | static_cast<int>(b)); | 30 | return static_cast<TextToDraw>(static_cast<int>(a) | static_cast<int>(b)); |
203 | 31 | } | 31 | } |
204 | 32 | 32 | ||
205 | 33 | #endif // end of include guard: WL_LOGIC_MAP_OBJECTS_DRAW_TEXT_H | 33 | #endif // end of include guard: WL_LOGIC_MAP_OBJECTS_DRAW_TEXT_H |
206 | 34 | 34 | ||
207 | === modified file 'src/logic/map_objects/immovable.cc' | |||
208 | --- src/logic/map_objects/immovable.cc 2016-10-25 07:07:14 +0000 | |||
209 | +++ src/logic/map_objects/immovable.cc 2016-10-26 19:44:13 +0000 | |||
210 | @@ -437,7 +437,7 @@ | |||
211 | 437 | } | 437 | } |
212 | 438 | 438 | ||
213 | 439 | void Immovable::draw(uint32_t gametime, | 439 | void Immovable::draw(uint32_t gametime, |
215 | 440 | const DrawText draw_text, | 440 | const TextToDraw draw_text, |
216 | 441 | const Vector2f& point_on_dst, | 441 | const Vector2f& point_on_dst, |
217 | 442 | float scale, | 442 | float scale, |
218 | 443 | RenderTarget* dst) { | 443 | RenderTarget* dst) { |
219 | @@ -452,7 +452,7 @@ | |||
220 | 452 | } | 452 | } |
221 | 453 | 453 | ||
222 | 454 | void Immovable::draw_construction(const uint32_t gametime, | 454 | void Immovable::draw_construction(const uint32_t gametime, |
224 | 455 | const DrawText draw_text, | 455 | const TextToDraw draw_text, |
225 | 456 | const Vector2f& point_on_dst, | 456 | const Vector2f& point_on_dst, |
226 | 457 | const float scale, | 457 | const float scale, |
227 | 458 | RenderTarget* dst) { | 458 | RenderTarget* dst) { |
228 | 459 | 459 | ||
229 | === modified file 'src/logic/map_objects/immovable.h' | |||
230 | --- src/logic/map_objects/immovable.h 2016-10-24 20:07:22 +0000 | |||
231 | +++ src/logic/map_objects/immovable.h 2016-10-26 19:44:13 +0000 | |||
232 | @@ -100,7 +100,7 @@ | |||
233 | 100 | // the point for the hotspot of the animation and 'scale' determines how big | 100 | // the point for the hotspot of the animation and 'scale' determines how big |
234 | 101 | // the immovable will be plotted. | 101 | // the immovable will be plotted. |
235 | 102 | virtual void draw(uint32_t gametime, | 102 | virtual void draw(uint32_t gametime, |
237 | 103 | DrawText draw_text, | 103 | TextToDraw draw_text, |
238 | 104 | const Vector2f& point_on_dst, | 104 | const Vector2f& point_on_dst, |
239 | 105 | float scale, | 105 | float scale, |
240 | 106 | RenderTarget* dst) = 0; | 106 | RenderTarget* dst) = 0; |
241 | @@ -222,7 +222,7 @@ | |||
242 | 222 | void cleanup(EditorGameBase&) override; | 222 | void cleanup(EditorGameBase&) override; |
243 | 223 | void act(Game&, uint32_t data) override; | 223 | void act(Game&, uint32_t data) override; |
244 | 224 | void draw(uint32_t gametime, | 224 | void draw(uint32_t gametime, |
246 | 225 | DrawText draw_text, | 225 | TextToDraw draw_text, |
247 | 226 | const Vector2f& point_on_dst, | 226 | const Vector2f& point_on_dst, |
248 | 227 | float scale, | 227 | float scale, |
249 | 228 | RenderTarget* dst) override; | 228 | RenderTarget* dst) override; |
250 | @@ -301,7 +301,7 @@ | |||
251 | 301 | private: | 301 | private: |
252 | 302 | void increment_program_pointer(); | 302 | void increment_program_pointer(); |
253 | 303 | void draw_construction(uint32_t gametime, | 303 | void draw_construction(uint32_t gametime, |
255 | 304 | DrawText draw_text, | 304 | TextToDraw draw_text, |
256 | 305 | const Vector2f& point_on_dst, | 305 | const Vector2f& point_on_dst, |
257 | 306 | float scale, | 306 | float scale, |
258 | 307 | RenderTarget* dst); | 307 | RenderTarget* dst); |
259 | 308 | 308 | ||
260 | === modified file 'src/logic/map_objects/map_object.cc' | |||
261 | --- src/logic/map_objects/map_object.cc 2016-10-23 12:59:11 +0000 | |||
262 | +++ src/logic/map_objects/map_object.cc 2016-10-26 19:44:13 +0000 | |||
263 | @@ -445,13 +445,13 @@ | |||
264 | 445 | egbase.objects().remove(*this); | 445 | egbase.objects().remove(*this); |
265 | 446 | } | 446 | } |
266 | 447 | 447 | ||
268 | 448 | void MapObject::do_draw_info(const DrawText& draw_text, | 448 | void MapObject::do_draw_info(const TextToDraw& draw_text, |
269 | 449 | const std::string& census, | 449 | const std::string& census, |
270 | 450 | const std::string& statictics, | 450 | const std::string& statictics, |
271 | 451 | const Vector2f& field_on_dst, | 451 | const Vector2f& field_on_dst, |
272 | 452 | float scale, | 452 | float scale, |
273 | 453 | RenderTarget* dst) const { | 453 | RenderTarget* dst) const { |
275 | 454 | if (draw_text == DrawText::kNone) { | 454 | if (draw_text == TextToDraw::kNone) { |
276 | 455 | return; | 455 | return; |
277 | 456 | } | 456 | } |
278 | 457 | 457 | ||
279 | @@ -468,11 +468,11 @@ | |||
280 | 468 | 468 | ||
281 | 469 | // Rounding guarantees that text aligns with pixels to avoid subsampling. | 469 | // Rounding guarantees that text aligns with pixels to avoid subsampling. |
282 | 470 | const Vector2f census_pos = round(field_on_dst - Vector2f(0, 48) * scale).cast<float>(); | 470 | const Vector2f census_pos = round(field_on_dst - Vector2f(0, 48) * scale).cast<float>(); |
284 | 471 | if (draw_text & DrawText::kCensus) { | 471 | if (draw_text & TextToDraw::kCensus) { |
285 | 472 | dst->blit(census_pos, rendered_census_info, BlendMode::UseAlpha, UI::Align::kCenter); | 472 | dst->blit(census_pos, rendered_census_info, BlendMode::UseAlpha, UI::Align::kCenter); |
286 | 473 | } | 473 | } |
287 | 474 | 474 | ||
289 | 475 | if (draw_text & DrawText::kStatistics && !statictics.empty()) { | 475 | if (draw_text & TextToDraw::kStatistics && !statictics.empty()) { |
290 | 476 | const Vector2f statistics_pos = | 476 | const Vector2f statistics_pos = |
291 | 477 | round(census_pos + Vector2f(0, rendered_census_info->height() / 2.f + 10 * scale)) | 477 | round(census_pos + Vector2f(0, rendered_census_info->height() / 2.f + 10 * scale)) |
292 | 478 | .cast<float>(); | 478 | .cast<float>(); |
293 | 479 | 479 | ||
294 | === modified file 'src/logic/map_objects/map_object.h' | |||
295 | --- src/logic/map_objects/map_object.h 2016-10-22 11:20:33 +0000 | |||
296 | +++ src/logic/map_objects/map_object.h 2016-10-26 19:44:13 +0000 | |||
297 | @@ -406,7 +406,7 @@ | |||
298 | 406 | virtual void cleanup(EditorGameBase&); | 406 | virtual void cleanup(EditorGameBase&); |
299 | 407 | 407 | ||
300 | 408 | /// Draws census and statistics on screen | 408 | /// Draws census and statistics on screen |
302 | 409 | void do_draw_info(const DrawText& draw_text, | 409 | void do_draw_info(const TextToDraw& draw_text, |
303 | 410 | const std::string& census, | 410 | const std::string& census, |
304 | 411 | const std::string& statictics, | 411 | const std::string& statictics, |
305 | 412 | const Vector2f& field_on_dst, | 412 | const Vector2f& field_on_dst, |
306 | 413 | 413 | ||
307 | === modified file 'src/logic/map_objects/tribes/building.cc' | |||
308 | --- src/logic/map_objects/tribes/building.cc 2016-10-22 11:20:33 +0000 | |||
309 | +++ src/logic/map_objects/tribes/building.cc 2016-10-26 19:44:13 +0000 | |||
310 | @@ -588,7 +588,7 @@ | |||
311 | 588 | 588 | ||
312 | 589 | 589 | ||
313 | 590 | void Building::draw(uint32_t gametime, | 590 | void Building::draw(uint32_t gametime, |
315 | 591 | const DrawText draw_text, | 591 | const TextToDraw draw_text, |
316 | 592 | const Vector2f& point_on_dst, | 592 | const Vector2f& point_on_dst, |
317 | 593 | const float scale, | 593 | const float scale, |
318 | 594 | RenderTarget* dst) { | 594 | RenderTarget* dst) { |
319 | @@ -606,12 +606,12 @@ | |||
320 | 606 | Draw overlay help strings when enabled. | 606 | Draw overlay help strings when enabled. |
321 | 607 | =============== | 607 | =============== |
322 | 608 | */ | 608 | */ |
324 | 609 | void Building::draw_info(const DrawText draw_text, | 609 | void Building::draw_info(const TextToDraw draw_text, |
325 | 610 | const Vector2f& point_on_dst, | 610 | const Vector2f& point_on_dst, |
326 | 611 | const float scale, | 611 | const float scale, |
327 | 612 | RenderTarget* dst) { | 612 | RenderTarget* dst) { |
328 | 613 | const std::string statistics_string = | 613 | const std::string statistics_string = |
330 | 614 | (draw_text & DrawText::kStatistics) ? info_string(InfoStringFormat::kStatistics) : ""; | 614 | (draw_text & TextToDraw::kStatistics) ? info_string(InfoStringFormat::kStatistics) : ""; |
331 | 615 | do_draw_info(draw_text, info_string(InfoStringFormat::kCensus), statistics_string, point_on_dst, | 615 | do_draw_info(draw_text, info_string(InfoStringFormat::kCensus), statistics_string, point_on_dst, |
332 | 616 | scale, dst); | 616 | scale, dst); |
333 | 617 | } | 617 | } |
334 | 618 | 618 | ||
335 | === modified file 'src/logic/map_objects/tribes/building.h' | |||
336 | --- src/logic/map_objects/tribes/building.h 2016-10-22 11:20:33 +0000 | |||
337 | +++ src/logic/map_objects/tribes/building.h 2016-10-26 19:44:13 +0000 | |||
338 | @@ -312,11 +312,11 @@ | |||
339 | 312 | void act(Game&, uint32_t data) override; | 312 | void act(Game&, uint32_t data) override; |
340 | 313 | 313 | ||
341 | 314 | void draw(uint32_t gametime, | 314 | void draw(uint32_t gametime, |
343 | 315 | DrawText draw_text, | 315 | TextToDraw draw_text, |
344 | 316 | const Vector2f& point_on_dst, | 316 | const Vector2f& point_on_dst, |
345 | 317 | float scale, | 317 | float scale, |
346 | 318 | RenderTarget* dst) override; | 318 | RenderTarget* dst) override; |
348 | 319 | void draw_info(DrawText draw_text, const Vector2f& point_on_dst, float scale, RenderTarget* dst); | 319 | void draw_info(TextToDraw draw_text, const Vector2f& point_on_dst, float scale, RenderTarget* dst); |
349 | 320 | 320 | ||
350 | 321 | virtual void create_options_window(InteractiveGameBase&, UI::Window*& registry) = 0; | 321 | virtual void create_options_window(InteractiveGameBase&, UI::Window*& registry) = 0; |
351 | 322 | 322 | ||
352 | 323 | 323 | ||
353 | === modified file 'src/logic/map_objects/tribes/constructionsite.cc' | |||
354 | --- src/logic/map_objects/tribes/constructionsite.cc 2016-10-22 11:20:33 +0000 | |||
355 | +++ src/logic/map_objects/tribes/constructionsite.cc 2016-10-26 19:44:13 +0000 | |||
356 | @@ -298,7 +298,7 @@ | |||
357 | 298 | =============== | 298 | =============== |
358 | 299 | */ | 299 | */ |
359 | 300 | void ConstructionSite::draw(uint32_t gametime, | 300 | void ConstructionSite::draw(uint32_t gametime, |
361 | 301 | DrawText draw_text, | 301 | TextToDraw draw_text, |
362 | 302 | const Vector2f& point_on_dst, | 302 | const Vector2f& point_on_dst, |
363 | 303 | float scale, | 303 | float scale, |
364 | 304 | RenderTarget* dst) { | 304 | RenderTarget* dst) { |
365 | 305 | 305 | ||
366 | === modified file 'src/logic/map_objects/tribes/constructionsite.h' | |||
367 | --- src/logic/map_objects/tribes/constructionsite.h 2016-10-22 11:20:33 +0000 | |||
368 | +++ src/logic/map_objects/tribes/constructionsite.h 2016-10-26 19:44:13 +0000 | |||
369 | @@ -115,7 +115,7 @@ | |||
370 | 115 | static void wares_queue_callback(Game&, WaresQueue*, DescriptionIndex, void* data); | 115 | static void wares_queue_callback(Game&, WaresQueue*, DescriptionIndex, void* data); |
371 | 116 | 116 | ||
372 | 117 | void draw(uint32_t gametime, | 117 | void draw(uint32_t gametime, |
374 | 118 | DrawText draw_text, | 118 | TextToDraw draw_text, |
375 | 119 | const Vector2f& point_on_dst, | 119 | const Vector2f& point_on_dst, |
376 | 120 | float scale, | 120 | float scale, |
377 | 121 | RenderTarget* dst) override; | 121 | RenderTarget* dst) override; |
378 | 122 | 122 | ||
379 | === modified file 'src/logic/map_objects/tribes/dismantlesite.cc' | |||
380 | --- src/logic/map_objects/tribes/dismantlesite.cc 2016-10-22 11:20:33 +0000 | |||
381 | +++ src/logic/map_objects/tribes/dismantlesite.cc 2016-10-26 19:44:13 +0000 | |||
382 | @@ -213,7 +213,7 @@ | |||
383 | 213 | =============== | 213 | =============== |
384 | 214 | */ | 214 | */ |
385 | 215 | void DismantleSite::draw(uint32_t gametime, | 215 | void DismantleSite::draw(uint32_t gametime, |
387 | 216 | const DrawText draw_text, | 216 | const TextToDraw draw_text, |
388 | 217 | const Vector2f& point_on_dst, | 217 | const Vector2f& point_on_dst, |
389 | 218 | float scale, | 218 | float scale, |
390 | 219 | RenderTarget* dst) { | 219 | RenderTarget* dst) { |
391 | 220 | 220 | ||
392 | === modified file 'src/logic/map_objects/tribes/dismantlesite.h' | |||
393 | --- src/logic/map_objects/tribes/dismantlesite.h 2016-10-22 11:20:33 +0000 | |||
394 | +++ src/logic/map_objects/tribes/dismantlesite.h 2016-10-26 19:44:13 +0000 | |||
395 | @@ -90,7 +90,7 @@ | |||
396 | 90 | void create_options_window(InteractiveGameBase&, UI::Window*& registry) override; | 90 | void create_options_window(InteractiveGameBase&, UI::Window*& registry) override; |
397 | 91 | 91 | ||
398 | 92 | void draw(uint32_t gametime, | 92 | void draw(uint32_t gametime, |
400 | 93 | DrawText draw_text, | 93 | TextToDraw draw_text, |
401 | 94 | const Vector2f& point_on_dst, | 94 | const Vector2f& point_on_dst, |
402 | 95 | float scale, | 95 | float scale, |
403 | 96 | RenderTarget* dst) override; | 96 | RenderTarget* dst) override; |
404 | 97 | 97 | ||
405 | === modified file 'src/logic/map_objects/tribes/ship.cc' | |||
406 | --- src/logic/map_objects/tribes/ship.cc 2016-10-24 14:04:00 +0000 | |||
407 | +++ src/logic/map_objects/tribes/ship.cc 2016-10-26 19:44:13 +0000 | |||
408 | @@ -940,7 +940,7 @@ | |||
409 | 940 | } | 940 | } |
410 | 941 | 941 | ||
411 | 942 | void Ship::draw(const EditorGameBase& egbase, | 942 | void Ship::draw(const EditorGameBase& egbase, |
413 | 943 | const DrawText& draw_text, | 943 | const TextToDraw& draw_text, |
414 | 944 | const Vector2f& field_on_dst, | 944 | const Vector2f& field_on_dst, |
415 | 945 | const float scale, | 945 | const float scale, |
416 | 946 | RenderTarget* dst) const { | 946 | RenderTarget* dst) const { |
417 | @@ -948,7 +948,7 @@ | |||
418 | 948 | 948 | ||
419 | 949 | // Show ship name and current activity | 949 | // Show ship name and current activity |
420 | 950 | std::string statistics_string = ""; | 950 | std::string statistics_string = ""; |
422 | 951 | if (draw_text & DrawText::kStatistics) { | 951 | if (draw_text & TextToDraw::kStatistics) { |
423 | 952 | switch (ship_state_) { | 952 | switch (ship_state_) { |
424 | 953 | case (ShipStates::kTransport): | 953 | case (ShipStates::kTransport): |
425 | 954 | /** TRANSLATORS: This is a ship state */ | 954 | /** TRANSLATORS: This is a ship state */ |
426 | 955 | 955 | ||
427 | === modified file 'src/logic/map_objects/tribes/ship.h' | |||
428 | --- src/logic/map_objects/tribes/ship.h 2016-10-24 14:04:00 +0000 | |||
429 | +++ src/logic/map_objects/tribes/ship.h 2016-10-26 19:44:13 +0000 | |||
430 | @@ -240,7 +240,7 @@ | |||
431 | 240 | 240 | ||
432 | 241 | protected: | 241 | protected: |
433 | 242 | void draw(const EditorGameBase&, | 242 | void draw(const EditorGameBase&, |
435 | 243 | const DrawText& draw_text, | 243 | const TextToDraw& draw_text, |
436 | 244 | const Vector2f& field_on_dst, | 244 | const Vector2f& field_on_dst, |
437 | 245 | float scale, | 245 | float scale, |
438 | 246 | RenderTarget* dst) const override; | 246 | RenderTarget* dst) const override; |
439 | 247 | 247 | ||
440 | === modified file 'src/logic/map_objects/tribes/soldier.cc' | |||
441 | --- src/logic/map_objects/tribes/soldier.cc 2016-10-22 11:24:18 +0000 | |||
442 | +++ src/logic/map_objects/tribes/soldier.cc 2016-10-26 19:44:13 +0000 | |||
443 | @@ -440,7 +440,7 @@ | |||
444 | 440 | * Draw this soldier. This basically draws him as a worker, but add health points | 440 | * Draw this soldier. This basically draws him as a worker, but add health points |
445 | 441 | */ | 441 | */ |
446 | 442 | void Soldier::draw(const EditorGameBase& game, | 442 | void Soldier::draw(const EditorGameBase& game, |
448 | 443 | const DrawText&, | 443 | const TextToDraw&, |
449 | 444 | const Vector2f& field_on_dst, | 444 | const Vector2f& field_on_dst, |
450 | 445 | const float scale, | 445 | const float scale, |
451 | 446 | RenderTarget* dst) const { | 446 | RenderTarget* dst) const { |
452 | 447 | 447 | ||
453 | === modified file 'src/logic/map_objects/tribes/soldier.h' | |||
454 | --- src/logic/map_objects/tribes/soldier.h 2016-10-22 11:20:33 +0000 | |||
455 | +++ src/logic/map_objects/tribes/soldier.h 2016-10-26 19:44:13 +0000 | |||
456 | @@ -209,7 +209,7 @@ | |||
457 | 209 | 209 | ||
458 | 210 | /// Draw this soldier | 210 | /// Draw this soldier |
459 | 211 | void draw(const EditorGameBase&, | 211 | void draw(const EditorGameBase&, |
461 | 212 | const DrawText& draw_text, | 212 | const TextToDraw& draw_text, |
462 | 213 | const Vector2f& point_on_dst, | 213 | const Vector2f& point_on_dst, |
463 | 214 | float scale, | 214 | float scale, |
464 | 215 | RenderTarget* dst) const override; | 215 | RenderTarget* dst) const override; |
465 | 216 | 216 | ||
466 | === modified file 'src/logic/map_objects/tribes/worker.cc' | |||
467 | --- src/logic/map_objects/tribes/worker.cc 2016-10-22 11:20:33 +0000 | |||
468 | +++ src/logic/map_objects/tribes/worker.cc 2016-10-26 19:44:13 +0000 | |||
469 | @@ -2535,7 +2535,7 @@ | |||
470 | 2535 | * Draw the worker, taking the carried ware into account. | 2535 | * Draw the worker, taking the carried ware into account. |
471 | 2536 | */ | 2536 | */ |
472 | 2537 | void Worker::draw(const EditorGameBase& egbase, | 2537 | void Worker::draw(const EditorGameBase& egbase, |
474 | 2538 | const DrawText&, | 2538 | const TextToDraw&, |
475 | 2539 | const Vector2f& field_on_dst, | 2539 | const Vector2f& field_on_dst, |
476 | 2540 | const float scale, | 2540 | const float scale, |
477 | 2541 | RenderTarget* dst) const { | 2541 | RenderTarget* dst) const { |
478 | 2542 | 2542 | ||
479 | === modified file 'src/logic/map_objects/tribes/worker.h' | |||
480 | --- src/logic/map_objects/tribes/worker.h 2016-10-22 11:20:33 +0000 | |||
481 | +++ src/logic/map_objects/tribes/worker.h 2016-10-26 19:44:13 +0000 | |||
482 | @@ -181,7 +181,7 @@ | |||
483 | 181 | const float scale, | 181 | const float scale, |
484 | 182 | RenderTarget* dst) const; | 182 | RenderTarget* dst) const; |
485 | 183 | void draw(const EditorGameBase&, | 183 | void draw(const EditorGameBase&, |
487 | 184 | const DrawText& draw_text, | 184 | const TextToDraw& draw_text, |
488 | 185 | const Vector2f& field_on_dst, | 185 | const Vector2f& field_on_dst, |
489 | 186 | float scale, | 186 | float scale, |
490 | 187 | RenderTarget* dst) const override; | 187 | RenderTarget* dst) const override; |
491 | 188 | 188 | ||
492 | === modified file 'src/wui/mapview.cc' | |||
493 | --- src/wui/mapview.cc 2016-10-24 20:56:32 +0000 | |||
494 | +++ src/wui/mapview.cc 2016-10-26 19:44:13 +0000 | |||
495 | @@ -131,20 +131,20 @@ | |||
496 | 131 | return; | 131 | return; |
497 | 132 | } | 132 | } |
498 | 133 | 133 | ||
500 | 134 | DrawText draw_text = DrawText::kNone; | 134 | TextToDraw draw_text = TextToDraw::kNone; |
501 | 135 | auto display_flags = intbase().get_display_flags(); | 135 | auto display_flags = intbase().get_display_flags(); |
502 | 136 | if (display_flags & InteractiveBase::dfShowCensus) { | 136 | if (display_flags & InteractiveBase::dfShowCensus) { |
504 | 137 | draw_text = draw_text | DrawText::kCensus; | 137 | draw_text = draw_text | TextToDraw::kCensus; |
505 | 138 | } | 138 | } |
506 | 139 | if (display_flags & InteractiveBase::dfShowStatistics) { | 139 | if (display_flags & InteractiveBase::dfShowStatistics) { |
508 | 140 | draw_text = draw_text | DrawText::kStatistics; | 140 | draw_text = draw_text | TextToDraw::kStatistics; |
509 | 141 | } | 141 | } |
510 | 142 | 142 | ||
511 | 143 | if (upcast(InteractivePlayer const, interactive_player, &intbase())) { | 143 | if (upcast(InteractivePlayer const, interactive_player, &intbase())) { |
512 | 144 | renderer_->rendermap( | 144 | renderer_->rendermap( |
513 | 145 | egbase, viewpoint_, zoom_, interactive_player->player(), draw_text, &dst); | 145 | egbase, viewpoint_, zoom_, interactive_player->player(), draw_text, &dst); |
514 | 146 | } else { | 146 | } else { |
516 | 147 | renderer_->rendermap(egbase, viewpoint_, zoom_, static_cast<DrawText>(draw_text), &dst); | 147 | renderer_->rendermap(egbase, viewpoint_, zoom_, static_cast<TextToDraw>(draw_text), &dst); |
517 | 148 | } | 148 | } |
518 | 149 | } | 149 | } |
519 | 150 | 150 | ||
520 | 151 | 151 | ||
521 | === modified file 'src/wui/transport_draw.cc' | |||
522 | --- src/wui/transport_draw.cc 2016-10-24 14:07:28 +0000 | |||
523 | +++ src/wui/transport_draw.cc 2016-10-26 19:44:13 +0000 | |||
524 | @@ -27,7 +27,7 @@ | |||
525 | 27 | namespace Widelands { | 27 | namespace Widelands { |
526 | 28 | 28 | ||
527 | 29 | void Flag::draw(uint32_t gametime, | 29 | void Flag::draw(uint32_t gametime, |
529 | 30 | const DrawText, | 30 | const TextToDraw, |
530 | 31 | const Vector2f& point_on_dst, | 31 | const Vector2f& point_on_dst, |
531 | 32 | float scale, | 32 | float scale, |
532 | 33 | RenderTarget* dst) { | 33 | RenderTarget* dst) { |
533 | @@ -54,6 +54,6 @@ | |||
534 | 54 | } | 54 | } |
535 | 55 | 55 | ||
536 | 56 | /** The road is drawn by the terrain renderer via marked fields. */ | 56 | /** The road is drawn by the terrain renderer via marked fields. */ |
538 | 57 | void Road::draw(uint32_t, const DrawText, const Vector2f&, float, RenderTarget*) { | 57 | void Road::draw(uint32_t, const TextToDraw, const Vector2f&, float, RenderTarget*) { |
539 | 58 | } | 58 | } |
540 | 59 | } | 59 | } |
I think namespace Widelands would be appropriate here, since it's located in logic.