Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 6491 | ||||
Proposed branch: | lp:~mxsscott/widelands/clang | ||||
Merge into: | lp:widelands | ||||
Diff against target: |
1018 lines (+148/-139) 30 files modified
src/compile_diagnostics.h (+18/-2) src/editor/editorinteractive.h (+1/-1) src/editor/tools/editor_set_port_space_tool.cc (+1/-2) src/editor/tools/editor_set_port_space_tool.h (+4/-5) src/editor/tools/editor_tool.h (+2/-1) src/editor/tools/editor_tool_action.h (+1/-1) src/editor/ui_menus/editor_player_menu.h (+2/-4) src/gamecontroller.h (+2/-2) src/graphic/text/rt_render.cc (+1/-4) src/io/filesystem/filesystem.cc (+15/-25) src/io/filesystem/filesystem.h (+9/-3) src/logic/building.h (+1/-1) src/logic/game.h (+4/-4) src/logic/player.cc (+2/-2) src/logic/playercommand.cc (+6/-9) src/logic/playercommand.h (+7/-9) src/logic/replay.cc (+14/-13) src/logic/replay.h (+9/-8) src/logic/ship.h (+1/-1) src/map_io/widelands_map_players_view_data_packet.cc (+3/-3) src/md5.h (+5/-4) src/network/netclient.cc (+2/-2) src/network/nethost.cc (+1/-1) src/network/network.cc (+3/-3) src/network/network.h (+5/-5) src/scripting/pluto.cc (+1/-1) src/ui_basic/table.cc (+0/-1) src/ui_basic/table.h (+18/-12) src/ui_basic/window.h (+4/-3) src/wui/warehousewindow.cc (+6/-7) |
||||
To merge this branch: | bzr merge lp:~mxsscott/widelands/clang | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mark Scott | Needs Resubmitting | ||
SirVer | Needs Fixing | ||
Review via email: mp+144001@code.launchpad.net |
Commit message
Description of the change
Fix cause of warnings reported by clang/llvm.
Mark Scott (mxsscott) wrote : | # |
Macro comment type:
Came directly from the source page https:/
FileSystem:
I agree, this doesn't look nice. I'll look into their usage and work out what their return values currently are to see if I can make better method signatures, and change to std::string.
const Coords starting_pos:
Will remove comment.
Mark Scott (mxsscott) wrote : | # |
Updates made following SirVer's comments.
If someone gives a quick nod on the filesystem changes I'll merge this into trunk and close the bug.
SirVer (sirver) wrote : | # |
Interestingly, the diff does not seem to update on resubmit. I had a look at the new commits, and: <nod> :) Certainly an improvement - thanks for making the changes and caring for the CLANG warnings.
Preview Diff
1 | === modified file 'src/compile_diagnostics.h' |
2 | --- src/compile_diagnostics.h 2013-01-06 12:55:31 +0000 |
3 | +++ src/compile_diagnostics.h 2013-01-20 19:32:24 +0000 |
4 | @@ -25,8 +25,6 @@ |
5 | * use in the middle of functions. |
6 | */ |
7 | #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 |
8 | -# define GCC_DIAG_STR(s) #s |
9 | -# define GCC_DIAG_JOINSTR(x, y) GCC_DIAG_STR(x ## y) |
10 | # define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x) |
11 | # define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x) |
12 | # define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \ |
13 | @@ -37,5 +35,23 @@ |
14 | # define GCC_DIAG_ON(x) |
15 | #endif |
16 | |
17 | +/* Macros for disabling Clang warnings and errors |
18 | + * From https://svn.boost.org/trac/boost/wiki/Guidelines/WarningsGuidelines and |
19 | + * slightly modified. |
20 | + */ |
21 | +#ifdef __clang__ |
22 | +# define CLANG_DIAG_DO_PRAGMA(x) _Pragma (#x) |
23 | +// _Pragma is unary operator #pragma ("") |
24 | +# define CLANG_DIAG_PRAGMA(x) CLANG_DIAG_DO_PRAGMA(clang diagnostic x) |
25 | +# define CLANG_DIAG_OFF(x) CLANG_DIAG_PRAGMA(push) \ |
26 | + CLANG_DIAG_PRAGMA(ignored x) |
27 | +// For example: #pragma clang diagnostic ignored "-Wno-unused-variable" |
28 | +# define CLANG_DIAG_ON(x) CLANG_DIAG_PRAGMA(pop) |
29 | +// For example: #pragma clang diagnostic warning "-Wno-unused-variable" |
30 | +#else // Ensure these macros do nothing for other compilers. |
31 | +# define CLANG_DIAG_OFF(x) |
32 | +# define CLANG_DIAG_ON(x) |
33 | +# define CLANG_DIAG_PRAGMA(x) |
34 | +#endif |
35 | |
36 | #endif |
37 | |
38 | === modified file 'src/editor/editorinteractive.h' |
39 | --- src/editor/editorinteractive.h 2012-06-06 14:51:03 +0000 |
40 | +++ src/editor/editorinteractive.h 2013-01-20 19:32:24 +0000 |
41 | @@ -39,7 +39,7 @@ |
42 | |
43 | |
44 | class Editor; |
45 | -struct Editor_Tool; |
46 | +class Editor_Tool; |
47 | |
48 | /** |
49 | * This is the EditorInteractive. It is like the InteractivePlayer class, |
50 | |
51 | === modified file 'src/editor/tools/editor_set_port_space_tool.cc' |
52 | --- src/editor/tools/editor_set_port_space_tool.cc 2012-02-21 13:52:14 +0000 |
53 | +++ src/editor/tools/editor_set_port_space_tool.cc 2013-01-20 19:32:24 +0000 |
54 | @@ -51,8 +51,7 @@ |
55 | Editor_Set_Port_Space_Tool::Editor_Set_Port_Space_Tool |
56 | (Editor_Unset_Port_Space_Tool & the_unset_tool) |
57 | : |
58 | - Editor_Tool(the_unset_tool, *this), |
59 | - m_unset_tool(the_unset_tool) |
60 | + Editor_Tool(the_unset_tool, *this) |
61 | {} |
62 | |
63 | |
64 | |
65 | === modified file 'src/editor/tools/editor_set_port_space_tool.h' |
66 | --- src/editor/tools/editor_set_port_space_tool.h 2012-02-21 13:52:14 +0000 |
67 | +++ src/editor/tools/editor_set_port_space_tool.h 2013-01-20 19:32:24 +0000 |
68 | @@ -28,7 +28,8 @@ |
69 | #define FSEL_EUPS_FILENAME "pics/fsel_editor_unset_port_space.png" |
70 | |
71 | /// Unsets a buildspace for ports. |
72 | -struct Editor_Unset_Port_Space_Tool : public Editor_Tool { |
73 | +class Editor_Unset_Port_Space_Tool : public Editor_Tool { |
74 | +public: |
75 | Editor_Unset_Port_Space_Tool(); |
76 | |
77 | int32_t handle_click_impl |
78 | @@ -44,7 +45,8 @@ |
79 | |
80 | |
81 | /// Sets a buildspace for ports. |
82 | -struct Editor_Set_Port_Space_Tool : public Editor_Tool { |
83 | +class Editor_Set_Port_Space_Tool : public Editor_Tool { |
84 | +public: |
85 | Editor_Set_Port_Space_Tool(Editor_Unset_Port_Space_Tool &); |
86 | |
87 | int32_t handle_click_impl |
88 | @@ -56,9 +58,6 @@ |
89 | Editor_Interactive & parent, Editor_Action_Args & args); |
90 | |
91 | char const * get_sel_impl() const {return FSEL_ESPS_FILENAME;} |
92 | - |
93 | -private: |
94 | - Editor_Unset_Port_Space_Tool & m_unset_tool; |
95 | }; |
96 | |
97 | int32_t Editor_Tool_Set_Port_Space_Callback |
98 | |
99 | === modified file 'src/editor/tools/editor_tool.h' |
100 | --- src/editor/tools/editor_tool.h 2012-02-21 13:52:14 +0000 |
101 | +++ src/editor/tools/editor_tool.h 2013-01-20 19:32:24 +0000 |
102 | @@ -36,7 +36,8 @@ |
103 | * one function (like delete_building, place building, modify building are 3 |
104 | * tools). |
105 | */ |
106 | -struct Editor_Tool : boost::noncopyable { |
107 | +class Editor_Tool : boost::noncopyable { |
108 | +public: |
109 | Editor_Tool(Editor_Tool & second, Editor_Tool & third, bool uda = true) : |
110 | m_second(second), m_third(third), undoable(uda) |
111 | {} |
112 | |
113 | === modified file 'src/editor/tools/editor_tool_action.h' |
114 | --- src/editor/tools/editor_tool_action.h 2012-02-21 13:52:14 +0000 |
115 | +++ src/editor/tools/editor_tool_action.h 2013-01-20 19:32:24 +0000 |
116 | @@ -23,7 +23,7 @@ |
117 | #include "logic/widelands_geometry.h" |
118 | #include "editor_action_args.h" |
119 | |
120 | -struct Editor_Tool; |
121 | +class Editor_Tool; |
122 | namespace Widelands {class map;} |
123 | struct Editor_Interactive; |
124 | |
125 | |
126 | === modified file 'src/editor/ui_menus/editor_player_menu.h' |
127 | --- src/editor/ui_menus/editor_player_menu.h 2012-02-15 21:25:34 +0000 |
128 | +++ src/editor/ui_menus/editor_player_menu.h 2013-01-20 19:32:24 +0000 |
129 | @@ -38,7 +38,8 @@ |
130 | struct Button; |
131 | } |
132 | |
133 | -struct Editor_Player_Menu : public UI::UniqueWindow { |
134 | +class Editor_Player_Menu : public UI::UniqueWindow { |
135 | +public: |
136 | Editor_Player_Menu |
137 | (Editor_Interactive &, UI::UniqueWindow::Registry &); |
138 | virtual ~Editor_Player_Menu() {} |
139 | @@ -55,9 +56,6 @@ |
140 | * m_plr_set_tribes_buts [MAX_PLAYERS]; |
141 | std::vector<std::string> m_tribes; |
142 | |
143 | - int32_t m_spt_index; |
144 | - int32_t m_mis_index; |
145 | - |
146 | int32_t m_posy; |
147 | |
148 | void name_changed(int32_t); |
149 | |
150 | === modified file 'src/gamecontroller.h' |
151 | --- src/gamecontroller.h 2012-04-28 10:57:54 +0000 |
152 | +++ src/gamecontroller.h 2013-01-20 19:32:24 +0000 |
153 | @@ -1,5 +1,5 @@ |
154 | /* |
155 | - * Copyright (C) 2008-2011 by the Widelands Development Team |
156 | + * Copyright (C) 2008-2011, 2013 by the Widelands Development Team |
157 | * |
158 | * This program is free software; you can redistribute it and/or |
159 | * modify it under the terms of the GNU General Public License |
160 | @@ -26,7 +26,7 @@ |
161 | |
162 | namespace Widelands { |
163 | struct Game; |
164 | -struct PlayerCommand; |
165 | +class PlayerCommand; |
166 | } |
167 | |
168 | |
169 | |
170 | === modified file 'src/graphic/text/rt_render.cc' |
171 | --- src/graphic/text/rt_render.cc 2013-01-06 15:23:45 +0000 |
172 | +++ src/graphic/text/rt_render.cc 2013-01-20 19:32:24 +0000 |
173 | @@ -1,5 +1,5 @@ |
174 | /* |
175 | - * Copyright (C) 2006-2012 by the Widelands Development Team |
176 | + * Copyright (C) 2006-2013 by the Widelands Development Team |
177 | * |
178 | * This program is free software; you can redistribute it and/or |
179 | * modify it under the terms of the GNU General Public License |
180 | @@ -402,9 +402,6 @@ |
181 | assert(false); // This should never be called |
182 | } |
183 | virtual bool is_non_mandatory_space() {return true;} |
184 | - |
185 | -private: |
186 | - uint32_t m_w; |
187 | }; |
188 | |
189 | /* |
190 | |
191 | === modified file 'src/io/filesystem/filesystem.cc' |
192 | --- src/io/filesystem/filesystem.cc 2012-09-21 21:36:07 +0000 |
193 | +++ src/io/filesystem/filesystem.cc 2013-01-20 19:32:24 +0000 |
194 | @@ -46,7 +46,7 @@ |
195 | #include "log.h" |
196 | #include <windows.h> |
197 | #include <io.h> |
198 | -#include <direct.h> |
199 | +#include <direct.h> |
200 | #else |
201 | #include <glob.h> |
202 | #include <sys/types.h> |
203 | @@ -321,8 +321,8 @@ |
204 | * Returns the filename of this path, everything after the last |
205 | * / or \ (or the whole string) |
206 | */ |
207 | -char const * FileSystem::FS_Filename(char const * p) { |
208 | - char const * result = p; |
209 | +const char * FileSystem::FS_Filename(const char * p) { |
210 | + const char * result = p; |
211 | |
212 | while (*p != '\0') { |
213 | if (*p == '/' || *p == '\\') |
214 | @@ -333,32 +333,22 @@ |
215 | return result; |
216 | } |
217 | |
218 | -char const * FileSystem::FS_Filename(char const * p, char const * & extension) |
219 | +std::string FileSystem::FS_FilenameExt(const std::string & f) |
220 | { |
221 | - extension = 0; |
222 | - char const * result = p; |
223 | - |
224 | - while (*p != '\0') { |
225 | - if (*p == '/' || *p == '\\') { |
226 | - extension = 0; |
227 | - result = p + 1; |
228 | - } else if (*p == '.') |
229 | - extension = p; |
230 | - ++p; |
231 | - } |
232 | - |
233 | - |
234 | - if (not extension) |
235 | - extension = p; |
236 | - return result; |
237 | + // Find last '.' - denotes start of extension |
238 | + size_t ext_start = f.rfind('.'); |
239 | + |
240 | + if (std::string::npos == ext_start) |
241 | + return ""; |
242 | + else |
243 | + return f.substr(ext_start); |
244 | } |
245 | |
246 | -std::string FileSystem::FS_FilenameWoExt(char const * const p) |
247 | +std::string FileSystem::FS_FilenameWoExt(const char * const p) |
248 | { |
249 | - char const * extension; |
250 | - std::string fname(p ? FileSystem::FS_Filename(p, extension) : ""); |
251 | - return |
252 | - extension ? fname.substr(0, fname.length() - strlen(extension)) : fname; |
253 | + std::string fname(p ? FileSystem::FS_Filename(p) : ""); |
254 | + std::string ext(FileSystem::FS_FilenameExt(fname)); |
255 | + return fname.substr(0, fname.length() - ext.length()); |
256 | } |
257 | |
258 | /// Create a filesystem from a zipfile or a real directory |
259 | |
260 | === modified file 'src/io/filesystem/filesystem.h' |
261 | --- src/io/filesystem/filesystem.h 2013-01-08 17:05:51 +0000 |
262 | +++ src/io/filesystem/filesystem.h 2013-01-20 19:32:24 +0000 |
263 | @@ -114,9 +114,15 @@ |
264 | std::string getWorkingDirectory() const; |
265 | std::string FS_CanonicalizeName(std::string path) const; |
266 | bool pathIsAbsolute(std::string const & path) const; |
267 | - static char const * FS_Filename(char const *); |
268 | - static char const * FS_Filename(char const *, char const * & extension); |
269 | - static std::string FS_FilenameWoExt(char const *); |
270 | + |
271 | + ///Given a filename, return the name with any path stripped off. |
272 | + static const char * FS_Filename(const char * n); |
273 | + |
274 | + ///Given a filename (without any path), return the extension, if any. |
275 | + static std::string FS_FilenameExt(const std::string & f); |
276 | + |
277 | + ///Given a filename, return the name with any path or extension stripped off. |
278 | + static std::string FS_FilenameWoExt(const char * n); |
279 | static std::string GetHomedir(); |
280 | |
281 | virtual unsigned long long DiskSpace() = 0; |
282 | |
283 | === modified file 'src/logic/building.h' |
284 | --- src/logic/building.h 2012-11-24 16:22:10 +0000 |
285 | +++ src/logic/building.h 2013-01-20 19:32:24 +0000 |
286 | @@ -35,7 +35,7 @@ |
287 | #include <cstring> |
288 | #include <vector> |
289 | |
290 | -namespace UI {struct Window;} |
291 | +namespace UI {class Window;} |
292 | struct BuildingHints; |
293 | struct Interactive_GameBase; |
294 | struct Profile; |
295 | |
296 | === modified file 'src/logic/game.h' |
297 | --- src/logic/game.h 2012-02-15 21:25:34 +0000 |
298 | +++ src/logic/game.h 2013-01-20 19:32:24 +0000 |
299 | @@ -1,5 +1,5 @@ |
300 | /* |
301 | - * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team |
302 | + * Copyright (C) 2002-2004, 2006-2011, 2013 by the Widelands Development Team |
303 | * |
304 | * This program is free software; you can redistribute it and/or |
305 | * modify it under the terms of the GNU General Public License |
306 | @@ -58,9 +58,9 @@ |
307 | |
308 | struct Player; |
309 | struct Map_Loader; |
310 | -struct PlayerCommand; |
311 | -struct ReplayReader; |
312 | -struct ReplayWriter; |
313 | +class PlayerCommand; |
314 | +class ReplayReader; |
315 | +class ReplayWriter; |
316 | |
317 | struct Game : Editor_Game_Base { |
318 | struct General_Stats { |
319 | |
320 | === modified file 'src/logic/player.cc' |
321 | --- src/logic/player.cc 2012-09-21 21:36:07 +0000 |
322 | +++ src/logic/player.cc 2013-01-20 19:32:24 +0000 |
323 | @@ -1,5 +1,5 @@ |
324 | /* |
325 | - * Copyright (C) 2002-2003, 2006-2012 by the Widelands Development Team |
326 | + * Copyright (C) 2002-2003, 2006-2013 by the Widelands Development Team |
327 | * |
328 | * This program is free software; you can redistribute it and/or |
329 | * modify it under the terms of the GNU General Public License |
330 | @@ -109,7 +109,7 @@ |
331 | |
332 | void Player::create_default_infrastructure() { |
333 | const Map & map = egbase().map(); |
334 | - if (Coords const starting_pos = map.get_starting_pos(m_plnum)) { |
335 | + if (map.get_starting_pos(m_plnum)) { |
336 | try { |
337 | Tribe_Descr::Initialization const & initialization = |
338 | tribe().initialization(m_initialization_index); |
339 | |
340 | === modified file 'src/logic/playercommand.cc' |
341 | --- src/logic/playercommand.cc 2012-09-21 21:36:07 +0000 |
342 | +++ src/logic/playercommand.cc 2013-01-20 19:32:24 +0000 |
343 | @@ -1,5 +1,5 @@ |
344 | /* |
345 | - * Copyright (C) 2004, 2007-2011 by the Widelands Development Team |
346 | + * Copyright (C) 2004, 2007-2011, 2013 by the Widelands Development Team |
347 | * |
348 | * This program is free software; you can redistribute it and/or |
349 | * modify it under the terms of the GNU General Public License |
350 | @@ -903,8 +903,7 @@ |
351 | uint32_t const _economy, |
352 | Ware_Index const _ware_type) |
353 | : |
354 | - Cmd_ChangeTargetQuantity(_duetime, _sender, _economy, _ware_type), |
355 | - m_economy(0) |
356 | + Cmd_ChangeTargetQuantity(_duetime, _sender, _economy, _ware_type) |
357 | {} |
358 | |
359 | void Cmd_ResetWareTargetQuantity::execute(Game & game) |
360 | @@ -947,7 +946,7 @@ |
361 | } |
362 | |
363 | Cmd_ResetWareTargetQuantity::Cmd_ResetWareTargetQuantity(StreamRead & des) |
364 | - : Cmd_ChangeTargetQuantity(des), m_economy(0) |
365 | + : Cmd_ChangeTargetQuantity(des) |
366 | {} |
367 | |
368 | void Cmd_ResetWareTargetQuantity::serialize(StreamWrite & ser) |
369 | @@ -1026,8 +1025,7 @@ |
370 | uint32_t const _economy, |
371 | Ware_Index const _ware_type) |
372 | : |
373 | - Cmd_ChangeTargetQuantity(_duetime, _sender, _economy, _ware_type), |
374 | - m_economy(0) |
375 | + Cmd_ChangeTargetQuantity(_duetime, _sender, _economy, _ware_type) |
376 | {} |
377 | |
378 | void Cmd_ResetWorkerTargetQuantity::execute(Game & game) |
379 | @@ -1070,7 +1068,7 @@ |
380 | } |
381 | |
382 | Cmd_ResetWorkerTargetQuantity::Cmd_ResetWorkerTargetQuantity(StreamRead & des) |
383 | - : Cmd_ChangeTargetQuantity(des), m_economy(0) |
384 | + : Cmd_ChangeTargetQuantity(des) |
385 | {} |
386 | |
387 | void Cmd_ResetWorkerTargetQuantity::serialize(StreamWrite & ser) |
388 | @@ -1395,8 +1393,7 @@ |
389 | |
390 | Cmd_ChangeMilitaryConfig::Cmd_ChangeMilitaryConfig(StreamRead & des) |
391 | : |
392 | -PlayerCommand (0, des.Unsigned8()), |
393 | -serial(0) |
394 | +PlayerCommand (0, des.Unsigned8()) |
395 | { |
396 | retreat = des.Unsigned8(); |
397 | /// Read reserved data |
398 | |
399 | === modified file 'src/logic/playercommand.h' |
400 | --- src/logic/playercommand.h 2012-09-21 21:36:07 +0000 |
401 | +++ src/logic/playercommand.h 2013-01-20 19:32:24 +0000 |
402 | @@ -1,5 +1,5 @@ |
403 | /* |
404 | - * Copyright (C) 2004, 2006-2011 by the Widelands Development Team |
405 | + * Copyright (C) 2004, 2006-2011, 2013 by the Widelands Development Team |
406 | * |
407 | * This program is free software; you can redistribute it and/or |
408 | * modify it under the terms of the GNU General Public License |
409 | @@ -38,7 +38,8 @@ |
410 | * reasonably unique (to be precise, they must be unique per duetime) and |
411 | * the same across all hosts, to ensure parallel simulation. |
412 | */ |
413 | -struct PlayerCommand : public GameLogicCommand { |
414 | +class PlayerCommand : public GameLogicCommand { |
415 | +public: |
416 | PlayerCommand (int32_t time, Player_Number); |
417 | |
418 | /// For savegame loading |
419 | @@ -344,7 +345,7 @@ |
420 | }; |
421 | |
422 | struct Cmd_ResetWareTargetQuantity : public Cmd_ChangeTargetQuantity { |
423 | - Cmd_ResetWareTargetQuantity() : Cmd_ChangeTargetQuantity(), m_economy(0), m_ware_type() {} |
424 | + Cmd_ResetWareTargetQuantity() : Cmd_ChangeTargetQuantity(), m_ware_type() {} |
425 | Cmd_ResetWareTargetQuantity |
426 | (int32_t duetime, Player_Number sender, |
427 | uint32_t economy, Ware_Index index); |
428 | @@ -361,7 +362,6 @@ |
429 | virtual void serialize (StreamWrite &); |
430 | |
431 | private: |
432 | - uint32_t m_economy; |
433 | Ware_Index m_ware_type; |
434 | }; |
435 | |
436 | @@ -388,7 +388,7 @@ |
437 | }; |
438 | |
439 | struct Cmd_ResetWorkerTargetQuantity : public Cmd_ChangeTargetQuantity { |
440 | - Cmd_ResetWorkerTargetQuantity() : Cmd_ChangeTargetQuantity(), m_economy(0), m_ware_type() {} |
441 | + Cmd_ResetWorkerTargetQuantity() : Cmd_ChangeTargetQuantity(), m_ware_type() {} |
442 | Cmd_ResetWorkerTargetQuantity |
443 | (int32_t duetime, Player_Number sender, |
444 | uint32_t economy, Ware_Index index); |
445 | @@ -405,7 +405,6 @@ |
446 | virtual void serialize (StreamWrite &); |
447 | |
448 | private: |
449 | - uint32_t m_economy; |
450 | Ware_Index m_ware_type; |
451 | }; |
452 | |
453 | @@ -517,12 +516,12 @@ |
454 | |
455 | // This is at very early stage, more vars should be added |
456 | struct Cmd_ChangeMilitaryConfig : public PlayerCommand { |
457 | - Cmd_ChangeMilitaryConfig() : PlayerCommand(), serial(0), retreat(0) {} // For savegame loading |
458 | + Cmd_ChangeMilitaryConfig() : PlayerCommand(), retreat(0) {} // For savegame loading |
459 | Cmd_ChangeMilitaryConfig |
460 | (int32_t const t, |
461 | int32_t const p, |
462 | uint32_t const ret) |
463 | - : PlayerCommand(t, p), serial(0), retreat(ret) |
464 | + : PlayerCommand(t, p), retreat(ret) |
465 | {} |
466 | |
467 | // Write these commands to a file (for savegames) |
468 | @@ -537,7 +536,6 @@ |
469 | virtual void serialize (StreamWrite &); |
470 | |
471 | private: |
472 | - Serial serial; |
473 | // By now only retreat info is stored |
474 | uint8_t retreat; |
475 | }; |
476 | |
477 | === modified file 'src/logic/replay.cc' |
478 | --- src/logic/replay.cc 2012-09-21 21:36:07 +0000 |
479 | +++ src/logic/replay.cc 2013-01-20 19:32:24 +0000 |
480 | @@ -1,5 +1,5 @@ |
481 | /* |
482 | - * Copyright (C) 2007-2009 by the Widelands Development Team |
483 | + * Copyright (C) 2007-2009,2013 by the Widelands Development Team |
484 | * |
485 | * This program is free software; you can redistribute it and/or |
486 | * modify it under the terms of the GNU General Public License |
487 | @@ -48,8 +48,9 @@ |
488 | #define SYNC_INTERVAL 200 |
489 | |
490 | |
491 | -struct Cmd_ReplaySyncRead : public Command { |
492 | - Cmd_ReplaySyncRead(uint32_t const _duetime, md5_checksum const & hash) |
493 | +class Cmd_ReplaySyncRead : public Command { |
494 | +public: |
495 | + Cmd_ReplaySyncRead(const uint32_t _duetime, const md5_checksum & hash) |
496 | : Command(_duetime), m_hash(hash) |
497 | {} |
498 | |
499 | @@ -57,7 +58,7 @@ |
500 | |
501 | void execute(Game & game) |
502 | { |
503 | - md5_checksum const myhash = game.get_sync_hash(); |
504 | + const md5_checksum myhash = game.get_sync_hash(); |
505 | |
506 | if (m_hash != myhash) { |
507 | log |
508 | @@ -84,8 +85,7 @@ |
509 | /** |
510 | * Load the savegame part of the given replay and open the command log. |
511 | */ |
512 | -ReplayReader::ReplayReader(Game & game, std::string const & filename) |
513 | - : m_game(game) |
514 | +ReplayReader::ReplayReader(Game & game, const std::string & filename) |
515 | { |
516 | m_replaytime = 0; |
517 | |
518 | @@ -98,7 +98,7 @@ |
519 | static_cast<Widelands::StreamRead *>(g_fs->OpenStreamRead(filename)); |
520 | |
521 | try { |
522 | - uint32_t const magic = m_cmdlog->Unsigned32(); |
523 | + const uint32_t magic = m_cmdlog->Unsigned32(); |
524 | if (magic == 0x2E21A100) |
525 | // Note: This was never released as part of a build |
526 | throw wexception |
527 | @@ -109,7 +109,7 @@ |
528 | throw wexception |
529 | ("%s apparently not a valid replay file", filename.c_str()); |
530 | |
531 | - uint8_t const version = m_cmdlog->Unsigned8(); |
532 | + const uint8_t version = m_cmdlog->Unsigned8(); |
533 | if (version < REPLAY_VERSION) |
534 | throw wexception |
535 | ("Replay of version %u is known to have desync problems", version); |
536 | @@ -141,7 +141,7 @@ |
537 | * \return a \ref Command that should be enqueued in the command queue |
538 | * or 0 if there are no remaining commands before the given time. |
539 | */ |
540 | -Command * ReplayReader::GetNextCommand(uint32_t const time) |
541 | +Command * ReplayReader::GetNextCommand(const uint32_t time) |
542 | { |
543 | if (!m_cmdlog) |
544 | return 0; |
545 | @@ -208,8 +208,9 @@ |
546 | * Command / timer that regularly inserts synchronization hashes into |
547 | * the replay. |
548 | */ |
549 | -struct Cmd_ReplaySyncWrite : public Command { |
550 | - Cmd_ReplaySyncWrite(uint32_t const _duetime) : Command(_duetime) {} |
551 | +class Cmd_ReplaySyncWrite : public Command { |
552 | +public: |
553 | + Cmd_ReplaySyncWrite(const uint32_t _duetime) : Command(_duetime) {} |
554 | |
555 | virtual uint8_t id() const {return QUEUE_CMD_REPLAYSYNCWRITE;} |
556 | |
557 | @@ -230,7 +231,7 @@ |
558 | * This is expected to be called just after game load has completed |
559 | * and the game has changed into running state. |
560 | */ |
561 | -ReplayWriter::ReplayWriter(Game & game, std::string const & filename) |
562 | +ReplayWriter::ReplayWriter(Game & game, const std::string & filename) |
563 | : m_game(game), m_filename(filename) |
564 | { |
565 | g_fs->EnsureDirectoryExists(REPLAY_DIR); |
566 | @@ -295,7 +296,7 @@ |
567 | /** |
568 | * Store a synchronization hash for the current game time in the replay. |
569 | */ |
570 | -void ReplayWriter::SendSync(md5_checksum const & hash) |
571 | +void ReplayWriter::SendSync(const md5_checksum & hash) |
572 | { |
573 | m_cmdlog->Unsigned8(pkt_syncreport); |
574 | m_cmdlog->Unsigned32(m_game.get_gametime()); |
575 | |
576 | === modified file 'src/logic/replay.h' |
577 | --- src/logic/replay.h 2012-02-15 21:25:34 +0000 |
578 | +++ src/logic/replay.h 2013-01-20 19:32:24 +0000 |
579 | @@ -1,5 +1,5 @@ |
580 | /* |
581 | - * Copyright (C) 2007-2009 by the Widelands Development Team |
582 | + * Copyright (C) 2007-2009,2013 by the Widelands Development Team |
583 | * |
584 | * This program is free software; you can redistribute it and/or |
585 | * modify it under the terms of the GNU General Public License |
586 | @@ -40,22 +40,22 @@ |
587 | namespace Widelands { |
588 | struct Command; |
589 | struct Game; |
590 | -struct PlayerCommand; |
591 | +class PlayerCommand; |
592 | struct StreamRead; |
593 | struct StreamWrite; |
594 | |
595 | /** |
596 | * Read game replays from disk. |
597 | */ |
598 | -struct ReplayReader { |
599 | - ReplayReader(Game &, std::string const & filename); |
600 | +class ReplayReader { |
601 | +public: |
602 | + ReplayReader(Game & game, const std::string & filename); |
603 | ~ReplayReader(); |
604 | |
605 | Command * GetNextCommand(uint32_t time); |
606 | bool EndOfReplay(); |
607 | |
608 | private: |
609 | - Game & m_game; |
610 | StreamRead * m_cmdlog; |
611 | |
612 | uint32_t m_replaytime; |
613 | @@ -64,12 +64,13 @@ |
614 | /** |
615 | * Write game replays to disk. |
616 | */ |
617 | -struct ReplayWriter { |
618 | - ReplayWriter(Game &, std::string const & filename); |
619 | +class ReplayWriter { |
620 | +public: |
621 | + ReplayWriter(Game &, const std::string & filename); |
622 | ~ReplayWriter(); |
623 | |
624 | void SendPlayerCommand(PlayerCommand *); |
625 | - void SendSync(md5_checksum const &); |
626 | + void SendSync(const md5_checksum &); |
627 | |
628 | private: |
629 | Game & m_game; |
630 | |
631 | === modified file 'src/logic/ship.h' |
632 | --- src/logic/ship.h 2012-02-15 21:25:34 +0000 |
633 | +++ src/logic/ship.h 2013-01-20 19:32:24 +0000 |
634 | @@ -24,7 +24,7 @@ |
635 | #include "economy/shippingitem.h" |
636 | #include "graphic/diranimations.h" |
637 | |
638 | -namespace UI {struct Window;} |
639 | +namespace UI {class Window;} |
640 | struct Interactive_GameBase; |
641 | |
642 | namespace Widelands { |
643 | |
644 | === modified file 'src/map_io/widelands_map_players_view_data_packet.cc' |
645 | --- src/map_io/widelands_map_players_view_data_packet.cc 2012-09-21 21:36:07 +0000 |
646 | +++ src/map_io/widelands_map_players_view_data_packet.cc 2013-01-20 19:32:24 +0000 |
647 | @@ -1,5 +1,5 @@ |
648 | /* |
649 | - * Copyright (C) 2007-2008, 2010-2012 by the Widelands Development Team |
650 | + * Copyright (C) 2007-2008, 2010-2013 by the Widelands Development Team |
651 | * |
652 | * This program is free software; you can redistribute it and/or |
653 | * modify it under the terms of the GNU General Public License |
654 | @@ -439,12 +439,12 @@ |
655 | // Store the player's view of roads and ownership in these |
656 | // temporary variables and save it in the player when set. |
657 | uint8_t roads = 0; |
658 | - Player_Number owner; |
659 | + Player_Number owner = 0; |
660 | |
661 | switch (f_vision) { // owner and map_object_descr |
662 | case 0: |
663 | // The player has never seen this node, so he has no |
664 | - // information about it. Neither should he be be informed about |
665 | + // information about it. Neither should he be informed about |
666 | // it now. |
667 | break; |
668 | case 1: { |
669 | |
670 | === modified file 'src/md5.h' |
671 | --- src/md5.h 2012-12-15 14:40:29 +0000 |
672 | +++ src/md5.h 2013-01-20 19:32:24 +0000 |
673 | @@ -69,9 +69,10 @@ |
674 | * |
675 | * Instances of this class can be copied. |
676 | */ |
677 | -template <typename Base> struct MD5Checksum : public Base { |
678 | +template <typename Base> class MD5Checksum : public Base { |
679 | +public: |
680 | MD5Checksum() {Reset();} |
681 | - explicit MD5Checksum(MD5Checksum const & other) |
682 | + explicit MD5Checksum(const MD5Checksum & other) |
683 | : |
684 | Base(), |
685 | can_handle_data(other.can_handle_data), sum(other.sum), ctx(other.ctx) |
686 | @@ -91,7 +92,7 @@ |
687 | /// |
688 | /// \param data data to compute chksum for |
689 | /// \param size size of data |
690 | - void Data(void const * const newdata, size_t const size) { |
691 | + void Data(const void * const newdata, const size_t size) { |
692 | assert(can_handle_data); |
693 | md5_process_bytes(newdata, size, &ctx); |
694 | } |
695 | @@ -108,7 +109,7 @@ |
696 | /// before this function. |
697 | /// |
698 | /// \return a pointer to an array of 16 bytes containing the checksum. |
699 | - md5_checksum const & GetChecksum() const { |
700 | + const md5_checksum & GetChecksum() const { |
701 | assert(!can_handle_data); |
702 | return sum; |
703 | } |
704 | |
705 | === modified file 'src/network/netclient.cc' |
706 | --- src/network/netclient.cc 2013-01-01 15:25:07 +0000 |
707 | +++ src/network/netclient.cc 2013-01-20 19:32:24 +0000 |
708 | @@ -753,7 +753,7 @@ |
709 | char * complete = complete_buf.get(); |
710 | #endif |
711 | fr.DataComplete(complete, bytes); |
712 | - MD5Checksum<FileRead> md5sum; |
713 | + SimpleMD5Checksum md5sum; |
714 | md5sum.Data(complete, bytes); |
715 | md5sum.FinishChecksum(); |
716 | std::string localmd5 = md5sum.GetChecksum().str(); |
717 | @@ -844,7 +844,7 @@ |
718 | char * complete = complete_buf.get(); |
719 | #endif |
720 | fr.DataComplete(complete, file->bytes); |
721 | - MD5Checksum<FileRead> md5sum; |
722 | + SimpleMD5Checksum md5sum; |
723 | md5sum.Data(complete, file->bytes); |
724 | md5sum.FinishChecksum(); |
725 | std::string localmd5 = md5sum.GetChecksum().str(); |
726 | |
727 | === modified file 'src/network/nethost.cc' |
728 | --- src/network/nethost.cc 2013-01-06 11:10:00 +0000 |
729 | +++ src/network/nethost.cc 2013-01-20 19:32:24 +0000 |
730 | @@ -1533,7 +1533,7 @@ |
731 | std::vector<char> complete(file->bytes); |
732 | fr.SetFilePos(0); |
733 | fr.DataComplete(&complete[0], file->bytes); |
734 | - MD5Checksum<FileRead> md5sum; |
735 | + SimpleMD5Checksum md5sum; |
736 | md5sum.Data(&complete[0], file->bytes); |
737 | md5sum.FinishChecksum(); |
738 | file->md5sum = md5sum.GetChecksum().str(); |
739 | |
740 | === modified file 'src/network/network.cc' |
741 | --- src/network/network.cc 2012-02-15 21:25:34 +0000 |
742 | +++ src/network/network.cc 2013-01-20 19:32:24 +0000 |
743 | @@ -186,10 +186,10 @@ |
744 | return m_index < buffer.size(); |
745 | } |
746 | |
747 | -bool Deserializer::read (TCPsocket sock) |
748 | +bool Deserializer::read(TCPsocket sock) |
749 | { |
750 | uint8_t buffer[512]; |
751 | - int32_t const bytes = SDLNet_TCP_Recv(sock, buffer, sizeof(buffer)); |
752 | + const int32_t bytes = SDLNet_TCP_Recv(sock, buffer, sizeof(buffer)); |
753 | if (bytes <= 0) |
754 | return false; |
755 | |
756 | @@ -206,7 +206,7 @@ |
757 | if (queue.size() < 2) |
758 | return false; |
759 | |
760 | - uint16_t const size = queue[0] << 8 | queue[1]; |
761 | + const uint16_t size = queue[0] << 8 | queue[1]; |
762 | if (size < 2) |
763 | return false; |
764 | |
765 | |
766 | === modified file 'src/network/network.h' |
767 | --- src/network/network.h 2012-02-15 21:25:34 +0000 |
768 | +++ src/network/network.h 2013-01-20 19:32:24 +0000 |
769 | @@ -31,7 +31,7 @@ |
770 | #include <string> |
771 | #include <vector> |
772 | |
773 | -struct Deserializer; |
774 | +class Deserializer; |
775 | |
776 | struct SyncCallback { |
777 | virtual ~SyncCallback() {} |
778 | @@ -130,7 +130,8 @@ |
779 | std::vector<FilePart> parts; |
780 | }; |
781 | |
782 | -struct Deserializer { |
783 | +class Deserializer { |
784 | +public: |
785 | /** |
786 | * Read data from the given socket. |
787 | * \return \c false if the socket was disconnected or another error |
788 | @@ -138,17 +139,16 @@ |
789 | * \c true if some data could be read (this does not imply that \ref avail |
790 | * will return \c true !) |
791 | */ |
792 | - bool read (TCPsocket); |
793 | + bool read(TCPsocket sock); |
794 | |
795 | /** |
796 | * \return \c true if an entire packet has been received. |
797 | */ |
798 | - bool avail () const; |
799 | + bool avail() const; |
800 | |
801 | private: |
802 | friend struct RecvPacket; |
803 | std::vector<uint8_t> queue; |
804 | - size_t index; |
805 | }; |
806 | |
807 | |
808 | |
809 | === modified file 'src/scripting/pluto.cc' |
810 | --- src/scripting/pluto.cc 2013-01-06 11:05:01 +0000 |
811 | +++ src/scripting/pluto.cc 2013-01-20 19:32:24 +0000 |
812 | @@ -31,7 +31,7 @@ |
813 | //are only used in conditional asserts |
814 | #include "compile_diagnostics.h" |
815 | GCC_DIAG_OFF("-Wunused-variable") |
816 | - |
817 | +CLANG_DIAG_OFF("-Wunused-variable") |
818 | |
819 | // Forward declarated from lua_impl.h. So we do not need to include it |
820 | int luna_restore_object(lua_State * L); |
821 | |
822 | === modified file 'src/ui_basic/table.cc' |
823 | --- src/ui_basic/table.cc 2012-12-14 20:09:35 +0000 |
824 | +++ src/ui_basic/table.cc 2013-01-20 19:32:24 +0000 |
825 | @@ -48,7 +48,6 @@ |
826 | : |
827 | Panel (parent, x, y, w, h), |
828 | m_total_width (0), |
829 | - m_max_pic_width (0), |
830 | m_fontname (UI_FONT_NAME), |
831 | m_fontsize (UI_FONT_SIZE_SMALL), |
832 | m_headerheight (15), |
833 | |
834 | === modified file 'src/ui_basic/table.h' |
835 | --- src/ui_basic/table.h 2012-12-14 20:09:35 +0000 |
836 | +++ src/ui_basic/table.h 2013-01-20 19:32:24 +0000 |
837 | @@ -42,8 +42,8 @@ |
838 | /// 1. a reference type, |
839 | /// 2. a pointer type or |
840 | /// 3. uintptr_t. |
841 | -template<typename Entry> struct Table { |
842 | - |
843 | +template<typename Entry> class Table { |
844 | +public: |
845 | struct Entry_Record { |
846 | }; |
847 | |
848 | @@ -108,8 +108,8 @@ |
849 | virtual bool handle_key(bool down, SDL_keysym code); |
850 | }; |
851 | |
852 | -template <> struct Table<void *> : public Panel { |
853 | - |
854 | +template <> class Table<void *> : public Panel { |
855 | +public: |
856 | struct Entry_Record { |
857 | Entry_Record(void * entry); |
858 | |
859 | @@ -132,7 +132,7 @@ |
860 | bool is_checked(uint8_t col) const; |
861 | |
862 | private: |
863 | - friend struct Table<void *>; |
864 | + friend class Table<void *>; |
865 | void * m_entry; |
866 | bool use_clr; |
867 | RGBColor clr; |
868 | @@ -261,7 +261,6 @@ |
869 | |
870 | Columns m_columns; |
871 | uint32_t m_total_width; |
872 | - uint32_t m_max_pic_width; |
873 | std::string m_fontname; |
874 | uint32_t m_fontsize; |
875 | uint32_t m_headerheight; |
876 | @@ -281,8 +280,10 @@ |
877 | }; |
878 | |
879 | template <typename Entry> |
880 | - struct Table<const Entry * const> : public Table<void *> |
881 | + class Table<const Entry * const> : public Table<void *> |
882 | { |
883 | +public: |
884 | + |
885 | typedef Table<void *> Base; |
886 | Table |
887 | (Panel * parent, |
888 | @@ -310,7 +311,8 @@ |
889 | } |
890 | }; |
891 | |
892 | -template <typename Entry> struct Table<Entry * const> : public Table<void *> { |
893 | +template <typename Entry> class Table<Entry * const> : public Table<void *> { |
894 | +public: |
895 | typedef Table<void *> Base; |
896 | Table |
897 | (Panel * parent, |
898 | @@ -337,7 +339,8 @@ |
899 | } |
900 | }; |
901 | |
902 | -template <typename Entry> struct Table<const Entry &> : public Table<void *> { |
903 | +template <typename Entry> class Table<const Entry &> : public Table<void *> { |
904 | +public: |
905 | typedef Table<void *> Base; |
906 | Table |
907 | (Panel * parent, |
908 | @@ -367,7 +370,8 @@ |
909 | } |
910 | }; |
911 | |
912 | -template <typename Entry> struct Table<Entry &> : public Table<void *> { |
913 | +template <typename Entry> class Table<Entry &> : public Table<void *> { |
914 | +public: |
915 | typedef Table<void *> Base; |
916 | Table |
917 | (Panel * parent, |
918 | @@ -396,7 +400,8 @@ |
919 | }; |
920 | |
921 | compile_assert(sizeof(void *) == sizeof(uintptr_t)); |
922 | -template <> struct Table<uintptr_t> : public Table<void *> { |
923 | +template <> class Table<uintptr_t> : public Table<void *> { |
924 | +public: |
925 | typedef Table<void *> Base; |
926 | Table |
927 | (Panel * parent, |
928 | @@ -424,7 +429,8 @@ |
929 | return reinterpret_cast<uintptr_t>(Base::get_selected()); |
930 | } |
931 | }; |
932 | -template <> struct Table<uintptr_t const> : public Table<uintptr_t> { |
933 | +template <> class Table<uintptr_t const> : public Table<uintptr_t> { |
934 | +public: |
935 | typedef Table<uintptr_t> Base; |
936 | Table |
937 | (Panel * parent, |
938 | |
939 | === modified file 'src/ui_basic/window.h' |
940 | --- src/ui_basic/window.h 2012-12-17 20:01:04 +0000 |
941 | +++ src/ui_basic/window.h 2013-01-20 19:32:24 +0000 |
942 | @@ -50,7 +50,8 @@ |
943 | * Minimize means, that the window is only the caption bar, nothing inside. |
944 | * Another click on this bar resizes the window again |
945 | */ |
946 | -struct Window : public NamedPanel { |
947 | +class Window : public NamedPanel { |
948 | +public: |
949 | Window |
950 | (Panel * parent, |
951 | const std::string& name, |
952 | @@ -61,7 +62,7 @@ |
953 | const std::string& title); |
954 | |
955 | void set_title(const std::string &); |
956 | - std::string const & get_title() const {return m_title;} |
957 | + const std::string & get_title() const {return m_title;} |
958 | |
959 | void set_center_panel(Panel * panel); |
960 | void move_out_of_the_way(); |
961 | @@ -93,7 +94,7 @@ |
962 | |
963 | private: |
964 | bool _is_minimal; |
965 | - uint32_t _oldw, _oldh; // if it is, these are the old formats |
966 | + uint32_t _oldh; // if it is, this is the old height |
967 | bool _dragging, _docked_left, _docked_right, _docked_bottom; |
968 | int32_t _drag_start_win_x, _drag_start_win_y; |
969 | int32_t _drag_start_mouse_x, _drag_start_mouse_y; |
970 | |
971 | === modified file 'src/wui/warehousewindow.cc' |
972 | --- src/wui/warehousewindow.cc 2012-12-14 20:09:35 +0000 |
973 | +++ src/wui/warehousewindow.cc 2013-01-20 19:32:24 +0000 |
974 | @@ -1,5 +1,5 @@ |
975 | /* |
976 | - * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team |
977 | + * Copyright (C) 2002-2004, 2006-2011, 2013 by the Widelands Development Team |
978 | * |
979 | * This program is free software; you can redistribute it and/or |
980 | * modify it under the terms of the GNU General Public License |
981 | @@ -40,25 +40,24 @@ |
982 | /** |
983 | * Extends the wares display to show and modify stock policy of items. |
984 | */ |
985 | -struct WarehouseWaresDisplay : WaresDisplay { |
986 | +class WarehouseWaresDisplay : public WaresDisplay { |
987 | +public: |
988 | WarehouseWaresDisplay |
989 | (UI::Panel * parent, uint32_t width, |
990 | - Interactive_GameBase &, Warehouse &, Widelands::WareWorker type, bool selectable); |
991 | + Warehouse & wh, Widelands::WareWorker type, bool selectable); |
992 | |
993 | protected: |
994 | virtual void draw_ware(RenderTarget & dst, Widelands::Ware_Index ware); |
995 | |
996 | private: |
997 | - Interactive_GameBase & m_igbase; |
998 | Warehouse & m_warehouse; |
999 | }; |
1000 | |
1001 | WarehouseWaresDisplay::WarehouseWaresDisplay |
1002 | - (UI::Panel * parent, uint32_t width, Interactive_GameBase & igbase, |
1003 | + (UI::Panel * parent, uint32_t width, |
1004 | Warehouse & wh, Widelands::WareWorker type, bool selectable) |
1005 | : |
1006 | WaresDisplay(parent, 0, 0, wh.owner().tribe(), type, selectable), |
1007 | -m_igbase(igbase), |
1008 | m_warehouse(wh) |
1009 | { |
1010 | set_inner_size(width, 0); |
1011 | @@ -110,7 +109,7 @@ |
1012 | m_wh(wh), |
1013 | m_can_act(m_gb.can_act(m_wh.owner().player_number())), |
1014 | m_type(type), |
1015 | - m_display(this, width, m_gb, m_wh, m_type, m_can_act) |
1016 | + m_display(this, width, m_wh, m_type, m_can_act) |
1017 | { |
1018 | add(&m_display, UI::Box::AlignLeft, true); |
1019 |
Ensure these macros so nothing for other compilers. -> typo: so should be do. starting_ pos(m_plnum) ) { -> you can just remove the variable here I think.
const char * & extension -> can you have a look if only the pointer or even better a const string& can be passed in here. reference to pointer looks fragile to me.
if (/* const Coords starting_pos = */map.get_
otherwise LGTM. Can you close the bug if this is appropriate now?