Merge lp:~widelands-dev/widelands/kill_frontier_and_flag_styles into lp:widelands

Proposed by SirVer
Status: Merged
Merged at revision: 7008
Proposed branch: lp:~widelands-dev/widelands/kill_frontier_and_flag_styles
Merge into: lp:widelands
Diff against target: 1032 lines (+108/-320)
37 files modified
CMakeLists.txt (+10/-0)
src/base/exceptions.cc (+0/-2)
src/base/port.h (+0/-2)
src/base/warning.h (+0/-1)
src/economy/fleet.cc (+11/-2)
src/editor/tools/editor_action_args.h (+1/-0)
src/game_io/game_player_info_data_packet.cc (+5/-54)
src/graphic/render/gamerenderer.cc (+2/-2)
src/graphic/text/rt_errors.h (+0/-1)
src/graphic/text_parser.cc (+0/-17)
src/graphic/text_parser.h (+1/-1)
src/io/filesystem/filesystem.h (+1/-0)
src/io/filesystem/filesystem_exceptions.h (+0/-2)
src/io/filesystem/zip_exceptions.h (+1/-4)
src/io/filesystem/zip_filesystem.h (+1/-1)
src/logic/constructionsite.cc (+1/-1)
src/logic/player.cc (+22/-31)
src/logic/player.h (+0/-11)
src/logic/tribe.cc (+4/-41)
src/logic/tribe.h (+15/-53)
src/map_io/widelands_map_buildingdata_data_packet.h (+16/-16)
src/map_io/widelands_map_players_view_data_packet.cc (+1/-2)
src/network/network.cc (+0/-4)
src/network/network.h (+0/-2)
src/profile/profile.cc (+2/-2)
src/scripting/c_utils.h (+1/-1)
src/scripting/lua_bases.h (+2/-2)
src/scripting/lua_game.cc (+0/-46)
src/scripting/lua_game.h (+1/-3)
src/scripting/lua_map.h (+4/-4)
src/ui_basic/unique_window.h (+5/-0)
src/wlapplication.h (+0/-1)
src/wui/transport_draw.cc (+1/-1)
src/wui/waresdisplay.cc (+0/-4)
tribes/atlanteans/conf (+0/-2)
tribes/barbarians/conf (+0/-2)
tribes/empire/conf (+0/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/kill_frontier_and_flag_styles
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+224210@code.launchpad.net

Description of the change

Fixes bug 1332842 and silences some Clang warnings either by fixing the root cause or by disabling the warning if that makes more sense.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-06-22 05:28:07 +0000
3+++ CMakeLists.txt 2014-06-23 21:15:13 +0000
4@@ -120,8 +120,18 @@
5 add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-padded")
6 add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-sign-conversion")
7 add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-switch-enum")
8+ add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-missing-noreturn")
9+ add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-implicit-fallthrough")
10 add_flag(WL_COMPILE_DIAGNOSTICS "-Qunused-arguments")
11
12+ # This warning warns when a default case is at a switch that handles all
13+ # cases. While this is super nice, silencing this warning for clang will add
14+ # a warning for GCC (which is not as clever and does not figure out that all
15+ # cases are handled). Therefore we disable the warning and the unreachable as
16+ # they always come in pairs in these cases.
17+ add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-covered-switch-default")
18+ add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-unreachable-code")
19+
20 # TODO(sirver): weak-vtables should be enabled, but leads to lot of errors right now.
21 add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-weak-vtables")
22 else()
23
24=== modified file 'src/base/exceptions.cc'
25--- src/base/exceptions.cc 2014-06-18 15:33:04 +0000
26+++ src/base/exceptions.cc 2014-06-23 21:15:13 +0000
27@@ -64,8 +64,6 @@
28 m_what = buffer;
29 }
30
31-warning::~warning() noexcept {}
32-
33 char const * warning::title() const
34 {
35 return m_title.c_str();
36
37=== modified file 'src/base/port.h'
38--- src/base/port.h 2014-06-01 18:00:48 +0000
39+++ src/base/port.h 2014-06-23 21:15:13 +0000
40@@ -27,6 +27,4 @@
41 #endif
42 #endif
43
44-
45 #endif /* end of include guard: PORT_H */
46-
47
48=== modified file 'src/base/warning.h'
49--- src/base/warning.h 2014-06-18 14:23:22 +0000
50+++ src/base/warning.h 2014-06-23 21:15:13 +0000
51@@ -41,7 +41,6 @@
52 struct warning : public std::exception {
53 explicit warning (char const * title, char const * message, ...)
54 PRINTF_FORMAT(3, 4);
55- virtual ~warning() noexcept;
56
57 /// The target of the returned pointer remains valid during the lifetime of
58 /// the warning object.
59
60=== modified file 'src/economy/fleet.cc'
61--- src/economy/fleet.cc 2014-06-21 10:24:12 +0000
62+++ src/economy/fleet.cc 2014-06-23 21:15:13 +0000
63@@ -40,7 +40,16 @@
64
65 namespace Widelands {
66
67-Map_Object_Descr fleet_descr("fleet", "Fleet");
68+namespace {
69+
70+// Every Map_Object() needs to have a description. So we make a dummy one for
71+// Fleet.
72+Map_Object_Descr* fleet_description() {
73+ static Map_Object_Descr fleet_descr("fleet", "Fleet");
74+ return &fleet_descr;
75+}
76+
77+} // namespace
78
79 /**
80 * Fleets are initialized empty.
81@@ -50,7 +59,7 @@
82 * The Fleet takes care of merging with existing fleets, if any.
83 */
84 Fleet::Fleet(Player & player) :
85- Map_Object(&fleet_descr),
86+ Map_Object(fleet_description()),
87 m_owner(player),
88 m_act_pending(false)
89 {
90
91=== modified file 'src/editor/tools/editor_action_args.h'
92--- src/editor/tools/editor_action_args.h 2014-03-31 20:21:27 +0000
93+++ src/editor/tools/editor_action_args.h 2014-06-23 21:15:13 +0000
94@@ -52,6 +52,7 @@
95
96 Editor_Action_Args(Editor_Interactive & base);
97 ~Editor_Action_Args();
98+
99 uint32_t refcount;
100 };
101
102
103=== modified file 'src/game_io/game_player_info_data_packet.cc'
104--- src/game_io/game_player_info_data_packet.cc 2014-05-11 07:38:01 +0000
105+++ src/game_io/game_player_info_data_packet.cc 2014-06-23 21:15:13 +0000
106@@ -45,9 +45,9 @@
107 for (uint32_t i = 1; i < max_players + 1; ++i) {
108 game.remove_player(i);
109 if (fr.Unsigned8()) {
110- bool const see_all = fr.Unsigned8();
111+ bool const see_all = fr.Unsigned8();
112
113- int32_t const plnum = fr.Unsigned8();
114+ int32_t const plnum = fr.Unsigned8();
115 if (plnum < 1 or MAX_PLAYERS < plnum)
116 throw game_data_error
117 ("player number (%i) is out of range (1 .. %u)",
118@@ -55,60 +55,16 @@
119 Widelands::TeamNumber team = 0;
120 if (packet_version >= 9)
121 team = fr.Unsigned8();
122- // Partner id in older shared kingdom feature was saved here in
123- // packet version 11. (between Build15 and Build16)
124- // Sorry for the mess -- nasenbaer
125- if (packet_version == 11)
126- fr.Unsigned8();
127+
128 char const * const tribe_name = fr.CString();
129- char const * const frontier_style_name =
130- packet_version < 7 ? nullptr : fr.CString();
131- char const * const flag_style_name =
132- packet_version < 7 ? nullptr : fr.CString();
133-
134- if (packet_version <= 12) { // Player colors used to be saved in this packet
135- for (uint32_t j = 0; j < 4; ++j) {
136- fr.Unsigned8();
137- fr.Unsigned8();
138- fr.Unsigned8();
139- }
140- }
141
142 std::string const name = fr.CString();
143
144 game.add_player(plnum, 0, tribe_name, name, team);
145 Player & player = game.player(plnum);
146- {
147- const Tribe_Descr & tribe = player.tribe();
148- try {
149- player.m_frontier_style_index =
150- frontier_style_name ?
151- tribe.frontier_style_index(frontier_style_name) : 0;
152- } catch (Tribe_Descr::Nonexistent) {
153- log
154- ("WARNING: player %1$u has frontier style index \"%2$s\", "
155- "which does not exist in his tribe %3$s; will use "
156- "default frontier style \"%4$s\" instead\n",
157- plnum, frontier_style_name, tribe.name().c_str(),
158- tribe.frontier_style_name(0).c_str());
159- }
160- try {
161- player.m_flag_style_index =
162- flag_style_name ?
163- tribe.flag_style_index(flag_style_name) : 0;
164- } catch (Tribe_Descr::Nonexistent) {
165- log
166- ("WARNING: player %1$u has flag style index \"%2$s\", "
167- "which does not exist in his tribe %3$s; will use "
168- "default flag style \"%4$s\" instead\n",
169- plnum, flag_style_name, tribe.name().c_str(),
170- tribe.flag_style_name(0).c_str());
171- }
172- }
173 player.set_see_all(see_all);
174
175- if (packet_version >= 6)
176- player.setAI(fr.CString());
177+ player.setAI(fr.CString());
178
179 if (packet_version >= 15)
180 player.ReadStatistics(fr, 3);
181@@ -165,12 +121,7 @@
182 fw.Unsigned8(plr->m_plnum);
183 fw.Unsigned8(plr->team_number());
184
185- {
186- const Tribe_Descr & tribe = plr->tribe();
187- fw.CString(tribe.name().c_str());
188- fw.CString(tribe.frontier_style_name(plr->m_frontier_style_index));
189- fw.CString(tribe.flag_style_name (plr->m_flag_style_index));
190- }
191+ fw.CString(plr->tribe().name().c_str());
192
193 // Seen fields is in a map packet
194 // Allowed buildings is in a map packet
195
196=== modified file 'src/graphic/render/gamerenderer.cc'
197--- src/graphic/render/gamerenderer.cc 2014-05-27 11:01:15 +0000
198+++ src/graphic/render/gamerenderer.cc 2014-06-23 21:15:13 +0000
199@@ -133,7 +133,7 @@
200
201 if (isborder[F]) {
202 const Player & owner = m_egbase->player(owner_number[F]);
203- uint32_t const anim_idx = owner.frontier_anim();
204+ uint32_t const anim_idx = owner.tribe().frontier_animation();
205 if (vision[F])
206 m_dst->drawanim(pos[F], anim_idx, 0, &owner);
207 for (uint32_t d = 1; d < 4; ++d) {
208@@ -221,7 +221,7 @@
209 } else if (const uint32_t pic = map_object_descr->main_animation()) {
210 m_dst->drawanim(pos[F], pic, 0, owner);
211 } else if (map_object_descr == &Widelands::g_flag_descr) {
212- m_dst->drawanim(pos[F], owner->flag_anim(), 0, owner);
213+ m_dst->drawanim(pos[F], owner->tribe().flag_animation(), 0, owner);
214 }
215 }
216 }
217
218=== modified file 'src/graphic/text/rt_errors.h'
219--- src/graphic/text/rt_errors.h 2014-06-18 14:23:22 +0000
220+++ src/graphic/text/rt_errors.h 2014-06-23 21:15:13 +0000
221@@ -28,7 +28,6 @@
222 public:
223 Exception(std::string msg) : std::exception(), m_msg(msg) {
224 }
225- virtual ~Exception() noexcept {}
226 virtual const char* what() const noexcept override {return m_msg.c_str();}
227
228 private:
229
230=== modified file 'src/graphic/text_parser.cc'
231--- src/graphic/text_parser.cc 2014-06-07 16:53:29 +0000
232+++ src/graphic/text_parser.cc 2014-06-23 21:15:13 +0000
233@@ -57,23 +57,6 @@
234 m_line_spacing = 0;
235 }
236
237-Text_Block::Text_Block(const Text_Block & src) {
238- m_words.clear();
239- m_line_breaks.clear();
240- for (uint32_t i = 0; i < src.m_words.size(); ++i)
241- m_words.push_back(src.m_words[i]);
242- for (uint32_t i = 0; i < src.m_line_breaks.size(); ++i)
243- m_line_breaks.push_back(src.m_line_breaks[i]);
244- m_font_size = src.m_font_size;
245- m_font_color = src.m_font_color;
246- m_font_weight = src.m_font_weight;
247- m_font_style = src.m_font_style;
248- m_font_decoration = src.m_font_decoration;
249- m_font_face = src.m_font_face;
250- m_line_spacing = src.m_line_spacing;
251-}
252-
253-
254 void Text_Parser::parse
255 (std::string & text,
256 std::vector<Richtext_Block> & blocks)
257
258=== modified file 'src/graphic/text_parser.h'
259--- src/graphic/text_parser.h 2014-06-07 16:29:05 +0000
260+++ src/graphic/text_parser.h 2014-06-23 21:15:13 +0000
261@@ -35,7 +35,7 @@
262 */
263 struct Text_Block {
264 Text_Block();
265- Text_Block(const Text_Block & src);
266+ // Copy and assignement operators are autogenerated.
267
268 void set_font_size(int32_t const font_size) {m_font_size = font_size;}
269 int32_t get_font_size() const {return m_font_size;}
270
271=== modified file 'src/io/filesystem/filesystem.h'
272--- src/io/filesystem/filesystem.h 2014-05-10 16:56:38 +0000
273+++ src/io/filesystem/filesystem.h 2014-06-23 21:15:13 +0000
274@@ -28,6 +28,7 @@
275 #include <vector>
276
277 #include <stdint.h>
278+#include <boost/noncopyable.hpp>
279
280 #include "io/filesystem/filesystem_exceptions.h"
281
282
283=== modified file 'src/io/filesystem/filesystem_exceptions.h'
284--- src/io/filesystem/filesystem_exceptions.h 2014-06-18 14:23:22 +0000
285+++ src/io/filesystem/filesystem_exceptions.h 2014-06-23 21:15:13 +0000
286@@ -39,8 +39,6 @@
287 m_message (message)
288 {}
289
290- virtual ~File_error() noexcept {}
291-
292 std::string m_thrower;
293 std::string m_filename;
294 std::string m_message;
295
296=== modified file 'src/io/filesystem/zip_exceptions.h'
297--- src/io/filesystem/zip_exceptions.h 2014-06-18 14:23:22 +0000
298+++ src/io/filesystem/zip_exceptions.h 2014-06-23 21:15:13 +0000
299@@ -31,12 +31,11 @@
300 * "couldn't open file (from zipfile "+m_zipfilename+")");
301 */
302 struct ZipOperation_error : public std::logic_error {
303- explicit ZipOperation_error
304+ ZipOperation_error
305 (const std::string & thrower,
306 const std::string & filename,
307 const std::string & zipfilename,
308 const std::string & message = "problem during zipfile operation")
309-
310 :
311 std::logic_error
312 (thrower + ": " + message + " (working on '" + filename +
313@@ -44,8 +43,6 @@
314 m_thrower(thrower), m_filename(filename), m_zipfilename(zipfilename)
315 {}
316
317- virtual ~ZipOperation_error() noexcept {}
318-
319 std::string m_thrower;
320 std::string m_filename;
321 std::string m_zipfilename;
322
323=== modified file 'src/io/filesystem/zip_filesystem.h'
324--- src/io/filesystem/zip_filesystem.h 2014-06-18 15:33:04 +0000
325+++ src/io/filesystem/zip_filesystem.h 2014-06-23 21:15:13 +0000
326@@ -32,7 +32,7 @@
327
328 class ZipFilesystem : public FileSystem {
329 public:
330- ZipFilesystem(const std::string &);
331+ explicit ZipFilesystem(const std::string &);
332 virtual ~ZipFilesystem();
333
334 virtual bool IsWritable() const override;
335
336=== modified file 'src/logic/constructionsite.cc'
337--- src/logic/constructionsite.cc 2014-06-08 21:47:45 +0000
338+++ src/logic/constructionsite.cc 2014-06-23 21:15:13 +0000
339@@ -366,7 +366,7 @@
340 uint32_t cur_frame;
341 try {
342 anim_idx = building().get_animation("build");
343- } catch (Map_Object_Descr::Animation_Nonexistent & e) {
344+ } catch (Map_Object_Descr::Animation_Nonexistent&) {
345 try {
346 anim_idx = building().get_animation("unoccupied");
347 } catch (Map_Object_Descr::Animation_Nonexistent) {
348
349=== modified file 'src/logic/player.cc'
350--- src/logic/player.cc 2014-06-22 11:03:55 +0000
351+++ src/logic/player.cc 2014-06-23 21:15:13 +0000
352@@ -147,8 +147,6 @@
353 :
354 m_egbase (the_egbase),
355 m_initialization_index(initialization_index),
356- m_frontier_style_index(0),
357- m_flag_style_index (0),
358 m_team_number(0),
359 m_team_player_uptodate(false),
360 m_see_all (false),
361@@ -184,37 +182,30 @@
362 void Player::create_default_infrastructure() {
363 const Map & map = egbase().map();
364 if (map.get_starting_pos(m_plnum)) {
365- try {
366- const Tribe_Descr::Initialization & initialization =
367- tribe().initialization(m_initialization_index);
368-
369- Game & game = ref_cast<Game, Editor_Game_Base>(egbase());
370+ const Tribe_Descr::Initialization & initialization =
371+ tribe().initialization(m_initialization_index);
372+
373+ Game & game = ref_cast<Game, Editor_Game_Base>(egbase());
374+
375+ // Run the corresponding script
376+ std::unique_ptr<LuaTable> table(game.lua().run_script(initialization.script));
377+ table->do_not_warn_about_unaccessed_keys();
378+ std::unique_ptr<LuaCoroutine> cr = table->get_coroutine("func");
379+ cr->push_arg(this);
380+ game.enqueue_command(new Cmd_LuaCoroutine(game.get_gametime(), cr.release()));
381+
382+ // Check if other starting positions are shared in and initialize them as well
383+ for (uint8_t n = 0; n < m_further_shared_in_player.size(); ++n) {
384+ Coords const further_pos = map.get_starting_pos(m_further_shared_in_player.at(n));
385
386 // Run the corresponding script
387- std::unique_ptr<LuaTable> table(game.lua().run_script(initialization.script));
388- table->do_not_warn_about_unaccessed_keys();
389- std::unique_ptr<LuaCoroutine> cr = table->get_coroutine("func");
390- cr->push_arg(this);
391- game.enqueue_command(new Cmd_LuaCoroutine(game.get_gametime(), cr.release()));
392-
393- // Check if other starting positions are shared in and initialize them as well
394- for (uint8_t n = 0; n < m_further_shared_in_player.size(); ++n) {
395- Coords const further_pos = map.get_starting_pos(m_further_shared_in_player.at(n));
396-
397- // Run the corresponding script
398- std::unique_ptr<LuaCoroutine> ncr =
399- game.lua()
400- .run_script(tribe().initialization(m_further_initializations.at(n)).script)
401- ->get_coroutine("func");
402- ncr->push_arg(this);
403- ncr->push_arg(further_pos);
404- game.enqueue_command(new Cmd_LuaCoroutine(game.get_gametime(), ncr.release()));
405- }
406- } catch (Tribe_Descr::Nonexistent &) {
407- throw game_data_error
408- ("the selected initialization index (%u) is outside the range "
409- "(tribe edited between preload and game start?)",
410- m_initialization_index);
411+ std::unique_ptr<LuaCoroutine> ncr =
412+ game.lua()
413+ .run_script(tribe().initialization(m_further_initializations.at(n)).script)
414+ ->get_coroutine("func");
415+ ncr->push_arg(this);
416+ ncr->push_arg(further_pos);
417+ game.enqueue_command(new Cmd_LuaCoroutine(game.get_gametime(), ncr.release()));
418 }
419 } else
420 throw warning
421
422=== modified file 'src/logic/player.h'
423--- src/logic/player.h 2014-04-21 18:18:01 +0000
424+++ src/logic/player.h 2014-06-23 21:15:13 +0000
425@@ -117,8 +117,6 @@
426
427 const std::string & get_name() const {return m_name;}
428 void set_name(const std::string & name) {m_name = name;}
429- void set_frontier_style(uint8_t a) {m_frontier_style_index = a;}
430- void set_flag_style(uint8_t a) {m_flag_style_index = a;}
431 void set_team_number(TeamNumber team);
432
433 void create_default_infrastructure();
434@@ -505,13 +503,6 @@
435 void count_civil_bld_lost () {++m_civil_blds_lost;}
436 void count_civil_bld_defeated() {++m_civil_blds_defeated;}
437
438- uint32_t frontier_anim() const {
439- return tribe().frontier_animation(m_frontier_style_index);
440- }
441- uint32_t flag_anim () const {
442- return tribe().flag_animation (m_flag_style_index);
443- }
444-
445 // Statistics
446 const Building_Stats_vector & get_building_statistics
447 (const Building_Index& i) const
448@@ -563,8 +554,6 @@
449 uint8_t m_initialization_index;
450 std::vector<uint8_t> m_further_initializations; // used in shared kingdom mode
451 std::vector<uint8_t> m_further_shared_in_player; // '' '' '' '' ''
452- uint8_t m_frontier_style_index;
453- uint8_t m_flag_style_index;
454 TeamNumber m_team_number;
455 std::vector<Player *> m_team_player;
456 bool m_team_player_uptodate;
457
458=== modified file 'src/logic/tribe.cc'
459--- src/logic/tribe.cc 2014-06-21 10:24:12 +0000
460+++ src/logic/tribe.cc 2014-06-23 21:15:13 +0000
461@@ -241,47 +241,10 @@
462 PARSE_ORDER_INFORMATION(worker);
463 }
464
465- try {
466- while (Section * const s = root_conf.get_next_section("frontier"))
467- {
468- char const * const style_name = s->get_safe_string("name");
469- try {
470- if (m_anim_frontier.empty())
471- throw Nonexistent();
472- frontier_style_index(style_name);
473- throw game_data_error("\"%s\" is duplicated", style_name);
474- } catch (Nonexistent) {
475- m_anim_frontier.push_back
476- (std::pair<std::string, uint32_t>
477- (style_name, g_gr->animations().load(path, *s)));
478- }
479- }
480- if (m_anim_frontier.empty())
481- throw game_data_error("none found");
482- } catch (const _wexception & e) {
483- throw game_data_error("frontier styles: %s", e.what());
484- }
485- try {
486- while (Section * const s = root_conf.get_next_section("flag"))
487- {
488- char const * const style_name = s->get_safe_string("name");
489- try {
490- if (m_anim_flag.empty())
491- throw Nonexistent();
492- flag_style_index(style_name);
493- throw game_data_error("\"%s\" is duplicated", style_name);
494- } catch (Nonexistent) {
495- m_anim_flag.push_back
496- (std::pair<std::string, uint32_t>
497- (style_name,
498- g_gr->animations().load(path, *s)));
499- }
500- }
501- if (m_anim_flag.empty())
502- throw game_data_error("none found");
503- } catch (const _wexception & e) {
504- throw game_data_error("flag styles: %s", e.what());
505- }
506+ m_frontier_animation_id =
507+ g_gr->animations().load(path, root_conf.get_safe_section("frontier"));
508+ m_flag_animation_id =
509+ g_gr->animations().load(path, root_conf.get_safe_section("flag"));
510
511 {
512 // Read initializations -- all scripts are initializations currently
513
514=== modified file 'src/logic/tribe.h'
515--- src/logic/tribe.h 2014-06-21 16:01:35 +0000
516+++ src/logic/tribe.h 2014-06-23 21:15:13 +0000
517@@ -132,49 +132,12 @@
518 return m_worker_types_without_cost;
519 }
520
521- typedef std::vector<std::pair<std::string, uint32_t> > AnimationStyles;
522- struct Nonexistent {};
523- uint8_t frontier_style_index(const std::string & stylename) const {
524- for (uint8_t result = m_anim_frontier.size();;)
525- if (m_anim_frontier.at(--result).first == stylename)
526- return result;
527- throw Nonexistent();
528- }
529- uint8_t flag_style_index (const std::string & stylename) const {
530- for (uint8_t result = m_anim_flag.size();;)
531- if (m_anim_flag.at(--result).first == stylename)
532- return result;
533- throw Nonexistent();
534- }
535- uint8_t frontier_style_index(char const * const stylename) const {
536- for (uint8_t result = m_anim_frontier.size();;)
537- if (m_anim_frontier.at(--result).first == stylename)
538- return result;
539- throw Nonexistent();
540- }
541- uint8_t flag_style_index (char const * const stylename) const {
542- for (uint8_t result = m_anim_flag.size();;)
543- if (m_anim_flag.at(--result).first == stylename)
544- return result;
545- throw Nonexistent();
546- }
547- uint8_t next_frontier_style_index(uint8_t i) const {
548- return ++i == m_anim_frontier.size() ? 0 : i;
549- }
550- uint8_t next_flag_style_index (uint8_t i) const {
551- return ++i == m_anim_flag .size() ? 0 : i;
552- }
553- const std::string & frontier_style_name (uint8_t const i) const {
554- return m_anim_frontier.at(i).first;
555- }
556- const std::string & flag_style_name (uint8_t const i) const {
557- return m_anim_flag .at(i).first;
558- }
559- uint32_t frontier_animation (uint8_t const i) const {
560- return m_anim_frontier.at(i).second;
561- }
562- uint32_t flag_animation (uint8_t const i) const {
563- return m_anim_flag .at(i).second;
564+ uint32_t frontier_animation() const {
565+ return m_frontier_animation_id;
566+ }
567+
568+ uint32_t flag_animation() const {
569+ return m_flag_animation_id;
570 }
571
572 uint32_t get_bob_vision_range() const {return m_bob_vision_range;}
573@@ -188,14 +151,13 @@
574 Military_Data get_military_data() const {return m_military_data;}
575
576 struct Initialization {
577- std::string script;
578- std::string descname;
579+ std::string script;
580+ std::string descname;
581 };
582- typedef std::vector<Initialization> Initializations;
583- const Initialization & initialization(uint8_t const index) const {
584- if (m_initializations.size() <= index)
585- throw Nonexistent();
586- return m_initializations[index];
587+
588+ // Returns the initalization at 'index' (which must not be out of bounds).
589+ const Initialization & initialization(const uint8_t index) const {
590+ return m_initializations.at(index);
591 }
592
593 typedef std::vector<std::vector<Widelands::Ware_Index> > WaresOrder;
594@@ -214,8 +176,8 @@
595
596 private:
597 const std::string m_name;
598- AnimationStyles m_anim_frontier;
599- AnimationStyles m_anim_flag;
600+ uint32_t m_frontier_animation_id;
601+ uint32_t m_flag_animation_id;
602 uint32_t m_bob_vision_range;
603
604 DescriptionMaintainer<Worker_Descr> m_workers;
605@@ -232,7 +194,7 @@
606
607 std::vector<Ware_Index> m_worker_types_without_cost;
608
609- Initializations m_initializations;
610+ std::vector<Initialization> m_initializations;
611
612 Military_Data m_military_data;
613 };
614
615=== modified file 'src/map_io/widelands_map_buildingdata_data_packet.h'
616--- src/map_io/widelands_map_buildingdata_data_packet.h 2014-05-11 07:53:49 +0000
617+++ src/map_io/widelands_map_buildingdata_data_packet.h 2014-06-23 21:15:13 +0000
618@@ -46,38 +46,38 @@
619 void Write(FileSystem&, Editor_Game_Base&, Map_Map_Object_Saver&);
620
621 private:
622- virtual void read_constructionsite
623+ void read_constructionsite
624 (ConstructionSite &, FileRead &, Game &, Map_Map_Object_Loader &);
625- virtual void read_dismantlesite
626+ void read_dismantlesite
627 (DismantleSite &, FileRead &, Game &, Map_Map_Object_Loader &);
628- virtual void read_partially_finished_building
629+ void read_partially_finished_building
630 (Partially_Finished_Building &, FileRead &, Game &, Map_Map_Object_Loader &);
631- virtual void read_constructionsite_v1
632+ void read_constructionsite_v1
633 (ConstructionSite &, FileRead &, Game &, Map_Map_Object_Loader &);
634- virtual void read_warehouse
635+ void read_warehouse
636 (Warehouse &, FileRead &, Game &, Map_Map_Object_Loader &);
637- virtual void read_militarysite
638+ void read_militarysite
639 (MilitarySite &, FileRead &, Game &, Map_Map_Object_Loader &);
640- virtual void read_trainingsite
641+ void read_trainingsite
642 (TrainingSite &, FileRead &, Game &, Map_Map_Object_Loader &);
643- virtual void read_productionsite
644+ void read_productionsite
645 (ProductionSite &, FileRead &, Game &, Map_Map_Object_Loader &);
646- virtual void read_formerbuildings_v2
647+ void read_formerbuildings_v2
648 (Building &, FileRead &, Game &, Map_Map_Object_Loader &);
649
650- virtual void write_constructionsite
651+ void write_constructionsite
652 (const ConstructionSite &, FileWrite &, Game &, Map_Map_Object_Saver &);
653- virtual void write_dismantlesite
654+ void write_dismantlesite
655 (const DismantleSite &, FileWrite &, Game &, Map_Map_Object_Saver &);
656- virtual void write_partially_finished_building
657+ void write_partially_finished_building
658 (const Partially_Finished_Building &, FileWrite &, Game &, Map_Map_Object_Saver &);
659- virtual void write_warehouse
660+ void write_warehouse
661 (const Warehouse &, FileWrite &, Game &, Map_Map_Object_Saver &);
662- virtual void write_militarysite
663+ void write_militarysite
664 (const MilitarySite &, FileWrite &, Game &, Map_Map_Object_Saver &);
665- virtual void write_trainingsite
666+ void write_trainingsite
667 (const TrainingSite &, FileWrite &, Game &, Map_Map_Object_Saver &);
668- virtual void write_productionsite
669+ void write_productionsite
670 (const ProductionSite &, FileWrite &, Game &, Map_Map_Object_Saver &);
671 };
672
673
674=== modified file 'src/map_io/widelands_map_players_view_data_packet.cc'
675--- src/map_io/widelands_map_players_view_data_packet.cc 2014-06-18 14:23:22 +0000
676+++ src/map_io/widelands_map_players_view_data_packet.cc 2014-06-23 21:15:13 +0000
677@@ -207,8 +207,7 @@
678 tribename(Tribename),
679 name(Name) {
680 }
681- virtual ~tribe_immovable_nonexistent() noexcept {
682- }
683+
684 std::string tribename;
685 std::string name;
686 };
687
688=== modified file 'src/network/network.cc'
689--- src/network/network.cc 2014-06-18 14:23:22 +0000
690+++ src/network/network.cc 2014-06-23 21:15:13 +0000
691@@ -226,10 +226,6 @@
692 m_what = buffer;
693 }
694
695-DisconnectException::~DisconnectException() noexcept
696-{
697-}
698-
699 char const * DisconnectException::what() const noexcept
700 {
701 return m_what.c_str();
702
703=== modified file 'src/network/network.h'
704--- src/network/network.h 2014-06-18 14:23:22 +0000
705+++ src/network/network.h 2014-06-23 21:15:13 +0000
706@@ -164,7 +164,6 @@
707 explicit DisconnectException
708 (const char * fmt, ...)
709 PRINTF_FORMAT(2, 3);
710- virtual ~DisconnectException() noexcept;
711
712 virtual const char * what() const noexcept override;
713
714@@ -178,7 +177,6 @@
715 */
716 struct ProtocolException : public std::exception {
717 explicit ProtocolException(uint8_t code) {m_what = code;}
718- virtual ~ProtocolException() noexcept {}
719
720 /// do NOT use!!! This exception shall only return the command number of the received message
721 /// via \ref ProtocolException:number()
722
723=== modified file 'src/profile/profile.cc'
724--- src/profile/profile.cc 2014-06-18 13:20:33 +0000
725+++ src/profile/profile.cc 2014-06-23 21:15:13 +0000
726@@ -37,7 +37,7 @@
727 #include "logic/world/world.h"
728
729 #define TRUE_WORDS 4
730-char const * trueWords[TRUE_WORDS] =
731+static char const * trueWords[TRUE_WORDS] =
732 {
733 "true",
734 "yes",
735@@ -46,7 +46,7 @@
736 };
737
738 #define FALSE_WORDS 4
739-char const * falseWords[FALSE_WORDS] =
740+static char const * falseWords[FALSE_WORDS] =
741 {
742 "false",
743 "no",
744
745=== modified file 'src/scripting/c_utils.h'
746--- src/scripting/c_utils.h 2014-06-18 13:20:33 +0000
747+++ src/scripting/c_utils.h 2014-06-23 21:15:13 +0000
748@@ -37,7 +37,7 @@
749 void report_error(lua_State*, const char*, ...)
750 __attribute__((__format__(__printf__, 2, 3), noreturn));
751 #else
752-void report_error [[noreturn]] (lua_State*, const char*, ...)
753+[[noreturn]] void report_error(lua_State*, const char*, ...)
754 #endif
755
756 #define luaL_checkint32(L, n) static_cast<int32_t>(luaL_checkinteger(L, (n)))
757
758=== modified file 'src/scripting/lua_bases.h'
759--- src/scripting/lua_bases.h 2014-06-12 07:22:23 +0000
760+++ src/scripting/lua_bases.h 2014-06-23 21:15:13 +0000
761@@ -39,7 +39,7 @@
762 LUNA_CLASS_HEAD(L_EditorGameBase);
763
764 L_EditorGameBase() {}
765- L_EditorGameBase(lua_State * L) {
766+ L_EditorGameBase(lua_State* L) {
767 report_error(L, "Cannot instantiate a 'EditorGameBase' directly!");
768 }
769 virtual ~L_EditorGameBase() {}
770@@ -72,7 +72,7 @@
771
772
773 L_PlayerBase() : m_pl(NONE) {}
774- L_PlayerBase(lua_State * L) : m_pl(NONE) {
775+ L_PlayerBase (lua_State * L) : m_pl(NONE) {
776 report_error(L, "Cannot instantiate a 'PlayerBase' directly!");
777 }
778 L_PlayerBase(Widelands::Player_Number n) {
779
780=== modified file 'src/scripting/lua_game.cc'
781--- src/scripting/lua_game.cc 2014-06-21 10:24:12 +0000
782+++ src/scripting/lua_game.cc 2014-06-23 21:15:13 +0000
783@@ -96,8 +96,6 @@
784 METHOD(L_Player, reveal_scenario),
785 METHOD(L_Player, reveal_campaign),
786 METHOD(L_Player, get_buildings),
787- METHOD(L_Player, set_flag_style),
788- METHOD(L_Player, set_frontier_style),
789 METHOD(L_Player, get_suitability),
790 METHOD(L_Player, allow_workers),
791 METHOD(L_Player, switchplayer),
792@@ -759,50 +757,6 @@
793 }
794
795 /* RST
796- .. method:: set_flag_style(name)
797-
798- Sets the appearance of the flags for this player to the given style.
799- The style must be defined for the tribe.
800-
801- :arg name: name of style
802- :type name: :class:`string`
803-*/
804-// UNTESTED, UNUSED so far
805-int L_Player::set_flag_style(lua_State * L) {
806- Player & p = get(L, get_game(L));
807- const char * name = luaL_checkstring(L, 2);
808-
809- try {
810- p.set_flag_style(p.tribe().flag_style_index(name));
811- } catch (Tribe_Descr::Nonexistent &) {
812- report_error(L, "Flag style <%s> does not exist!\n", name);
813- }
814- return 0;
815-}
816-
817-/* RST
818- .. method:: set_frontier_style(name)
819-
820- Sets the appearance of the frontiers for this player to the given style.
821- The style must be defined for the tribe.
822-
823- :arg name: name of style
824- :type name: :class:`string`
825-*/
826-// UNTESTED, UNUSED so far
827-int L_Player::set_frontier_style(lua_State * L) {
828- Player & p = get(L, get_game(L));
829- const char * name = luaL_checkstring(L, 2);
830-
831- try {
832- p.set_frontier_style(p.tribe().frontier_style_index(name));
833- } catch (Tribe_Descr::Nonexistent &) {
834- report_error(L, "Frontier style <%s> does not exist!\n", name);
835- }
836- return 0;
837-}
838-
839-/* RST
840 .. method:: get_suitability(building, field)
841
842 Returns the suitability that this building has for this field. This
843
844=== modified file 'src/scripting/lua_game.h'
845--- src/scripting/lua_game.h 2014-06-12 07:22:23 +0000
846+++ src/scripting/lua_game.h 2014-06-23 21:15:13 +0000
847@@ -88,8 +88,6 @@
848 int reveal_scenario(lua_State * L);
849 int reveal_campaign(lua_State * L);
850 int get_buildings(lua_State * L);
851- int set_flag_style(lua_State * L);
852- int set_frontier_style(lua_State * L);
853 int get_suitability(lua_State * L);
854 int allow_workers(lua_State * L);
855 int switchplayer(lua_State * L);
856@@ -157,7 +155,7 @@
857
858 L_Message(uint8_t, Widelands::Message_Id);
859 L_Message() : m_plr(0), m_mid(0) {}
860- L_Message(lua_State * L) : m_plr(0) {
861+ L_Message(lua_State * L) {
862 report_error(L, "Cannot instantiate a '%s' directly!", className);
863 }
864
865
866=== modified file 'src/scripting/lua_map.h'
867--- src/scripting/lua_map.h 2014-06-21 10:24:12 +0000
868+++ src/scripting/lua_map.h 2014-06-23 21:15:13 +0000
869@@ -163,7 +163,7 @@
870 /*
871 * C Methods
872 */
873- CASTED_GET(BaseImmovable);
874+ CASTED_GET(BaseImmovable)
875 };
876
877 class L_PlayerImmovable : public L_BaseImmovable {
878@@ -189,7 +189,7 @@
879 /*
880 * C Methods
881 */
882- CASTED_GET(PlayerImmovable);
883+ CASTED_GET(PlayerImmovable)
884 };
885
886 class L_PortDock : public L_PlayerImmovable {
887@@ -213,7 +213,7 @@
888 /*
889 * C methods
890 */
891- CASTED_GET(PortDock);
892+ CASTED_GET(PortDock)
893 };
894
895 class L_Building : public L_PlayerImmovable {
896@@ -239,7 +239,7 @@
897 /*
898 * C Methods
899 */
900- CASTED_GET(Building);
901+ CASTED_GET(Building)
902 };
903
904 class L_Flag : public L_PlayerImmovable {
905
906=== modified file 'src/ui_basic/unique_window.h'
907--- src/ui_basic/unique_window.h 2014-04-06 12:31:56 +0000
908+++ src/ui_basic/unique_window.h 2014-06-23 21:15:13 +0000
909@@ -22,6 +22,8 @@
910
911 #include <functional>
912
913+#include "boost/noncopyable.hpp"
914+
915 #include "ui_basic/button.h"
916 #include "ui_basic/window.h"
917
918@@ -55,6 +57,9 @@
919 int32_t x, y;
920 bool valid_pos;
921
922+ Registry(const Registry&) = default;
923+ Registry& operator = (const Registry&) = default;
924+
925 Registry() : window(nullptr), x(0), y(0), valid_pos(false) {}
926 ~Registry();
927 };
928
929=== modified file 'src/wlapplication.h'
930--- src/wlapplication.h 2014-06-18 14:23:22 +0000
931+++ src/wlapplication.h 2014-06-23 21:15:13 +0000
932@@ -45,7 +45,6 @@
933 explicit Parameter_error(std::string text)
934 : std::runtime_error(text)
935 {}
936- virtual ~Parameter_error() noexcept {}
937 };
938
939 // input
940
941=== modified file 'src/wui/transport_draw.cc'
942--- src/wui/transport_draw.cc 2014-02-22 16:49:17 +0000
943+++ src/wui/transport_draw.cc 2014-06-23 21:15:13 +0000
944@@ -41,7 +41,7 @@
945 };
946
947 dst.drawanim
948- (pos, owner().flag_anim(), game.get_gametime() - m_animstart, &owner());
949+ (pos, owner().tribe().flag_animation(), game.get_gametime() - m_animstart, &owner());
950
951 const uint32_t ware_filled = m_ware_filled;
952 for (uint32_t i = 0; i < ware_filled; ++i) { // draw wares
953
954=== modified file 'src/wui/waresdisplay.cc'
955--- src/wui/waresdisplay.cc 2014-06-08 21:47:45 +0000
956+++ src/wui/waresdisplay.cc 2014-06-23 21:15:13 +0000
957@@ -297,10 +297,8 @@
958 switch (m_type) {
959 case Widelands::wwWARE:
960 return m_tribe.wares_order();
961- break;
962 case Widelands::wwWORKER:
963 return m_tribe.workers_order();
964- break;
965 default:
966 throw wexception("Invalid m_type %d", m_type);
967 }
968@@ -311,10 +309,8 @@
969 switch (m_type) {
970 case Widelands::wwWARE:
971 return m_tribe.wares_order_coords();
972- break;
973 case Widelands::wwWORKER:
974 return m_tribe.workers_order_coords();
975- break;
976 default:
977 throw wexception("Invalid m_type %d", m_type);
978 }
979
980=== modified file 'tribes/atlanteans/conf'
981--- tribes/atlanteans/conf 2014-06-22 16:33:32 +0000
982+++ tribes/atlanteans/conf 2014-06-23 21:15:13 +0000
983@@ -16,13 +16,11 @@
984
985 # Some blue fires would be fine, but just an idea
986 [frontier]
987-name=frontier
988 pics=pics/frontier_??.png
989 hotspot=3 12
990
991 # Not just a plain color, maybe a cross or some stribes
992 [flag]
993-name=flag
994 pics=pics/flag_??.png
995 hotspot=15 35
996 fps=10
997
998=== modified file 'tribes/barbarians/conf'
999--- tribes/barbarians/conf 2014-06-22 16:33:32 +0000
1000+++ tribes/barbarians/conf 2014-06-23 21:15:13 +0000
1001@@ -16,13 +16,11 @@
1002
1003
1004 [frontier]
1005-name=frontier
1006 pics=pics/frontier_??.png
1007 hotspot=1 19
1008
1009
1010 [flag]
1011-name=flag
1012 pics=pics/flag_??.png
1013 hotspot=10 38
1014 fps=5
1015
1016=== modified file 'tribes/empire/conf'
1017--- tribes/empire/conf 2014-06-22 16:33:32 +0000
1018+++ tribes/empire/conf 2014-06-23 21:15:13 +0000
1019@@ -16,13 +16,11 @@
1020
1021 # No idea for the frontier. Maybe some javelins?
1022 [frontier]
1023-name=frontier
1024 pics=pics/frontier_??.png
1025 hotspot=1 19
1026
1027 # Not just a plain color, maybe a cross or some stribes
1028 [flag]
1029-name=flag
1030 pics=pics/flag_??.png
1031 hotspot=14 38
1032 fps=10

Subscribers

People subscribed via source and target branches

to status/vote changes: