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