widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #05774
[Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/clang-codecheck into lp:widelands.
Commit message:
Prepared the codecheck rules and source code to be compatible with clang-format.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/clang-codecheck/+merge/284586
This branch modifies / removes all codecheck rules that conflict with clang-format.
After running clang-format, new codecheck errors will be flagged up - I fixed those as well.
I have a NOCOM question in defaultai, but I guess it's OK - I had 4 AIs dish it out on Calvisson and then call to NEVER_HERE() wasn't triggered.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/clang-codecheck into lp:widelands.
=== removed file 'cmake/codecheck/rules/illegal_space_after_opening_brace'
--- cmake/codecheck/rules/illegal_space_after_opening_brace 2010-11-01 12:12:18 +0000
+++ cmake/codecheck/rules/illegal_space_after_opening_brace 1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-#!/usr/bin/python
-
-
-"""
-This catches an opening brace followed by a space, but it allows it if a
-comment begins there, such as "{ // comment".
-"""
-
-error_msg = "No space after opening brace allowed!"
-strip_comments_and_strings = True
-strip_macros = True
-
-import re
-class EvalMatches( object ):
- REGEXP = re.compile(r"""(?x)
-\{([ ]\s*.*)
-""")
-
- def __call__(self, lines, fn):
- errors = []
- curline = 0
- for l in lines:
- l = l.rstrip()
- curline += 1
- m = self.REGEXP.search(l)
- if m:
- g = m.group(1)
- if not len(g): continue
- if g[-1] == '\\': continue
-
- errors.append( (fn, curline, error_msg))
- return errors
-
-
-evaluate_matches = EvalMatches()
-
-
-forbidden = [
- '{ /',
- '{ / /',
- '{ h',
- '{ "h"',
-]
-
-allowed = [
- "if(blah) { \\",
- '\tif ((m_readyflags | thisflag) != 3) { // codepath a',
- r'// { This is ok',
- r'/// {{{ Like this',
- r'/* {{{ And this this */',
- r'{ // And this also',
- r'{',
- r'{/',
- r'{/ /',
- r'{h',
- r'{"h"',
- "namespace Widelands {\n",
- "// Do { what we want in comments",
- "buffer[i] = '{'",
- r" // FIXME instead of replacing < with { in chat messages.",
- "{ /* check number of arguments */",
- "{ // check number of arguments",
-]
=== removed file 'cmake/codecheck/rules/line_starting_with_space_followed_by_control_structure'
--- cmake/codecheck/rules/line_starting_with_space_followed_by_control_structure 2010-02-05 01:13:20 +0000
+++ cmake/codecheck/rules/line_starting_with_space_followed_by_control_structure 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
-#!/usr/bin/python
-
-
-"""
-Lines with control structures affect how editors indent the controlled lines
-following them. So an existing line of that kind that is badly indented can
-cause newly added code to become badly indented. Therefore it is especially
-important that the control structures are correctly indented.
-
-This does not yet include for loops, because there are still too many of them
-that need fixing and they should eventually be replaced with iteration macros
-anyway.
-
-I disagree with the macros. I do not think they add to the clarity of the code.
- -- SirVer
-"""
-
-error_msg = "Bad indentation."
-
-strip_comments_and_strings = True
-strip_macros = True
-regexp=r"""^ * +(\{|case|else|try|(catch|if|switch|while) *\()"""
-
-forbidden = [
- ' {',
- ' else',
- ' if (a)',
- ' switch (a)',
- ' while (a)',
-]
-
-allowed = [
- ' {',
- ' }',
- ' else',
- ' if (a)',
- ' switch (a)',
- ' while (a)',
-"""#define iterate_players_existing(p, nr_players, egbase, player) \\
- iterate_player_numbers(p, nr_players) \\
- if (Widelands::Player * const player = (egbase).get_player(p)) \\""",
-
-]
=== removed file 'cmake/codecheck/rules/missing_padding'
--- cmake/codecheck/rules/missing_padding 2014-07-16 08:23:42 +0000
+++ cmake/codecheck/rules/missing_padding 1970-01-01 00:00:00 +0000
@@ -1,378 +0,0 @@
-#!/usr/bin/env python -tt
-# encoding: utf-8
-#
-
-"""
-Checking for forbidden padding.
-TypeName* and TypeName& are okay, as are TypeName * and TypeName &.
-"""
-
-error_msg="Missing padding for operator. Needs a space before and after."
-
-import re
-
-# It is easier to search for invalids than for 'NOT' invalids
-regexp = re.compile(r"""(?x)
-([^\s](?:(?:&&)|(?:\|\|)))|
-((?:(?:&&)|(?:\|\|))[^\s])|
-([^\s>(&*:!{+\-[.](?<!operator)[*&][^*\s>)},])| # Type*, Type&, operator
-([+\-*/|^&!<]?={1,2}[^\s=])| # '+= a', 'a== a', 'a!= a'
-([^\s=!+-/^*/&|^<>r%][+\-*/^&|!<>%]?={1,2})| # ' +=a', ' ==a', ' !=a', doesn't match 'r=' for operator=
-
-([^-<]>[^\s=&>*(:,);])| # 'a >b'
-
-([^\s][/^\%](?!=))| # '/ a'
-([/^\%][^=\s])|
-([^\s\-eE([{]-[^\s=\->])| # -> and -= and unary -, also 8e-1
-([^\s+]\+[^\s=+]) # +=
-"""
-)
-
-def match_function( lines, fn ):
- errors = []
- for lineno,line in enumerate(lines):
- line = line.strip()
- if not len(line) or line[0] == '#':
- continue
-
- lineno += 1
-
- if regexp.search(line):
- errors.append( (fn, lineno, error_msg) )
-
- return errors
-
-strip_comments_and_strings = True
-
-evaluate_matches = match_function
-
-forbidden = [
- " a== b",
- " a ==b",
- " a !=b",
- " a!= b",
- "a>= b",
- "a >=b",
- "b<= a",
- "b <=a",
- #"b< a", could also be std::vector<a
- #"b <a", could also be std::vector<hai>
- #"b> a", could also be std::vector<hallo> hi;
- "b >a",
-
- ' a&& b',
- ' a &&b',
- ' a|| b',
- ' a ||b',
-
- 'char a = a^ a;',
- 'char a = a ^a;',
-
- # Eriks tests
- ## missing_padding.cc
- 'char a=a;',
- 'char a = a^a;',
- 'char a = a%a;',
- 'char a = a/a;',
- 'char a = a*a;',
- 'char a = a+a;',
- 'char a = a-a;',
- 'char A =A;',
- 'char A = A^A;',
- 'char A = A%A;',
- 'char A = A/A;',
- 'char A = A*A;',
- 'char A = A+A;',
- 'char A = A-A;',
-
- 'char b=b;',
- 'char b = b^b;',
- 'char b = b%b;',
- 'char b = b/b;',
- 'char b = b*b;',
- 'char b = b+b;',
- 'char b = b-b;',
- 'char B =B;',
- 'char B = B^B;',
- 'char B = B%B;',
- 'char B = B/B;',
- 'char B = B*B;',
- 'char B = B+B;',
- 'char B = B-B;',
-
- 'char _ =_;',
- 'char _ = _^_;',
- 'char _ = _%_;',
- 'char _ = _/_;',
- 'char _ = _*_;',
- 'char _ = _+_;',
- 'char _ = _-_;',
-
- 'char x0 =010;',
- 'char x0 = 010^010;',
- 'char x0 = 010%010;',
- 'char x0 = 010/010;',
- 'char x0 = 010*010;',
- 'char x0 = 010+010;',
- 'char x0 = 010-010;',
-
- 'char x1 =1;',
- 'char x1 = 1^1;',
- 'char x1 = 1%1;',
- 'char x1 = 1/1;',
- 'char x1 = 1*1;',
- 'char x1 = 1+1;',
- 'char x1 = 1-1;',
-
- 'char const * str ="";',
-
- 'char ch =' ';',
-
- 'a^= a;',
- 'a ^=a;',
- 'a^=a;',
- 'a/g= a;',
- 'a /g=a;',
- 'a/g=a;',
- 'a*= a;',
- 'a *=a;',
- 'a*=a;',
- 'a-= a;',
- 'a -=a;',
- 'a-=a;',
- 'a+= a;',
- 'a +=a;',
- 'a+=a;',
- 'a%=a;',
- 'a%= a;',
- 'a %=a;',
-
- 'A^= A;',
- 'A ^=A;',
- 'A^=A;',
- 'A/g= A;',
- 'A /g=A;',
- 'A/g=A;',
- 'A*= A;',
- 'A *=A;',
- 'A*=A;',
- 'A-= A;',
- 'A -=A;',
- 'A-=A;',
- 'A+= A;',
- 'A +=A;',
- 'A+=A;',
-
- '_^= _;',
- '_ ^=_;',
- '_^=_;',
- '_/g= _;',
- '_ /g=_;',
- '_/g=_;',
- '_*= _;',
- '_ *=_;',
- '_*=_;',
- '_-= _;',
- '_ -=_;',
- '_-=_;',
- '_+= _;',
- '_ +=_;',
- '_+=_;',
-
-]
-
-allowed = [
- "char** argv",
- "AnimationGfx(const IImageLoader&, AnimationData const * data);",
- "RoutingNode* a;",
- "Blahtype& b;",
- "std::vector<RoutingNode*> & nodes",
-
- 'type_a& aa = aa;',
- 'type_A& AA = AA;',
- 'type_b& bb = bb;',
- 'type_B& BB = BB;',
- 'type_c& cc = cc;',
- 'type_C& CC = AA;',
- 'type_d& dd = dd;',
- 'type_D& DD = DD;',
- 'type_e& ee = ee;',
- 'type_E& EE = EE;',
- 'type_f& ff = ff;',
- 'type_F& FF = FF;',
- 'type_g& gg = gg;',
- 'type_G& GG = GG;',
- 'type_h& hh = hh;',
- 'type_H& HH = HH;',
- 'type_i& ii = ii;',
- 'type_I& II = II;',
- 'type_j& jj = jj;',
- 'type_J& JJ = JJ;',
- 'type_k& kk = kk;',
- 'type_K& KK = KK;',
- 'type_l& ll = ll;',
- 'type_L& LL = LL;',
- 'type_m& mm = mm;',
- 'type_M& MM = MM;',
- 'type_n& nn = nn;',
- 'type_N& NN = NN;',
- 'type_o& oo = oo;',
- 'type_O& OO = OO;',
- 'type_p& pp = pp;',
- 'type_P& PP = PP;',
- 'type_q& qq = qq;',
- 'type_Q& QQ = QQ;',
- 'type_r& rr = rr;',
- 'type_R& RR = RR;',
- 'type_s& ss = ss;',
- 'type_S& SS = SS;',
- 'type_t& tt = tt;',
- 'type_T& TT = TT;',
- 'type_u& uu = uu;',
- 'type_U& UU = UU;',
- 'type_v& vv = vv;',
- 'type_V& VV = VV;',
- 'type_w& ww = ww;',
- 'type_W& WW = WW;',
- 'type_x& xx = xx;',
- 'type_X& XX = XX;',
- 'type_y& yy = yy;',
- 'type_Y& YY = YY;',
- 'type_z& zz = zz;',
- 'type_Z& ZZ = ZZ;',
- 'type_a* aaa;',
- 'type_b* bbb;',
- 'type_c* ccc;',
- 'type_d* ddd;',
- 'type_e* eee;',
- 'type_f* fff;',
- 'type_g* ggg;',
- 'type_h* hhh;',
- 'type_i* iii;',
- 'type_j* jjj;',
- 'type_k* kkk;',
- 'type_l* lll;',
- 'type_m* mmm;',
- 'type_n* nnn;',
- 'type_o* ooo;',
- 'type_p* ppp;',
- 'type_q* qqq;',
- 'type_r* rrr;',
- 'type_s* sss;',
- 'type_t* ttt;',
- 'type_u* uuu;',
- 'type_v* vvv;',
- 'type_w* www;',
- 'type_x* xxx;',
- 'type_y* yyy;',
- 'type_z* zzz;',
- 'type_A* AAA;',
- 'type_B* BBB;',
- 'type_C* CCC;',
- 'type_D* DDD;',
- 'type_E* EEE;',
- 'type_F* FFF;',
- 'type_G* GGG;',
- 'type_H* HHH;',
- 'type_I* III;',
- 'type_J* JJJ;',
- 'type_K* KKK;',
- 'type_L* LLL;',
- 'type_M* MMM;',
- 'type_N* NNN;',
- 'type_O* OOO;',
- 'type_P* PPP;',
- 'type_Q* QQQ;',
- 'type_R* RRR;',
- 'type_S* SSS;',
- 'type_T* TTT;',
- 'type_U* UUU;',
- 'type_V* VVV;',
- 'type_W* WWW;',
- 'type_X* XXX;',
- 'type_Y* YYY;',
- 'type_Z* ZZZ;',
- "RoutingNode* a;",
- "Blahtype& b;",
- "RoutingNode * a;",
- "Blahtype & b;",
- "/** Some comment **/",
- "std::vector<RoutingNode *> & nodes",
- "if (a && b)",
- "\tOpen.push(&start);",
- "\t\t*reinterpret_cast<std::vector<RoutingNode *>*>(&m_flags);",
- "std::vector<RoutingNode *>& nodes",
- "/* warehouses can determine max idle priority*/",
- "blah // I *wanna* do that",
- "&*m_stack.rbegin()",
-
- "(std::set<std::string>, j.current->second, i)",
-
- # > <
- "r = (palette[i].r * shade) >> 8;",
- "std::vector<High>",
- "std::vector<State>::iterator it = m_stack.end();",
-
- "v->get_string()", # pointers are fine
-
- # Allow includes
- "#include <sys/types.h>",
-
-
- # Ignore strings & comments
- "\tif (*i.current == '%') {",
- "if (calc_linewidth(font, cur_word) > (max_width /*/ 2*/)) {",
-
-
- # * Pointer to pointer
- "func(int **r);",
- "void (a::*b)",
- "if (!*ppgrid) {",
- "void MiniMap::toggle(Layers button) {*m_view.m_flags ^= button;}",
- "m_loaded_obj[&object] = false;",
- "m_loaded_obj[*object] = false;",
- "(_callback_argument_this.*_callback_function)();",
- "friend struct Table<void *>;",
-
- # Unary minus
- "-1",
- "func(-1);",
- "8.46126929e-5",
- "-8.46126929e-5",
-
- # Operator=
- "int someclass::operator= (int)",
- "int someclass::operator* (int)",
- "int someclass::operator== (int)",
-
- # increment, decrement
- "incr++;",
- "++incr;",
- "--decr;",
- "decr--;",
- "++*digit_to_increment;",
-
- # +=, -=
- "result += it",
- "result -= it",
-
- # Logical
- "a && b",
- "a || b",
-
- # compares
- "a == b",
- "a != b",
- "a >= b",
- "b <= a",
- "b < a",
- "b > a",
- "AreaWatcher(const Player_Area<>);",
- "void func (Player_Area<Area>);",
-
- 'a %= a;',
-
- 'Texture const & /* f_r_texture */',
- 'int32_t estimate(Map & /* map */, FCoords /* pos */) const {return 0;}',
-
-]
=== removed file 'cmake/codecheck/rules/space_as_indentation'
--- cmake/codecheck/rules/space_as_indentation 2014-07-03 06:14:16 +0000
+++ cmake/codecheck/rules/space_as_indentation 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-#!/usr/bin/env python -tt
-# encoding: utf-8
-#
-
-"""
-Indentation should be done with tabs, but spaces are allowed for alignment.
-
-This is not obligatory for macros, because of the Alignement of the \\ at the end
-"""
-
-import re
-
-error_msg="Use tabs for indentation."
-
-strip_comments_and_strings = True
-strip_macros = True
-
-class EvalMatches( object ):
- STARTS_WITH_SPACES = re.compile(r"^ +")
- def __call__(self, lines, fn):
- errors = []
- for curline, l in enumerate(lines, 1):
- if self.STARTS_WITH_SPACES.match(l):
- last_char = l.rstrip()[-1] if l.rstrip() else ""
- if last_char in ",{)":
- continue
- errors.append( (fn, curline, error_msg))
- return errors
-
-
-evaluate_matches = EvalMatches()
-
-forbidden = [
- " if ",
- " c = anrn",
-]
-
-allowed = [
- " if(a)\n",
- "if\n",
- "\tif(a) {\n",
- " // Comment is ok",
- "/*\n * Multiline comment too */",
- "#in macros\\\nHi\\\n Hi", # \\\n it's ok too",
-]
=== modified file 'cmake/codecheck/rules/upcast_without_macro'
--- cmake/codecheck/rules/upcast_without_macro 2012-02-15 21:25:34 +0000
+++ cmake/codecheck/rules/upcast_without_macro 2016-02-01 11:17:20 +0000
@@ -6,7 +6,7 @@
abbreviated with the upcast macro: upcast(Some_Type, an_identifier, source)
"""
-regexp=r"""(^\s*|[^:][^_a-zA-Z0-9]|:[^: ]) *(([_a-zA-Z][_a-zA-Z0-9]* *::)* *[_a-zA-Z][_a-zA-Z0-9]*(( +const)? *\*)*) *(const *)?\* *const +[_a-zA-Z][_a-zA-Z0-9]* *= *dynamic_cast *< *\2 *(const *)?\* *>"""
+regexp=r"""(^(<?!#define)\s*|[^:][^_a-zA-Z0-9]|:[^: ]) *(([_a-zA-Z][_a-zA-Z0-9]* *::)* *[_a-zA-Z][_a-zA-Z0-9]*(( +const)? *\*)*) *(const *)?\* *const +[_a-zA-Z][_a-zA-Z0-9]* *= *dynamic_cast *< *\2 *(const *)?\* *>"""
error_msg = "Your upcast is ugly. Use upcast() macro!"
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc 2016-01-24 17:01:59 +0000
+++ src/ai/defaultai.cc 2016-02-01 11:17:20 +0000
@@ -215,8 +215,8 @@
}
}
break;
- default:
- ;
+ default:
+ NEVER_HERE(); // NOCOM(GunChleoc) Is this the intended behaviour here?
}
});
}
=== modified file 'src/editor/tools/editor_tool.h'
--- src/editor/tools/editor_tool.h 2016-01-28 05:24:34 +0000
+++ src/editor/tools/editor_tool.h 2016-02-01 11:17:20 +0000
@@ -47,7 +47,7 @@
enum ToolIndex {First, Second, Third};
int32_t handle_click
- (const ToolIndex i,
+ (ToolIndex i,
const Widelands::World& world, Widelands::NodeAndTriangle<> const center,
EditorInteractive& parent, EditorActionArgs* args, Widelands::Map* map)
{
@@ -57,7 +57,7 @@
}
int32_t handle_undo
- (const ToolIndex i,
+ (ToolIndex i,
const Widelands::World& world, Widelands::NodeAndTriangle<> const center,
EditorInteractive& parent, EditorActionArgs* args, Widelands::Map* map)
{
=== modified file 'src/graphic/text/rt_errors.h'
--- src/graphic/text/rt_errors.h 2014-09-09 17:15:20 +0000
+++ src/graphic/text/rt_errors.h 2016-02-01 11:17:20 +0000
@@ -36,9 +36,9 @@
std::string m_msg;
};
-#define DEF_ERR(name) class name : public Exception { \
+#define DEF_ERR(Name) class Name : public Exception { \
public: \
- name(std::string msg) : Exception(msg) {} \
+ Name(std::string msg) : Exception(msg) {} \
};
DEF_ERR(AttributeNotFound)
=== modified file 'src/io/filesystem/layered_filesystem.h'
--- src/io/filesystem/layered_filesystem.h 2014-09-29 13:30:46 +0000
+++ src/io/filesystem/layered_filesystem.h 2016-02-01 11:17:20 +0000
@@ -67,8 +67,7 @@
void make_directory (const std::string & fs_dirname) override;
void * load(const std::string & fname, size_t & length) override;
- virtual void write
- (const std::string & fname, void const * data, int32_t length) override;
+ void write(const std::string& fname, void const* data, int32_t length) override;
StreamRead * open_stream_read (const std::string & fname) override;
StreamWrite * open_stream_write(const std::string & fname) override;
=== modified file 'src/io/filesystem/zip_filesystem.h'
--- src/io/filesystem/zip_filesystem.h 2016-01-17 21:49:49 +0000
+++ src/io/filesystem/zip_filesystem.h 2016-02-01 11:17:20 +0000
@@ -45,15 +45,12 @@
void * load(const std::string & fname, size_t & length) override;
- virtual void write
- (const std::string & fname, void const * data, int32_t length) override;
+ void write(const std::string& fname, void const* data, int32_t length) override;
void ensure_directory_exists(const std::string & fs_dirname) override;
void make_directory (const std::string & fs_dirname) override;
- virtual StreamRead * open_stream_read
- (const std::string & fname) override;
- virtual StreamWrite * open_stream_write
- (const std::string & fname) override;
+ StreamRead* open_stream_read(const std::string& fname) override;
+ StreamWrite* open_stream_write(const std::string& fname) override;
FileSystem * make_sub_file_system(const std::string & fs_dirname) override;
FileSystem * create_sub_file_system(const std::string & fs_dirname, Type) override;
=== modified file 'src/logic/map_objects/immovable.h'
--- src/logic/map_objects/immovable.h 2015-11-29 09:43:15 +0000
+++ src/logic/map_objects/immovable.h 2016-02-01 11:17:20 +0000
@@ -271,8 +271,7 @@
private:
void increment_program_pointer();
- void draw_construction
- (const EditorGameBase &, RenderTarget &, const Point);
+ void draw_construction(const EditorGameBase&, RenderTarget&, Point);
};
=== modified file 'src/logic/map_objects/tribes/carrier.h'
--- src/logic/map_objects/tribes/carrier.h 2015-11-28 22:29:26 +0000
+++ src/logic/map_objects/tribes/carrier.h 2016-02-01 11:17:20 +0000
@@ -103,8 +103,7 @@
Loader * create_loader() override;
public:
- virtual void do_save
- (EditorGameBase &, MapObjectSaver &, FileWrite &) override;
+ void do_save(EditorGameBase&, MapObjectSaver&, FileWrite&) override;
};
}
=== modified file 'src/logic/map_objects/tribes/constructionsite.h'
--- src/logic/map_objects/tribes/constructionsite.h 2015-11-28 22:29:26 +0000
+++ src/logic/map_objects/tribes/constructionsite.h 2016-02-01 11:17:20 +0000
@@ -99,8 +99,7 @@
void update_statistics_string(std::string* statistics_string) override;
uint32_t build_step_time() const override {return CONSTRUCTIONSITE_STEP_TIME;}
- virtual void create_options_window
- (InteractiveGameBase &, UI::Window * & registry) override;
+ void create_options_window(InteractiveGameBase&, UI::Window*& registry) override;
static void wares_queue_callback
(Game &, WaresQueue *, DescriptionIndex, void * data);
=== modified file 'src/logic/map_objects/tribes/dismantlesite.h'
--- src/logic/map_objects/tribes/dismantlesite.h 2015-11-28 22:29:26 +0000
+++ src/logic/map_objects/tribes/dismantlesite.h 2016-02-01 11:17:20 +0000
@@ -79,8 +79,7 @@
uint32_t build_step_time() const override {return DISMANTLESITE_STEP_TIME;}
- virtual void create_options_window
- (InteractiveGameBase &, UI::Window * & registry) override;
+ void create_options_window(InteractiveGameBase&, UI::Window*& registry) override;
void draw(const EditorGameBase &, RenderTarget &, const FCoords&, const Point&) override;
};
=== modified file 'src/logic/map_objects/tribes/militarysite.cc'
--- src/logic/map_objects/tribes/militarysite.cc 2016-01-06 19:11:20 +0000
+++ src/logic/map_objects/tribes/militarysite.cc 2016-02-01 11:17:20 +0000
@@ -499,10 +499,9 @@
{
// Somebody is killing my soldiers in the middle of upgrade
// or I have kicked out his predecessor already.
- if
- ((m_upgrade_soldier_request)
- && (m_upgrade_soldier_request->is_open() || 0 == m_upgrade_soldier_request->get_count()))
- {
+ if (m_upgrade_soldier_request && (m_upgrade_soldier_request->is_open() ||
+ 0 == m_upgrade_soldier_request->get_count())) {
+
// Economy was not able to find the soldiers I need.
// I can safely drop the upgrade request and go to fill mode.
m_upgrade_soldier_request.reset();
=== modified file 'src/logic/map_objects/tribes/militarysite.h'
--- src/logic/map_objects/tribes/militarysite.h 2016-01-06 19:11:20 +0000
+++ src/logic/map_objects/tribes/militarysite.h 2016-02-01 11:17:20 +0000
@@ -130,8 +130,7 @@
protected:
void conquer_area(EditorGameBase &);
- virtual void create_options_window
- (InteractiveGameBase &, UI::Window * & registry) override;
+ void create_options_window(InteractiveGameBase&, UI::Window*& registry) override;
private:
void update_statistics_string(std::string*) override;
=== modified file 'src/logic/map_objects/tribes/soldier.h'
--- src/logic/map_objects/tribes/soldier.h 2016-01-06 19:11:20 +0000
+++ src/logic/map_objects/tribes/soldier.h 2016-02-01 11:17:20 +0000
@@ -182,8 +182,7 @@
Point calc_drawpos(const EditorGameBase &, Point) const;
/// Draw this soldier
- virtual void draw
- (const EditorGameBase &, RenderTarget &, const Point&) const override;
+ void draw(const EditorGameBase&, RenderTarget&, const Point&) const override;
static void calc_info_icon_size
(const TribeDescr &, uint32_t & w, uint32_t & h);
@@ -309,8 +308,7 @@
Loader * create_loader() override;
public:
- virtual void do_save
- (EditorGameBase &, MapObjectSaver &, FileWrite &) override;
+ void do_save(EditorGameBase&, MapObjectSaver&, FileWrite&) override;
};
}
=== modified file 'src/logic/map_objects/tribes/trainingsite.h'
--- src/logic/map_objects/tribes/trainingsite.h 2015-11-28 22:29:26 +0000
+++ src/logic/map_objects/tribes/trainingsite.h 2016-02-01 11:17:20 +0000
@@ -200,8 +200,7 @@
protected:
- virtual void create_options_window
- (InteractiveGameBase &, UI::Window * & registry) override;
+ void create_options_window(InteractiveGameBase&, UI::Window*& registry) override;
void program_end(Game &, ProgramResult) override;
private:
=== modified file 'src/logic/map_objects/tribes/warehouse.h'
--- src/logic/map_objects/tribes/warehouse.h 2016-01-17 09:54:31 +0000
+++ src/logic/map_objects/tribes/warehouse.h 2016-02-01 11:17:20 +0000
@@ -225,8 +225,7 @@
/// Initializes the container sizes for the owner's tribe.
void init_containers(Player& owner);
/// Create the warehouse information window.
- virtual void create_options_window
- (InteractiveGameBase &, UI::Window * & registry) override;
+ void create_options_window(InteractiveGameBase&, UI::Window*& registry) override;
private:
void init_portdock(EditorGameBase & egbase);
=== modified file 'src/logic/map_objects/world/map_gen.h'
--- src/logic/map_objects/world/map_gen.h 2015-11-28 22:29:26 +0000
+++ src/logic/map_objects/world/map_gen.h 2016-02-01 11:17:20 +0000
@@ -123,8 +123,7 @@
MapGenInfo(const LuaTable& table, const World& world);
size_t get_num_areas(MapGenAreaInfo::MapGenAreaType areaType) const;
- const MapGenAreaInfo & get_area
- (MapGenAreaInfo::MapGenAreaType const areaType, uint32_t const index)
+ const MapGenAreaInfo& get_area(MapGenAreaInfo::MapGenAreaType areaType, uint32_t index)
const;
const MapGenBobCategory * get_bob_category(const std::string & bobCategory) const;
=== modified file 'src/logic/player.h'
--- src/logic/player.h 2016-01-24 20:11:53 +0000
+++ src/logic/player.h 2016-02-01 11:17:20 +0000
@@ -460,13 +460,11 @@
Flag * build_flag(Coords); /// Build a flag if it is allowed.
Road & force_road(const Path &);
Road * build_road(const Path &); /// Build a road if it is allowed.
- Building & force_building
- (const Coords,
- const Building::FormerBuildings &);
- Building & force_csite
- (const Coords,
+ Building& force_building(Coords, const Building::FormerBuildings&);
+ Building& force_csite
+ (Coords,
DescriptionIndex,
- const Building::FormerBuildings & = Building::FormerBuildings());
+ const Building::FormerBuildings& = Building::FormerBuildings());
Building * build(Coords, DescriptionIndex, bool, Building::FormerBuildings &);
void bulldoze(PlayerImmovable &, bool recurse = false);
void flagaction(Flag &);
@@ -550,8 +548,7 @@
void update_building_statistics(Building &, NoteImmovable::Ownership ownership);
void update_team_players();
void play_message_sound(const Message::Type & msgtype);
- void _enhance_or_dismantle
- (Building *, DescriptionIndex const index_of_new_building);
+ void _enhance_or_dismantle(Building*, DescriptionIndex index_of_new_building);
// Called when a node becomes seen or has changed. Discovers the node and
// those of the 6 surrounding edges/triangles that are not seen from another
=== modified file 'src/map_io/s2map.h'
--- src/map_io/s2map.h 2014-10-04 09:40:18 +0000
+++ src/map_io/s2map.h 2016-02-01 11:17:20 +0000
@@ -37,8 +37,7 @@
S2MapLoader(const std::string& filename, Widelands::Map& M);
int32_t preload_map(bool) override;
- virtual int32_t load_map_complete
- (Widelands::EditorGameBase &, bool scenario) override;
+ int32_t load_map_complete(Widelands::EditorGameBase&, bool scenario) override;
private:
const std::string m_filename;
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc 2016-01-28 05:24:34 +0000
+++ src/network/nethost.cc 2016-02-01 11:17:20 +0000
@@ -118,8 +118,8 @@
{
h->set_map(mapname, mapfilename, maxplayers, savegame);
}
- virtual void set_player_state
- (uint8_t const number, PlayerSettings::State const state) override
+ void set_player_state
+ (uint8_t number, PlayerSettings::State const state) override
{
if (number >= settings().players.size())
return;
@@ -210,8 +210,8 @@
h->set_player_state(number, newstate, true);
}
- virtual void set_player_tribe
- (uint8_t const number, const std::string & tribe, bool const random_tribe) override
+ void set_player_tribe
+ (uint8_t number, const std::string& tribe, bool const random_tribe) override
{
if (number >= h->settings().players.size())
return;
@@ -223,8 +223,7 @@
||
settings().players.at(number).state == PlayerSettings::stateShared
||
- settings().players.at(number).state == PlayerSettings::stateOpen // For savegame loading
- )
+ settings().players.at(number).state == PlayerSettings::stateOpen) // For savegame loading
h->set_player_tribe(number, tribe, random_tribe);
}
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2016-01-24 17:01:59 +0000
+++ src/scripting/lua_map.cc 2016-02-01 11:17:20 +0000
@@ -852,10 +852,10 @@
.. code-block:: lua
- l:set_soldiers{
+ l:set_soldiers({
[{0,0,0,0}] = 10,
[{1,2,3,4}] = 5,
- )
+ })
would add 10 level 0 soldier and 5 soldiers with hit point level 1,
attack level 2, defense level 3 and evade level 4 (as long as this is
Follow ups
-
[Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
From: noreply, 2016-02-03
-
Re: [Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
From: Tino, 2016-02-03
-
[Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
From: bunnybot, 2016-02-03
-
Re: [Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
From: SirVer, 2016-02-03
-
Re: [Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
From: GunChleoc, 2016-02-02
-
[Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
From: bunnybot, 2016-02-02
-
Re: [Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
From: SirVer, 2016-02-02
-
Re: [Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
From: GunChleoc, 2016-02-01
-
[Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
From: bunnybot, 2016-02-01
-
Re: [Merge] lp:~widelands-dev/widelands/clang-codecheck into lp:widelands
From: TiborB, 2016-02-01