Fix GCC 6 -Wmisleading-indentation warnings

This commit is contained in:
Ignacio R. Morelle 2016-11-08 01:59:52 -03:00
parent 311a021b77
commit e1059405c0
3 changed files with 44 additions and 27 deletions

View file

@ -7,6 +7,7 @@ Version 1.12.6+dev:
* Miscellaneous and bug fixes:
* Debug commands that create units now do so for the currently controlled
side instead of always side 1.
* Fixed GCC 6 warnings about misleading indentation.
Version 1.12.6:
* Campaigns:

View file

@ -1239,31 +1239,32 @@ static bool add_font_to_fontlist(config &fonts_config,
std::vector<font::subset_descriptor>& fontlist, const std::string& name)
{
config &font = fonts_config.find_child("font", "name", name);
if (!font)
if(!font) {
return false;
fontlist.push_back(font::subset_descriptor());
fontlist.back().name = name;
std::vector<std::string> ranges = utils::split(font["codepoints"]);
for(std::vector<std::string>::const_iterator itor = ranges.begin();
itor != ranges.end(); ++itor) {
std::vector<std::string> r = utils::split(*itor, '-');
if(r.size() == 1) {
size_t r1 = lexical_cast_default<size_t>(r[0], 0);
fontlist.back().present_codepoints.push_back(std::pair<size_t, size_t>(r1, r1));
} else if(r.size() == 2) {
size_t r1 = lexical_cast_default<size_t>(r[0], 0);
size_t r2 = lexical_cast_default<size_t>(r[1], 0);
fontlist.back().present_codepoints.push_back(std::pair<size_t, size_t>(r1, r2));
}
}
return true;
}
fontlist.push_back(font::subset_descriptor());
fontlist.back().name = name;
std::vector<std::string> ranges = utils::split(font["codepoints"]);
for(std::vector<std::string>::const_iterator itor = ranges.begin();
itor != ranges.end(); ++itor) {
std::vector<std::string> r = utils::split(*itor, '-');
if(r.size() == 1) {
size_t r1 = lexical_cast_default<size_t>(r[0], 0);
fontlist.back().present_codepoints.push_back(std::pair<size_t, size_t>(r1, r1));
} else if(r.size() == 2) {
size_t r1 = lexical_cast_default<size_t>(r[0], 0);
size_t r2 = lexical_cast_default<size_t>(r[1], 0);
fontlist.back().present_codepoints.push_back(std::pair<size_t, size_t>(r1, r2));
}
}
return true;
}
namespace font {
namespace {

View file

@ -1095,7 +1095,10 @@ std::ostream& operator << (std::ostream& outstream, const unit_animation& u_anim
std::cout << "[";
int i=0;
BOOST_FOREACH(std::string event, u_animation.event_) {
if (i>0) std::cout << ','; i++;
if(i > 0) {
std::cout << ',';
}
i++;
std::cout << event;
}
std::cout << "]\n";
@ -1106,7 +1109,10 @@ std::ostream& operator << (std::ostream& outstream, const unit_animation& u_anim
std::cout << "\thits=";
i=0;
BOOST_FOREACH(const unit_animation::hit_type hit_type, u_animation.hits_) {
if (i>0) std::cout << ','; i++;
if(i > 0) {
std::cout << ',';
}
i++;
switch (hit_type) {
case (unit_animation::HIT) : std::cout << "hit"; break;
case (unit_animation::MISS) : std::cout << "miss"; break;
@ -1120,7 +1126,10 @@ std::ostream& operator << (std::ostream& outstream, const unit_animation& u_anim
std::cout << "\tdirections=";
i=0;
BOOST_FOREACH(const map_location::DIRECTION direction, u_animation.directions_) {
if (i>0) std::cout << ','; i++;
if(i > 0) {
std::cout << ',';
}
i++;
switch (direction) {
case (map_location::NORTH) : std::cout << "n"; break;
case (map_location::NORTH_EAST): std::cout << "ne"; break;
@ -1137,7 +1146,10 @@ std::ostream& operator << (std::ostream& outstream, const unit_animation& u_anim
i=0;
std::cout << "\tterrain=";
BOOST_FOREACH(const t_translation::t_terrain terrain, u_animation.terrain_types_) {
if (i>0) std::cout << ','; i++;
if(i > 0) {
std::cout << ',';
}
i++;
std::cout << terrain;
}
std::cout << '\n';
@ -1199,7 +1211,10 @@ std::ostream& operator << (std::ostream& outstream, const unit_animation& u_anim
std::cout << "[/";
i=0;
BOOST_FOREACH(std::string event, u_animation.event_) {
if (i>0) std::cout << ','; i++;
if(i > 0) {
std::cout << ',';
}
i++;
std::cout << event;
}
std::cout << "]\n";