widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02482
[Merge] lp:~widelands-dev/widelands/bug-1343302_codecheck into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1343302_codecheck into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1343302 in widelands: "Remove the use of "and", "or" and "not"."
https://bugs.launchpad.net/widelands/+bug/1343302
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1343302_codecheck/+merge/228357
IMO the rule is now ready - strip_comments_and_strings = True is all that was needed to make it work and simplify it.
--
https://code.launchpad.net/~widelands-dev/widelands/bug-1343302_codecheck/+merge/228357
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1343302_codecheck into lp:widelands.
=== added file 'cmake/codecheck/rules/do_not_use_operator_synonyms'
--- cmake/codecheck/rules/do_not_use_operator_synonyms 1970-01-01 00:00:00 +0000
+++ cmake/codecheck/rules/do_not_use_operator_synonyms 2014-07-25 18:59:12 +0000
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+
+
+error_msg = "Do not use operator synonyms, e.g. use \"&&\" rather than \"and\"."
+
+strip_comments_and_strings = True
+
+regexp = (
+ r"""(\Wand(\W|$)"""
+ r"""|\Wand_eq(\W|$)"""
+ r"""|\Wbitand(\W|$)"""
+ r"""|\Wor(\W|$)"""
+ r"""|\Wor_eq(\W|$)"""
+ r"""|\Wxor(\W|$)"""
+ r"""|\Wxor_eq(\W|$)"""
+ r"""|\Wnot(\W|$)"""
+ r"""|\Wnot_eq(\W|$)"""
+ r"""|\Wcompl(\W|$))"""
+ )
+
+forbidden = [
+ "if (foo == 0 and bar > 1)",
+ "if (foo == 0 bitand bar > 1)",
+ "if (foo == 0 and_eq bar > 1)",
+ "if (foo == 0 or bar > 1)",
+ "if (foo == 0 or_eq bar > 1)",
+ "if (foo == 0 xor bar > 1)",
+ "if (foo == 0 xor_eq bar > 1)",
+ "if (foo == 0 not bar > 1)",
+ "if (foo == 0 not_eq bar > 1)",
+ "if (foo == 0 compl bar > 1)"
+]
+
+allowed = [
+ "if (foo == 0 && bar > 1)",
+ "if (foo == 0 & bar > 1)",
+ "if (foo == 0 &= bar > 1)",
+ "if (foo == 0 || bar > 1)",
+ "if (foo == 0 |= bar > 1)",
+ "if (foo == 0 ^ bar > 1)",
+ "if (foo == 0 ^= bar > 1)",
+ "if (foo == 0 ! bar > 1)",
+ "if (foo == 0 != bar > 1)",
+ "if (foo == 0 ~ bar > 1)"
+]
+
=== modified file 'src/ai/ai_help_structs.cc'
--- src/ai/ai_help_structs.cc 2014-07-14 10:45:44 +0000
+++ src/ai/ai_help_structs.cc 2014-07-25 18:59:12 +0000
@@ -28,8 +28,8 @@
bool FindNodeWithFlagOrRoad::accept(const Map&, FCoords fc) const {
if (upcast(PlayerImmovable const, pimm, fc.field->get_immovable()))
- return pimm->get_economy() != economy and(dynamic_cast<Flag const*>(pimm)
- or(dynamic_cast<Road const*>(pimm) &&
+ return pimm->get_economy() != economy && (dynamic_cast<Flag const*>(pimm)
+ || (dynamic_cast<Road const*>(pimm) &&
(fc.field->nodecaps() & BUILDCAPS_FLAG)));
return false;
}
@@ -53,7 +53,7 @@
if (dynamic_cast<Flag const*>(imm))
return true;
- if (not dynamic_cast<Road const*>(imm) || !(endcaps & BUILDCAPS_FLAG))
+ if (!dynamic_cast<Road const*>(imm) || !(endcaps & BUILDCAPS_FLAG))
return false;
}
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc 2014-07-23 15:58:57 +0000
+++ src/ai/defaultai.cc 2014-07-25 18:59:12 +0000
@@ -114,17 +114,17 @@
}
DefaultAI::~DefaultAI() {
- while (not buildable_fields.empty()) {
+ while (!buildable_fields.empty()) {
delete buildable_fields.back();
buildable_fields.pop_back();
}
- while (not mineable_fields.empty()) {
+ while (!mineable_fields.empty()) {
delete mineable_fields.back();
mineable_fields.pop_back();
}
- while (not economies.empty()) {
+ while (!economies.empty()) {
delete economies.back();
economies.pop_back();
}
@@ -314,7 +314,7 @@
bo.prod_build_material_ = bh.prod_build_material();
// here we identify hunters
- if (bo.outputs_.size() == 1 and tribe_->safe_ware_index("meat") == bo.outputs_.at(0)) {
+ if (bo.outputs_.size() == 1 && tribe_->safe_ware_index("meat") == bo.outputs_.at(0)) {
bo.is_hunter_ = true;
} else
bo.is_hunter_ = false;
@@ -364,7 +364,7 @@
if (upcast(PlayerImmovable, imm, f.field->get_immovable()))
// Guard by a set - immovables might be on several nodes at once.
- if (&imm->owner() == player_ and not found_immovables.count(imm)) {
+ if (&imm->owner() == player_ && !found_immovables.count(imm)) {
found_immovables.insert(imm);
gain_immovable(*imm);
}
@@ -379,7 +379,7 @@
* milliseconds if the area the computer owns is big.
*/
void DefaultAI::update_all_buildable_fields(const int32_t gametime) {
- while (not buildable_fields.empty() and buildable_fields.front()->next_update_due_ <= gametime) {
+ while (!buildable_fields.empty() && buildable_fields.front()->next_update_due_ <= gametime) {
BuildableField& bf = *buildable_fields.front();
// check whether we lost ownership of the node
@@ -411,7 +411,7 @@
* milliseconds if the area the computer owns is big.
*/
void DefaultAI::update_all_mineable_fields(const int32_t gametime) {
- while (not mineable_fields.empty() and mineable_fields.front()->next_update_due_ <= gametime) {
+ while (!mineable_fields.empty() && mineable_fields.front()->next_update_due_ <= gametime) {
MineableField* mf = mineable_fields.front();
// check whether we lost ownership of the node
@@ -493,7 +493,7 @@
}
// to save some CPU
- if (mines_.size() > 8 and game().get_gametime() % 3 > 0)
+ if (mines_.size() > 8 && game().get_gametime() % 3 > 0)
field.unowned_mines_pots_nearby_ = 0;
else
field.unowned_mines_pots_nearby_ = map.find_fields(
@@ -534,7 +534,7 @@
}
// counting fields with fish
- if (field.water_nearby_ > 0 and game().get_gametime() % 10 == 0) {
+ if (field.water_nearby_ > 0 && game().get_gametime() % 10 == 0) {
map.find_fields(Area<FCoords>(field.coords, 6),
&resource_list,
FindNodeResource(world.get_resource("fish")));
@@ -553,7 +553,7 @@
if (BaseImmovable const* const imm = fse.field->get_immovable())
if (dynamic_cast<Flag const*>(imm)
- or(dynamic_cast<Road const*>(imm) && (fse.field->nodecaps() & BUILDCAPS_FLAG)))
+ || (dynamic_cast<Road const*>(imm) && (fse.field->nodecaps() & BUILDCAPS_FLAG)))
field.preferred_ = true;
for (uint32_t i = 0; i < immovables.size(); ++i) {
@@ -654,7 +654,7 @@
const int32_t radius = militarysite->descr().get_conquers() + 4;
const int32_t v = radius - dist;
- if (v > 0 and dist > 0) {
+ if (v > 0 && dist > 0) {
field.military_capacity_ += militarysite->maxSoldierCapacity();
field.military_presence_ += militarysite->stationedSoldiers().size();
@@ -685,7 +685,7 @@
if (BaseImmovable const* const imm = fse.field->get_immovable())
if (dynamic_cast<Flag const*>(imm)
- or(dynamic_cast<Road const*>(imm) && (fse.field->nodecaps() & BUILDCAPS_FLAG)))
+ || (dynamic_cast<Road const*>(imm) && (fse.field->nodecaps() & BUILDCAPS_FLAG)))
field.preferred_ = true;
container_iterate_const(std::vector<ImmovableFound>, immovables, i) {
@@ -802,7 +802,7 @@
if ((militarysites.size() * 2 + 20) <
productionsites.size()
- or spots<(3 + (static_cast<int32_t>(productionsites.size()) / 5))or num_constructionsites_>(
+ || spots<(3 + (static_cast<int32_t>(productionsites.size()) / 5)) || num_constructionsites_>(
(militarysites.size() + productionsites.size()) / 2)) {
new_buildings_stop_ = true;
}
@@ -865,8 +865,9 @@
if (!bf->reachable)
continue;
+ // add randomnes and ease AI
if (time(nullptr) % 5 == 0)
- continue; // add randomnes and ease AI
+ continue;
// Continue if field is blocked at the moment
field_blocked = false;
@@ -902,7 +903,7 @@
if (bo.unoccupied_)
continue;
- if (not(bo.type == BuildingObserver::MILITARYSITE) and bo.cnt_under_construction_ >= 2)
+ if (!(bo.type == BuildingObserver::MILITARYSITE) && bo.cnt_under_construction_ >= 2)
continue;
// so we are going to seriously evaluate this building on this field,
@@ -948,7 +949,7 @@
if (bo.type == BuildingObserver::PRODUCTIONSITE) {
// exclude spots on border
- if (bf->near_border_ and not bo.need_trees_ and not bo.need_stones_)
+ if (bf->near_border_ && !bo.need_trees_ && !bo.need_stones_)
continue;
// this can be only a well (as by now)
@@ -958,7 +959,7 @@
if (bo.cnt_under_construction_ + bo.unoccupied_ > 0)
continue;
- if ((bo.cnt_built_ + bo.unoccupied_) > 0 and gametime < kBaseInfrastructureTime)
+ if ((bo.cnt_built_ + bo.unoccupied_) > 0 && gametime < kBaseInfrastructureTime)
continue;
if (new_buildings_stop_)
continue;
@@ -1023,13 +1024,13 @@
// production hint (f.e. associate forester with logs)
- if (bo.need_water_ and bf->water_nearby_ < 5) // probably some of them needs water
+ if (bo.need_water_ && bf->water_nearby_ < 5) // probably some of them needs water
continue;
if (bo.plants_trees_) { // RANGERS
// if there are too many trees nearby
- if (bf->trees_nearby_ > 25 and bo.total_count() >= 2)
+ if (bf->trees_nearby_ > 25 && bo.total_count() >= 2)
continue;
// sometimes all area is blocked by trees so this is to prevent this
@@ -1058,8 +1059,8 @@
else if (bo.total_count() < bo.cnt_target_)
prio += 30 + bf->producers_nearby_.at(bo.production_hint_) * 5;
- } else if (gametime > kBaseInfrastructureTime and not
- new_buildings_stop_) { // gamekeepers or so
+ } else if (gametime > kBaseInfrastructureTime &&
+ !new_buildings_stop_) { // gamekeepers or so
if (bo.stocklevel_time < game().get_gametime() - 5 * 1000) {
bo.stocklevel_ =
get_stocklevel_by_hint(static_cast<size_t>(bo.production_hint_));
@@ -1077,7 +1078,7 @@
prio += bf->producers_nearby_.at(bo.production_hint_) * 10;
prio += recalc_with_border_range(*bf, prio);
- } else if (bo.stocklevel_ < 50 and not new_buildings_stop_) {
+ } else if (bo.stocklevel_ < 50 && !new_buildings_stop_) {
prio += bf->producers_nearby_.at(bo.production_hint_) * 5;
prio += recalc_with_border_range(*bf, prio); // only for not wood producers_
} else
@@ -1086,11 +1087,11 @@
if (prio <= 0)
continue;
- } else if (bo.recruitment_ and gametime >
- kBaseInfrastructureTime and not new_buildings_stop_) {
+ } else if (bo.recruitment_ && gametime >
+ kBaseInfrastructureTime && !new_buildings_stop_) {
// this will depend on number of mines_ and productionsites
if (static_cast<int32_t>((productionsites.size() + mines_.size()) / 30) >
- bo.total_count() and bo.cnt_under_construction_ ==
+ bo.total_count() && bo.cnt_under_construction_ ==
0)
prio = 4 + bulgarian_constant;
} else { // finally normal productionsites
@@ -1101,36 +1102,36 @@
continue;
// if hunter and too little critters nearby skipping
- if (bo.is_hunter_ and bf->critters_nearby_ < 5)
+ if (bo.is_hunter_ && bf->critters_nearby_ < 5)
continue;
// similarly for fishers
- if (bo.need_water_ and bf->fish_nearby_ <= 1)
+ if (bo.need_water_ && bf->fish_nearby_ <= 1)
continue;
// first eliminate buildings needing water if there is short supplies
- if (bo.need_water_ and bf->water_nearby_ < 4)
+ if (bo.need_water_ && bf->water_nearby_ < 4)
continue;
- if (bo.is_basic_ and bo.total_count() == 0)
+ if (bo.is_basic_ && bo.total_count() == 0)
prio = 150 + max_preciousness;
- else if (bo.is_food_basic_ and game().get_gametime() >
- kPrimaryFoodStartTime and bo.total_count() ==
+ else if (bo.is_food_basic_ && game().get_gametime() >
+ kPrimaryFoodStartTime && bo.total_count() ==
0) {
prio = 40 + max_preciousness;
} else if (game().get_gametime() <
- kBaseInfrastructureTime or
+ kBaseInfrastructureTime ||
new_buildings_stop_) // leave 15 minutes for basic infrastructure only
continue;
- else if ((bo.is_basic_ and bo.total_count() <=
- 1)or(output_is_needed and bo.total_count() == 0))
+ else if ((bo.is_basic_ && bo.total_count() <=
+ 1) || (output_is_needed && bo.total_count() == 0))
prio = 80 + max_preciousness;
else if (bo.inputs_.size() == 0) {
bo.cnt_target_ =
1 + static_cast<int32_t>(mines_.size() + productionsites.size()) / 8;
if (bo.cnt_built_ >
- bo.cnt_target_ and not(
- bo.space_consumer_ or bo.is_food_basic_)) // spaceconsumers_ and basic_s
+ bo.cnt_target_ &&
+ !(bo.space_consumer_ || bo.is_food_basic_)) // spaceconsumers_ and basic_s
// can be built more then target
continue;
@@ -1145,7 +1146,7 @@
if (bo.space_consumer_) // need to consider trees nearby
prio += 20 - (bf->trees_nearby_ / 3);
- if (not bo.space_consumer_)
+ if (!bo.space_consumer_)
prio -= bf->producers_nearby_.at(bo.outputs_.at(0)) *
20; // leave some free space between them
@@ -1172,18 +1173,18 @@
// to have two buildings from everything (intended for upgradeable buildings)
// but I do not know how to identify such buildings
if (bo.cnt_built_ == 1
- and game().get_gametime() > 60 * 60 * 1000
- and bo.desc->enhancement() != INVALID_INDEX
- and !mines_.empty())
+ && game().get_gametime() > 60 * 60 * 1000
+ && bo.desc->enhancement() != INVALID_INDEX
+ && !mines_.empty())
{
prio = max_preciousness + bulgarian_constant;
}
// if output is needed and there are no idle buildings
else if (output_is_needed) {
- if (bo.cnt_built_ > 0 and bo.current_stats_ > 80) {
+ if (bo.cnt_built_ > 0 && bo.current_stats_ > 80) {
prio = max_preciousness + bulgarian_constant + 30;
- } else if (bo.cnt_built_ > 0 and bo.current_stats_ > 55) {
+ } else if (bo.cnt_built_ > 0 && bo.current_stats_ > 55) {
prio = max_preciousness + bulgarian_constant;
}
@@ -1208,22 +1209,22 @@
} // production sites done
else if (bo.type == BuildingObserver::MILITARYSITE) {
- if (new_military_buildings_stop and not bf->enemy_nearby_)
- continue;
-
- if (near_enemy_b_buildings_stop and bf->enemy_nearby_)
- continue;
-
- if (bf->enemy_nearby_ and bo.fighting_type_)
+ if (new_military_buildings_stop && !bf->enemy_nearby_)
+ continue;
+
+ if (near_enemy_b_buildings_stop && bf->enemy_nearby_)
+ continue;
+
+ if (bf->enemy_nearby_ && bo.fighting_type_)
; // it is ok, go on
else if (bf->unowned_mines_pots_nearby_ >
- 0 and(bo.mountain_conqueror_ or bo.expansion_type_))
+ 0 && (bo.mountain_conqueror_ || bo.expansion_type_))
; // it is ok, go on
- else if (bf->unowned_land_nearby_ and bo.expansion_type_) {
+ else if (bf->unowned_land_nearby_ && bo.expansion_type_) {
// decreasing probability for big buidlings
- if (bo.desc->get_size() == 2 and gametime % 5 >= 1)
+ if (bo.desc->get_size() == 2 && gametime % 5 >= 1)
continue;
- if (bo.desc->get_size() == 3 and gametime % 15 >= 1)
+ if (bo.desc->get_size() == 3 && gametime % 15 >= 1)
continue;
}
// it is ok, go on
@@ -1231,7 +1232,7 @@
continue; // the building is not suitable for situation
if (bo.desc->get_size() ==
- 3 and game().get_gametime() <
+ 3 && game().get_gametime() <
15 * 60 * 1000) // do not built fortresses in first half of hour of game
continue;
@@ -1239,7 +1240,7 @@
continue;
// not to build so many military buildings nearby
- if (!bf->enemy_nearby_ and bf->military_in_constr_nearby_ > 0)
+ if (!bf->enemy_nearby_ && bf->military_in_constr_nearby_ > 0)
continue;
// here is to consider unowned potential mines
@@ -1257,7 +1258,7 @@
if (bo.desc->get_size() < maxsize)
prio = prio - 5; // penalty
- if (bf->enemy_nearby_ and bf->military_capacity_ < 12) {
+ if (bf->enemy_nearby_ && bf->military_capacity_ < 12) {
prio += 100;
}
@@ -1272,7 +1273,7 @@
// chance for a warehouses (containing waiting soldiers or wares
// needed for soldier training) near the frontier.
if ((static_cast<int32_t>(productionsites.size() + mines_.size())) / 35 >
- static_cast<int32_t>(numof_warehouses_) and bo.cnt_under_construction_ ==
+ static_cast<int32_t>(numof_warehouses_) && bo.cnt_under_construction_ ==
0)
prio = 13;
@@ -1290,7 +1291,7 @@
// build after 20 production sites and then after each 50 production site
if (static_cast<int32_t>((productionsites.size() + 30) / 50) >
- bo.total_count() and bo.cnt_under_construction_ ==
+ bo.total_count() && bo.cnt_under_construction_ ==
0)
prio = 4;
@@ -1329,7 +1330,7 @@
for (uint32_t i = 0; i < buildings_.size() && productionsites.size() > 8; ++i) {
BuildingObserver& bo = buildings_.at(i);
- if (not bo.mines_marble_ and gametime <
+ if (!bo.mines_marble_ && gametime <
kBaseInfrastructureTime) // allow only stone mines_ in early stages of game
continue;
@@ -1352,7 +1353,7 @@
}
// Only try to build mines_ that produce needed wares.
- if (((bo.cnt_built_ - bo.unoccupied_) > 0 and bo.current_stats_ < 20)or bo.stocklevel_ >
+ if (((bo.cnt_built_ - bo.unoccupied_) > 0 && bo.current_stats_ < 20) || bo.stocklevel_ >
40 + static_cast<uint32_t>(bo.mines_marble_) * 30) {
continue;
@@ -1430,7 +1431,7 @@
blocked_fields.push_back(blocked);
// if space consumer we block also nearby fields
- if (best_building->space_consumer_ and not best_building->plants_trees_) {
+ if (best_building->space_consumer_ && !best_building->plants_trees_) {
Map& map = game().map();
MapRegion<Area<FCoords>> mr(map, Area<FCoords>(map.get_fcoords(proposed_coords), 3));
@@ -1441,7 +1442,7 @@
} while (mr.advance(map));
}
- if (not(best_building->type == BuildingObserver::MILITARYSITE))
+ if (!(best_building->type == BuildingObserver::MILITARYSITE))
best_building->construction_decision_time_ = gametime;
else // very ugly hack here
best_building->construction_decision_time_ = gametime - kBuildingMinInterval / 2;
@@ -1508,7 +1509,7 @@
// If the economy consists of just one constructionsite, and the defaultAI
// failed more than 4 times to connect, we remove the constructionsite
- if (eo_to_connect->failed_connection_tries > 3 and eo_to_connect->flags.size() == 1) {
+ if (eo_to_connect->failed_connection_tries > 3 && eo_to_connect->flags.size() == 1) {
Building* bld = eo_to_connect->flags.front()->get_building();
if (bld) {
@@ -1732,7 +1733,7 @@
Path& path = *new Path();
if (map.findpath(flag.get_position(), nf.flag->get_position(), 0, path, check) >=
- 0 and static_cast<int32_t>(2 * path.get_nsteps() + 2) < nf.cost_) {
+ 0 && static_cast<int32_t>(2 * path.get_nsteps() + 2) < nf.cost_) {
game().send_player_build_road(player_number(), path);
return true;
}
@@ -1855,7 +1856,7 @@
// Wells handling
if (site.bo->mines_water_) {
if (site.unoccupied_till_ + 6 * 60 * 1000 < game().get_gametime()
- and site.site->get_statistics_percent() ==
+ && site.site->get_statistics_percent() ==
0) {
site.bo->last_dismantle_time_ = game().get_gametime();
flags_to_be_removed.push_back(site.site->base_flag().get_position());
@@ -1882,7 +1883,7 @@
}
if (site.unoccupied_till_ + 6 * 60 * 1000 < game().get_gametime()
- and site.site->get_statistics_percent() ==
+ && site.site->get_statistics_percent() ==
0) {
// it is possible that there are stones but quary is not able to mine them
site.bo->last_dismantle_time_ = game().get_gametime();
@@ -1897,13 +1898,13 @@
// All other SPACE_CONSUMERS without input and above target_count
if (site.bo->inputs_.empty() // does not consume anything
- and site.bo->production_hint_ ==
+ && site.bo->production_hint_ ==
-1 // not a renewing building (forester...)
- and site.unoccupied_till_ +
+ && site.unoccupied_till_ +
10 * 60 * 1000 <
game().get_gametime() // > 10 minutes old
- and site.site->can_start_working() // building is occupied
- and site.bo->space_consumer_ and not site.bo->plants_trees_) {
+ && site.site->can_start_working() // building is occupied
+ && site.bo->space_consumer_ && !site.bo->plants_trees_) {
// if we have more buildings then target
if (site.bo->cnt_built_ > site.bo->cnt_target_) {
@@ -1913,7 +1914,7 @@
}
if (site.site->get_statistics_percent()<
- 30 and site.bo->stocklevel_> 100) { // production stats == 0%
+ 30 && site.bo->stocklevel_> 100) { // production stats == 0%
site.bo->last_dismantle_time_ = game().get_gametime();
flags_to_be_removed.push_back(site.site->base_flag().get_position());
game().send_player_dismantle(*site.site);
@@ -1933,10 +1934,10 @@
}
// buildings with inputs_, checking if we can a dismantle some due to low performance
- if (!site.bo->inputs_.empty() and(site.bo->cnt_built_ - site.bo->unoccupied_) >=
- 3 and site.site->can_start_working() and site.site->get_statistics_percent() <
- 20 and // statistics for the building
- site.bo->current_stats_<30 and // overall statistics
+ if (!site.bo->inputs_.empty() && (site.bo->cnt_built_ - site.bo->unoccupied_) >=
+ 3 && site.site->can_start_working() && site.site->get_statistics_percent() <
+ 20 && // statistics for the building
+ site.bo->current_stats_<30 && // overall statistics
(game().get_gametime() - site.unoccupied_till_)> 10 *
60 * 1000) {
@@ -1951,10 +1952,10 @@
// first if is only for log, second one is "executive"
if (site.bo->inputs_.size() ==
- 0 and site.bo->production_hint_ <
- 0 and site.site->can_start_working()
- and not site.bo->space_consumer_ and site.site->get_statistics_percent() <
- 10 and((game().get_gametime() - site.built_time_) > 10 * 60 * 1000)) {
+ 0 && site.bo->production_hint_ <
+ 0 && site.site->can_start_working()
+ && !site.bo->space_consumer_ && site.site->get_statistics_percent() <
+ 10 && ((game().get_gametime() - site.built_time_) > 10 * 60 * 1000)) {
site.bo->last_dismantle_time_ = game().get_gametime();
flags_to_be_removed.push_back(site.site->base_flag().get_position());
@@ -1974,7 +1975,7 @@
uint16_t score = site.bo->stocklevel_;
- if (score > 150 and site.bo->cnt_built_ > site.bo->cnt_target_) {
+ if (score > 150 && site.bo->cnt_built_ > site.bo->cnt_target_) {
site.bo->last_dismantle_time_ = game().get_gametime();
flags_to_be_removed.push_back(site.site->base_flag().get_position());
@@ -1982,12 +1983,12 @@
return true;
}
- if (score > 70 and not site.site->is_stopped()) {
+ if (score > 70 && !site.site->is_stopped()) {
game().send_player_start_stop_building(*site.site);
}
- if (score < 50 and site.site->is_stopped()) {
+ if (score < 50 && site.site->is_stopped()) {
game().send_player_start_stop_building(*site.site);
}
@@ -2025,9 +2026,9 @@
{
// forcing first upgrade
if ((en_bo.cnt_under_construction_ + en_bo.cnt_built_ + en_bo.unoccupied_) == 0
- and(site.bo->cnt_built_ - site.bo->unoccupied_) >= 1
- and(game().get_gametime() - site.unoccupied_till_) > 30 * 60 * 1000
- and !mines_.empty())
+ && (site.bo->cnt_built_ - site.bo->unoccupied_) >= 1
+ && (game().get_gametime() - site.unoccupied_till_) > 30 * 60 * 1000
+ && !mines_.empty())
{
game().send_player_enhance_building(*site.site, enhancement);
return true;
@@ -2039,11 +2040,11 @@
// now, let consider normal upgrade
// do not upgrade if candidate production % is too low
if ((en_bo.cnt_built_ - en_bo.unoccupied_) != 0
- or(en_bo.cnt_under_construction_ + en_bo.unoccupied_) <= 0
- or en_bo.current_stats_ >= 50) {
+ || (en_bo.cnt_under_construction_ + en_bo.unoccupied_) <= 0
+ || en_bo.current_stats_ >= 50) {
if (en_bo.current_stats_ > 65
- and ((en_bo.current_stats_ - site.bo->current_stats_) + // priority for enhancement
+ && ((en_bo.current_stats_ - site.bo->current_stats_) + // priority for enhancement
(en_bo.current_stats_ - 65)) > 0)
{
enbld = enhancement;
@@ -2085,7 +2086,7 @@
// first get rid of mines that are missing workers for some time (5 minutes)
// released worker (if any) can be usefull elsewhere !
- if (site.built_time_ + 5 * 60 * 1000 < gametime and not site.site->can_start_working()) {
+ if (site.built_time_ + 5 * 60 * 1000 < gametime && !site.site->can_start_working()) {
flags_to_be_removed.push_back(site.site->base_flag().get_position());
game().send_player_dismantle(*site.site);
return true;
@@ -2123,7 +2124,7 @@
if (en_bo.unoccupied_ + en_bo.cnt_under_construction_ <= 0)
{
// do not upgrade target building are not working properly (probably do not have food)
- if (en_bo.cnt_built_ <= 0 and en_bo.current_stats_ >= 60)
+ if (en_bo.cnt_built_ <= 0 && en_bo.current_stats_ >= 60)
{
// do not build the same building so soon (kind of duplicity check)
if (gametime - en_bo.construction_decision_time_ >= kBuildingMinInterval)
@@ -2258,8 +2259,8 @@
update_buildable_field(bf, vision, true);
const int32_t size_penalty = ms->get_size() - 1;
- if (bf.military_capacity_ > 9 and bf.military_presence_ >
- 3 and bf.military_loneliness_<160 and bf.military_stationed_>(2 + size_penalty)) {
+ if (bf.military_capacity_ > 9 && bf.military_presence_ >
+ 3 && bf.military_loneliness_<160 && bf.military_stationed_>(2 + size_penalty)) {
if (ms->get_playercaps() & Widelands::Building::PCap_Dismantle) {
flags_to_be_removed.push_back(ms->base_flag().get_position());
@@ -2315,7 +2316,7 @@
// NOTE take care about the type of computer player_. The more
// NOTE aggressive a computer player_ is, the more important is
// NOTE this check. So we add \var type as bonus.
- if (bf.enemy_nearby_ and prio > 0)
+ if (bf.enemy_nearby_ && prio > 0)
prio /= (3 + type_);
return prio;
@@ -2380,7 +2381,7 @@
void DefaultAI::consider_productionsite_influence(BuildableField& field,
Coords coords,
const BuildingObserver& bo) {
- if (bo.space_consumer_ and game().map().calc_distance(coords, field.coords) < 4)
+ if (bo.space_consumer_ && game().map().calc_distance(coords, field.coords) < 4)
++field.space_consumers_nearby_;
for (size_t i = 0; i < bo.inputs_.size(); ++i)
@@ -2627,7 +2628,7 @@
}
- if (not any_attackable) {
+ if (!any_attackable) {
next_attack_consideration_due_ = 120 * 1000 + (gametime % 30 + 2) * 1000 + gametime;
return false;
}
@@ -2638,7 +2639,7 @@
Map& map = game().map();
uint16_t position = 0;
- for (uint32_t i = 0; i < attempts && not any_attacked; ++i) {
+ for (uint32_t i = 0; i < attempts && !any_attacked; ++i) {
position = (game().get_gametime() + (3 * i)) % militarysites.size();
// picking random military sites
@@ -2661,7 +2662,7 @@
// uint8_t retreat = ms->owner().get_retreat_percentage();
// skipping if based on "enemies nearby" there are probably no enemies nearby
- if (not mso->enemies_nearby and gametime % 8 > 0) {
+ if (!mso->enemies_nearby && gametime % 8 > 0) {
continue; // go on with next attempt
}
@@ -2680,7 +2681,7 @@
mso->enemies_nearby = true;
- if (not player_attackable[bld->owner().player_number() - 1]) {
+ if (!player_attackable[bld->owner().player_number() - 1]) {
continue;
}
=== modified file 'src/base/md5.h'
--- src/base/md5.h 2014-07-05 16:41:51 +0000
+++ src/base/md5.h 2014-07-25 18:59:12 +0000
@@ -52,7 +52,7 @@
return memcmp(data, o.data, sizeof(data)) == 0;
}
- bool operator!= (const md5_checksum & o) const {return not (*this == o);}
+ bool operator!= (const md5_checksum & o) const {return !(*this == o);}
};
// Note that the implementation of MD5Checksum is basically just
=== modified file 'src/base/point.cc'
--- src/base/point.cc 2014-06-24 20:21:13 +0000
+++ src/base/point.cc 2014-07-25 18:59:12 +0000
@@ -30,10 +30,10 @@
}
bool Point::operator == (const Point& other) const {
- return x == other.x and y == other.y;
+ return x == other.x && y == other.y;
}
bool Point::operator != (const Point& other) const {
- return not(*this == other);
+ return !(*this == other);
}
Point Point::operator +(const Point& other) const {
=== modified file 'src/economy/cmd_call_economy_balance.cc'
--- src/economy/cmd_call_economy_balance.cc 2014-06-01 18:00:48 +0000
+++ src/economy/cmd_call_economy_balance.cc 2014-07-25 18:59:12 +0000
@@ -68,7 +68,7 @@
GameLogicCommand::Read(fr, egbase, mol);
uint8_t const player_number = fr.Unsigned8();
if (Player * const player = egbase.get_player(player_number)) {
- if (not fr.Unsigned8())
+ if (!fr.Unsigned8())
throw wexception("0 is not allowed here");
uint16_t const economy_number = fr.Unsigned16();
if (economy_number < player->get_nr_economies())
=== modified file 'src/economy/economy.cc'
--- src/economy/economy.cc 2014-07-22 09:54:49 +0000
+++ src/economy/economy.cc 2014-07-25 18:59:12 +0000
@@ -130,7 +130,7 @@
Economy * e = f1.get_economy();
// No economy in the editor.
- if (not e)
+ if (!e)
return;
e->m_split_checks.push_back(std::make_pair(OPtr<Flag>(&f1), OPtr<Flag>(&f2)));
@@ -549,8 +549,8 @@
// window for *this where the options window for e is, to give the user
// some continuity.
if
- (e.m_optionswindow_registry.window and
- not m_optionswindow_registry.window)
+ (e.m_optionswindow_registry.window &&
+ !m_optionswindow_registry.window)
{
m_optionswindow_registry.x = e.m_optionswindow_registry.x;
m_optionswindow_registry.y = e.m_optionswindow_registry.y;
@@ -841,7 +841,7 @@
// Requests for heroes should not trigger the creation of more rookies
if (soldier_level_check)
{
- if (not (req.get_requirements().check(*m_soldier_prototype)))
+ if (!(req.get_requirements().check(*m_soldier_prototype)))
continue;
}
=== modified file 'src/economy/economy_data_packet.cc'
--- src/economy/economy_data_packet.cc 2014-05-11 07:38:01 +0000
+++ src/economy/economy_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -36,7 +36,7 @@
uint16_t const version = fr.Unsigned16();
try {
- if (1 <= version and version <= CURRENT_ECONOMY_VERSION) {
+ if (1 <= version && version <= CURRENT_ECONOMY_VERSION) {
if (2 <= version)
try {
const Tribe_Descr & tribe = m_eco->owner().tribe();
=== modified file 'src/economy/flag.cc'
--- src/economy/flag.cc 2014-07-14 14:40:42 +0000
+++ src/economy/flag.cc 2014-07-25 18:59:12 +0000
@@ -80,7 +80,7 @@
auto should_be_deleted = [&egbase, this](const OPtr<Worker>& r) {
Worker& worker = *r.get(egbase);
Bob::State const* const state = worker.get_state(Worker::taskWaitforcapacity);
- if (not state) {
+ if (!state) {
log("WARNING: worker %u is in the capacity wait queue of flag %u but "
"does not have a waitforcapacity task! Removing from queue.\n",
worker.serial(),
@@ -138,7 +138,7 @@
init(egbase);
- if (road and game)
+ if (road && game)
road->postsplit(*game, *this);
}
@@ -498,7 +498,7 @@
while (!m_capacity_wait.empty()) {
Worker * const w = m_capacity_wait[0].get(game);
m_capacity_wait.erase(m_capacity_wait.begin());
- if (w and w->wakeup_flag_capacity(game, *this))
+ if (w && w->wakeup_flag_capacity(game, *this))
break;
}
}
=== modified file 'src/economy/flag.h'
--- src/economy/flag.h 2014-07-14 14:40:42 +0000
+++ src/economy/flag.h 2014-07-25 18:59:12 +0000
@@ -86,8 +86,8 @@
bool has_road() const {
return
- m_roads[0] or m_roads[1] or m_roads[2] or
- m_roads[3] or m_roads[4] or m_roads[5];
+ m_roads[0] || m_roads[1] || m_roads[2] ||
+ m_roads[3] || m_roads[4] || m_roads[5];
}
Road * get_road(uint8_t const dir) const {return m_roads[dir - 1];}
uint8_t nr_of_roads() const;
=== modified file 'src/economy/fleet.cc'
--- src/economy/fleet.cc 2014-07-22 09:54:49 +0000
+++ src/economy/fleet.cc 2014-07-25 18:59:12 +0000
@@ -204,7 +204,7 @@
*/
void Fleet::merge(Editor_Game_Base & egbase, Fleet * other)
{
- if (m_ports.empty() and not other->m_ports.empty()) {
+ if (m_ports.empty() && !other->m_ports.empty()) {
other->merge(egbase, this);
return;
}
=== modified file 'src/economy/idleworkersupply.cc'
--- src/economy/idleworkersupply.cc 2014-07-14 20:09:27 +0000
+++ src/economy/idleworkersupply.cc 2014-07-25 18:59:12 +0000
@@ -94,7 +94,7 @@
uint32_t IdleWorkerSupply::nr_supplies(const Game &, const Request & req) const
{
assert
- (req.get_type() != wwWORKER or
+ (req.get_type() != wwWORKER ||
req.get_index() < m_worker.descr().tribe().get_nrworkers());
if
(req.get_type() == wwWORKER &&
=== modified file 'src/economy/request.cc'
--- src/economy/request.cc 2014-07-14 10:45:44 +0000
+++ src/economy/request.cc 2014-07-25 18:59:12 +0000
@@ -68,13 +68,13 @@
m_required_interval(0),
m_last_request_time(m_required_time)
{
- assert(m_type == wwWARE or m_type == wwWORKER);
- if (w == wwWARE and _target.owner().tribe().get_nrwares() <= index)
+ assert(m_type == wwWARE || m_type == wwWORKER);
+ if (w == wwWARE && _target.owner().tribe().get_nrwares() <= index)
throw wexception
("creating ware request with index %u, but tribe has only %u "
"ware types",
index, _target.owner().tribe().get_nrwares ());
- if (w == wwWORKER and _target.owner().tribe().get_nrworkers() <= index)
+ if (w == wwWORKER && _target.owner().tribe().get_nrworkers() <= index)
throw wexception
("creating worker request with index %u, but tribe has only %u "
"worker types",
@@ -86,7 +86,7 @@
Request::~Request()
{
// Remove from the economy
- if (is_open() and m_economy)
+ if (is_open() && m_economy)
m_economy->remove_request(*this);
// Cancel all ongoing transfers
@@ -184,10 +184,10 @@
// Target and econmy should be set. Same is true for callback stuff.
- assert(m_type == wwWARE or m_type == wwWORKER);
+ assert(m_type == wwWARE || m_type == wwWORKER);
const Tribe_Descr & tribe = m_target.owner().tribe();
- assert(m_type != wwWARE or m_index < tribe.get_nrwares ());
- assert(m_type != wwWORKER or m_index < tribe.get_nrworkers());
+ assert(m_type != wwWARE || m_index < tribe.get_nrwares ());
+ assert(m_type != wwWORKER || m_index < tribe.get_nrworkers());
fw.CString
(m_type == wwWARE ?
tribe.get_ware_descr (m_index)->name() :
@@ -230,7 +230,7 @@
(Editor_Game_Base & egbase, uint32_t const nr) const
{
if (m_count <= nr) {
- if (not(m_count == 1 and nr == 1)) {
+ if (!(m_count == 1 && nr == 1)) {
log
("Request::get_base_required_time: WARNING nr = %u but count is %u, "
"which is not allowed according to the comment for this function\n",
=== modified file 'src/economy/road.cc'
--- src/economy/road.cc 2014-07-23 14:49:10 +0000
+++ src/economy/road.cc 2014-07-25 18:59:12 +0000
@@ -289,8 +289,8 @@
carrier->set_location (this);
carrier->update_task_road(*game);
} else if
- (not i.current->carrier_request and
- (i.current->carrier_type == 1 or
+ (!i.current->carrier_request &&
+ (i.current->carrier_type == 1 ||
m_type == Road_Busy))
_request_carrier(*i.current);
}
@@ -543,8 +543,8 @@
j.current->carrier = nullptr;
container_iterate(SlotVector, newroad.m_carrier_slots, k)
if
- (not k.current->carrier.get(game) and
- not k.current->carrier_request and
+ (!k.current->carrier.get(game) &&
+ !k.current->carrier_request &&
k.current->carrier_type == j.current->carrier_type)
{
k.current->carrier = &ref_cast<Carrier, Worker> (w);
@@ -571,9 +571,9 @@
// work correctly
container_iterate(SlotVector, m_carrier_slots, i)
if
- (not i.current->carrier.get(game) and
- not i.current->carrier_request and
- (i.current->carrier_type == 1 or
+ (!i.current->carrier.get(game) &&
+ !i.current->carrier_request &&
+ (i.current->carrier_type == 1 ||
m_type == Road_Busy))
_request_carrier(*i.current);
@@ -639,8 +639,8 @@
_mark_map(game);
container_iterate(SlotVector, m_carrier_slots, i)
if
- (not i.current->carrier.get(game) and
- not i.current->carrier_request and
+ (!i.current->carrier.get(game) &&
+ !i.current->carrier_request &&
i.current->carrier_type != 1)
_request_carrier(*i.current);
}
=== modified file 'src/economy/transfer.cc'
--- src/economy/transfer.cc 2014-07-03 19:26:30 +0000
+++ src/economy/transfer.cc 2014-07-25 18:59:12 +0000
@@ -224,7 +224,7 @@
assert(&m_route.get_flag(m_game, 0) == location);
// special rule to get wares into buildings
- if (m_ware and m_route.get_nrsteps() == 1)
+ if (m_ware && m_route.get_nrsteps() == 1)
if (dynamic_cast<Building const *>(destination)) {
assert(&m_route.get_flag(m_game, 1) == &destflag);
=== modified file 'src/economy/ware_instance.cc'
--- src/economy/ware_instance.cc 2014-07-23 14:49:10 +0000
+++ src/economy/ware_instance.cc 2014-07-25 18:59:12 +0000
@@ -230,7 +230,7 @@
*/
void WareInstance::set_economy(Economy * const e)
{
- if (m_descr_index == INVALID_INDEX or m_economy == e)
+ if (m_descr_index == INVALID_INDEX || m_economy == e)
return;
if (m_economy)
=== modified file 'src/economy/wares_queue.cc'
--- src/economy/wares_queue.cc 2014-07-22 09:54:49 +0000
+++ src/economy/wares_queue.cc 2014-07-25 18:59:12 +0000
@@ -258,7 +258,7 @@
{
uint16_t const packet_version = fr.Unsigned16();
try {
- if (packet_version == WARES_QUEUE_DATA_PACKET_VERSION or packet_version == 1) {
+ if (packet_version == WARES_QUEUE_DATA_PACKET_VERSION || packet_version == 1) {
delete m_request;
m_ware = owner().tribe().ware_index(fr.CString ());
m_max_size = fr.Unsigned32();
=== modified file 'src/editor/editorinteractive.cc'
--- src/editor/editorinteractive.cc 2014-07-22 09:54:49 +0000
+++ src/editor/editorinteractive.cc 2014-07-25 18:59:12 +0000
@@ -185,7 +185,7 @@
m_history.reset();
std::unique_ptr<Widelands::Map_Loader> ml(map.get_correct_loader(filename));
- if (not ml.get())
+ if (!ml.get())
throw warning
(_("Unsupported format"),
_("Widelands could not load the file \"%s\". The file format seems to be incompatible."),
@@ -300,7 +300,7 @@
tools.current().operates_on_triangles() ?
sel.triangle != get_sel_pos().triangle : sel.node != get_sel_pos().node;
Interactive_Base::set_sel_pos(sel);
- if (target_changed and m_left_mouse_button_is_down)
+ if (target_changed && m_left_mouse_button_is_down)
map_clicked(true);
}
@@ -500,7 +500,7 @@
void Editor_Interactive::select_tool
(Editor_Tool & primary, Editor_Tool::Tool_Index const which) {
- if (which == Editor_Tool::First and & primary != tools.current_pointer) {
+ if (which == Editor_Tool::First && & primary != tools.current_pointer) {
if (primary.has_size_one())
set_sel_radius_and_update_menu(0);
Widelands::Map & map = egbase().map();
@@ -548,7 +548,7 @@
references.end();
if (player) {
for (; it < references_end; ++it)
- if (it->player == player and it->object == data) {
+ if (it->player == player && it->object == data) {
references.erase(it);
break;
}
=== modified file 'src/editor/map_generator.cc'
--- src/editor/map_generator.cc 2014-07-22 09:54:49 +0000
+++ src/editor/map_generator.cc 2014-07-25 18:59:12 +0000
@@ -80,7 +80,7 @@
const MapGenBobCategory * bobCategory = landResource.getBobCategory(terrType);
- if (not bobCategory) // no bobs defined here...
+ if (!bobCategory) // no bobs defined here...
return;
uint32_t immovDens = landResource.getImmovableDensity();
@@ -100,14 +100,14 @@
// Set bob according to bob area
- if (set_immovable and (num = bobCategory->num_immovables()))
+ if (set_immovable && (num = bobCategory->num_immovables()))
egbase_.create_immovable
(fc,
bobCategory->get_immovable
(static_cast<size_t>(rng.rand() / (kMaxElevation / num))),
nullptr);
- if (set_moveable and (num = bobCategory->num_critters()))
+ if (set_moveable && (num = bobCategory->num_critters()))
egbase_.create_bob
(fc,
egbase_.world().get_bob
@@ -286,7 +286,7 @@
for (uint32_t x = 0; x < w; x += 16)
for (uint32_t y = 0; y < h; y += 16) {
values[x + y * w] = rng.rand();
- if (x % 32 or y % 32) {
+ if (x % 32 || y % 32) {
values[x + y * w] += kAverageElevation;
values[x + y * w] /= 2;
}
=== modified file 'src/editor/tools/editor_history.cc'
--- src/editor/tools/editor_history.cc 2014-03-01 17:09:07 +0000
+++ src/editor/tools/editor_history.cc 2014-07-25 18:59:12 +0000
@@ -38,7 +38,7 @@
Editor_Action_Args::~Editor_Action_Args()
{
- while (not draw_actions.empty()) {
+ while (!draw_actions.empty()) {
delete draw_actions.back();
draw_actions.pop_back();
}
@@ -105,7 +105,7 @@
map, center, parent, tool.format_args(ind, parent));
if (draw && tool.is_unduable()) {
if
- (undo_stack.empty() or
+ (undo_stack.empty() ||
undo_stack.front().tool.get_sel_impl() != std::string(m_draw_tool.get_sel_impl()))
{
Editor_Tool_Action da
@@ -113,7 +113,7 @@
map, center, parent,
m_draw_tool.format_args(Editor_Tool::First, parent));
- if (not undo_stack.empty()) {
+ if (!undo_stack.empty()) {
m_draw_tool.add_action(undo_stack.front(), *da.args);
undo_stack.pop_front();
}
=== modified file 'src/editor/tools/editor_increase_resources_tool.cc'
--- src/editor/tools/editor_increase_resources_tool.cc 2014-06-05 05:40:53 +0000
+++ src/editor/tools/editor_increase_resources_tool.cc 2014-07-25 18:59:12 +0000
@@ -108,8 +108,8 @@
args.orgRes.push_back(mr.location().field->get_resources_amount());
if
- ((res == args.cur_res or not mr.location().field->get_resources_amount())
- and
+ ((res == args.cur_res || !mr.location().field->get_resources_amount())
+ &&
Editor_Change_Resource_Tool_Callback(mr.location(), map, world, args.cur_res))
{
// Ok, we're doing something. First remove the current overlays.
@@ -119,7 +119,7 @@
(mr.location().field->get_resources_amount()));
overlay_manager.remove_overlay(mr.location(), pic);
- if (not amount) {
+ if (!amount) {
mr.location().field->set_resources(0, 0);
mr.location().field->set_starting_res_amount(0);
} else {
=== modified file 'src/editor/tools/editor_place_bob_tool.cc'
--- src/editor/tools/editor_place_bob_tool.cc 2014-04-01 17:30:12 +0000
+++ src/editor/tools/editor_place_bob_tool.cc 2014-07-25 18:59:12 +0000
@@ -48,7 +48,7 @@
} while (mr.advance(map));
}
- if (not args.nbob_type.empty()) {
+ if (!args.nbob_type.empty()) {
Widelands::Editor_Game_Base & egbase = parent.egbase();
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
@@ -75,7 +75,7 @@
Widelands::Node_and_Triangle<Widelands::Coords> center,
Editor_Interactive& parent,
Editor_Action_Args& args) {
- if (not args.nbob_type.empty()) {
+ if (!args.nbob_type.empty()) {
Widelands::Editor_Game_Base & egbase = parent.egbase();
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
=== modified file 'src/editor/tools/editor_place_immovable_tool.cc'
--- src/editor/tools/editor_place_immovable_tool.cc 2014-07-03 19:26:30 +0000
+++ src/editor/tools/editor_place_immovable_tool.cc 2014-07-25 18:59:12 +0000
@@ -38,7 +38,7 @@
Editor_Interactive& parent,
Editor_Action_Args& args) {
const int32_t radius = args.sel_radius;
- if (not get_nr_enabled())
+ if (!get_nr_enabled())
return radius;
Widelands::Editor_Game_Base & egbase = parent.egbase();
if (args.oimmov_types.empty())
@@ -54,7 +54,7 @@
} while (mr.advance(map));
}
- if (not args.nimmov_types.empty())
+ if (!args.nimmov_types.empty())
{
Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr
(map,
@@ -63,8 +63,8 @@
std::list<int32_t>::iterator i = args.nimmov_types.begin();
do {
if
- (not mr.location().field->get_immovable()
- and
+ (!mr.location().field->get_immovable()
+ &&
(mr.location().field->nodecaps() & Widelands::MOVECAPS_WALK))
egbase.create_immovable(mr.location(), *i, nullptr);
++i;
=== modified file 'src/editor/tools/editor_set_resources_tool.cc'
--- src/editor/tools/editor_set_resources_tool.cc 2014-06-05 05:40:53 +0000
+++ src/editor/tools/editor_set_resources_tool.cc 2014-07-25 18:59:12 +0000
@@ -61,7 +61,7 @@
(world.get_resource(res)->get_editor_pic (mr.location().field->get_resources_amount()));
overlay_manager.remove_overlay(mr.location(), pic);
- if (not amount) {
+ if (!amount) {
mr.location().field->set_resources(0, 0);
mr.location().field->set_starting_res_amount(0);
} else {
@@ -105,7 +105,7 @@
(world.get_resource(res)->get_editor_pic(mr.location().field->get_resources_amount()));
overlay_manager.remove_overlay(mr.location(), pic);
- if (not amount) {
+ if (!amount) {
mr.location().field->set_resources(0, 0);
mr.location().field->set_starting_res_amount(0);
} else {
=== modified file 'src/editor/tools/editor_set_terrain_tool.cc'
--- src/editor/tools/editor_set_terrain_tool.cc 2014-03-01 17:09:07 +0000
+++ src/editor/tools/editor_set_terrain_tool.cc 2014-07-25 18:59:12 +0000
@@ -31,7 +31,7 @@
Editor_Interactive& /* parent */,
Editor_Action_Args& args) {
assert
- (center.triangle.t == TCoords<>::D or center.triangle.t == TCoords<>::R);
+ (center.triangle.t == TCoords<>::D || center.triangle.t == TCoords<>::R);
uint16_t const radius = args.sel_radius;
int32_t max = 0;
@@ -50,7 +50,7 @@
} while (mr.advance(map));
}
- if (not args.terrainType.empty()) {
+ if (!args.terrainType.empty()) {
Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr
(map, Widelands::Area<TCoords<Widelands::FCoords> >
(TCoords<Widelands::FCoords>
@@ -74,9 +74,9 @@
Editor_Interactive& /* parent */,
Editor_Action_Args& args) {
assert
- (center.triangle.t == TCoords<>::D or center.triangle.t == TCoords<>::R);
+ (center.triangle.t == TCoords<>::D || center.triangle.t == TCoords<>::R);
uint16_t const radius = args.sel_radius;
- if (not args.terrainType.empty()) {
+ if (!args.terrainType.empty()) {
int32_t max = 0;
Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr
(map,
=== modified file 'src/editor/ui_menus/categorized_item_selection_menu.h'
--- src/editor/ui_menus/categorized_item_selection_menu.h 2014-07-22 09:54:49 +0000
+++ src/editor/ui_menus/categorized_item_selection_menu.h 2014-07-25 18:59:12 +0000
@@ -145,10 +145,10 @@
// needs is the key state at the time the mouse was clicked. See the
// usage comment for get_key_state.
const bool multiselect = get_key_state(SDLK_LCTRL) | get_key_state(SDLK_RCTRL);
- if (not t and(not multiselect or tool_->get_nr_enabled() == 1))
+ if (!t && (!multiselect || tool_->get_nr_enabled() == 1))
checkboxes_[n]->set_state(true);
else {
- if (not multiselect) {
+ if (!multiselect) {
for (uint32_t i = 0; tool_->get_nr_enabled(); ++i)
tool_->enable(i, false);
// disable all checkboxes
=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.cc'
--- src/editor/ui_menus/editor_main_menu_load_map.cc 2014-06-21 10:24:12 +0000
+++ src/editor/ui_menus/editor_main_menu_load_map.cc 2014-07-25 18:59:12 +0000
@@ -220,10 +220,10 @@
{
const char * const name = pname->c_str();
if
- (strcmp(FileSystem::FS_Filename(name), ".") and
- strcmp(FileSystem::FS_Filename(name), "..") and
- g_fs->IsDirectory(name) and
- not WL_Map_Loader::is_widelands_map(name))
+ (strcmp(FileSystem::FS_Filename(name), ".") &&
+ strcmp(FileSystem::FS_Filename(name), "..") &&
+ g_fs->IsDirectory(name) &&
+ !WL_Map_Loader::is_widelands_map(name))
m_ls->add
(FileSystem::FS_Filename(name),
=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc'
--- src/editor/ui_menus/editor_main_menu_save_map.cc 2014-07-05 14:22:44 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map.cc 2014-07-25 18:59:12 +0000
@@ -172,14 +172,14 @@
fill_list();
} else { // Ok, save this map
Widelands::Map & map = eia().egbase().map();
- if (not strcmp(map.get_name(), _("No Name"))) {
+ if (!strcmp(map.get_name(), _("No Name"))) {
std::string::size_type const filename_size = filename.size();
map.set_name
((4 <= filename_size
- and filename[filename_size - 1] == 'f'
- and filename[filename_size - 2] == 'm'
- and filename[filename_size - 3] == 'w'
- and filename[filename_size - 4] == '.'
+ && filename[filename_size - 1] == 'f'
+ && filename[filename_size - 2] == 'm'
+ && filename[filename_size - 3] == 'w'
+ && filename[filename_size - 4] == '.'
?
filename.substr(0, filename_size - 4) : filename)
.c_str());
@@ -301,10 +301,10 @@
{
const char * const name = pname->c_str();
if
- (strcmp(FileSystem::FS_Filename(name), ".") and
- strcmp(FileSystem::FS_Filename(name), "..") and
- g_fs->IsDirectory(name) and
- not Widelands::WL_Map_Loader::is_widelands_map(name))
+ (strcmp(FileSystem::FS_Filename(name), ".") &&
+ strcmp(FileSystem::FS_Filename(name), "..") &&
+ g_fs->IsDirectory(name) &&
+ !Widelands::WL_Map_Loader::is_widelands_map(name))
m_ls->add
(FileSystem::FS_Filename(name),
@@ -379,7 +379,7 @@
% FileSystem::FS_Filename(filename.c_str())).str();
UI::WLMessageBox mbox
(&eia(), _("Error Saving Map!"), s, UI::WLMessageBox::YESNO);
- if (not mbox.run())
+ if (!mbox.run())
return false;
g_fs->Unlink(complete_filename);
=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
--- src/editor/ui_menus/editor_player_menu.cc 2014-07-22 09:54:49 +0000
+++ src/editor/ui_menus/editor_player_menu.cc 2014-07-25 18:59:12 +0000
@@ -227,7 +227,7 @@
Widelands::Player_Number const nr_players = old_nr_players - 1;
assert(1 <= nr_players);
- if (not menu.is_player_tribe_referenced(old_nr_players)) {
+ if (!menu.is_player_tribe_referenced(old_nr_players)) {
if (const Widelands::Coords sp = map.get_starting_pos(old_nr_players)) {
// Remove starting position marker.
char picsname[] = "pics/editor_player_00_starting_pos.png";
@@ -309,7 +309,7 @@
void Editor_Player_Menu::player_tribe_clicked(uint8_t n) {
Editor_Interactive & menu =
ref_cast<Editor_Interactive, UI::Panel>(*get_parent());
- if (not menu.is_player_tribe_referenced(n + 1)) {
+ if (!menu.is_player_tribe_referenced(n + 1)) {
std::string t = m_plr_set_tribes_buts[n]->get_title();
if (!Widelands::Tribe_Descr::exists_tribe(t))
throw wexception
@@ -412,7 +412,7 @@
const Widelands::Player_Number player_number = p->player_number();
const Widelands::Coords starting_pos = map.get_starting_pos(player_number);
Widelands::BaseImmovable * const imm = map[starting_pos].get_immovable();
- if (not imm) {
+ if (!imm) {
// place HQ
const Widelands::Tribe_Descr & tribe = p->tribe();
const Widelands::Building_Index idx =
=== modified file 'src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc'
--- src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2014-07-20 13:00:05 +0000
+++ src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2014-07-25 18:59:12 +0000
@@ -113,7 +113,7 @@
for (Building_Index i = 0; i < nr_buildings; ++i) {
const Widelands::Building_Descr & building =
*tribe.get_building_descr(i);
- if (not building.is_enhanced() and not building.is_buildable())
+ if (!building.is_enhanced() && !building.is_buildable())
continue;
(m_player.is_building_type_allowed(i) ? m_allowed : m_forbidden).add
(building.descname().c_str(), i, building.get_icon());
=== modified file 'src/editor/ui_menus/editor_tool_place_bob_options_menu.cc'
--- src/editor/ui_menus/editor_tool_place_bob_options_menu.cc 2014-07-22 09:54:49 +0000
+++ src/editor/ui_menus/editor_tool_place_bob_options_menu.cc 2014-07-25 18:59:12 +0000
@@ -125,12 +125,12 @@
// TODO(unknown) usage comment for get_key_state.
const bool multiselect =
get_key_state(SDLK_LCTRL) | get_key_state(SDLK_RCTRL);
- if (not t and (not multiselect or m_pit.get_nr_enabled() == 1)) {
+ if (!t && (!multiselect || m_pit.get_nr_enabled() == 1)) {
m_checkboxes[n]->set_state(true);
return;
}
- if (not multiselect) {
+ if (!multiselect) {
for (uint32_t i = 0; m_pit.get_nr_enabled(); ++i) m_pit.enable(i, false);
// disable all checkboxes
=== modified file 'src/game_io/game_interactive_player_data_packet.cc'
--- src/game_io/game_interactive_player_data_packet.cc 2014-05-11 07:38:01 +0000
+++ src/game_io/game_interactive_player_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -47,7 +47,7 @@
throw game_data_error("Invalid player number: %i.", player_number);
}
- if (not game.get_player(player_number)) {
+ if (!game.get_player(player_number)) {
// This happens if the player, that saved the game, was a spectator
// and the slot for player 1 was not used in the game.
// So now we try to create an InteractivePlayer object for another
=== modified file 'src/game_io/game_map_data_packet.cc'
--- src/game_io/game_map_data_packet.cc 2014-06-11 05:06:42 +0000
+++ src/game_io/game_map_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -37,7 +37,7 @@
void Game_Map_Data_Packet::Read
(FileSystem & fs, Game & game, Map_Map_Object_Loader * const)
{
- if (not fs.FileExists("map") or not fs.IsDirectory("map"))
+ if (!fs.FileExists("map") || !fs.IsDirectory("map"))
throw game_data_error("no map");
// Now Load the map as it would be a normal map saving.
=== modified file 'src/game_io/game_player_economies_data_packet.cc'
--- src/game_io/game_player_economies_data_packet.cc 2014-07-03 19:26:30 +0000
+++ src/game_io/game_player_economies_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -46,7 +46,7 @@
FileRead fr;
fr.Open(fs, "binary/player_economies");
uint16_t const packet_version = fr.Unsigned16();
- if (3 <= packet_version and packet_version <= CURRENT_PACKET_VERSION) {
+ if (3 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) {
iterate_players_existing(p, nr_players, game, player)
try {
Player::Economies & economies = player->m_economies;
=== modified file 'src/game_io/game_player_info_data_packet.cc'
--- src/game_io/game_player_info_data_packet.cc 2014-07-05 14:22:44 +0000
+++ src/game_io/game_player_info_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -40,7 +40,7 @@
FileRead fr;
fr.Open(fs, "binary/player_info");
uint16_t const packet_version = fr.Unsigned16();
- if (5 <= packet_version and packet_version <= CURRENT_PACKET_VERSION) {
+ if (5 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) {
uint32_t const max_players = fr.Unsigned16();
for (uint32_t i = 1; i < max_players + 1; ++i) {
game.remove_player(i);
@@ -48,7 +48,7 @@
bool const see_all = fr.Unsigned8();
int32_t const plnum = fr.Unsigned8();
- if (plnum < 1 or MAX_PLAYERS < plnum)
+ if (plnum < 1 || MAX_PLAYERS < plnum)
throw game_data_error
("player number (%i) is out of range (1 .. %u)",
plnum, MAX_PLAYERS);
=== modified file 'src/graphic/animation.cc'
--- src/graphic/animation.cc 2014-07-22 09:54:49 +0000
+++ src/graphic/animation.cc 2014-07-25 18:59:12 +0000
@@ -272,7 +272,7 @@
if (image_files_.empty())
throw wexception("animation without pictures.");
- if (pc_mask_image_files_.size() and pc_mask_image_files_.size() != image_files_.size())
+ if (pc_mask_image_files_.size() && pc_mask_image_files_.size() != image_files_.size())
throw wexception
("animation has %" PRIuS " frames but playercolor mask has %" PRIuS " frames",
image_files_.size(), pc_mask_image_files_.size());
@@ -280,7 +280,7 @@
for (const std::string& filename : image_files_) {
const Image* image = g_gr->images().get(filename);
if (frames_.size() &&
- (frames_[0]->width() != image->width() or frames_[0]->height() != image->height())) {
+ (frames_[0]->width() != image->width() || frames_[0]->height() != image->height())) {
throw wexception("wrong size: (%u, %u), should be (%u, %u) like the first frame",
image->width(),
image->height(),
@@ -294,8 +294,13 @@
// TODO(unknown) Do not load playercolor mask as opengl texture or use it as
// opengl texture.
const Image* pc_image = g_gr->images().get(filename);
+<<<<<<< TREE
if (frames_[0]->width() != pc_image->width() or frames_[0]->height() != pc_image->height()) {
// TODO(unknown): see bug #1324642
+=======
+ if (frames_[0]->width() != pc_image->width() || frames_[0]->height() != pc_image->height()) {
+ // TODO: see bug #1324642
+>>>>>>> MERGE-SOURCE
throw wexception("playercolor mask has wrong size: (%u, %u), should "
"be (%u, %u) like the animation frame",
pc_image->width(),
=== modified file 'src/graphic/color.cc'
--- src/graphic/color.cc 2014-07-14 10:45:44 +0000
+++ src/graphic/color.cc 2014-07-25 18:59:12 +0000
@@ -34,7 +34,7 @@
}
bool RGBColor::operator == (const RGBColor& other) const {
- return r == other.r and g == other.g and b == other.b;
+ return r == other.r && g == other.g && b == other.b;
}
bool RGBColor::operator != (const RGBColor& other) const {
return !(*this == other);
=== modified file 'src/graphic/font_handler.cc'
--- src/graphic/font_handler.cc 2014-06-01 18:00:48 +0000
+++ src/graphic/font_handler.cc 2014-07-25 18:59:12 +0000
@@ -180,7 +180,7 @@
// Work around an Issue in SDL_TTF that dies when the surface
// has zero width
int width = 0;
- if (TTF_SizeUTF8(font, lce.text.c_str(), &width, nullptr) < 0 or !width) {
+ if (TTF_SizeUTF8(font, lce.text.c_str(), &width, nullptr) < 0 || !width) {
lce.width = 0;
lce.height = TTF_FontHeight(font);
return;
=== modified file 'src/graphic/graphic.cc'
--- src/graphic/graphic.cc 2014-07-22 09:54:49 +0000
+++ src/graphic/graphic.cc 2014-07-25 18:59:12 +0000
@@ -114,7 +114,7 @@
sdlsurface = SDL_SetVideoMode(w, h, 32, flags);
// If we tried opengl and it was not successful try without opengl
- if (!sdlsurface and opengl)
+ if (!sdlsurface && opengl)
{
log("Graphics: Could not set videomode: %s, trying without opengl\n", SDL_GetError());
flags &= ~SDL_OPENGL;
@@ -138,7 +138,7 @@
// setting the videomode was successful. Print some information now
log("Graphics: Setting video mode was successful\n");
- if (opengl and 0 != (sdlsurface->flags & SDL_GL_DOUBLEBUFFER))
+ if (opengl && 0 != (sdlsurface->flags & SDL_GL_DOUBLEBUFFER))
log("Graphics: OPENGL DOUBLE BUFFERING ENABLED\n");
if (0 != (sdlsurface->flags & SDL_FULLSCREEN))
log("Graphics: FULLSCREEN ENABLED\n");
@@ -220,7 +220,7 @@
// extensions will be valid if we ever succeeded in runnning glewInit.
m_caps.gl.tex_power_of_two =
- (m_caps.gl.major_version < 2) and
+ (m_caps.gl.major_version < 2) &&
(strstr(extensions, "GL_ARB_texture_non_power_of_two") == nullptr);
log("Graphics: OpenGL: Textures ");
log
@@ -228,7 +228,7 @@
"may have any size\n");
m_caps.gl.multitexture =
- ((strstr(extensions, "GL_ARB_multitexture") != nullptr) and
+ ((strstr(extensions, "GL_ARB_multitexture") != nullptr) &&
(strstr(extensions, "GL_ARB_texture_env_combine") != nullptr));
log("Graphics: OpenGL: Multitexture capabilities ");
log(m_caps.gl.multitexture ? "sufficient\n" : "insufficient, only basic terrain rendering possible\n");
@@ -443,7 +443,7 @@
return;
}
- if (force or m_update_fullscreen) {
+ if (force || m_update_fullscreen) {
//flip defaults to SDL_UpdateRect(m_surface, 0, 0, 0, 0);
SDL_Flip(m_sdl_screen);
} else
=== modified file 'src/graphic/image_transformations.cc'
--- src/graphic/image_transformations.cc 2014-07-14 10:45:44 +0000
+++ src/graphic/image_transformations.cc 2014-07-25 18:59:12 +0000
@@ -425,7 +425,7 @@
}
const Image* resize(const Image* original, uint16_t w, uint16_t h) {
- if (original->width() == w and original->height() == h)
+ if (original->width() == w && original->height() == h)
return original;
const string new_hash = (boost::format("%s:%i:%i") % original->hash() % w % h).str();
=== modified file 'src/graphic/render/gl_surface_texture.cc'
--- src/graphic/render/gl_surface_texture.cc 2014-06-25 05:42:44 +0000
+++ src/graphic/render/gl_surface_texture.cc 2014-07-25 18:59:12 +0000
@@ -85,9 +85,9 @@
uint8_t bpp = surface->format->BytesPerPixel;
if
- (surface->format->palette or (surface->format->colorkey > 0) or
- m_tex_w != static_cast<uint32_t>(surface->w) or
- m_tex_h != static_cast<uint32_t>(surface->h) or
+ (surface->format->palette || (surface->format->colorkey > 0) ||
+ m_tex_w != static_cast<uint32_t>(surface->w) ||
+ m_tex_h != static_cast<uint32_t>(surface->h) ||
(bpp != 3 && bpp != 4))
{
SDL_Surface * converted = SDL_CreateRGBSurface
@@ -109,7 +109,7 @@
if (bpp == 4) {
if
- (fmt.Rmask == 0x000000ff and fmt.Gmask == 0x0000ff00 and
+ (fmt.Rmask == 0x000000ff && fmt.Gmask == 0x0000ff00 &&
fmt.Bmask == 0x00ff0000)
{
if (fmt.Amask == 0xff000000) {
@@ -121,7 +121,7 @@
glPixelTransferi(GL_ALPHA_BIAS, 1.0f);
}
} else if
- (fmt.Bmask == 0x000000ff and fmt.Gmask == 0x0000ff00 and
+ (fmt.Bmask == 0x000000ff && fmt.Gmask == 0x0000ff00 &&
fmt.Rmask == 0x00ff0000)
{
if (fmt.Amask == 0xff000000) {
@@ -136,12 +136,12 @@
throw wexception("OpenGL: Unknown pixel format");
} else if (bpp == 3) {
if
- (fmt.Rmask == 0x000000ff and fmt.Gmask == 0x0000ff00 and
+ (fmt.Rmask == 0x000000ff && fmt.Gmask == 0x0000ff00 &&
fmt.Bmask == 0x00ff0000)
{
pixels_format = GL_RGB;
} else if
- (fmt.Bmask == 0x000000ff and fmt.Gmask == 0x0000ff00 and
+ (fmt.Bmask == 0x000000ff && fmt.Gmask == 0x0000ff00 &&
fmt.Rmask == 0x00ff0000)
{
pixels_format = GL_BGR;
=== modified file 'src/graphic/render/minimaprenderer.cc'
--- src/graphic/render/minimaprenderer.cc 2014-07-22 09:54:49 +0000
+++ src/graphic/render/minimaprenderer.cc 2014-07-25 18:59:12 +0000
@@ -87,15 +87,15 @@
// * winterland -> orange
if (upcast(PlayerImmovable const, immovable, f.field->get_immovable())) {
- if ((layers & MiniMapLayer::Road) and dynamic_cast<Road const *>(immovable)) {
+ if ((layers & MiniMapLayer::Road) && dynamic_cast<Road const *>(immovable)) {
pixelcolor = blend_color(format, pixelcolor, 255, 255, 255);
}
if
- (((layers & MiniMapLayer::Flag) and dynamic_cast<Flag const *>(immovable))
- or
+ (((layers & MiniMapLayer::Flag) && dynamic_cast<Flag const *>(immovable))
+ ||
((layers & MiniMapLayer::Building)
- and
+ &&
dynamic_cast<Widelands::Building const *>(immovable)))
{
pixelcolor = SDL_MapRGB(&const_cast<SDL_PixelFormat&>(format), 255, 255, 255);
@@ -187,7 +187,7 @@
uint32_t modx = pbottomright.x % 2;
uint32_t mody = pbottomright.y % 2;
- if (not player or player->see_all()) {
+ if (!player || player->see_all()) {
for (uint32_t y = 0; y < surface_h; ++y) {
uint8_t * pix = pixels + y * pitch;
Widelands::FCoords f
=== modified file 'src/graphic/render/terrain_sdl.h'
--- src/graphic/render/terrain_sdl.h 2014-07-23 14:49:10 +0000
+++ src/graphic/render/terrain_sdl.h 2014-07-25 18:59:12 +0000
@@ -540,7 +540,7 @@
continue;
for (int32_t i = 0, y = (centery >> 16) - 2; i < 5; ++i, ++y)
- if (0 < y and y < dsth)
+ if (0 < y && y < dsth)
reinterpret_cast<T *>
(static_cast<uint8_t *>(dst.get_pixels()) + y * dst.get_pitch())
[x]
@@ -567,7 +567,7 @@
continue;
for (int32_t i = 0, x = (centerx >> 16) - 2; i < 5; ++i, ++x)
- if (0 < x and x < dstw)
+ if (0 < x && x < dstw)
reinterpret_cast<T *>
(static_cast<uint8_t *>(dst.get_pixels()) + y * dst.get_pitch())
[x]
@@ -604,7 +604,7 @@
uint8_t road;
road = (roads >> Widelands::Road_East) & Widelands::Road_Mask;
- if (-128 < f_vert.b or -128 < r_vert.b) {
+ if (-128 < f_vert.b || -128 < r_vert.b) {
if (road) {
switch (road) {
case Widelands::Road_Normal:
@@ -623,7 +623,7 @@
}
road = (roads >> Widelands::Road_SouthEast) & Widelands::Road_Mask;
- if (-128 < f_vert.b or -128 < br_vert.b) {
+ if (-128 < f_vert.b || -128 < br_vert.b) {
if (road) {
switch (road) {
case Widelands::Road_Normal:
@@ -642,7 +642,7 @@
}
road = (roads >> Widelands::Road_SouthWest) & Widelands::Road_Mask;
- if (-128 < f_vert.b or -128 < bl_vert.b) {
+ if (-128 < f_vert.b || -128 < bl_vert.b) {
if (road) {
switch (road) {
case Widelands::Road_Normal:
=== modified file 'src/graphic/rendertarget.cc'
--- src/graphic/rendertarget.cc 2014-07-23 14:49:10 +0000
+++ src/graphic/rendertarget.cc 2014-07-25 18:59:12 +0000
@@ -367,7 +367,7 @@
r.x += m_rect.x;
r.y += m_rect.y;
- return r.w and r.h;
+ return r.w && r.h;
}
/**
=== modified file 'src/graphic/text/rt_parse.cc'
--- src/graphic/text/rt_parse.cc 2014-07-14 10:45:44 +0000
+++ src/graphic/text/rt_parse.cc 2014-07-25 18:59:12 +0000
@@ -50,7 +50,7 @@
}
bool Attr::get_bool() const {
- if (m_value == "true" or m_value == "1" or m_value == "yes")
+ if (m_value == "true" || m_value == "1" || m_value == "yes")
return true;
return false;
}
@@ -132,13 +132,13 @@
TagConstraint tc = tcs[m_name];
for (;;) {
- if (not tc.text_allowed)
+ if (!tc.text_allowed)
ts.skip_ws();
size_t line = ts.line(), col = ts.col();
std::string text = ts.till_any("<");
if (text != "") {
- if (not tc.text_allowed)
+ if (!tc.text_allowed)
throw SyntaxError_Impl(line, col, "no text, as only tags are allowed here", text, ts.peek(100));
m_childs.push_back(new Child(text));
}
@@ -151,7 +151,7 @@
child->parse(ts, tcs, allowed_tags);
if (!tc.allowed_childs.count(child->name()))
throw SyntaxError_Impl(line, col, "an allowed tag", child->name(), ts.peek(100, cpos));
- if (!allowed_tags.empty() and !allowed_tags.count(child->name()))
+ if (!allowed_tags.empty() && !allowed_tags.count(child->name()))
throw SyntaxError_Impl(line, col, "an allowed tag", child->name(), ts.peek(100, cpos));
m_childs.push_back(new Child(child));
=== modified file 'src/graphic/text/sdl_ttf_font.cc'
--- src/graphic/text/sdl_ttf_font.cc 2014-07-14 10:45:44 +0000
+++ src/graphic/text/sdl_ttf_font.cc 2014-07-25 18:59:12 +0000
@@ -115,7 +115,7 @@
} else
text_surface = TTF_RenderUTF8_Blended(font_, txt.c_str(), sdlclr);
- if (not text_surface)
+ if (!text_surface)
throw RenderError((format("Rendering '%s' gave the error: %s") % txt % TTF_GetError()).str());
return *surface_cache->insert(hash, Surface::create(text_surface), true);
=== modified file 'src/graphic/text/test/render_richtext.cc'
--- src/graphic/text/test/render_richtext.cc 2014-07-01 07:12:55 +0000
+++ src/graphic/text/test/render_richtext.cc 2014-07-25 18:59:12 +0000
@@ -41,7 +41,7 @@
std::string read_stdin() {
std::string txt;
- while (not std::cin.eof()) {
+ while (!std::cin.eof()) {
std::string line;
getline(std::cin, line);
txt += line + "\n";
=== modified file 'src/graphic/text/textstream.cc'
--- src/graphic/text/textstream.cc 2013-07-26 20:19:36 +0000
+++ src/graphic/text/textstream.cc 2014-07-25 18:59:12 +0000
@@ -53,11 +53,11 @@
* r* means skip_ws starting from the back of the string
*/
void TextStream::skip_ws() {
- while (m_i < m_end and isspace(m_t[m_i]))
+ while (m_i < m_end && isspace(m_t[m_i]))
m_consume(1);
}
void TextStream::rskip_ws() {
- while (m_i < m_end and isspace(m_t[m_end - 1]))
+ while (m_i < m_end && isspace(m_t[m_end - 1]))
--m_end;
}
@@ -133,7 +133,7 @@
*/
string TextStream::parse_string() {
string delim = peek(1);
- if (delim == "'" or delim == "\"") {
+ if (delim == "'" || delim == "\"") {
m_consume(1);
string rv = till_any(delim);
m_consume(1);
=== modified file 'src/graphic/text_parser.cc'
--- src/graphic/text_parser.cc 2014-07-05 14:22:44 +0000
+++ src/graphic/text_parser.cc 2014-07-25 18:59:12 +0000
@@ -181,7 +181,7 @@
}
block.erase(0, block_start.size());
- if (block.size() and *block.begin() == ' ')
+ if (block.size() && *block.begin() == ' ')
block.erase(0, 1);
const std::string::size_type format_end_pos = block.find(format_end);
=== modified file 'src/io/fileread.cc'
--- src/io/fileread.cc 2014-06-18 14:23:22 +0000
+++ src/io/fileread.cc 2014-07-25 18:59:12 +0000
@@ -71,7 +71,7 @@
size_t FileRead::Data(void* dst, size_t bufsize) {
assert(data_);
size_t read = 0;
- for (; read < bufsize and filepos_ < length_; ++read, ++filepos_) {
+ for (; read < bufsize && filepos_ < length_; ++read, ++filepos_) {
static_cast<char*>(dst)[read] = data_[filepos_];
}
return read;
@@ -114,7 +114,7 @@
if (EndOfFile())
return nullptr;
char* result = data_ + filepos_;
- for (; data_[filepos_] and data_[filepos_] != '\n'; ++filepos_)
+ for (; data_[filepos_] && data_[filepos_] != '\n'; ++filepos_)
if (data_[filepos_] == '\r') {
data_[filepos_] = '\0';
++filepos_;
=== modified file 'src/io/filesystem/disk_filesystem.cc'
--- src/io/filesystem/disk_filesystem.cc 2014-07-23 14:49:10 +0000
+++ src/io/filesystem/disk_filesystem.cc 2014-07-25 18:59:12 +0000
@@ -60,7 +60,7 @@
struct stat st;
m_exists = (stat(c_str(), &st) != -1);
- m_isDirectory = m_exists and S_ISDIR(st.st_mode);
+ m_isDirectory = m_exists && S_ISDIR(st.st_mode);
}
};
@@ -291,7 +291,7 @@
it = dirname.find(m_filesep, it);
FileSystemPath fspath(FS_CanonicalizeName(dirname.substr(0, it)));
- if (fspath.m_exists and !fspath.m_isDirectory)
+ if (fspath.m_exists && !fspath.m_isDirectory)
throw wexception
("%s exists and is not a directory",
dirname.substr(0, it).c_str());
@@ -353,7 +353,7 @@
try {
file = fopen(fullname.c_str(), "rb");
- if (not file)
+ if (!file)
throw File_error("RealFSImpl::Load", fullname.c_str());
// determine the size of the file (rather quirky, but it doesn't require
@@ -374,7 +374,7 @@
// allocate a buffer and read the entire file into it
data = malloc(size + 1); // TODO(unknown) memory leak!
int result = fread(data, size, 1, file);
- if (size and (result != 1)) {
+ if (size && (result != 1)) {
throw wexception
("RealFSImpl::Load: read failed for %s (%s) with size %" PRIuS "",
fname.c_str(), fullname.c_str(), size);
@@ -416,7 +416,7 @@
size_t const c = fwrite(data, length, 1, f);
fclose(f);
- if (length and c != 1) // data might be 0 blocks long
+ if (length && c != 1) // data might be 0 blocks long
throw wexception
("Write to %s (%s) failed", fname.c_str(), fullname.c_str());
}
=== modified file 'src/io/filesystem/filesystem.cc'
--- src/io/filesystem/filesystem.cc 2014-07-23 14:49:10 +0000
+++ src/io/filesystem/filesystem.cc 2014-07-25 18:59:12 +0000
@@ -161,7 +161,7 @@
// their own "standards"?
#define TRY_USE_AS_HOMEDIR(name) \
homedir = getenv(name); \
- if (homedir.size() and check_writeable_for_data(homedir.c_str())) \
+ if (homedir.size() && check_writeable_for_data(homedir.c_str())) \
return homedir; \
TRY_USE_AS_HOMEDIR("USERPROFILE");
=== modified file 'src/io/filesystem/layered_filesystem.cc'
--- src/io/filesystem/layered_filesystem.cc 2014-07-23 14:49:10 +0000
+++ src/io/filesystem/layered_filesystem.cc 2014-07-25 18:59:12 +0000
@@ -103,7 +103,7 @@
* Returns true if the file can be found in at least one of the sub-filesystems
*/
bool LayeredFileSystem::FileExists(const std::string & path) {
- if (m_home and m_home->FileExists(path))
+ if (m_home && m_home->FileExists(path))
return true;
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
if ((*it)->FileExists(path))
@@ -117,7 +117,7 @@
*/
// TODO(unknown): What if it's a file in some and a dir in others?????
bool LayeredFileSystem::IsDirectory(const std::string & path) {
- if (m_home and m_home->IsDirectory(path))
+ if (m_home && m_home->IsDirectory(path))
return true;
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
@@ -153,7 +153,7 @@
void LayeredFileSystem::Write
(const std::string & fname, void const * const data, int32_t const length)
{
- if (m_home and m_home->IsWritable())
+ if (m_home && m_home->IsWritable())
return m_home->Write(fname, data, length);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
@@ -225,11 +225,11 @@
*/
FileSystem * LayeredFileSystem::MakeSubFileSystem(const std::string & dirname)
{
- if (m_home and m_home->IsWritable() and m_home->FileExists(dirname))
+ if (m_home && m_home->IsWritable() && m_home->FileExists(dirname))
return m_home->MakeSubFileSystem(dirname);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable() and (*it)->FileExists(dirname))
+ if ((*it)->IsWritable() && (*it)->FileExists(dirname))
return (*it)->MakeSubFileSystem(dirname);
throw wexception("LayeredFileSystem: unable to create sub filesystem");
@@ -240,11 +240,11 @@
*/
FileSystem * LayeredFileSystem::CreateSubFileSystem(const std::string & dirname, Type const type)
{
- if (m_home and m_home->IsWritable() and not m_home->FileExists(dirname))
+ if (m_home && m_home->IsWritable() && !m_home->FileExists(dirname))
return m_home->CreateSubFileSystem(dirname, type);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable() and not (*it)->FileExists(dirname))
+ if ((*it)->IsWritable() && !(*it)->FileExists(dirname))
return (*it)->CreateSubFileSystem(dirname, type);
throw wexception("LayeredFileSystem: unable to create sub filesystem");
@@ -257,12 +257,12 @@
if (!FileExists(file))
return;
- if (m_home and m_home->IsWritable() and m_home->FileExists(file)) {
+ if (m_home && m_home->IsWritable() && m_home->FileExists(file)) {
m_home->Unlink(file);
return;
}
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable() and (*it)->FileExists(file)) {
+ if ((*it)->IsWritable() && (*it)->FileExists(file)) {
(*it)->Unlink(file);
return;
}
@@ -273,12 +273,12 @@
{
if (!FileExists(old_name))
return;
- if (m_home and m_home->IsWritable() and m_home->FileExists(old_name)) {
+ if (m_home && m_home->IsWritable() && m_home->FileExists(old_name)) {
m_home->Rename(old_name, new_name);
return;
}
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable() and (*it)->FileExists(old_name)) {
+ if ((*it)->IsWritable() && (*it)->FileExists(old_name)) {
(*it)->Rename(old_name, new_name);
return;
}
=== modified file 'src/io/filesystem/zip_filesystem.cc'
--- src/io/filesystem/zip_filesystem.cc 2014-07-23 14:49:10 +0000
+++ src/io/filesystem/zip_filesystem.cc 2014-07-25 18:59:12 +0000
@@ -341,7 +341,7 @@
unzCloseCurrentFile(m_unzipfile);
void * const result = malloc(totallen + 1);
- if (not result)
+ if (!result)
throw std::bad_alloc();
unzOpenCurrentFile(m_unzipfile);
unzReadCurrentFile(m_unzipfile, result, totallen);
=== modified file 'src/io/filewrite.cc'
--- src/io/filewrite.cc 2014-07-14 10:45:44 +0000
+++ src/io/filewrite.cc 2014-07-25 18:59:12 +0000
@@ -55,7 +55,7 @@
}
void FileWrite::Data(const void* const src, const size_t size, Pos const pos = Pos::Null()) {
- assert(data_ or not length_);
+ assert(data_ || !length_);
Pos i = pos;
if (pos.isNull()) {
=== modified file 'src/logic/battle.cc'
--- src/logic/battle.cc 2014-07-22 09:54:49 +0000
+++ src/logic/battle.cc 2014-07-25 18:59:12 +0000
@@ -68,7 +68,7 @@
}
// Ensures only live soldiers eganges in a battle
- assert(First.get_current_hitpoints() and Second.get_current_hitpoints());
+ assert(First.get_current_hitpoints() && Second.get_current_hitpoints());
init(game);
}
@@ -133,7 +133,7 @@
Soldier * Battle::opponent(Soldier& soldier)
{
- assert(m_first == &soldier or m_second == &soldier);
+ assert(m_first == &soldier || m_second == &soldier);
Soldier* other_soldier = m_first == &soldier ? m_second : m_first;
return other_soldier;
}
@@ -148,7 +148,7 @@
// Identify what soldier is calling the routine
uint8_t const this_soldier_is = &soldier == m_first ? 1 : 2;
- assert(m_first->getBattle() == this or m_second->getBattle() == this);
+ assert(m_first->getBattle() == this || m_second->getBattle() == this);
// Created this three 'states' of the battle:
// *First time entered, one enters :
@@ -159,12 +159,12 @@
// roundFighted, reset m_readyflags
bool const oneReadyToFight = (m_readyflags == 0);
bool const roundFighted = (m_readyflags == 3);
- bool const bothReadyToFight = ((this_soldier_is | m_readyflags) == 3) and
+ bool const bothReadyToFight = ((this_soldier_is | m_readyflags) == 3) &&
(!roundFighted);
std::string what_anim;
// Apply pending damage
- if (m_damage and oneReadyToFight) {
+ if (m_damage && oneReadyToFight) {
// Current attacker is last defender, so damage goes to current attacker
if (m_first_strikes)
m_first ->damage(m_damage);
@@ -183,7 +183,7 @@
return schedule_destroy(game);
}
- if (!m_first or !m_second)
+ if (!m_first || !m_second)
return soldier.skip_act();
// So both soldiers are alive; are we ready to trade the next blow?
@@ -216,8 +216,8 @@
// Time for one of us to hurt the other. Which one is on turn is decided
// by calculateRound.
assert
- ((m_readyflags == 1 and this_soldier_is == 2) or
- (m_readyflags == 2 and this_soldier_is == 1));
+ ((m_readyflags == 1 && this_soldier_is == 2) ||
+ (m_readyflags == 2 && this_soldier_is == 1));
// Both are now ready, mark flags, so our opponent can get new animation
m_readyflags = 3;
=== modified file 'src/logic/bill_of_materials.h'
--- src/logic/bill_of_materials.h 2014-07-05 16:41:51 +0000
+++ src/logic/bill_of_materials.h 2014-07-25 18:59:12 +0000
@@ -37,7 +37,7 @@
++i; ++current; return *this;
}
bool empty() const {return current == end;}
- operator bool() const {return not empty();}
+ operator bool() const {return !empty();}
uint8_t i;
BillOfMaterials::const_iterator current;
=== modified file 'src/logic/bob.cc'
--- src/logic/bob.cc 2014-07-15 10:02:22 +0000
+++ src/logic/bob.cc 2014-07-25 18:59:12 +0000
@@ -260,7 +260,7 @@
*/
void Bob::push_task(Game & game, const Task & task, uint32_t const tdelta)
{
- assert(not task.unique or not get_state(task));
+ assert(!task.unique || !get_state(task));
assert(m_in_act || m_stack.empty());
m_stack.push_back(State(&task));
@@ -707,7 +707,7 @@
if
(state.ivar2
- and
+ &&
static_cast<Path::Step_Vector::size_type>(state.ivar1) + 1
==
path->get_nsteps())
@@ -891,7 +891,7 @@
// Always call checkNodeBlocked, because it might communicate with other
// bobs (as is the case for soldiers on the battlefield).
- if (checkNodeBlocked(game, newnode, true) and !force)
+ if (checkNodeBlocked(game, newnode, true) && !force)
return -2;
// Move is go
=== modified file 'src/logic/buildcost.cc'
--- src/logic/buildcost.cc 2014-06-01 18:00:48 +0000
+++ src/logic/buildcost.cc 2014-07-25 18:59:12 +0000
@@ -38,7 +38,7 @@
("a buildcost item of this ware type has already been "
"defined");
int32_t const value = val->get_int();
- if (value < 1 or 255 < value)
+ if (value < 1 || 255 < value)
throw wexception("count is out of range 1 .. 255");
insert(std::pair<Ware_Index, uint8_t>(idx, value));
} else
=== modified file 'src/logic/building.cc'
--- src/logic/building.cc 2014-07-24 05:21:20 +0000
+++ src/logic/building.cc 2014-07-25 18:59:12 +0000
@@ -90,7 +90,7 @@
}
m_helptext_script = directory + "/help.lua";
- if (not g_fs->FileExists(m_helptext_script))
+ if (!g_fs->FileExists(m_helptext_script))
m_helptext_script = "";
// Parse build options
@@ -293,7 +293,7 @@
}
Bob::State const* const state = worker.get_state(Worker::taskLeavebuilding);
- if (not state) {
+ if (!state) {
log
("WARNING: worker %u is in the leave queue of building %u but "
"does not have a leavebuilding task! Removing from queue.\n",
@@ -341,7 +341,7 @@
const Building_Descr & tmp_descr = descr();
if (tmp_descr.is_destructible()) {
caps |= PCap_Bulldoze;
- if (tmp_descr.is_buildable() or tmp_descr.is_enhanced())
+ if (tmp_descr.is_buildable() || tmp_descr.is_enhanced())
caps |= PCap_Dismantle;
}
if (tmp_descr.enhancement() != INVALID_INDEX)
@@ -388,7 +388,7 @@
map.get_brn(m_position, &neighb);
{
Flag * flag = dynamic_cast<Flag *>(map.get_immovable(neighb));
- if (not flag)
+ if (!flag)
flag =
new Flag (egbase, owner(), neighb);
m_flag = flag;
@@ -834,7 +834,7 @@
void Building::add_worker(Worker & worker) {
- if (not get_workers().size()) {
+ if (!get_workers().size()) {
if (worker.descr().name() != "builder")
set_seeing(true);
}
@@ -845,7 +845,7 @@
void Building::remove_worker(Worker & worker) {
PlayerImmovable::remove_worker(worker);
- if (not get_workers().size())
+ if (!get_workers().size())
set_seeing(false);
workers_changed();
}
@@ -914,8 +914,8 @@
rt_description += img;
{
std::string::iterator it = rt_description.end() - 1;
- for (; it != rt_description.begin() and *it != '?'; --it) {}
- for (; *it == '?'; --it)
+ for (; it != rt_description.begin() && *it != '?'; --it) {}
+ for (; *it == '?'; --it)
*it = '0';
}
rt_description += "><p font-size=14 font-face=DejaVuSerif>";
=== modified file 'src/logic/checkstep.cc'
--- src/logic/checkstep.cc 2013-07-26 20:19:36 +0000
+++ src/logic/checkstep.cc 2014-07-25 18:59:12 +0000
@@ -168,11 +168,11 @@
// Calculate cost and passability
if
- (not (endcaps & m_movecaps)
- and
- not
+ (!(endcaps & m_movecaps)
+ &&
+ !
((endcaps & MOVECAPS_WALK)
- and
+ &&
(m_player.get_buildcaps(start) & m_movecaps & MOVECAPS_SWIM)))
return false;
@@ -184,8 +184,8 @@
return
dynamic_cast<Flag const *>(imm)
- or
- (dynamic_cast<Road const *>(imm) and (endcaps & BUILDCAPS_FLAG));
+ ||
+ (dynamic_cast<Road const *>(imm) && (endcaps & BUILDCAPS_FLAG));
}
return true;
=== modified file 'src/logic/cmd_queue.cc'
--- src/logic/cmd_queue.cc 2014-07-23 14:49:10 +0000
+++ src/logic/cmd_queue.cc 2014-07-25 18:59:12 +0000
@@ -55,7 +55,7 @@
// Note: Order of destruction of Items is not guaranteed
void Cmd_Queue::flush() {
uint32_t cbucket = 0;
- while (m_ncmds and cbucket < CMD_QUEUE_BUCKET_SIZE) {
+ while (m_ncmds && cbucket < CMD_QUEUE_BUCKET_SIZE) {
std::priority_queue<cmditem> & current_cmds = m_cmds[cbucket];
while (!current_cmds.empty()) {
=== modified file 'src/logic/constructionsite.cc'
--- src/logic/constructionsite.cc 2014-07-22 09:54:49 +0000
+++ src/logic/constructionsite.cc 2014-07-25 18:59:12 +0000
@@ -204,7 +204,7 @@
if (m_work_completed >= m_work_steps)
return false; // completed, so don't burn
- return m_work_completed or !m_old_buildings.empty();
+ return m_work_completed || !m_old_buildings.empty();
}
/*
@@ -237,7 +237,7 @@
return true;
}
- if (not m_work_steps) // Happens for building without buildcost.
+ if (!m_work_steps) // Happens for building without buildcost.
schedule_destroy(game); // Complete the building immediately.
// Check if one step has completed
=== modified file 'src/logic/dismantlesite.cc'
--- src/logic/dismantlesite.cc 2014-07-15 07:44:14 +0000
+++ src/logic/dismantlesite.cc 2014-07-25 18:59:12 +0000
@@ -177,11 +177,11 @@
return true;
}
- if (not m_work_steps) // Happens for building without buildcost.
+ if (!m_work_steps) // Happens for building without buildcost.
schedule_destroy(game); // Complete the building immediately.
// Check if one step has completed
- if (static_cast<int32_t>(game.get_gametime() - m_work_steptime) >= 0 and m_working) {
+ if (static_cast<int32_t>(game.get_gametime() - m_work_steptime) >= 0 && m_working) {
++m_work_completed;
for (uint32_t i = 0; i < m_wares.size(); ++i) {
@@ -217,7 +217,7 @@
worker.descr().get_right_walk_anims(false),
true);
worker.set_location(nullptr);
- } else if (not m_working) {
+ } else if (!m_working) {
m_work_steptime = game.get_gametime() + DISMANTLESITE_STEP_TIME;
worker.start_task_idle
(game, worker.descr().get_animation("work"), DISMANTLESITE_STEP_TIME);
=== modified file 'src/logic/editor_game_base.cc'
--- src/logic/editor_game_base.cc 2014-07-22 09:54:49 +0000
+++ src/logic/editor_game_base.cc 2014-07-25 18:59:12 +0000
@@ -70,7 +70,11 @@
map_ (nullptr),
lasttrackserial_ (0)
{
+<<<<<<< TREE
if (not lua_) // TODO(SirVer): this is sooo ugly, I can't say
+=======
+ if (!lua_) // TODO SirVer: this is sooo ugly, I can't say
+>>>>>>> MERGE-SOURCE
lua_.reset(new LuaEditorInterface(this));
g_sound_handler.egbase_ = this;
@@ -198,7 +202,7 @@
void Editor_Game_Base::inform_players_about_immovable
(Map_Index const i, Map_Object_Descr const * const descr)
{
- if (not Road::IsRoadDescr(descr))
+ if (!Road::IsRoadDescr(descr))
iterate_players_existing_const(plnum, MAX_PLAYERS, *this, p) {
Player::Field & player_field = p->m_fields[i];
if (1 < player_field.vision) {
@@ -249,7 +253,7 @@
if
(pid <= MAX_PLAYERS
||
- not dynamic_cast<const Game *>(this))
+ !dynamic_cast<const Game *>(this))
{ // if this is editor, load the tribe anyways
// the tribe is used, postload it
tribes_[id]->postload(*this);
@@ -695,7 +699,7 @@
assert (player_area.player_number <= map().get_nrplayers());
assert (preferred_player <= map().get_nrplayers());
assert(preferred_player != player_area.player_number);
- assert(not conquer || not preferred_player);
+ assert(!conquer || !preferred_player);
Player & conquering_player = player(player_area.player_number);
MapRegion<Area<FCoords> > mr(map(), player_area);
do {
@@ -709,12 +713,12 @@
// adds the influence
Military_Influence new_influence_modified = conquering_player.military_influence(index) +=
influence;
- if (owner && not conquer_guarded_location_by_superior_influence)
+ if (owner && !conquer_guarded_location_by_superior_influence)
new_influence_modified = 1;
if (!owner || player(owner).military_influence(index) < new_influence_modified) {
change_field_owner(mr.location(), player_area.player_number);
}
- } else if (not(conquering_player.military_influence(index) -= influence) &&
+ } else if (!(conquering_player.military_influence(index) -= influence) &&
owner == player_area.player_number) {
// The player completely lost influence over the location, which he
// owned. Now we must see if some other player has influence and if
@@ -772,7 +776,7 @@
PlayerImmovable & imm =
ref_cast<PlayerImmovable, BaseImmovable>(*i.current->object);
if
- (not
+ (!
m[i.current->coords].is_interior(imm.owner().player_number()))
if
(std::find(burnlist.begin(), burnlist.end(), &imm)
=== modified file 'src/logic/game.cc'
--- src/logic/game.cc 2014-07-23 14:49:10 +0000
+++ src/logic/game.cc 2014-07-25 18:59:12 +0000
@@ -192,7 +192,7 @@
// this is to ensure we do not crash because of diskspace
// still this is only possibe to go from true->false
// still probally should not do this with an assert but with better checks
- assert(m_state == gs_notrunning || not wr);
+ assert(m_state == gs_notrunning || !wr);
m_writereplay = wr;
}
@@ -478,7 +478,7 @@
} else {
// Is a scenario!
iterate_players_existing_novar(p, nr_players, *this) {
- if (not map().get_starting_pos(p))
+ if (!map().get_starting_pos(p))
throw warning
(_("Missing starting position"),
_
@@ -540,7 +540,7 @@
if (m_writereplay) {
log("Starting replay writer\n");
- assert(not m_replaywriter);
+ assert(!m_replaywriter);
m_replaywriter = new ReplayWriter(*this, fname);
log("Replay writer has started\n");
@@ -626,7 +626,7 @@
/// (Only) called by the dedicated server, to end a game once all players left
void Game::end_dedicated_game() {
- assert(not g_gr);
+ assert(!g_gr);
m_state = gs_notrunning;
}
@@ -995,7 +995,7 @@
workerid < tribe_workers;
++workerid)
if
- (not
+ (!
dynamic_cast<Carrier::Descr const *>
(tribe.get_worker_descr(workerid)))
wostock += eco->stock_worker(workerid);
=== modified file 'src/logic/game_controller.h'
--- src/logic/game_controller.h 2014-07-05 16:41:51 +0000
+++ src/logic/game_controller.h 2014-07-25 18:59:12 +0000
@@ -80,7 +80,7 @@
* Toggle pause state (convenience function)
*/
void togglePaused() {
- setPaused(not isPaused());
+ setPaused(!isPaused());
}
/**
=== modified file 'src/logic/immovable.cc'
--- src/logic/immovable.cc 2014-07-16 08:23:42 +0000
+++ src/logic/immovable.cc 2014-07-25 18:59:12 +0000
@@ -142,7 +142,7 @@
Section& program_s = prof.get_safe_section(_name.c_str());
while (Section::Value* const v = program_s.get_next_val()) {
Action* action;
- if (not strcmp(v->get_name(), "animate")) {
+ if (!strcmp(v->get_name(), "animate")) {
// Copying, as next_word() modifies the string..... Awful design.
std::unique_ptr<char []> arguments(new char[strlen(v->get_string()) + 1]);
strncpy(arguments.get(), v->get_string(), strlen(v->get_string()) + 1);
@@ -156,17 +156,17 @@
g_gr->animations().load(directory, prof.get_safe_section(animation_name)));
}
action = new ActAnimate(v->get_string(), immovable);
- } else if (not strcmp(v->get_name(), "transform")) {
+ } else if (!strcmp(v->get_name(), "transform")) {
action = new ActTransform(v->get_string(), immovable);
- } else if (not strcmp(v->get_name(), "grow")) {
+ } else if (!strcmp(v->get_name(), "grow")) {
action = new ActGrow(v->get_string(), immovable);
- } else if (not strcmp(v->get_name(), "remove")) {
+ } else if (!strcmp(v->get_name(), "remove")) {
action = new ActRemove(v->get_string(), immovable);
- } else if (not strcmp(v->get_name(), "seed")) {
+ } else if (!strcmp(v->get_name(), "seed")) {
action = new ActSeed(v->get_string(), immovable);
- } else if (not strcmp(v->get_name(), "playFX")) {
+ } else if (!strcmp(v->get_name(), "playFX")) {
action = new ActPlayFX(directory, v->get_string(), immovable);
- } else if (not strcmp(v->get_name(), "construction")) {
+ } else if (!strcmp(v->get_name(), "construction")) {
action = new ActConstruction(v->get_string(), immovable, directory, prof);
} else {
throw game_data_error("unknown command type \"%s\"", v->get_name());
@@ -769,7 +769,7 @@
try {
// The header has been peeled away by the caller
uint8_t const version = fr.Unsigned8();
- if (1 <= version and version <= IMMOVABLE_SAVEGAME_VERSION) {
+ if (1 <= version && version <= IMMOVABLE_SAVEGAME_VERSION) {
const std::string owner_name = fr.CString();
const std::string old_name = fr.CString();
@@ -822,10 +822,10 @@
}
m_id = descr.get_animation(animation_name);
- if (not reached_end) { // The next parameter is the duration.
+ if (!reached_end) { // The next parameter is the duration.
char * endp;
long int const value = strtol(parameters, &endp, 0);
- if (*endp or value <= 0)
+ if (*endp || value <= 0)
throw game_data_error("expected %s but found \"%s\"", "duration in ms", parameters);
m_duration = value;
} else {
@@ -856,11 +856,11 @@
std::string filename = next_word(parameters, reached_end);
name = directory + "/" + filename;
- if (not reached_end) {
+ if (!reached_end) {
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
priority = value;
- if (*endp or priority != value)
+ if (*endp || priority != value)
throw game_data_error
("expected %s but found \"%s\"", "priority", parameters);
} else
@@ -899,7 +899,7 @@
bob = false;
else if (params[i][0] >= '0' && params[i][0] <= '9') {
long int const value = atoi(params[i].c_str());
- if (value < 1 or 254 < value)
+ if (value < 1 || 254 < value)
throw game_data_error
("expected %s but found \"%s\"", "probability in range [1, 254]",
params[i].c_str());
@@ -939,7 +939,7 @@
void ImmovableProgram::ActTransform::execute
(Game & game, Immovable & immovable) const
{
- if (probability == 0 or game.logic_rand() % 256 < probability) {
+ if (probability == 0 || game.logic_rand() % 256 < probability) {
Player * player = immovable.get_owner();
Coords const c = immovable.get_position();
Tribe_Descr const * const owner_tribe =
@@ -974,7 +974,7 @@
*p = '\0';
++p;
Tribe_Descr const * const owner_tribe = descr.get_owner_tribe();
- if (not owner_tribe)
+ if (!owner_tribe)
throw game_data_error
(
"immovable type not in tribe but target type has scope "
@@ -1027,7 +1027,7 @@
if (*parameters) {
char * endp;
long int const value = strtol(parameters, &endp, 0);
- if (*endp or value < 1 or 254 < value)
+ if (*endp || value < 1 || 254 < value)
throw game_data_error
("expected %s but found \"%s\"",
"probability in range [1, 254]", parameters);
@@ -1042,7 +1042,7 @@
void ImmovableProgram::ActRemove::execute
(Game & game, Immovable & immovable) const
{
- if (probability == 0 or game.logic_rand() % 256 < probability)
+ if (probability == 0 || game.logic_rand() % 256 < probability)
immovable.remove(game); // Now immovable is a dangling reference!
else
immovable.program_step(game);
@@ -1059,7 +1059,7 @@
*p = '\0';
++p;
Tribe_Descr const * const owner_tribe = descr.get_owner_tribe();
- if (not owner_tribe)
+ if (!owner_tribe)
throw game_data_error
(
"immovable type not in tribe but target type has scope "
@@ -1080,7 +1080,7 @@
++p;
char * endp;
long int const value = strtol(p, &endp, 0);
- if (*endp or value < 1 or 254 < value)
+ if (*endp || value < 1 || 254 < value)
throw game_data_error
("expected %s but found \"%s\"", "probability in range [1, 254]",
p);
=== modified file 'src/logic/map.cc'
--- src/logic/map.cc 2014-07-23 14:49:10 +0000
+++ src/logic/map.cc 2014-07-25 18:59:12 +0000
@@ -270,7 +270,7 @@
}
amount /= 6;
- if (res == -1 or not amount) {
+ if (res == -1 || !amount) {
f.field->set_resources(0, 0);
f.field->set_starting_res_amount(0);
} else {
@@ -631,10 +631,10 @@
(pathfields->fields[neighb.field - m_fields.get()].cycle
!=
pathfields->cycle
- and
+ &&
// node within the radius?
calc_distance(area, neighb) <= area.radius
- and
+ &&
// allowed to move onto this node?
checkstep.allowed
(*this,
@@ -1084,7 +1084,7 @@
// we cannot build anything on it. Exception: we can build flags on roads.
if (BaseImmovable * const imm = get_immovable(f))
if
- (not dynamic_cast<Road const *>(imm)
+ (!dynamic_cast<Road const *>(imm)
&&
imm->get_size() >= BaseImmovable::SMALL)
{
@@ -1698,7 +1698,7 @@
return 0; // duh...
}
- if (not checkstep.reachabledest(*this, end))
+ if (!checkstep.reachabledest(*this, end))
return -1;
if (!persist)
@@ -1755,7 +1755,7 @@
// Check passability
if
- (not
+ (!
checkstep.allowed
(*this,
cur,
@@ -1870,7 +1870,7 @@
do {
if
(difference < 0
- and
+ &&
mr.location().field->height
<
static_cast<uint8_t>(-difference))
=== modified file 'src/logic/mapdifferenceregion.cc'
--- src/logic/mapdifferenceregion.cc 2013-09-23 18:47:02 +0000
+++ src/logic/mapdifferenceregion.cc 2014-07-25 18:59:12 +0000
@@ -30,9 +30,9 @@
--m_remaining_in_edge;
return true;
} else {
- if (not m_passed_corner) {
+ if (!m_passed_corner) {
m_passed_corner = true;
- --m_direction; if (not m_direction) m_direction = 6;
+ --m_direction; if (!m_direction) m_direction = 6;
m_remaining_in_edge = m_area.radius;
return advance(map);
}
@@ -46,7 +46,7 @@
assert(1 <= m_direction);
assert (m_direction <= 6);
assert(m_passed_corner);
- --m_direction; if (not m_direction) m_direction = 6;
+ --m_direction; if (!m_direction) m_direction = 6;
Area<FCoords>::Radius_type steps_left = m_area.radius + 1;
switch (m_direction) {
#define DIRECTION_CASE(dir, neighbour_function) \
@@ -63,7 +63,7 @@
DIRECTION_CASE(WALK_W, get_ln);
default: assert(false);
}
- --m_direction; if (not m_direction) m_direction = 6;
+ --m_direction; if (!m_direction) m_direction = 6;
m_remaining_in_edge = m_area.radius;
m_passed_corner = false;
}
=== modified file 'src/logic/mapdifferenceregion.h'
--- src/logic/mapdifferenceregion.h 2014-07-05 16:41:51 +0000
+++ src/logic/mapdifferenceregion.h 2014-07-25 18:59:12 +0000
@@ -44,8 +44,8 @@
{
assert(1 <= direction);
assert (direction <= 6);
- --direction; if (not direction) direction = 6;
- --direction; if (not direction) direction = 6;
+ --direction; if (!direction) direction = 6;
+ --direction; if (!direction) direction = 6;
switch (direction) {
#define DIRECTION_CASE(dir, neighbour_function) \
case dir: \
@@ -61,8 +61,8 @@
DIRECTION_CASE(WALK_W, get_ln);
#undef DIRECTION_CASE
}
- --direction; if (not direction) direction = 6;
- --direction; if (not direction) direction = 6;
+ --direction; if (!direction) direction = 6;
+ --direction; if (!direction) direction = 6;
m_direction = direction;
}
=== modified file 'src/logic/maphollowregion.cc'
--- src/logic/maphollowregion.cc 2013-09-23 18:47:02 +0000
+++ src/logic/maphollowregion.cc 2014-07-25 18:59:12 +0000
@@ -44,7 +44,7 @@
++m_rowpos;
if (m_rowpos < m_rowwidth) {
map.get_rn(m_hollow_area, &m_hollow_area);
- if ((m_phase & (Upper|Lower)) and m_rowpos == m_delta_radius) {
+ if ((m_phase & (Upper|Lower)) && m_rowpos == m_delta_radius) {
// Jump over the hole.
const uint32_t holewidth = m_rowwidth - 2 * m_delta_radius;
for (uint32_t i = 0; i < holewidth; ++i)
@@ -53,13 +53,13 @@
}
} else {
++m_row;
- if (m_phase == Top and m_row == m_delta_radius)
+ if (m_phase == Top && m_row == m_delta_radius)
m_phase = Upper;
// If we completed the widest, center line, switch into lower mode
// There are m_radius+1 lines in the upper "half", because the upper
// half includes the center line.
- else if (m_phase == Upper and m_row > m_hollow_area.radius) {
+ else if (m_phase == Upper && m_row > m_hollow_area.radius) {
m_row = 1;
m_phase = Lower;
}
@@ -72,7 +72,7 @@
if (m_row > m_hollow_area.radius) {
m_phase = None;
return true; // early out
- } else if (m_phase == Lower and m_row > m_hollow_area.hole_radius)
+ } else if (m_phase == Lower && m_row > m_hollow_area.hole_radius)
m_phase = Bottom;
map.get_brn(m_left, &m_hollow_area);
=== modified file 'src/logic/maptriangleregion.cc'
--- src/logic/maptriangleregion.cc 2013-09-23 18:47:02 +0000
+++ src/logic/maptriangleregion.cc 2014-07-25 18:59:12 +0000
@@ -25,7 +25,7 @@
(const Map & map, Area<TCoords<> > area)
: m_radius_is_odd(area.radius & 1)
{
- assert(area.t == TCoords<>::R or area.t == TCoords<>::D);
+ assert(area.t == TCoords<>::R || area.t == TCoords<>::D);
const uint16_t radius_plus_1 = area.radius + 1;
const uint16_t half_radius_rounded_down = area.radius / 2;
m_row_length = radius_plus_1;
@@ -151,7 +151,7 @@
(const Map & map, Area<TCoords<FCoords> > area)
: m_radius_is_odd(area.radius & 1)
{
- assert(area.t == TCoords<FCoords>::R or area.t == TCoords<FCoords>::D);
+ assert(area.t == TCoords<FCoords>::R || area.t == TCoords<FCoords>::D);
const uint16_t radius_plus_1 = area.radius + 1;
const uint16_t half_radius_rounded_down = area.radius / 2;
m_row_length = radius_plus_1;
=== modified file 'src/logic/militarysite.cc'
--- src/logic/militarysite.cc 2014-07-23 15:58:57 +0000
+++ src/logic/militarysite.cc 2014-07-25 18:59:12 +0000
@@ -523,10 +523,10 @@
}
else // not doing upgrade request
{
- if ((capacity != stationed) or (m_normal_soldier_request))
+ if ((capacity != stationed) || (m_normal_soldier_request))
update_normal_soldier_request();
- if ((capacity == stationed) and (! m_normal_soldier_request))
+ if ((capacity == stationed) && (! m_normal_soldier_request))
{
if (presentSoldiers().size() == capacity)
{
@@ -922,9 +922,9 @@
for (uint32_t i = 0; i < immovables.size(); ++i)
if (upcast(MilitarySite const, militarysite, immovables[i].object))
if
- (this != militarysite and
- &owner () == &militarysite->owner() and
- get_size() <= militarysite->get_size() and
+ (this != militarysite &&
+ &owner () == &militarysite->owner() &&
+ get_size() <= militarysite->get_size() &&
militarysite->m_didconquer)
return true;
return false;
@@ -1060,7 +1060,7 @@
bool maxchanged = reqmax != soldier_upgrade_required_max;
bool minchanged = reqmin != soldier_upgrade_required_min;
- if (maxchanged or minchanged)
+ if (maxchanged || minchanged)
{
if (m_upgrade_soldier_request && (m_upgrade_soldier_request->is_open()))
{
=== modified file 'src/logic/player.cc'
--- src/logic/player.cc 2014-07-23 14:49:10 +0000
+++ src/logic/player.cc 2014-07-25 18:59:12 +0000
@@ -348,8 +348,8 @@
Coords const position = m .position ();
container_iterate_const(MessageQueue, messages(), i)
if
- (i.current->second->sender() == m.sender() and
- gametime < i.current->second->sent() + timeout and
+ (i.current->second->sender() == m.sender() &&
+ gametime < i.current->second->sent() + timeout &&
map.calc_distance(i.current->second->position(), position) <= radius)
{
delete &m;
@@ -382,25 +382,25 @@
const Map & map = egbase().map();
uint8_t buildcaps = fc.field->nodecaps();
- if (not fc.field->is_interior(m_plnum))
+ if (!fc.field->is_interior(m_plnum))
buildcaps = 0;
// Check if a building's flag can't be build due to ownership
else if (buildcaps & BUILDCAPS_BUILDINGMASK) {
FCoords flagcoords;
map.get_brn(fc, &flagcoords);
- if (not flagcoords.field->is_interior(m_plnum))
+ if (!flagcoords.field->is_interior(m_plnum))
buildcaps &= ~BUILDCAPS_BUILDINGMASK;
// Prevent big buildings that would swell over borders.
if
((buildcaps & BUILDCAPS_BIG) == BUILDCAPS_BIG
- and
- (not map.tr_n(fc).field->is_interior(m_plnum)
- or
- not map.tl_n(fc).field->is_interior(m_plnum)
- or
- not map. l_n(fc).field->is_interior(m_plnum)))
+ &&
+ (!map.tr_n(fc).field->is_interior(m_plnum)
+ ||
+ !map.tl_n(fc).field->is_interior(m_plnum)
+ ||
+ !map. l_n(fc).field->is_interior(m_plnum)))
buildcaps &= ~BUILDCAPS_SMALL;
}
@@ -428,7 +428,7 @@
if (upcast(Flag, existing_flag, immovable)) {
if (&existing_flag->owner() == this)
return *existing_flag;
- } else if (not dynamic_cast<Road const *>(immovable)) // A road is OK.
+ } else if (!dynamic_cast<Road const *>(immovable)) // A road is OK.
immovable->remove(egbase()); // Make room for the flag.
}
MapRegion<Area<FCoords> > mr(map, Area<FCoords>(c, 1));
@@ -734,7 +734,7 @@
(Building * building, Building_Index const index_of_new_building)
{
if (&building->owner() ==
- this and(index_of_new_building == INVALID_INDEX ||
+ this && (index_of_new_building == INVALID_INDEX ||
building->descr().enhancement() == index_of_new_building)) {
Building::FormerBuildings former_buildings = building->get_former_buildings();
const Coords position = building->get_position();
@@ -791,7 +791,7 @@
void Player::allow_worker_type(Ware_Index const i, bool const allow) {
assert(i < m_allowed_worker_types.size());
- assert(not allow or tribe().get_worker_descr(i)->is_buildable());
+ assert(!allow || tribe().get_worker_descr(i)->is_buildable());
m_allowed_worker_types[i] = allow;
}
@@ -811,7 +811,7 @@
*/
void Player::add_economy(Economy & economy)
{
- if (not has_economy(economy))
+ if (!has_economy(economy))
m_economies.push_back(&economy);
}
@@ -924,7 +924,7 @@
present.begin(), present.begin() + nr_taken);
count += nr_taken;
nr_wanted -= nr_taken;
- if (not nr_wanted)
+ if (!nr_wanted)
break;
}
}
@@ -1014,17 +1014,17 @@
field.border = f.field->is_border();
field.border_r =
- ((1 | r_vision) and (r_owner_number == field.owner)
- and
- ((tr_owner_number == field.owner) xor (br_owner_number == field.owner)));
+ ((1 | r_vision) && (r_owner_number == field.owner)
+ &&
+ ((tr_owner_number == field.owner) ^ (br_owner_number == field.owner)));
field.border_br =
- ((1 | bl_vision) and (bl_owner_number == field.owner)
- and
- ((l_owner_number == field.owner) xor (br_owner_number == field.owner)));
+ ((1 | bl_vision) && (bl_owner_number == field.owner)
+ &&
+ ((l_owner_number == field.owner) ^ (br_owner_number == field.owner)));
field.border_bl =
- ((1 | br_vision) and (br_owner_number == field.owner)
- and
- ((r_owner_number == field.owner) xor (bl_owner_number == field.owner)));
+ ((1 | br_vision) && (br_owner_number == field.owner)
+ &&
+ ((r_owner_number == field.owner) ^ (bl_owner_number == field.owner)));
{ // map_object_descr[TCoords::None]
=== modified file 'src/logic/playercommand.cc'
--- src/logic/playercommand.cc 2014-07-14 21:52:13 +0000
+++ src/logic/playercommand.cc 2014-07-25 18:59:12 +0000
@@ -156,10 +156,10 @@
{
try {
const uint16_t packet_version = fr.Unsigned16();
- if (2 <= packet_version and packet_version <= PLAYER_COMMAND_VERSION) {
+ if (2 <= packet_version && packet_version <= PLAYER_COMMAND_VERSION) {
GameLogicCommand::Read(fr, egbase, mol);
m_sender = fr.Unsigned8 ();
- if (not egbase.get_player(m_sender))
+ if (!egbase.get_player(m_sender))
throw game_data_error("player %u does not exist", m_sender);
m_cmdserial = fr.Unsigned32();
} else
@@ -198,7 +198,7 @@
try {
const uint16_t packet_version = fr.Unsigned16();
if
- (1 <= packet_version and
+ (1 <= packet_version &&
packet_version <= PLAYER_CMD_BULLDOZE_VERSION)
{
PlayerCommand::Read(fr, egbase, mol);
@@ -1251,7 +1251,7 @@
{
Player & player = game.player(sender());
if
- (economy () < player.get_nr_economies() and
+ (economy () < player.get_nr_economies() &&
ware_type() < player.tribe().get_nrwares())
player.get_economy_by_number(economy())->set_ware_target_quantity
(ware_type(), m_permanent, duetime());
@@ -1314,7 +1314,7 @@
Player & player = game.player(sender());
const Tribe_Descr & tribe = player.tribe();
if
- (economy () < player.get_nr_economies() and
+ (economy () < player.get_nr_economies() &&
ware_type() < tribe.get_nrwares())
{
const int32_t count =
@@ -1373,7 +1373,7 @@
{
Player & player = game.player(sender());
if
- (economy () < player.get_nr_economies() and
+ (economy () < player.get_nr_economies() &&
ware_type() < player.tribe().get_nrwares())
player.get_economy_by_number(economy())->set_worker_target_quantity
(ware_type(), m_permanent, duetime());
@@ -1436,7 +1436,7 @@
Player & player = game.player(sender());
const Tribe_Descr & tribe = player.tribe();
if
- (economy () < player.get_nr_economies() and
+ (economy () < player.get_nr_economies() &&
ware_type() < tribe.get_nrwares())
{
const int32_t count =
@@ -1682,7 +1682,7 @@
if (const Building * const building = flag->get_building()) {
if
(player.is_hostile(flag->owner())
- and
+ &&
1
<
player.vision
@@ -1759,7 +1759,7 @@
if (packet_version == PLAYER_MESSAGE_CMD_VERSION) {
PlayerCommand::Read(fr, egbase, mol);
m_message_id = Message_Id(fr.Unsigned32());
- if (not m_message_id)
+ if (!m_message_id)
throw game_data_error
("(player %u): message id is null", sender());
} else
=== modified file 'src/logic/production_program.cc'
--- src/logic/production_program.cc 2014-07-23 15:58:57 +0000
+++ src/logic/production_program.cc 2014-07-25 18:59:12 +0000
@@ -83,7 +83,7 @@
/// now candidate points to " 75" and result is true
bool match(char* & candidate, const char* pattern) {
for (char* p = candidate;; ++p, ++pattern)
- if (not * pattern) {
+ if (!*pattern) {
candidate = p;
return true;
} else if (*p != *pattern)
@@ -129,7 +129,7 @@
/// throws _wexception
bool match_force_skip(char* & candidate, const char* pattern) {
for (char* p = candidate;; ++p, ++pattern)
- if (not * pattern) {
+ if (!*pattern) {
force_skip(p);
candidate = p;
return true;
@@ -164,8 +164,8 @@
for (;;) {
char const * ware = parameters;
while
- (*parameters and *parameters != ',' and
- *parameters != ':' and *parameters != ' ')
+ (*parameters && *parameters != ',' &&
+ *parameters != ':' && *parameters != ' ')
++parameters;
char const terminator = *parameters;
*parameters = '\0';
@@ -181,7 +181,7 @@
count_max += i.front().second;
break;
}
- if (group.first.size() and ware_index <= *group.first.begin())
+ if (group.first.size() && ware_index <= *group.first.begin())
throw game_data_error
(
"wrong order of ware types within group: ware type %s appears "
@@ -196,7 +196,7 @@
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
count = value;
- if ((*endp and *endp != ' ') or value < 1 or count != value)
+ if ((*endp && *endp != ' ') || value < 1 || count != value)
throw game_data_error
("expected %s but found \"%s\"", "count", parameters);
parameters = endp;
@@ -233,7 +233,7 @@
bool ProductionProgram::ActReturn::Negation::evaluate
(const ProductionSite & ps) const
{
- return not operand->evaluate(ps);
+ return !operand->evaluate(ps);
}
std::string ProductionProgram::ActReturn::Negation::description
(const Tribe_Descr & tribe) const
@@ -438,7 +438,7 @@
m_conditions.push_back(create_condition(parameters, descr));
if (*parameters) {
skip(parameters);
- if (not match_force_skip(parameters, "and"))
+ if (!match_force_skip(parameters, "and"))
throw game_data_error
("expected \"%s\" or end of input", "and");
} else
@@ -447,13 +447,13 @@
} else if (match_force_skip(parameters, "unless")) {
m_is_when = false;
for (;;) {
- if (not *parameters)
+ if (!*parameters)
throw game_data_error
("expected condition at end of input");
m_conditions.push_back(create_condition(parameters, descr));
if (*parameters) {
skip(parameters);
- if (not match_force_skip(parameters, "or"))
+ if (!match_force_skip(parameters, "or"))
throw game_data_error
("expected \"%s\" or end of input", "or");
} else
@@ -497,7 +497,7 @@
std::string condition_string = "";
for (wl_const_range<Conditions> i(m_conditions); i;)
{
- if (not (i.front()->evaluate(ps))) // A condition is false,
+ if (!(i.front()->evaluate(ps))) // A condition is false,
return ps.program_step(game); // continue program.
condition_string += i.front()->description(ps.owner().tribe());
@@ -573,7 +573,7 @@
}
// Override with specified handling methods.
- while (not reached_end) {
+ while (!reached_end) {
skip(parameters);
match_force_skip(parameters, "on");
log("found \"on \": parameters = \"%s\"\n", parameters);
@@ -614,7 +614,7 @@
"{\"fail\"|\"complete\"|\"skip\"|\"repeat\"}",
parameters);
m_handling_methods[result_to_set_method_for - 1] = handling_method;
- reached_end = not *parameters;
+ reached_end = !*parameters;
log
("read handling method for result %u: %u, parameters = \"%s\", "
"reached_end = %u\n",
@@ -722,7 +722,7 @@
char * endp;
long long int const value = strtoll(parameters, &endp, 0);
m_duration = value;
- if (*endp or value <= 0 or m_duration != value)
+ if (*endp || value <= 0 || m_duration != value)
throw game_data_error
("expected %s but found \"%s\"",
"duration in ms", parameters);
@@ -777,7 +777,7 @@
try {
bool reached_end;
char * const animation_name = next_word(parameters, reached_end);
- if (not strcmp(animation_name, "idle"))
+ if (!strcmp(animation_name, "idle"))
throw game_data_error
("idle animation is default; calling is not allowed");
if (descr->is_animation_known(animation_name))
@@ -786,11 +786,11 @@
m_id = g_gr->animations().load(directory.c_str(), prof.get_safe_section(animation_name));
descr->add_animation(animation_name, m_id);
}
- if (not reached_end) { // The next parameter is the duration.
+ if (!reached_end) { // The next parameter is the duration.
char * endp;
long long int const value = strtoll(parameters, &endp, 0);
m_duration = value;
- if (*endp or value <= 0 or m_duration != value)
+ if (*endp || value <= 0 || m_duration != value)
throw game_data_error
("expected %s but found \"%s\"",
"duration in ms", parameters);
@@ -819,7 +819,7 @@
m_groups.resize(m_groups.size() + 1);
parse_ware_type_group
(parameters, *m_groups.rbegin(), tribe, descr.inputs());
- if (not *parameters)
+ if (!*parameters)
break;
force_skip(parameters);
}
@@ -957,9 +957,9 @@
strtoull(parameters, &endp, 0);
item.second = value;
if
- ((*endp and *endp != ' ')
- or
- value < 1 or item.second != value)
+ ((*endp && *endp != ' ')
+ ||
+ value < 1 || item.second != value)
throw game_data_error
("expected %s but found \"%s\"",
"count", parameters);
@@ -972,7 +972,7 @@
more = *parameters != '\0';
*parameters = '\0';
if
- (not
+ (!
descr.is_output_ware_type
(item.first = tribe.safe_ware_index(ware)))
throw game_data_error
@@ -1058,9 +1058,9 @@
strtoull(parameters, &endp, 0);
item.second = value;
if
- ((*endp and *endp != ' ')
- or
- value < 1 or item.second != value)
+ ((*endp && *endp != ' ')
+ ||
+ value < 1 || item.second != value)
throw game_data_error
("expected %s but found \"%s\"",
"count", parameters);
@@ -1073,7 +1073,7 @@
more = *parameters != '\0';
*parameters = '\0';
if
- (not
+ (!
descr.is_output_worker_type
(item.first = tribe.safe_worker_index(worker)))
throw game_data_error
@@ -1141,7 +1141,7 @@
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
m_distance = value;
- if (*endp != ' ' or m_distance != value)
+ if (*endp != ' ' || m_distance != value)
throw game_data_error
("expected %s but found \"%s\"", "distance", parameters);
parameters = endp;
@@ -1151,7 +1151,7 @@
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
m_max = value;
- if (*endp != ' ' or value < 1 or 100 < value)
+ if (*endp != ' ' || value < 1 || 100 < value)
throw game_data_error
("expected %s but found \"%s\"",
"percentage", parameters);
@@ -1162,7 +1162,7 @@
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
m_chance = value;
- if (*endp != ' ' or value < 1 or 100 < value)
+ if (*endp != ' ' || value < 1 || 100 < value)
throw game_data_error
("expected %s but found \"%s\"",
"percentage", parameters);
@@ -1172,7 +1172,7 @@
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
m_training = value;
- if (*endp or value < 1 or 100 < value)
+ if (*endp || value < 1 || 100 < value)
throw game_data_error
("expected %s but found \"%s\"",
"percentage", parameters);
@@ -1235,7 +1235,7 @@
int32_t digged_percentage = 100;
if (totalstart)
digged_percentage = 100 - totalres * 100 / totalstart;
- if (not totalres)
+ if (!totalres)
digged_percentage = 100;
if (digged_percentage < m_max) {
@@ -1324,9 +1324,15 @@
}
ProductionProgram::ActCheck_Soldier::ActCheck_Soldier(char* parameters) {
+<<<<<<< TREE
// TODO(unknown) This is currently hardcoded for "soldier", but should allow any
// soldier type name.
if (not match_force_skip(parameters, "soldier"))
+=======
+ // FIXME This is currently hardcoded for "soldier", but should allow any
+ // FIXME soldier type name.
+ if (!match_force_skip(parameters, "soldier"))
+>>>>>>> MERGE-SOURCE
throw game_data_error
("expected %s but found \"%s\"", "soldier type", parameters);
try {
@@ -1346,7 +1352,7 @@
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
level = value;
- if (*endp or level != value)
+ if (*endp || level != value)
throw game_data_error
("expected %s but found \"%s\"", "level", parameters);
} catch (const _wexception & e) {
@@ -1400,9 +1406,15 @@
}
ProductionProgram::ActTrain::ActTrain(char* parameters) {
+<<<<<<< TREE
// TODO(unknown) This is currently hardcoded for "soldier", but should allow any
// soldier type name.
if (not match_force_skip(parameters, "soldier"))
+=======
+ // FIXME This is currently hardcoded for "soldier", but should allow any
+ // FIXME soldier type name.
+ if (!match_force_skip(parameters, "soldier"))
+>>>>>>> MERGE-SOURCE
throw game_data_error
("expected %s but found \"%s\"", "soldier type", parameters);
try {
@@ -1423,7 +1435,7 @@
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
level = value;
- if (*endp != ' ' or level != value)
+ if (*endp != ' ' || level != value)
throw game_data_error
("expected %s but found \"%s\"", "level", parameters);
parameters = endp;
@@ -1433,7 +1445,7 @@
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
target_level = value;
- if (*endp or target_level != value or target_level <= level)
+ if (*endp || target_level != value || target_level <= level)
throw game_data_error
("expected level > %u but found \"%s\"", level, parameters);
}
@@ -1509,11 +1521,11 @@
std::string filename = next_word(parameters, reached_end);
name = directory + "/" + filename;
- if (not reached_end) {
+ if (!reached_end) {
char * endp;
unsigned long long int const value = strtoull(parameters, &endp, 0);
priority = value;
- if (*endp or priority != value)
+ if (*endp || priority != value)
throw game_data_error
("expected %s but found \"%s\"", "priority", parameters);
} else
@@ -1687,33 +1699,33 @@
Section& program_s = prof.get_safe_section(_name.c_str());
while (Section::Value* const v = program_s.get_next_val()) {
ProductionProgram::Action* action;
- if (not strcmp(v->get_name(), "return"))
+ if (!strcmp(v->get_name(), "return"))
action = new ActReturn(v->get_string(), *building);
- else if (not strcmp(v->get_name(), "call"))
+ else if (!strcmp(v->get_name(), "call"))
action = new ActCall(v->get_string(), *building);
- else if (not strcmp(v->get_name(), "sleep"))
+ else if (!strcmp(v->get_name(), "sleep"))
action = new ActSleep(v->get_string());
- else if (not strcmp(v->get_name(), "animate"))
+ else if (!strcmp(v->get_name(), "animate"))
action = new ActAnimate(v->get_string(), directory, prof, building);
- else if (not strcmp(v->get_name(), "consume"))
+ else if (!strcmp(v->get_name(), "consume"))
action = new ActConsume(v->get_string(), *building);
- else if (not strcmp(v->get_name(), "produce"))
+ else if (!strcmp(v->get_name(), "produce"))
action = new ActProduce(v->get_string(), *building);
- else if (not strcmp(v->get_name(), "recruit"))
+ else if (!strcmp(v->get_name(), "recruit"))
action = new ActRecruit(v->get_string(), *building);
- else if (not strcmp(v->get_name(), "worker"))
+ else if (!strcmp(v->get_name(), "worker"))
action = new ActWorker(v->get_string(), _name, building);
- else if (not strcmp(v->get_name(), "mine"))
+ else if (!strcmp(v->get_name(), "mine"))
action = new ActMine(v->get_string(), world, _name, building);
- else if (not strcmp(v->get_name(), "check_soldier"))
+ else if (!strcmp(v->get_name(), "check_soldier"))
action = new ActCheck_Soldier(v->get_string());
- else if (not strcmp(v->get_name(), "train"))
+ else if (!strcmp(v->get_name(), "train"))
action = new ActTrain(v->get_string());
- else if (not strcmp(v->get_name(), "playFX"))
+ else if (!strcmp(v->get_name(), "playFX"))
action = new ActPlayFX(directory, v->get_string());
- else if (not strcmp(v->get_name(), "construct"))
+ else if (!strcmp(v->get_name(), "construct"))
action = new ActConstruct(v->get_string(), _name, building);
- else if (not strcmp(v->get_name(), "check_map"))
+ else if (!strcmp(v->get_name(), "check_map"))
action = new ActCheck_Map(v->get_string());
else
throw game_data_error("unknown command type \"%s\"", v->get_name());
=== modified file 'src/logic/productionsite.cc'
--- src/logic/productionsite.cc 2014-07-23 04:47:30 +0000
+++ src/logic/productionsite.cc 2014-07-25 18:59:12 +0000
@@ -100,7 +100,7 @@
if (i.current->first == idx)
throw wexception("duplicated");
int32_t const value = val->get_int();
- if (value < 1 or 255 < value)
+ if (value < 1 || 255 < value)
throw wexception("count is out of range 1 .. 255");
m_inputs.push_back(std::pair<Ware_Index, uint8_t>(idx, value));
} else
@@ -126,7 +126,7 @@
} catch (const _wexception & e) {
throw wexception("%s=\"%s\": %s", v->get_name(), v->get_string(), e.what());
}
- if (working_positions().empty() and not global_s.has_val("max_soldiers"))
+ if (working_positions().empty() && !global_s.has_val("max_soldiers"))
throw wexception("no working/soldier positions");
// Get programs
@@ -297,7 +297,7 @@
unsigned int lastPercOk = (lastOk * 100) / (STATISTICS_VECTOR_LENGTH / 2);
std::string color;
- if (percOk > (m_crude_percent / 10000) and percOk - (m_crude_percent / 10000) > 50)
+ if (percOk > (m_crude_percent / 10000) && percOk - (m_crude_percent / 10000) > 50)
color = UI_FONT_CLR_IDLE_HEX;
else if (percOk < 33)
color = UI_FONT_CLR_BAD_HEX;
@@ -322,7 +322,7 @@
const std::string trend_str =
(boost::format("<font color=%s>%s</font>") % color % trend).str();
- if (0 < percOk and percOk < 100) {
+ if (0 < percOk && percOk < 100) {
snprintf
(m_statistics_buffer, sizeof(m_statistics_buffer),
"%s %s", perc_str.c_str(), trend_str.c_str());
@@ -452,7 +452,7 @@
assigned = true;
break;
}
- if (not assigned)
+ if (!assigned)
return -1;
if (upcast(Game, game, &egbase))
@@ -595,7 +595,7 @@
if
(m_program_timer
- and
+ &&
static_cast<int32_t>(game.get_gametime() - m_program_time) >= 0)
{
m_program_timer = false;
@@ -689,7 +689,7 @@
void ProductionSite::try_start_working(Game & game) {
- if (can_start_working() and descr().working_positions().size()) {
+ if (can_start_working() && descr().working_positions().size()) {
Worker & main_worker = *m_working_positions[0].worker;
main_worker.reset_tasks(game);
main_worker.start_task_buildingwork(game);
=== modified file 'src/logic/requirements.cc'
--- src/logic/requirements.cc 2014-07-05 12:17:03 +0000
+++ src/logic/requirements.cc 2014-07-25 18:59:12 +0000
@@ -30,7 +30,7 @@
bool Requirements::check(const Map_Object & obj) const
{
- return !m or m->check(obj);
+ return !m || m->check(obj);
}
#define REQUIREMENTS_VERSION 3
@@ -227,8 +227,8 @@
{
tAttribute const at = static_cast<tAttribute>(fr.Unsigned32());
if
- (at != atrHP and at != atrAttack and at != atrDefense and at != atrEvade
- and
+ (at != atrHP && at != atrAttack && at != atrDefense && at != atrEvade
+ &&
at != atrTotal)
throw game_data_error
(
=== modified file 'src/logic/single_player_game_settings_provider.cc'
--- src/logic/single_player_game_settings_provider.cc 2014-07-16 19:23:38 +0000
+++ src/logic/single_player_game_settings_provider.cc 2014-07-25 18:59:12 +0000
@@ -220,8 +220,8 @@
PlayerSettings const position = settings().players.at(number);
PlayerSettings const player = settings().players.at(settings().playernum);
if
- (number < settings().players.size() and
- (position.state == PlayerSettings::stateOpen or
+ (number < settings().players.size() &&
+ (position.state == PlayerSettings::stateOpen ||
position.state == PlayerSettings::stateComputer))
{
setPlayer(number, player);
=== modified file 'src/logic/soldier.cc'
--- src/logic/soldier.cc 2014-07-16 08:25:35 +0000
+++ src/logic/soldier.cc 2014-07-25 18:59:12 +0000
@@ -60,10 +60,10 @@
* remove spaces at the beginning or the end of a string
*/
void remove_spaces(std::string& s) {
- while (s[0] == ' ' or s[0] == '\t' or s[0] == '\n')
+ while (s[0] == ' ' || s[0] == '\t' || s[0] == '\n')
s.erase(0, 1);
- while (*s.rbegin() == ' ' or * s.rbegin() == '\t' or * s.rbegin() == '\n')
+ while (*s.rbegin() == ' ' || * s.rbegin() == '\t' || * s.rbegin() == '\n')
s.erase(s.size() - 1, 1);
}
@@ -91,12 +91,12 @@
remove_spaces(*i.current);
char * endp;
m_min_attack = strtol(list[0].c_str(), &endp, 0);
- if (*endp or 0 == m_min_attack)
+ if (*endp || 0 == m_min_attack)
throw game_data_error
("expected %s but found \"%s\"",
"positive integer", list[0].c_str());
m_max_attack = strtol(list[1].c_str(), &endp, 0);
- if (*endp or m_max_attack < m_min_attack)
+ if (*endp || m_max_attack < m_min_attack)
throw game_data_error
("expected positive integer >= %u but found \"%s\"",
m_min_attack, list[1].c_str());
@@ -988,13 +988,13 @@
}
if
- (!enemy or
- ((state.ivar1 & CF_RETREAT_WHEN_INJURED) and
- state.ui32var3 > get_current_hitpoints() and
+ (!enemy ||
+ ((state.ivar1 & CF_RETREAT_WHEN_INJURED) &&
+ state.ui32var3 > get_current_hitpoints() &&
defenders > 0))
{
// Injured soldiers will try to return to safe site at home.
- if (state.ui32var3 > get_current_hitpoints() and defenders) {
+ if (state.ui32var3 > get_current_hitpoints() && defenders) {
state.coords = Coords::Null();
state.objvar1 = nullptr;
}
@@ -1004,12 +1004,12 @@
if (state.coords) {
BaseImmovable * const newimm = game.map()[state.coords].get_immovable();
upcast(MilitarySite, newsite, newimm);
- if (newsite and (&newsite->owner() == &owner())) {
+ if (newsite && (&newsite->owner() == &owner())) {
if (upcast(SoldierControl, ctrl, newsite)) {
state.objvar1 = nullptr;
// We may also have our location destroyed in between
if
- (ctrl->stationedSoldiers().size() < ctrl->soldierCapacity() and
+ (ctrl->stationedSoldiers().size() < ctrl->soldierCapacity() &&
(!location || location->base_flag().get_position()
!=
newsite ->base_flag().get_position()))
@@ -1078,8 +1078,8 @@
{
if (upcast(Soldier, soldier, bob)) {
return
- soldier->get_current_hitpoints() and
- soldier->is_attacking_player(game, player) and
+ soldier->get_current_hitpoints() &&
+ soldier->is_attacking_player(game, player) &&
soldier->owner().is_hostile(player);
}
return false;
@@ -1169,7 +1169,7 @@
* Attempt to fix a crash when player bulldozes a building being defended
* by soldiers.
*/
- if (not location)
+ if (!location)
return pop_task(game);
Flag & baseflag = location->base_flag();
@@ -1186,7 +1186,7 @@
// If we only are defending our home ...
if (state.ivar1 & CF_DEFEND_STAYHOME) {
- if (position == location and state.ivar2 == 1) {
+ if (position == location && state.ivar2 == 1) {
molog("[defense] stayhome: returned home\n");
return pop_task_or_fight(game);
}
@@ -1233,8 +1233,8 @@
FindBobSoldierAttackingPlayer(game, *get_owner()));
if
- (soldiers.empty() or
- ((state.ivar1 & CF_RETREAT_WHEN_INJURED) and
+ (soldiers.empty() ||
+ ((state.ivar1 & CF_RETREAT_WHEN_INJURED) &&
get_current_hitpoints() < state.ui32var3))
{
@@ -1290,7 +1290,7 @@
// Check soldier, be sure that we can fight against soldier.
// Soldiers can not go over enemy land when defending.
if
- ((soldier->canBeChallenged()) and
+ ((soldier->canBeChallenged()) &&
(f.get_owned_by() == get_owner()->player_number()))
{
uint32_t thisDist = game.map().calc_distance
@@ -1510,7 +1510,7 @@
}
}
} else {
- if (opponent.stayHome() and (this == m_battle->second())) {
+ if (opponent.stayHome() && (this == m_battle->second())) {
// Wait until correct roles are assigned
new Battle(game, *m_battle->second(), *m_battle->first());
return schedule_act(game, 10);
@@ -1682,7 +1682,7 @@
{
if (upcast(Soldier, soldier, bob))
return
- soldier->isOnBattlefield() and
+ soldier->isOnBattlefield() &&
soldier->get_current_hitpoints();
return false;
}
@@ -1703,7 +1703,7 @@
if
(!attackdefense ||
- ((attackdefense->ivar1 & CF_RETREAT_WHEN_INJURED) and
+ ((attackdefense->ivar1 & CF_RETREAT_WHEN_INJURED) &&
attackdefense->ui32var3 > get_current_hitpoints()))
{
// Retreating or non-combatant soldiers act like normal bobs
=== modified file 'src/logic/trainingsite.cc'
--- src/logic/trainingsite.cc 2014-07-22 09:54:49 +0000
+++ src/logic/trainingsite.cc 2014-07-25 18:59:12 +0000
@@ -208,7 +208,7 @@
container_iterate_const(std::vector<Soldier *>, m_soldiers, i) {
(*i.current)->set_location_initially(*this);
- assert(not (*i.current)->get_state()); // Should be newly created.
+ assert(!(*i.current)->get_state()); // Should be newly created.
if (game)
(*i.current)->start_task_idle(*game, 0, -1);
=== modified file 'src/logic/tribe.cc'
--- src/logic/tribe.cc 2014-07-22 09:54:49 +0000
+++ src/logic/tribe.cc 2014-07-25 18:59:12 +0000
@@ -105,7 +105,7 @@
(_name, _descname, path, prof, global_s, *this); \
Ware_Index const worker_idx = m_workers.add(&worker_descr); \
if \
- (worker_descr.is_buildable() and \
+ (worker_descr.is_buildable() && \
worker_descr.buildcost().empty()) \
m_worker_types_without_cost.push_back(worker_idx); \
PARSE_MAP_OBJECT_TYPES_END;
@@ -384,7 +384,7 @@
uint32_t Tribe_Descr::get_resource_indicator
(ResourceDescription const * const res, uint32_t const amount) const
{
- if (not res or not amount) {
+ if (!res || !amount) {
int32_t idx = get_immovable_index("resi_none");
if (idx == -1)
throw game_data_error
@@ -405,7 +405,7 @@
++num_indicators;
}
- if (not num_indicators)
+ if (!num_indicators)
throw game_data_error
("tribe %s does not declare a resource indicator for resource %s",
name().c_str(),
=== modified file 'src/logic/warehouse.cc'
--- src/logic/warehouse.cc 2014-07-22 09:54:49 +0000
+++ src/logic/warehouse.cc 2014-07-25 18:59:12 +0000
@@ -372,7 +372,7 @@
for (uint8_t i = worker_types_without_cost.size(); i;) {
Ware_Index const worker_index = worker_types_without_cost.at(--i);
if
- (owner().is_worker_type_allowed(worker_index) and
+ (owner().is_worker_type_allowed(worker_index) &&
m_next_worker_without_cost_spawn[i] == static_cast<uint32_t>(Never()))
{
if (next_spawn == static_cast<uint32_t>(Never()))
@@ -610,7 +610,7 @@
Soldier * soldier = static_cast<Soldier *>(*it);
// Soldier dead ...
- if (not soldier or soldier->get_current_hitpoints() == 0) {
+ if (!soldier || soldier->get_current_hitpoints() == 0) {
it = soldiers.erase(it);
m_supply->remove_workers(ware, 1);
continue;
@@ -950,14 +950,14 @@
bool Warehouse::can_create_worker(Game &, Ware_Index const worker) const {
- if (not (worker < m_supply->get_workers().get_nrwareids()))
+ if (!(worker < m_supply->get_workers().get_nrwareids()))
throw wexception
("worker type %d does not exists (max is %d)",
worker, m_supply->get_workers().get_nrwareids());
const Worker_Descr & w_desc = *descr().tribe().get_worker_descr(worker);
assert(&w_desc);
- if (not w_desc.is_buildable())
+ if (!w_desc.is_buildable())
return false;
// see if we have the resources
=== modified file 'src/logic/warelist.h'
--- src/logic/warelist.h 2014-07-05 16:41:51 +0000
+++ src/logic/warelist.h 2014-07-25 18:59:12 +0000
@@ -59,7 +59,7 @@
}
bool operator== (const WareList &) const;
- bool operator!= (const WareList & wl) const {return not (*this == wl);}
+ bool operator!= (const WareList & wl) const {return !(*this == wl);}
mutable boost::signals2::signal<void ()> changed;
=== modified file 'src/logic/widelands.h'
--- src/logic/widelands.h 2014-07-22 09:54:49 +0000
+++ src/logic/widelands.h 2014-07-25 18:59:12 +0000
@@ -72,19 +72,19 @@
uint8_t hp, attack, defense, evade;
bool operator== (const Soldier_Strength & other) const {
return
- hp == other.hp and
- attack == other.attack and
- defense == other.defense and
+ hp == other.hp &&
+ attack == other.attack &&
+ defense == other.defense &&
evade == other.evade;
}
bool operator< (const Soldier_Strength & other) const {
return
- hp < other.hp or
- (hp == other.hp and
- (attack < other.attack or
- (attack == other.attack and
- (defense < other.defense or
- (defense == other.defense and
+ hp < other.hp ||
+ (hp == other.hp &&
+ (attack < other.attack ||
+ (attack == other.attack &&
+ (defense < other.defense ||
+ (defense == other.defense &&
evade < other.evade)))));
}
};
=== modified file 'src/logic/widelands_geometry.cc'
--- src/logic/widelands_geometry.cc 2014-06-21 16:01:35 +0000
+++ src/logic/widelands_geometry.cc 2014-07-25 18:59:12 +0000
@@ -28,11 +28,11 @@
{}
bool Coords::operator== (const Coords& other) const {
- return x == other.x and y == other.y;
+ return x == other.x && y == other.y;
}
bool Coords::operator!= (const Coords & other) const {
- return not (*this == other);
+ return !(*this == other);
}
Coords::operator bool() const {
@@ -44,7 +44,7 @@
if (y < new_origin.y)
y += extent.h;
y -= new_origin.y;
- if ((y & 1)and(new_origin.y & 1) and++ new_origin.x == extent.w)
+ if ((y & 1) && (new_origin.y & 1) && ++ new_origin.x == extent.w)
new_origin.x = 0;
if (x < new_origin.x)
x += extent.w;
=== modified file 'src/logic/widelands_geometry.h'
--- src/logic/widelands_geometry.h 2014-07-05 16:41:51 +0000
+++ src/logic/widelands_geometry.h 2014-07-25 18:59:12 +0000
@@ -79,10 +79,10 @@
{}
bool operator== (const Area& other) const {
- return Coords_type::operator== (other) and radius == other.radius;
+ return Coords_type::operator== (other) && radius == other.radius;
}
bool operator!= (const Area& other) const {
- return Coords_type::operator!= (other) or radius != other.radius;
+ return Coords_type::operator!= (other) || radius != other.radius;
}
Radius_type radius;
@@ -96,10 +96,10 @@
bool operator== (const HollowArea& other) const {
return
- Area_type::operator== (other) and hole_radius == other.hole_radius;
+ Area_type::operator== (other) && hole_radius == other.hole_radius;
}
bool operator!= (const HollowArea& other) const {
- return not (*this == other);
+ return !(*this == other);
}
typename Area_type::Radius_type hole_radius;
@@ -133,10 +133,10 @@
{}
bool operator== (const TCoords& other) const {
- return Coords_type::operator== (other) and t == other.t;
+ return Coords_type::operator== (other) && t == other.t;
}
bool operator!= (const TCoords& other) const {
- return Coords_type::operator!= (other) or t != other.t;
+ return Coords_type::operator!= (other) || t != other.t;
}
TriangleIndex t;
@@ -155,10 +155,10 @@
{}
bool operator== (Node_and_Triangle<> const other) const {
- return node == other.node and triangle == other.triangle;
+ return node == other.node && triangle == other.triangle;
}
bool operator!= (Node_and_Triangle<> const other) const {
- return not (*this == other);
+ return !(*this == other);
}
Node_Coords_type node;
=== modified file 'src/logic/widelands_geometry_io.cc'
--- src/logic/widelands_geometry_io.cc 2014-05-11 07:38:01 +0000
+++ src/logic/widelands_geometry_io.cc 2014-07-25 18:59:12 +0000
@@ -94,8 +94,8 @@
}
void WriteCoords32(StreamWrite* wr, const Coords& c) {
- assert(static_cast<uint16_t>(c.x) < 0x8000 or c.x == -1);
- assert(static_cast<uint16_t>(c.y) < 0x8000 or c.y == -1);
+ assert(static_cast<uint16_t>(c.x) < 0x8000 || c.x == -1);
+ assert(static_cast<uint16_t>(c.y) < 0x8000 || c.y == -1);
{
uint16_t const x = Little16(c.x);
wr->Data(&x, 2);
=== modified file 'src/logic/worker.cc'
--- src/logic/worker.cc 2014-07-24 05:21:20 +0000
+++ src/logic/worker.cc 2014-07-25 18:59:12 +0000
@@ -646,7 +646,7 @@
// Walk towards it
if
- (not
+ (!
start_task_movepath
(game,
dest,
@@ -1072,7 +1072,7 @@
*/
void Worker::set_location(PlayerImmovable * const location)
{
- assert(not location or Object_Ptr(location).get(owner().egbase()));
+ assert(!location || Object_Ptr(location).get(owner().egbase()));
PlayerImmovable * const oldlocation = get_location(owner().egbase());
if (oldlocation == location)
@@ -1486,7 +1486,7 @@
} else if (upcast(Road, road, nextstep)) { // Flag to Road
if
(&road->get_flag(Road::FlagStart) != location
- and
+ &&
&road->get_flag(Road::FlagEnd) != location)
throw wexception
("MO(%u): [transfer]: nextstep is road, but we are nowhere near",
@@ -1696,7 +1696,7 @@
// state pointer might become invalid
state.ivar1 = 1;
- if (not building->get_building_work(game, *this, success)) {
+ if (!building->get_building_work(game, *this, success)) {
set_animation(game, 0);
return skip_act();
}
@@ -1820,7 +1820,7 @@
// Determine the building's flag and move to it
if
- (not
+ (!
start_task_movepath
(game,
location->base_flag().get_position(),
@@ -2185,7 +2185,7 @@
state.ivar1 = 1; // force return to building
- if (not location) {
+ if (!location) {
// this can happen if the flag (and the building) is destroyed while
// the worker leaves the building.
molog
@@ -2216,7 +2216,7 @@
descr().get_right_walk_anims(does_carry_ware()), true);
}
- if (not dynamic_cast<Building const *>(location)) {
+ if (!dynamic_cast<Building const *>(location)) {
// This can happen "naturally" if the building gets destroyed, but the
// flag is still there and the worker tries to enter from that flag.
// E.g. the player destroyed the building, it is destroyed, through an
@@ -2510,7 +2510,7 @@
// check whether we're on a flag and it's time to return home
if (upcast(Flag, flag, map[get_position()].get_immovable())) {
- if (&flag->owner() == &owner() and flag->economy().warehouses().size()) {
+ if (&flag->owner() == &owner() && flag->economy().warehouses().size()) {
set_location(flag);
return pop_task(game);
}
@@ -2650,11 +2650,11 @@
BaseImmovable * const imm = map.get_immovable(get_position());
if
- (not imm
- or
+ (!imm
+ ||
(imm->get_size() == BaseImmovable::NONE
- and
- not imm->has_attribute(RESI)))
+ &&
+ !imm->has_attribute(RESI)))
{
--state.ivar1;
return start_task_program(game, state.svar1);
@@ -2732,7 +2732,7 @@
return pop_task(game);
if
- (not
+ (!
start_task_movepath
(game, owner_area, 0, descr().get_right_walk_anims(does_carry_ware())))
{
@@ -2854,7 +2854,7 @@
if
(dist > oldest_distance
- || (dist == oldest_distance and time < oldest_time))
+ || (dist == oldest_distance && time < oldest_time))
{
oldest_distance = dist;
oldest_time = time;
=== modified file 'src/logic/worker.h'
--- src/logic/worker.h 2014-07-23 16:01:30 +0000
+++ src/logic/worker.h 2014-07-25 18:59:12 +0000
@@ -92,7 +92,7 @@
/// should be there already). The worker must already be in the same economy
/// as the location.
void set_location_initially(PlayerImmovable & location) {
- assert(not m_location.is_set());
+ assert(!m_location.is_set());
assert(location.serial());
assert(m_economy);
assert(m_economy == location.get_economy());
=== modified file 'src/map_io/s2map.cc'
--- src/map_io/s2map.cc 2014-07-23 14:49:10 +0000
+++ src/map_io/s2map.cc 2014-07-25 18:59:12 +0000
@@ -174,11 +174,11 @@
std::unique_ptr<uint8_t[]> section;
memcpy(buffer, fr.Data(6), 6);
if
- (buffer[0] != 0x10 or
- buffer[1] != 0x27 or
- buffer[2] != 0x00 or
- buffer[3] != 0x00 or
- buffer[4] != 0x00 or
+ (buffer[0] != 0x10 ||
+ buffer[1] != 0x27 ||
+ buffer[2] != 0x00 ||
+ buffer[3] != 0x00 ||
+ buffer[4] != 0x00 ||
buffer[5] != 0x00)
{
cerr << "Section marker not found" << endl;
=== modified file 'src/map_io/widelands_map_building_data_packet.cc'
--- src/map_io/widelands_map_building_data_packet.cc 2014-07-14 21:52:13 +0000
+++ src/map_io/widelands_map_building_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -131,7 +131,7 @@
Extent const extent = map.extent();
iterate_Map_FCoords(map, extent, fc) {
upcast(Building const, building, fc.field->get_immovable());
- if (building and building->get_position() == fc) {
+ if (building && building->get_position() == fc) {
// We only write Buildings.
// Buildings can life on only one main position.
assert(!mos.is_object_known(*building));
=== modified file 'src/map_io/widelands_map_buildingdata_data_packet.cc'
--- src/map_io/widelands_map_buildingdata_data_packet.cc 2014-07-16 08:25:35 +0000
+++ src/map_io/widelands_map_buildingdata_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -80,13 +80,13 @@
try {
uint16_t const packet_version = fr.Unsigned16();
- if (1 <= packet_version and packet_version <= CURRENT_PACKET_VERSION) {
+ if (1 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) {
for (;;) {
- if (2 <= packet_version and fr.EndOfFile())
+ if (2 <= packet_version && fr.EndOfFile())
break;
Serial const serial = fr.Unsigned32();
- if (packet_version < 2 and serial == 0xffffffff) {
- if (not fr.EndOfFile())
+ if (packet_version < 2 && serial == 0xffffffff) {
+ if (!fr.EndOfFile())
throw game_data_error
("expected end of file after serial 0xffffffff");
break;
@@ -478,7 +478,7 @@
try {
uint16_t const packet_version = fr.Unsigned16();
if
- (1 <= packet_version and
+ (1 <= packet_version &&
packet_version <= CURRENT_WAREHOUSE_PACKET_VERSION)
{
Ware_Index const nr_wares = warehouse.descr().tribe().get_nrwares();
@@ -617,7 +617,7 @@
} else
for (;;) {
char const * const worker_typename = fr.CString ();
- if (not *worker_typename) // encountered the terminator ("")
+ if (!*worker_typename) // encountered the terminator ("")
break;
uint32_t const next_spawn = fr.Unsigned32();
Ware_Index const worker_index =
@@ -852,7 +852,7 @@
try {
uint16_t const packet_version = fr.Unsigned16();
if
- (1 <= packet_version and
+ (1 <= packet_version &&
packet_version <= CURRENT_PRODUCTIONSITE_PACKET_VERSION)
{
ProductionSite::Working_Position & wp_begin =
@@ -923,9 +923,9 @@
uint32_t count = j->second;
assert(count);
if (worker_descr.can_act_as(j->first)) {
- while (wp->worker or wp->worker_request) {
+ while (wp->worker || wp->worker_request) {
++wp;
- if (not --count)
+ if (!--count)
goto end_working_position;
}
break;
@@ -1504,7 +1504,7 @@
fw.Unsigned16(nr_workers);
for (ProductionSite::Working_Position const * i = &begin; i < &end; ++i)
if (Worker const * const w = i->worker) {
- assert(not i->worker_request);
+ assert(!i->worker_request);
assert(mos.is_object_known(*w));
fw.Unsigned32(mos.get_object_file_index(*w));
}
=== modified file 'src/map_io/widelands_map_extradata_data_packet.cc'
--- src/map_io/widelands_map_extradata_data_packet.cc 2014-07-15 18:38:06 +0000
+++ src/map_io/widelands_map_extradata_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -47,7 +47,7 @@
prof.get_safe_section("global").get_safe_int("packet_version");
if (packet_version == CURRENT_PACKET_VERSION) {
// Read all pics.
- if (fs.FileExists("pics") and fs.IsDirectory("pics")) {
+ if (fs.FileExists("pics") && fs.IsDirectory("pics")) {
filenameset_t pictures = fs.ListDirectory("pics");
for
(filenameset_t::iterator pname = pictures.begin();
=== modified file 'src/map_io/widelands_map_flagdata_data_packet.cc'
--- src/map_io/widelands_map_flagdata_data_packet.cc 2014-07-03 19:26:30 +0000
+++ src/map_io/widelands_map_flagdata_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -54,15 +54,15 @@
try {
uint16_t const packet_version = fr.Unsigned16();
- if (1 <= packet_version and packet_version <= CURRENT_PACKET_VERSION) {
+ if (1 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) {
const Map & map = egbase.map();
Extent const extent = map.extent();
for (;;) {
- if (2 <= packet_version and fr.EndOfFile())
+ if (2 <= packet_version && fr.EndOfFile())
break;
Serial const serial = fr.Unsigned32();
- if (packet_version < 2 and serial == 0xffffffff) {
- if (not fr.EndOfFile())
+ if (packet_version < 2 && serial == 0xffffffff) {
+ if (!fr.EndOfFile())
throw game_data_error
("expected end of file after serial 0xffffffff");
break;
=== modified file 'src/map_io/widelands_map_players_messages_data_packet.cc'
--- src/map_io/widelands_map_players_messages_data_packet.cc 2014-06-08 21:02:17 +0000
+++ src/map_io/widelands_map_players_messages_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -123,9 +123,9 @@
Message::Status status = Message::Archived; // default status
if (char const * const status_string = s->get_string("status")) {
try {
- if (not strcmp(status_string, "new"))
+ if (!strcmp(status_string, "new"))
status = Message::New;
- else if (not strcmp(status_string, "read"))
+ else if (!strcmp(status_string, "read"))
status = Message::Read;
else
throw game_data_error
@@ -184,10 +184,10 @@
const Message & message = *i.current->second;
assert(message.sent() <= static_cast<uint32_t>(egbase.get_gametime()));
assert
- (message.duration() == Forever() or
+ (message.duration() == Forever() ||
message.sent() < message.sent() + message.duration());
if
- (message.duration() != Forever() and
+ (message.duration() != Forever() &&
message.sent() + message.duration()
<
static_cast<uint32_t>(egbase.get_gametime()))
@@ -208,7 +208,7 @@
message.status() == Message::Read ? "read" :
message.status() == Message::Archived ? "archived" : "ERROR");
assert
- (message.duration() == Forever() or
+ (message.duration() == Forever() ||
static_cast<uint32_t>(egbase.get_gametime())
<=
message.sent() + message.duration());
=== modified file 'src/map_io/widelands_map_players_view_data_packet.cc'
--- src/map_io/widelands_map_players_view_data_packet.cc 2014-07-23 14:49:10 +0000
+++ src/map_io/widelands_map_players_view_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -162,7 +162,7 @@
}
#define CHECK_TRAILING_BYTES(file, filename) \
- if (not(file).EndOfFile()) \
+ if (!(file).EndOfFile()) \
throw game_data_error("Map_Players_View_Data_Packet::Read: player %u:" \
"Found %lu trailing bytes in \"%s\"", \
plnum, \
@@ -171,7 +171,7 @@
// TODO(unknown) Legacy code deprecated since build18
template <uint8_t const Size> struct BitInBuffer {
- static_assert(Size == 1 or Size == 2 or Size == 4, "Unexpected Size.");
+ static_assert(Size == 1 || Size == 2 || Size == 4, "Unexpected Size.");
BitInBuffer(FileRead* fr) : buffer(0), mask(0x00) {
m_fr = fr;
}
@@ -991,10 +991,10 @@
{
Map_Object_Descr const * const map_object_descr = map_object_data->map_object_descr;
const Player::Constructionsite_Information & csi = map_object_data->csi;
- assert(not Road::IsRoadDescr(map_object_descr));
+ assert(!Road::IsRoadDescr(map_object_descr));
uint8_t immovable_kind = 255;
- if (not map_object_descr)
+ if (!map_object_descr)
immovable_kind = 0;
else if (upcast(Immovable_Descr const, immovable_descr, map_object_descr)) {
immovable_kind = 1;
@@ -1094,7 +1094,7 @@
vision_file.Unsigned32(f_player_field.vision);
- if (not f_seen) {
+ if (!f_seen) {
if (f_everseen) { // node
unseen_times_file.Unsigned32
@@ -1119,7 +1119,7 @@
if
// the player does not see the D triangle now but has
// seen it
- (not bl_seen & not br_seen &
+ (!bl_seen & !br_seen &
(f_everseen | bl_everseen | br_everseen))
{
terrains_file.Unsigned8(f_player_field.terrains.d);
@@ -1130,7 +1130,7 @@
if
// the player does not see the R triangle now but has
// seen it
- (not br_seen & not r_seen &
+ (!br_seen & !r_seen &
(f_everseen | br_everseen | r_everseen))
{
terrains_file.Unsigned8(f_player_field.terrains.r);
@@ -1140,11 +1140,11 @@
}
// edges
- if (not bl_seen & (f_everseen | bl_everseen))
+ if (!bl_seen & (f_everseen | bl_everseen))
roads_file.Unsigned8(f_player_field.road_sw());
- if (not br_seen & (f_everseen | br_everseen))
+ if (!br_seen & (f_everseen | br_everseen))
roads_file.Unsigned8(f_player_field.road_se());
- if (not r_seen & (f_everseen | r_everseen))
+ if (!r_seen & (f_everseen | r_everseen))
roads_file.Unsigned8(f_player_field.road_e ());
}
=== modified file 'src/map_io/widelands_map_road_data_packet.cc'
--- src/map_io/widelands_map_road_data_packet.cc 2014-07-03 19:26:30 +0000
+++ src/map_io/widelands_map_road_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -85,7 +85,7 @@
for (; field < fields_end; ++field)
if (upcast(Road const, road, field->get_immovable())) // only roads
// Roads can life on multiple positions.
- if (not mos.is_object_known(*road))
+ if (!mos.is_object_known(*road))
fw.Unsigned32(mos.register_object(*road));
fw.Unsigned32(0xffffffff);
=== modified file 'src/map_io/widelands_map_roaddata_data_packet.cc'
--- src/map_io/widelands_map_roaddata_data_packet.cc 2014-07-22 09:54:49 +0000
+++ src/map_io/widelands_map_roaddata_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -55,15 +55,15 @@
try {
uint16_t const packet_version = fr.Unsigned16();
- if (1 <= packet_version and packet_version <= CURRENT_PACKET_VERSION) {
+ if (1 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) {
const Map & map = egbase.map();
Player_Number const nr_players = map.get_nrplayers();
for (;;) {
- if (2 <= packet_version and fr.EndOfFile())
+ if (2 <= packet_version && fr.EndOfFile())
break;
Serial const serial = fr.Unsigned32();
- if (packet_version < 2 and serial == 0xffffffff) {
- if (not fr.EndOfFile())
+ if (packet_version < 2 && serial == 0xffffffff) {
+ if (!fr.EndOfFile())
throw game_data_error
("expected end of file after serial 0xffffffff");
break;
@@ -108,7 +108,7 @@
road.m_cost[0] = fr.Unsigned32();
road.m_cost[1] = fr.Unsigned32();
Path::Step_Vector::size_type const nr_steps = fr.Unsigned16();
- if (not nr_steps)
+ if (!nr_steps)
throw game_data_error("nr_steps = 0");
Path p(road.m_flags[0]->get_position());
for (Path::Step_Vector::size_type i = nr_steps; i; --i)
@@ -129,9 +129,9 @@
road.m_idle_index = fr.Unsigned32();
uint32_t const count = fr.Unsigned32();
- if (not count)
+ if (!count)
throw game_data_error("no carrier slot");
- if (packet_version <= 2 and 1 < count)
+ if (packet_version <= 2 && 1 < count)
throw game_data_error
(
"expected 1 but found %u carrier slots in road saved "
@@ -176,13 +176,13 @@
packet_version < 3 ? 1 : fr.Unsigned32();
if
- (i < road.m_carrier_slots.size() and
+ (i < road.m_carrier_slots.size() &&
road.m_carrier_slots[i].carrier_type == carrier_type)
{
assert(!road.m_carrier_slots[i].carrier.get(egbase));
road.m_carrier_slots[i].carrier = carrier;
- if (carrier or carrier_request) {
+ if (carrier || carrier_request) {
delete road.m_carrier_slots[i].carrier_request;
road.m_carrier_slots[i].carrier_request =
carrier_request;
@@ -226,7 +226,7 @@
const Field & fields_end = map[map.max_index()];
for (Field const * field = &map[0]; field < &fields_end; ++field)
if (upcast(Road const, r, field->get_immovable()))
- if (not mos.is_object_saved(*r)) {
+ if (!mos.is_object_saved(*r)) {
assert(mos.is_object_known(*r));
fw.Unsigned32(mos.get_object_file_index(*r));
=== modified file 'src/map_io/widelands_map_saver.cc'
--- src/map_io/widelands_map_saver.cc 2014-07-05 13:14:42 +0000
+++ src/map_io/widelands_map_saver.cc 2014-07-25 18:59:12 +0000
@@ -136,7 +136,7 @@
iterate_players_existing_const(plnum, nr_players, m_egbase, player) {
Building_Index const nr_buildings = player->tribe().get_nrbuildings();
for (Building_Index i = 0; i < nr_buildings; ++i)
- if (not player->is_building_type_allowed(i)) {
+ if (!player->is_building_type_allowed(i)) {
log("Writing Allowed Building Types Data ... ");
Map_Allowed_Building_Types_Data_Packet p;
p .Write(m_fs, m_egbase, *m_mos);
=== modified file 'src/map_io/widelands_map_scripting_data_packet.cc'
--- src/map_io/widelands_map_scripting_data_packet.cc 2014-07-03 19:26:30 +0000
+++ src/map_io/widelands_map_scripting_data_packet.cc 2014-07-25 18:59:12 +0000
@@ -56,7 +56,7 @@
// wise this makes no sense.
upcast(Game, g, &egbase);
FileRead fr;
- if (g and fr.TryOpen(fs, "scripting/globals.dump"))
+ if (g && fr.TryOpen(fs, "scripting/globals.dump"))
{
const uint32_t sentinel = fr.Unsigned32();
const uint32_t packet_version = fr.Unsigned32();
=== modified file 'src/network/internet_gaming.cc'
--- src/network/internet_gaming.cc 2014-07-14 10:45:44 +0000
+++ src/network/internet_gaming.cc 2014-07-25 18:59:12 +0000
@@ -97,7 +97,7 @@
/// \returns the one and only InternetGaming instance.
InternetGaming & InternetGaming::ref() {
- if (not ig)
+ if (!ig)
ig = new InternetGaming();
return * ig;
}
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc 2014-07-22 09:54:49 +0000
+++ src/network/nethost.cc 2014-07-25 18:59:12 +0000
@@ -281,7 +281,7 @@
virtual void setPlayerNumber(uint8_t const number) override {
if
- (number == UserSettings::none() or
+ (number == UserSettings::none() ||
number < h->settings().players.size())
h->setPlayerNumber(number);
}
@@ -765,7 +765,7 @@
// Setup by the users
log ("[Dedicated] Entering set up mode, waiting for user interaction!\n");
- while (not d->dedicated_start) {
+ while (!d->dedicated_start) {
handle_network();
// TODO(unknown) this should be improved.
#ifndef _WIN32
@@ -1303,7 +1303,7 @@
}
void NetHost::dserver_send_maps_and_saves(Client & client) {
- assert (not d->game);
+ assert (!d->game);
if (d->settings.maps.empty()) {
// Read in maps
@@ -2014,7 +2014,7 @@
*/
bool NetHost::haveUserName(const std::string & name, uint8_t ignoreplayer) {
for (uint32_t i = 0; i < d->settings.users.size(); ++i)
- if (i != ignoreplayer and d->settings.users.at(i).name == name)
+ if (i != ignoreplayer && d->settings.users.at(i).name == name)
return true;
// Computer players are not handled like human users,
@@ -2022,7 +2022,7 @@
if (ignoreplayer < d->settings.users.size())
ignoreplayer = d->settings.users.at(ignoreplayer).position;
for (uint32_t i = 0; i < d->settings.players.size(); ++i)
- if (i != ignoreplayer and d->settings.players.at(i).name == name)
+ if (i != ignoreplayer && d->settings.players.at(i).name == name)
return true;
return false;
=== modified file 'src/network/network.cc'
--- src/network/network.cc 2014-06-23 21:07:36 +0000
+++ src/network/network.cc 2014-07-25 18:59:12 +0000
@@ -195,7 +195,7 @@
queue.insert(queue.end(), &buffer[0], &buffer[bytes]);
- return queue.size() < 2 or 2 <= (queue[0] << 8 | queue[1]);
+ return queue.size() < 2 || 2 <= (queue[0] << 8 | queue[1]);
}
/**
=== modified file 'src/profile/profile.cc'
--- src/profile/profile.cc 2014-06-23 20:17:05 +0000
+++ src/profile/profile.cc 2014-07-25 18:59:12 +0000
@@ -109,7 +109,7 @@
{
char * endp;
long long int i = strtoll(m_value, &endp, 0);
- if (*endp or i < 0)
+ if (*endp || i < 0)
throw wexception("%s: '%s' is not natural", get_name(), m_value);
return i;
}
@@ -119,7 +119,7 @@
{
char * endp;
long long int i = strtoll(m_value, &endp, 0);
- if (*endp or i < 1)
+ if (*endp || i < 1)
throw wexception("%s: '%s' is not positive", get_name(), m_value);
return i;
}
@@ -217,7 +217,7 @@
void Section::check_used() const
{
container_iterate_const(Value_list, m_values, i)
- if (not i.current->is_used())
+ if (!i.current->is_used())
m_profile->error
("Section [%s], key '%s' not used (did you spell the name "
"correctly?)",
@@ -228,7 +228,7 @@
bool Section::has_val(char const * const name) const
{
container_iterate_const(Value_list, m_values, i)
- if (not strcasecmp(i.current->get_name(), name))
+ if (!strcasecmp(i.current->get_name(), name))
return true;
return false;
}
@@ -260,7 +260,7 @@
Section::Value * Section::get_next_val(char const * const name)
{
container_iterate(Value_list, m_values, i)
- if (not i.current->is_used())
+ if (!i.current->is_used())
if (!name || !strcasecmp(i.current->get_name(), name)) {
i.current->mark_used();
return &*i.current;
@@ -634,7 +634,7 @@
Section * Profile::get_next_section(char const * const name)
{
container_iterate(Section_list, m_sections, i)
- if (not i.current->is_used())
+ if (!i.current->is_used())
if (!name || !strcasecmp(i.current->get_name(), name)) {
i.current->mark_used();
return &*i.current;
@@ -769,9 +769,9 @@
// first, check for multiline string
if
- ((tail[0] == '\'' or tail[0] == '"')
- and
- (tail[1] == '\'' or tail[1] == '"'))
+ ((tail[0] == '\'' || tail[0] == '"')
+ &&
+ (tail[1] == '\'' || tail[1] == '"'))
{
reading_multiline = true;
tail += 2;
@@ -826,7 +826,7 @@
}
// Make sure that the requested global section exists, even if it is empty.
- if (global_section and not get_section(global_section))
+ if (global_section && !get_section(global_section))
create_section_duplicate(global_section);
}
=== modified file 'src/scripting/c_utils.cc'
--- src/scripting/c_utils.cc 2014-06-05 05:40:53 +0000
+++ src/scripting/c_utils.cc 2014-07-25 18:59:12 +0000
@@ -32,7 +32,7 @@
Factory * fac = static_cast<Factory *>(lua_touserdata(L, -1));
lua_pop(L, 1); // pop this userdata
- if (not fac)
+ if (!fac)
throw LuaError("\"factory\" field was nil, which should be impossible!");
return *fac;
@@ -43,7 +43,7 @@
Widelands::Game * g = static_cast<Widelands::Game *>(lua_touserdata(L, -1));
lua_pop(L, 1); // pop this userdata
- if (not g)
+ if (!g)
throw LuaError
("\"game\" field was nil. get_game was not called in a game.");
@@ -56,7 +56,7 @@
(lua_touserdata(L, -1));
lua_pop(L, 1); // pop this userdata
- if (not g)
+ if (!g)
throw LuaError
("\"egbase\" field was nil. This should be impossible.");
@@ -73,7 +73,7 @@
lua_pop(L, 1); // pop this userdata
- if (not mol)
+ if (!mol)
throw LuaError
("\"mol\" field was nil. This should be impossible.");
@@ -89,7 +89,7 @@
lua_pop(L, 1); // pop this userdata
- if (not mos)
+ if (!mos)
throw LuaError
("\"mos\" field was nil. This should be impossible.");
=== modified file 'src/scripting/lua_bases.cc'
--- src/scripting/lua_bases.cc 2014-07-11 22:53:34 +0000
+++ src/scripting/lua_bases.cc 2014-07-25 18:59:12 +0000
@@ -127,7 +127,7 @@
uint32_t idx = 1;
for (Player_Number i = 1; i <= MAX_PLAYERS; i++) {
Player * rv = egbase.get_player(i);
- if (not rv)
+ if (!rv)
continue;
lua_pushuint32(L, idx++);
@@ -349,7 +349,7 @@
force = luaL_checkboolean(L, 3);
Flag * f;
- if (not force) {
+ if (!force) {
f = get(L, get_egbase(L)).build_flag(c->fcoords(L));
if (!f)
report_error(L, "Couldn't build flag!");
@@ -398,22 +398,22 @@
for (int32_t i = 3; i <= lua_gettop(L); i++) {
std::string d = luaL_checkstring(L, i);
- if (d == "ne" or d == "tr") {
+ if (d == "ne" || d == "tr") {
path.append(map, 1);
map.get_trn(current, ¤t);
- } else if (d == "e" or d == "r") {
+ } else if (d == "e" || d == "r") {
path.append(map, 2);
map.get_rn(current, ¤t);
- } else if (d == "se" or d == "br") {
+ } else if (d == "se" || d == "br") {
path.append(map, 3);
map.get_brn(current, ¤t);
- } else if (d == "sw" or d == "bl") {
+ } else if (d == "sw" || d == "bl") {
path.append(map, 4);
map.get_bln(current, ¤t);
- } else if (d == "w" or d == "l") {
+ } else if (d == "w" || d == "l") {
path.append(map, 5);
map.get_ln(current, ¤t);
- } else if (d == "nw" or d == "tl") {
+ } else if (d == "nw" || d == "tl") {
path.append(map, 6);
map.get_tln(current, ¤t);
} else
@@ -438,11 +438,11 @@
r = &get(L, egbase).force_road(path);
} else {
BaseImmovable * bi = map.get_immovable(current);
- if (!bi or bi->get_type() != Map_Object::FLAG) {
+ if (!bi || bi->get_type() != Map_Object::FLAG) {
if (!get(L, egbase).build_flag(current))
report_error(L, "Could not place end flag!");
}
- if (bi and bi == starting_flag)
+ if (bi && bi == starting_flag)
report_error(L, "Cannot build a closed loop!");
r = get(L, egbase).build_road(path);
@@ -508,7 +508,7 @@
b = get(L, get_egbase(L)).build
(c->coords(), i, constructionsite, former_buildings);
}
- if (not b)
+ if (!b)
report_error(L, "Couldn't place building!");
LuaMap::upcasted_immovable_to_lua(L, b);
=== modified file 'src/scripting/lua_game.cc'
--- src/scripting/lua_game.cc 2014-07-05 14:22:44 +0000
+++ src/scripting/lua_game.cc 2014-07-25 18:59:12 +0000
@@ -305,17 +305,17 @@
if (n == 4) {
// Optional arguments
lua_getfield(L, 4, "duration");
- if (not lua_isnil(L, -1))
+ if (!lua_isnil(L, -1))
d = luaL_checkuint32(L, -1);
lua_pop(L, 1);
lua_getfield(L, 4, "field");
- if (not lua_isnil(L, -1))
+ if (!lua_isnil(L, -1))
c = (*get_user_class<L_Field>(L, -1))->coords();
lua_pop(L, 1);
lua_getfield(L, 4, "status");
- if (not lua_isnil(L, -1)) {
+ if (!lua_isnil(L, -1)) {
std::string s = luaL_checkstring(L, -1);
if (s == "new") st = Message::New;
else if (s == "read") st = Message::Read;
@@ -325,12 +325,12 @@
lua_pop(L, 1);
lua_getfield(L, 4, "sender");
- if (not lua_isnil(L, -1))
+ if (!lua_isnil(L, -1))
sender = luaL_checkstring(L, -1);
lua_pop(L, 1);
lua_getfield(L, 4, "popup");
- if (not lua_isnil(L, -1))
+ if (!lua_isnil(L, -1))
popup = luaL_checkboolean(L, -1);
lua_pop(L, 1);
}
@@ -406,7 +406,7 @@
#define CHECK_ARG(var, type) \
lua_getfield(L, -1, #var); \
- if (not lua_isnil(L, -1)) var = luaL_check ## type(L, -1); \
+ if (!lua_isnil(L, -1)) var = luaL_check ## type(L, -1); \
lua_pop(L, 1);
if (lua_gettop(L) == 4) {
@@ -418,7 +418,7 @@
// This must be done manually
lua_getfield(L, 4, "field");
- if (not lua_isnil(L, -1)) {
+ if (!lua_isnil(L, -1)) {
Coords c = (*get_user_class<L_Field>(L, -1))->coords();
game.get_ipl()->move_view_to(c);
}
@@ -774,7 +774,7 @@
for (Ware_Index i = 0; i < tribe.get_nrworkers(); ++i) {
const Worker_Descr & worker_descr = *tribe.get_worker_descr(i);
- if (not worker_descr.is_buildable())
+ if (!worker_descr.is_buildable())
continue;
player.allow_worker_type(i, true);
=== modified file 'src/scripting/lua_globals.cc'
--- src/scripting/lua_globals.cc 2014-07-16 08:23:42 +0000
+++ src/scripting/lua_globals.cc 2014-07-25 18:59:12 +0000
@@ -149,7 +149,7 @@
static int L__(lua_State * L) {
lua_getglobal(L, "__TEXTDOMAIN");
- if (not lua_isnil(L, -1)) {
+ if (!lua_isnil(L, -1)) {
i18n::Textdomain dom(luaL_checkstring(L, -1));
lua_pushstring(L, i18n::translate(luaL_checkstring(L, 1)));
} else {
@@ -181,7 +181,7 @@
const uint32_t n = luaL_checkuint32(L, 3);
lua_getglobal(L, "__TEXTDOMAIN");
- if (not lua_isnil(L, -1)) {
+ if (!lua_isnil(L, -1)) {
i18n::Textdomain dom(luaL_checkstring(L, -1));
lua_pushstring(L, ngettext(msgid.c_str(), msgid_plural.c_str(), n));
} else {
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2014-07-24 05:21:20 +0000
+++ src/scripting/lua_map.cc 2014-07-25 18:59:12 +0000
@@ -166,7 +166,7 @@
(lua_State * L, const Tribe_Descr & tribe) \
{ \
int32_t nargs = lua_gettop(L); \
- if (nargs != 2 and nargs != 3) \
+ if (nargs != 2 && nargs != 3) \
report_error(L, "Wrong number of arguments to set_" #type "!"); \
btype##sMap rv; \
if (nargs == 3) { \
@@ -2069,7 +2069,7 @@
// Both objects are destroyed: they are equal
if (me == you) lua_pushboolean(L, true);
- else if (!me or !you) // One of the objects is destroyed: they are distinct
+ else if (!me || !you) // One of the objects is destroyed: they are distinct
lua_pushboolean(L, false);
else // Compare them
lua_pushboolean
@@ -3619,7 +3619,7 @@
int32_t amount = luaL_checkint32(L, -1);
int32_t max_amount = get_egbase(L).world().get_resource(res)->max_amount();
- if (amount < 0 or amount > max_amount)
+ if (amount < 0 || amount > max_amount)
report_error(L, "Illegal amount: %i, must be >= 0 and <= %i", amount, max_amount);
field->set_resources(res, amount);
=== modified file 'src/scripting/lua_table.h'
--- src/scripting/lua_table.h 2014-07-05 16:41:51 +0000
+++ src/scripting/lua_table.h 2014-07-25 18:59:12 +0000
@@ -167,7 +167,7 @@
lua_xmove(t, L_, 1);
}
- if (not lua_isthread(L_, -1)) {
+ if (!lua_isthread(L_, -1)) {
lua_pop(L_, 1);
throw LuaError(boost::lexical_cast<std::string>(key) + " is not a function value.");
}
=== modified file 'src/scripting/lua_ui.cc'
--- src/scripting/lua_ui.cc 2014-07-05 12:48:58 +0000
+++ src/scripting/lua_ui.cc 2014-07-25 18:59:12 +0000
@@ -107,7 +107,7 @@
static void _put_all_visible_buttons_into_table
(lua_State * L, UI::Panel * g)
{
- if (not g) return;
+ if (!g) return;
for (UI::Panel * f = g->get_first_child(); f; f = f->get_next_sibling())
{
@@ -138,7 +138,7 @@
static void _put_all_tabs_into_table
(lua_State * L, UI::Panel * g)
{
- if (not g) return;
+ if (!g) return;
for (UI::Panel * f = g->get_first_child(); f; f = f->get_next_sibling())
{
@@ -171,7 +171,7 @@
static void _put_all_visible_windows_into_table
(lua_State * L, UI::Panel * g)
{
- if (not g) return;
+ if (!g) return;
for (UI::Panel * f = g->get_first_child(); f; f = f->get_next_sibling())
{
=== modified file 'src/scripting/scripting.cc'
--- src/scripting/scripting.cc 2014-06-26 05:53:49 +0000
+++ src/scripting/scripting.cc 2014-07-25 18:59:12 +0000
@@ -111,7 +111,7 @@
lua_pop(L, 1); // No return value from script
lua_newtable(L); // Push an empty table
}
- if (not lua_istable(L, -1))
+ if (!lua_istable(L, -1))
throw LuaError("Script did not return a table!");
// Restore old value of __file__.
=== modified file 'src/sound/sound_handler.cc'
--- src/sound/sound_handler.cc 2014-07-23 14:49:10 +0000
+++ src/sound/sound_handler.cc 2014-07-25 18:59:12 +0000
@@ -118,7 +118,7 @@
if
(SDL_InitSubSystem(SDL_INIT_AUDIO) == -1
- or
+ ||
Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, bufsize) == -1)
{
SDL_QuitSubSystem(SDL_INIT_AUDIO);
@@ -277,7 +277,7 @@
if (nosound_)
return;
- if (not fr.TryOpen(*g_fs, path)) {
+ if (!fr.TryOpen(*g_fs, path)) {
log("WARNING: Could not open %s for reading!\n", path);
return;
}
@@ -535,7 +535,7 @@
void Sound_Handler::start_music
(const std::string & songset_name, int32_t fadein_ms)
{
- if (get_disable_music() or nosound_)
+ if (get_disable_music() || nosound_)
return;
if (fadein_ms == 0) fadein_ms = 250; // avoid clicks
@@ -565,7 +565,7 @@
*/
void Sound_Handler::stop_music(int32_t fadeout_ms)
{
- if (get_disable_music() or nosound_)
+ if (get_disable_music() || nosound_)
return;
if (fadeout_ms == 0) fadeout_ms = 250; // avoid clicks
@@ -658,7 +658,7 @@
* \param volume The new music volume.
*/
void Sound_Handler::set_music_volume(int32_t volume) {
- if (not lock_audio_disabling_ and not nosound_) {
+ if (!lock_audio_disabling_ && !nosound_) {
music_volume_ = volume;
Mix_VolumeMusic(volume);
g_options.pull_section("global").set_int("music_volume", volume);
@@ -673,7 +673,7 @@
* \param volume The new music volume.
*/
void Sound_Handler::set_fx_volume(int32_t volume) {
- if (not lock_audio_disabling_ and not nosound_) {
+ if (!lock_audio_disabling_ && !nosound_) {
fx_volume_ = volume;
Mix_Volume(-1, volume);
g_options.pull_section("global").set_int("fx_volume", volume);
=== modified file 'src/ui_basic/button.cc'
--- src/ui_basic/button.cc 2014-07-14 10:45:44 +0000
+++ src/ui_basic/button.cc 2014-07-25 18:59:12 +0000
@@ -164,13 +164,13 @@
void Button::draw(RenderTarget & dst)
{
// Draw the background
- if (not m_flat or m_draw_flat_background) {
+ if (!m_flat || m_draw_flat_background) {
assert(m_pic_background);
dst.fill_rect(Rect(Point(0, 0), get_w(), get_h()), RGBAColor(0, 0, 0, 255));
dst.tile(Rect(Point(0, 0), get_w(), get_h()), m_pic_background, Point(get_x(), get_y()));
}
- if (m_enabled and m_highlighted and not m_flat)
+ if (m_enabled && m_highlighted && !m_flat)
dst.brighten_rect
(Rect(Point(0, 0), get_w(), get_h()), MOUSE_OVER_BRIGHT_FACTOR);
@@ -207,14 +207,14 @@
RGBAColor black(0, 0, 0, 255);
// m_permpressed is true, we invert the behaviour on m_pressed
- bool draw_pressed = m_permpressed ? not (m_pressed and m_highlighted)
- : (m_pressed and m_highlighted);
+ bool draw_pressed = m_permpressed ? !(m_pressed && m_highlighted)
+ : (m_pressed && m_highlighted);
- if (not m_flat) {
+ if (!m_flat) {
assert(2 <= get_w());
assert(2 <= get_h());
// button is a normal one, not flat
- if (not draw_pressed) {
+ if (!draw_pressed) {
// top edge
dst.brighten_rect
(Rect(Point(0, 0), get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR);
@@ -246,7 +246,7 @@
} else {
// Button is flat, do not draw borders, instead, if it is pressed, draw
// a box around it.
- if (m_enabled and m_highlighted)
+ if (m_enabled && m_highlighted)
{
RGBAColor shade(100, 100, 100, 80);
dst.fill_rect(Rect(Point(0, 0), get_w(), 2), shade);
=== modified file 'src/ui_basic/checkbox.cc'
--- src/ui_basic/checkbox.cc 2014-07-14 10:45:44 +0000
+++ src/ui_basic/checkbox.cc 2014-07-25 18:59:12 +0000
@@ -64,15 +64,15 @@
*/
void Statebox::set_enabled(bool const enabled)
{
- if (((m_flags & Is_Enabled) > 1) and enabled)
+ if (((m_flags & Is_Enabled) > 1) && enabled)
return;
set_flags(Is_Enabled, enabled);
- if (not (m_flags & Has_Custom_Picture)) {
+ if (!(m_flags & Has_Custom_Picture)) {
m_pic_graphics = g_gr->images().get(enabled ? "pics/checkbox_light.png" : "pics/checkbox.png");
set_flags
- (Is_Highlighted, (m_flags & Is_Highlighted) and (m_flags & Is_Enabled));
+ (Is_Highlighted, (m_flags & Is_Highlighted) && (m_flags & Is_Enabled));
}
update();
@@ -85,7 +85,7 @@
* Args: on true if the checkbox should be checked
*/
void Statebox::set_state(bool const on) {
- if (on xor ((m_flags & Is_Checked) > 1)) {
+ if (on ^ ((m_flags & Is_Checked) > 1)) {
set_flags(Is_Checked, on);
changed();
changedto(on);
@@ -136,7 +136,7 @@
*/
void Statebox::handle_mousein(bool const inside) {
bool oldhl = m_flags & Is_Highlighted;
- set_flags(Is_Highlighted, inside and (m_flags & Is_Enabled));
+ set_flags(Is_Highlighted, inside && (m_flags & Is_Enabled));
if (oldhl != (m_flags & Is_Highlighted))
update();
@@ -147,7 +147,7 @@
* Left-click: Toggle checkbox state
*/
bool Statebox::handle_mousepress(const uint8_t btn, int32_t, int32_t) {
- if (btn == SDL_BUTTON_LEFT and (m_flags & Is_Enabled)) {
+ if (btn == SDL_BUTTON_LEFT && (m_flags & Is_Enabled)) {
clicked();
return true;
} else
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc 2014-07-23 14:49:10 +0000
+++ src/ui_basic/editbox.cc 2014-07-25 18:59:12 +0000
@@ -281,7 +281,7 @@
while ((m->text[--m->caret] & 0xc0) == 0x80) {};
if (code.mod & (KMOD_LCTRL | KMOD_RCTRL))
for (uint32_t new_caret = m->caret;; m->caret = new_caret)
- if (0 == new_caret or isspace(m->text[--new_caret]))
+ if (0 == new_caret || isspace(m->text[--new_caret]))
break;
check_caret();
@@ -303,7 +303,7 @@
for (uint32_t new_caret = m->caret;; ++new_caret)
if
(new_caret == m->text.size()
- or
+ ||
isspace(m->text[new_caret - 1]))
{
m->caret = new_caret;
@@ -390,7 +390,7 @@
// example ~ + o results in a o with a tilde over it. The ~ is reported
// as a 0 on keystroke, the o then as the unicode character. We simply
// ignore the 0.
- if (is_printable(code) and code.unicode) {
+ if (is_printable(code) && code.unicode) {
insert(code);
return true;
}
=== modified file 'src/ui_basic/listselect.cc'
--- src/ui_basic/listselect.cc 2014-07-14 10:45:44 +0000
+++ src/ui_basic/listselect.cc 2014-07-25 18:59:12 +0000
@@ -374,7 +374,7 @@
}
assert(2 <= get_eff_w());
// Make the area a bit more white and more transparent
- if (r.w > 0 and r.h > 0)
+ if (r.w > 0 && r.h > 0)
{
dst.brighten_rect(r, - ms_darken_value * 2);
}
@@ -433,7 +433,7 @@
m_last_click_time = time;
y = (y + m_scrollpos) / get_lineheight();
- if (y < 0 or static_cast<int32_t>(m_entry_records.size()) <= y)
+ if (y < 0 || static_cast<int32_t>(m_entry_records.size()) <= y)
return false;
play_click();
select(y);
@@ -441,9 +441,9 @@
if // check if doubleclicked
(time - real_last_click_time < DOUBLE_CLICK_INTERVAL
- and
+ &&
m_last_selection == m_selection
- and
+ &&
m_selection != no_selection_index())
double_clicked(m_selection);
@@ -461,7 +461,7 @@
bool BaseListselect::handle_mousemove(uint8_t, int32_t, int32_t y, int32_t, int32_t) {
y = (y + m_scrollpos) / get_lineheight();
- if (y < 0 or static_cast<int32_t>(m_entry_records.size()) <= y) {
+ if (y < 0 || static_cast<int32_t>(m_entry_records.size()) <= y) {
set_tooltip("");
return false;
}
=== modified file 'src/ui_basic/multilineeditbox.cc'
--- src/ui_basic/multilineeditbox.cc 2014-07-05 14:22:44 +0000
+++ src/ui_basic/multilineeditbox.cc 2014-07-25 18:59:12 +0000
@@ -436,7 +436,7 @@
// example ~ + o results in a o with a tilde over it. The ~ is reported
// as a 0 on keystroke, the o then as the unicode character. We simply
// ignore the 0.
- if (is_printable(code) and code.unicode) {
+ if (is_printable(code) && code.unicode) {
insert(code);
}
break;
=== modified file 'src/ui_basic/multilinetextarea.cc'
--- src/ui_basic/multilinetextarea.cc 2014-07-14 10:45:44 +0000
+++ src/ui_basic/multilinetextarea.cc 2014-07-25 18:59:12 +0000
@@ -194,7 +194,7 @@
(uint8_t const btn, int32_t const x, int32_t const y)
{
return
- btn == SDL_BUTTON_WHEELUP or btn == SDL_BUTTON_WHEELDOWN ?
+ btn == SDL_BUTTON_WHEELUP || btn == SDL_BUTTON_WHEELDOWN ?
m_scrollbar.handle_mousepress(btn, x, y) : false;
}
=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc 2014-07-22 09:54:49 +0000
+++ src/ui_basic/panel.cc 2014-07-25 18:59:12 +0000
@@ -499,9 +499,9 @@
void Panel::update(int32_t x, int32_t y, int32_t w, int32_t h)
{
if
- (x >= static_cast<int32_t>(_w) or x + w <= 0
- or
- y >= static_cast<int32_t>(_h) or y + h <= 0)
+ (x >= static_cast<int32_t>(_w) || x + w <= 0
+ ||
+ y >= static_cast<int32_t>(_h) || y + h <= 0)
return;
_needdraw = true;
@@ -950,9 +950,9 @@
if (!child->get_handle_mouse() || !child->is_visible())
continue;
if
- (x < child->_x + static_cast<int32_t>(child->_w) and x >= child->_x
- and
- y < child->_y + static_cast<int32_t>(child->_h) and y >= child->_y)
+ (x < child->_x + static_cast<int32_t>(child->_w) && x >= child->_x
+ &&
+ y < child->_y + static_cast<int32_t>(child->_h) && y >= child->_y)
break;
}
@@ -971,7 +971,7 @@
*/
void Panel::do_mousein(bool const inside)
{
- if (not _g_allow_user_input)
+ if (!_g_allow_user_input)
return;
if (!inside && _mousein) {
@@ -987,7 +987,7 @@
* Returns whether the event was processed.
*/
bool Panel::do_mousepress(const uint8_t btn, int32_t x, int32_t y) {
- if (not _g_allow_user_input) {
+ if (!_g_allow_user_input) {
return true;
}
if (get_can_focus()) {
@@ -1003,7 +1003,7 @@
// usage comment for get_key_state.
// Some window managers use alt-drag, so we can't only use the alt keys
if
- ((not _g_mousegrab) && (btn == SDL_BUTTON_LEFT) &&
+ ((!_g_mousegrab) && (btn == SDL_BUTTON_LEFT) &&
((get_key_state(SDLK_LALT) | get_key_state(SDLK_RALT) |
get_key_state(SDLK_MODE) | get_key_state(SDLK_LSHIFT))))
if (handle_alt_drag(x, y))
@@ -1021,7 +1021,7 @@
return handle_mousepress(btn, x, y);
}
bool Panel::do_mouserelease(const uint8_t btn, int32_t x, int32_t y) {
- if (not _g_allow_user_input)
+ if (!_g_allow_user_input)
return true;
x -= _lborder;
@@ -1040,7 +1040,7 @@
(uint8_t const state,
int32_t x, int32_t y, int32_t const xdiff, int32_t const ydiff)
{
- if (not _g_allow_user_input)
+ if (!_g_allow_user_input)
return true;
x -= _lborder;
@@ -1068,7 +1068,7 @@
*/
bool Panel::do_key(bool const down, SDL_keysym const code)
{
- if (not _g_allow_user_input)
+ if (!_g_allow_user_input)
return true;
if (_focus) {
@@ -1119,9 +1119,9 @@
}
if
- (0 <= x and x < static_cast<int32_t>(mousein->_w)
- and
- 0 <= y and y < static_cast<int32_t>(mousein->_h))
+ (0 <= x && x < static_cast<int32_t>(mousein->_w)
+ &&
+ 0 <= y && y < static_cast<int32_t>(mousein->_h))
rcv = mousein;
else
mousein = nullptr;
@@ -1142,14 +1142,14 @@
* panel.
*/
void Panel::ui_mousepress(const uint8_t button, int32_t x, int32_t y) {
- if (not _g_allow_user_input)
+ if (!_g_allow_user_input)
return;
if (Panel * const p = ui_trackmouse(x, y))
p->do_mousepress(button, x, y);
}
void Panel::ui_mouserelease(const uint8_t button, int32_t x, int32_t y) {
- if (not _g_allow_user_input)
+ if (!_g_allow_user_input)
return;
if (Panel * const p = ui_trackmouse(x, y))
@@ -1164,7 +1164,7 @@
(uint8_t const state,
int32_t x, int32_t y, int32_t const xdiff, int32_t const ydiff)
{
- if (not _g_allow_user_input)
+ if (!_g_allow_user_input)
return;
if (!xdiff && !ydiff)
@@ -1189,7 +1189,7 @@
*/
void Panel::ui_key(bool const down, SDL_keysym const code)
{
- if (not _g_allow_user_input)
+ if (!_g_allow_user_input)
return;
_modal->do_key(down, code);
=== modified file 'src/ui_basic/progresswindow.cc'
--- src/ui_basic/progresswindow.cc 2014-07-14 10:45:44 +0000
+++ src/ui_basic/progresswindow.cc 2014-07-25 18:59:12 +0000
@@ -64,7 +64,7 @@
m_label_center.y = yres * PROGRESS_LABEL_POSITION_Y / 100;
Rect wnd_rect(Point(0, 0), xres, yres);
- if (!m_background_pic or xres != m_xres or yres != m_yres) {
+ if (!m_background_pic || xres != m_xres || yres != m_yres) {
// (Re-)Load background graphics
m_background_pic = ImageTransformations::resize(g_gr->images().get(m_background), xres, yres);
=== modified file 'src/ui_basic/slider.cc'
--- src/ui_basic/slider.cc 2014-07-22 09:54:49 +0000
+++ src/ui_basic/slider.cc 2014-07-25 18:59:12 +0000
@@ -207,7 +207,7 @@
return;
m_enabled = enabled;
- if (not enabled) {
+ if (!enabled) {
m_pressed = false;
m_highlighted = false;
grab_mouse(false);
@@ -237,7 +237,7 @@
*/
void Slider::handle_mousein(bool inside)
{
- if (not inside)
+ if (!inside)
set_highlighted(false);
}
@@ -273,14 +273,14 @@
void Slider::cursor_moved(int32_t pointer, int32_t x, int32_t y) {
int32_t o_cursor_pos = m_cursor_pos;
- if (not m_enabled)
+ if (!m_enabled)
return;
set_highlighted
- (pointer >= m_cursor_pos and pointer <= m_cursor_pos + m_cursor_size
- and y >= 0 and y < get_h() and x >= 0 and x < get_w());
+ (pointer >= m_cursor_pos && pointer <= m_cursor_pos + m_cursor_size
+ && y >= 0 && y < get_h() && x >= 0 && x < get_w());
- if (not m_pressed)
+ if (!m_pressed)
return;
m_cursor_pos = pointer - m_relative_move;
@@ -321,7 +321,7 @@
* \param pointer The relative position of the mouse pointer.
*/
void Slider::cursor_pressed(int32_t pointer) {
- if (not m_enabled)
+ if (!m_enabled)
return;
grab_mouse(true);
@@ -342,7 +342,7 @@
* \param ofs The cursor offset.
*/
void Slider::bar_pressed(int32_t pointer, int32_t ofs) {
- if (not m_enabled)
+ if (!m_enabled)
return;
grab_mouse(true);
@@ -447,14 +447,14 @@
return false;
- if (x >= m_cursor_pos and x <= m_cursor_pos + m_cursor_size) {
+ if (x >= m_cursor_pos && x <= m_cursor_pos + m_cursor_size) {
// click on cursor
cursor_pressed(x);
return true;
} else if
- (y >= get_y_gap() - 2 and
- y <= static_cast<int32_t>(get_h()) - get_y_gap() + 2 and
- x >= get_x_gap() and
+ (y >= get_y_gap() - 2 &&
+ y <= static_cast<int32_t>(get_h()) - get_y_gap() + 2 &&
+ x >= get_x_gap() &&
x < static_cast<int32_t>(get_w()) - get_x_gap())
{ // click on bar
bar_pressed(x, get_x_gap());
@@ -528,14 +528,14 @@
if (btn != SDL_BUTTON_LEFT)
return false;
- if (y >= m_cursor_pos and y <= m_cursor_pos + m_cursor_size) {
+ if (y >= m_cursor_pos && y <= m_cursor_pos + m_cursor_size) {
// click on cursor
cursor_pressed(y);
return true;
} else if
- (y >= get_y_gap() and
- y <= static_cast<int32_t>(get_h()) - get_y_gap() and
- x >= get_x_gap() - 2 and
+ (y >= get_y_gap() &&
+ y <= static_cast<int32_t>(get_h()) - get_y_gap() &&
+ x >= get_x_gap() - 2 &&
x < static_cast<int32_t>(get_w()) - get_x_gap() + 2)
{ // click on bar
bar_pressed(y, get_y_gap());
=== modified file 'src/ui_basic/table.cc'
--- src/ui_basic/table.cc 2014-07-14 10:45:44 +0000
+++ src/ui_basic/table.cc 2014-07-25 18:59:12 +0000
@@ -124,7 +124,7 @@
m_columns.push_back(c);
}
- if (not m_scrollbar) {
+ if (!m_scrollbar) {
m_scrollbar =
new Scrollbar
(get_parent(),
@@ -215,7 +215,7 @@
void Table<void *>::header_button_clicked(Columns::size_type const n) {
assert(m_columns.at(n).btn);
if (get_sort_colum() == n) {
- set_sort_descending(not get_sort_descending()); // change sort direction
+ set_sort_descending(!get_sort_descending()); // change sort direction
sort();
return;
}
@@ -386,9 +386,9 @@
if // check if doubleclicked
(time - real_last_click_time < DOUBLE_CLICK_INTERVAL
- and
+ &&
m_last_selection == m_selection
- and m_selection != no_selection_index())
+ && m_selection != no_selection_index())
double_clicked(m_selection);
return true;
=== modified file 'src/ui_basic/unique_window.cc'
--- src/ui_basic/unique_window.cc 2014-04-06 11:58:13 +0000
+++ src/ui_basic/unique_window.cc 2014-07-25 18:59:12 +0000
@@ -32,7 +32,7 @@
* Creates the window, if it does not exist.
*/
void UniqueWindow::Registry::create() {
- if (not window) {
+ if (!window) {
open_window();
}
}
=== modified file 'src/ui_basic/window.cc'
--- src/ui_basic/window.cc 2014-07-22 09:54:49 +0000
+++ src/ui_basic/window.cc 2014-07-25 18:59:12 +0000
@@ -150,7 +150,7 @@
*/
void Window::layout()
{
- if (m_center_panel && not _is_minimal) {
+ if (m_center_panel && !_is_minimal) {
m_center_panel->set_pos(Point(0, 0));
m_center_panel->set_size(get_inner_w(), get_inner_h());
}
@@ -164,9 +164,9 @@
const Point mouse = get_mouse_position();
if
- (0 <= mouse.x and mouse.x < get_w()
- and
- 0 <= mouse.y and mouse.y < get_h())
+ (0 <= mouse.x && mouse.x < get_w()
+ &&
+ 0 <= mouse.y && mouse.y < get_h())
{
set_pos
(Point(get_x(), get_y())
@@ -205,22 +205,22 @@
int32_t px = get_x();
int32_t py = get_y();
if
- ((parent->get_inner_w() < static_cast<uint32_t>(get_w())) and
- (px + get_w() <= static_cast<int32_t>(parent->get_inner_w()) or px >= 0))
+ ((parent->get_inner_w() < static_cast<uint32_t>(get_w())) &&
+ (px + get_w() <= static_cast<int32_t>(parent->get_inner_w()) || px >= 0))
px = (static_cast<int32_t>(parent->get_inner_w()) - get_w()) / 2;
if
- ((parent->get_inner_h() < static_cast<uint32_t>(get_h())) and
- (py + get_h() < static_cast<int32_t>(parent->get_inner_h()) or py > 0))
+ ((parent->get_inner_h() < static_cast<uint32_t>(get_h())) &&
+ (py + get_h() < static_cast<int32_t>(parent->get_inner_h()) || py > 0))
py = 0;
if (parent->get_inner_w() >= static_cast<uint32_t>(get_w())) {
if (px < 0) {
px = 0;
- if (parent->get_dock_windows_to_edges() and not _docked_left)
+ if (parent->get_dock_windows_to_edges() && !_docked_left)
_docked_left = true;
} else if (px + static_cast<uint32_t>(get_w()) >= parent->get_inner_w()) {
px = static_cast<int32_t>(parent->get_inner_w()) - get_w();
- if (parent->get_dock_windows_to_edges() and not _docked_right)
+ if (parent->get_dock_windows_to_edges() && !_docked_right)
_docked_right = true;
}
if (_docked_left)
@@ -234,9 +234,9 @@
else if (py + static_cast<uint32_t>(get_h()) > parent->get_inner_h()) {
py = static_cast<int32_t>(parent->get_inner_h()) - get_h();
if
- (not _is_minimal
- and
- parent->get_dock_windows_to_edges() and not _docked_bottom)
+ (!_is_minimal
+ &&
+ parent->get_dock_windows_to_edges() && !_docked_bottom)
_docked_bottom = true;
}
if (_docked_bottom)
@@ -325,7 +325,7 @@
Align_Center);
}
- if (not _is_minimal) {
+ if (!_is_minimal) {
const int32_t vt_bar_end = get_h() -
(_docked_bottom ? 0 : BT_B_PIXMAP_THICKNESS) - VT_B_THINGY_PIXMAP_LEN;
const int32_t vt_bar_end_minus_middle =
@@ -423,7 +423,7 @@
}
-void Window::think() {if (not is_minimal()) Panel::think();}
+void Window::think() {if (!is_minimal()) Panel::think();}
/**
@@ -437,9 +437,9 @@
// usage comment for get_key_state.
if
(((get_key_state(SDLK_LCTRL) | get_key_state(SDLK_RCTRL))
- and
+ &&
btn == SDL_BUTTON_LEFT)
- or
+ ||
btn == SDL_BUTTON_MIDDLE)
is_minimal() ? restore() : minimize();
else if (btn == SDL_BUTTON_LEFT) {
@@ -508,7 +508,7 @@
move_inside_parent();
}
void Window::minimize() {
- assert(not _is_minimal);
+ assert(!_is_minimal);
int32_t y = get_y(), x = get_x();
if (_docked_bottom) {
y -= BT_B_PIXMAP_THICKNESS; // Minimal can not be bottom-docked.
@@ -606,21 +606,21 @@
snap_target;
snap_target = snap_target->get_next_sibling())
{
- if (snap_target != this and snap_target->is_snap_target()) {
+ if (snap_target != this && snap_target->is_snap_target()) {
int32_t const other_left = snap_target->get_x();
int32_t const other_top = snap_target->get_y();
int32_t const other_right = other_left + snap_target->get_w();
int32_t const other_bot = other_top + snap_target->get_h();
if (other_top <= bot && other_bot >= top) {
- if (not SOWO || left <= other_right) {
+ if (!SOWO || left <= other_right) {
const int32_t distance = abs(left - other_right);
if (distance < nearest_snap_distance_x) {
nearest_snap_distance_x = distance;
new_left = other_right;
}
}
- if (not SOWO || right >= other_left) {
+ if (!SOWO || right >= other_left) {
const int32_t distance = abs(right - other_left);
if (distance < nearest_snap_distance_x) {
nearest_snap_distance_x = distance;
@@ -629,14 +629,14 @@
}
}
if (other_left <= right && other_right >= left) {
- if (not SOWO || top <= other_bot) {
+ if (!SOWO || top <= other_bot) {
const int32_t distance = abs(top - other_bot);
if (distance < nearest_snap_distance_y) {
nearest_snap_distance_y = distance;
new_top = other_bot;
}
}
- if (not SOWO || bot >= other_top) {
+ if (!SOWO || bot >= other_top) {
const int32_t distance = abs(bot - other_top);
if (distance < nearest_snap_distance_y) {
nearest_snap_distance_y = distance;
@@ -649,20 +649,20 @@
}
if (parent->get_dock_windows_to_edges()) {
- if (new_left <= 0 and new_left >= -VT_B_PIXMAP_THICKNESS) {
+ if (new_left <= 0 && new_left >= -VT_B_PIXMAP_THICKNESS) {
new_left = -VT_B_PIXMAP_THICKNESS;
_docked_left = true;
} else if (_docked_left) {
_docked_left = false;
}
- if (new_left >= (max_x - w) and new_left <= (max_x - w) + VT_B_PIXMAP_THICKNESS) {
+ if (new_left >= (max_x - w) && new_left <= (max_x - w) + VT_B_PIXMAP_THICKNESS) {
new_left = (max_x - w) + VT_B_PIXMAP_THICKNESS;
_docked_right = true;
} else if (_docked_right) {
_docked_right = false;
}
- if (not _is_minimal) { // minimal windows can not be bottom-docked
- if (new_top >= (max_y - h) and new_top <= (max_y - h) + BT_B_PIXMAP_THICKNESS) {
+ if (!_is_minimal) { // minimal windows can not be bottom-docked
+ if (new_top >= (max_y - h) && new_top <= (max_y - h) + BT_B_PIXMAP_THICKNESS) {
new_top = (max_y - h) + BT_B_PIXMAP_THICKNESS;
_docked_bottom = true;
} else if (_docked_bottom) {
=== modified file 'src/ui_fsmenu/editor_mapselect.cc'
--- src/ui_fsmenu/editor_mapselect.cc 2014-07-05 14:22:44 +0000
+++ src/ui_fsmenu/editor_mapselect.cc 2014-07-25 18:59:12 +0000
@@ -227,11 +227,11 @@
{
const char * const name = pname->c_str();
if
- (strcmp(FileSystem::FS_Filename(name), ".") and
+ (strcmp(FileSystem::FS_Filename(name), ".") &&
// Upsy, appeared again. ignore
- strcmp(FileSystem::FS_Filename(name), "..") and
- g_fs->IsDirectory(name) and
- not WL_Map_Loader::is_widelands_map(name))
+ strcmp(FileSystem::FS_Filename(name), "..") &&
+ g_fs->IsDirectory(name) &&
+ !WL_Map_Loader::is_widelands_map(name))
m_list.add
(FileSystem::FS_Filename(name),
=== modified file 'src/ui_fsmenu/internet_lobby.cc'
--- src/ui_fsmenu/internet_lobby.cc 2014-07-05 14:22:44 +0000
+++ src/ui_fsmenu/internet_lobby.cc 2014-07-25 18:59:12 +0000
@@ -414,7 +414,7 @@
// convert IPv6 addresses returned by the metaserver to IPv4 addresses.
// At the moment SDL_net does not support IPv6 anyways.
- if (not ip.compare(0, 7, "::ffff:")) {
+ if (!ip.compare(0, 7, "::ffff:")) {
ip = ip.substr(7);
log("InternetGaming: cut IPv6 address: %s\n", ip.c_str());
}
=== modified file 'src/ui_fsmenu/intro.cc'
--- src/ui_fsmenu/intro.cc 2014-07-14 10:45:44 +0000
+++ src/ui_fsmenu/intro.cc 2014-07-25 18:59:12 +0000
@@ -47,7 +47,7 @@
bool Fullscreen_Menu_Intro::handle_key(bool const down, SDL_keysym const code)
{
- if (down and code.sym == SDLK_ESCAPE)
+ if (down && code.sym == SDLK_ESCAPE)
end_modal(0);
return true;
=== modified file 'src/ui_fsmenu/launch_spg.cc'
--- src/ui_fsmenu/launch_spg.cc 2014-07-05 14:22:44 +0000
+++ src/ui_fsmenu/launch_spg.cc 2014-07-25 18:59:12 +0000
@@ -312,7 +312,7 @@
m_pos[i]->set_visible(true);
const PlayerSettings & player = settings.players[i];
if
- (player.state == PlayerSettings::stateOpen or
+ (player.state == PlayerSettings::stateOpen ||
player.state == PlayerSettings::stateComputer)
m_pos[i]->set_enabled(true);
else
@@ -400,7 +400,7 @@
// Check whether the host would still keep a valid position and return if
// yes.
if
- (settings.playernum == UserSettings::none() or
+ (settings.playernum == UserSettings::none() ||
settings.playernum < newplayernumber)
return;
=== modified file 'src/ui_fsmenu/mapselect.cc'
--- src/ui_fsmenu/mapselect.cc 2014-07-14 10:45:44 +0000
+++ src/ui_fsmenu/mapselect.cc 2014-07-25 18:59:12 +0000
@@ -205,11 +205,11 @@
const MapData & r1 = m_maps_data[m_table[rowa]];
const MapData & r2 = m_maps_data[m_table[rowb]];
- if (!r1.width and !r2.width) {
+ if (!r1.width && !r2.width) {
return r1.name < r2.name;
- } else if (!r1.width and r2.width) {
+ } else if (!r1.width && r2.width) {
return true;
- } else if (r1.width and !r2.width) {
+ } else if (r1.width && !r2.width) {
return false;
}
return r1.name < r2.name;
@@ -222,7 +222,7 @@
MapData const * Fullscreen_Menu_MapSelect::get_map() const
{
- if (not m_table.has_selection())
+ if (!m_table.has_selection())
return nullptr;
return &m_maps_data[m_table.get_selected()];
}
@@ -405,7 +405,7 @@
bool has_all_tags = true;
for (std::set<uint32_t>::const_iterator it = m_req_tags.begin(); it != m_req_tags.end(); ++it)
has_all_tags &= mapdata.tags.count(m_tags_ordered[*it]);
- if (not has_all_tags)
+ if (!has_all_tags)
continue;
=== modified file 'src/ui_fsmenu/netsetup_lan.cc'
--- src/ui_fsmenu/netsetup_lan.cc 2014-07-22 09:54:49 +0000
+++ src/ui_fsmenu/netsetup_lan.cc 2014-07-25 18:59:12 +0000
@@ -150,7 +150,7 @@
for (uint32_t i = 0; i < opengames_size; ++i) {
const Net_Open_Game & game = *opengames[i];
- if (not strcmp(game.info.hostname, host.c_str())) {
+ if (!strcmp(game.info.hostname, host.c_str())) {
addr = game.address;
port = game.port;
return true;
=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc 2014-07-22 09:54:49 +0000
+++ src/ui_fsmenu/options.cc 2014-07-25 18:59:12 +0000
@@ -265,10 +265,10 @@
m_inputgrab .set_state(opt.inputgrab);
m_label_music .set_textstyle(ts_small());
m_music .set_state(opt.music);
- m_music .set_enabled(not g_sound_handler.lock_audio_disabling_);
+ m_music .set_enabled(!g_sound_handler.lock_audio_disabling_);
m_label_fx .set_textstyle(ts_small());
m_fx .set_state(opt.fx);
- m_fx .set_enabled(not g_sound_handler.lock_audio_disabling_);
+ m_fx .set_enabled(!g_sound_handler.lock_audio_disabling_);
m_label_maxfps .set_textstyle(ts_small());
m_label_resolution.set_textstyle(ts_small());
m_reslist .set_font(ui_fn(), fs_small());
@@ -300,7 +300,7 @@
++modes)
{
const SDL_Rect & mode = **modes;
- if (800 <= mode.w and 600 <= mode.h)
+ if (800 <= mode.w && 600 <= mode.h)
{
const ScreenResolution this_res = {mode.w, mode.h};
if
@@ -320,12 +320,12 @@
/** TRANSLATORS: Screen resolution, e.g. 800 x 600*/
sprintf(buf, _("%1$i x %2$i"), m_resolutions[i].xres, m_resolutions[i].yres);
const bool selected =
- m_resolutions[i].xres == opt.xres and
+ m_resolutions[i].xres == opt.xres &&
m_resolutions[i].yres == opt.yres;
did_select_a_res |= selected;
m_reslist.add(buf, nullptr, nullptr, selected);
}
- if (not did_select_a_res) {
+ if (!did_select_a_res) {
char buf[32];
/** TRANSLATORS: Screen resolution, e.g. 800 x 600*/
sprintf(buf, "%1$i x %2$i", opt.xres, opt.yres);
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2014-07-23 14:49:10 +0000
+++ src/wlapplication.cc 2014-07-25 18:59:12 +0000
@@ -413,14 +413,14 @@
}
std::string realservername(server);
bool name_valid = false;
- while (not name_valid) {
+ while (!name_valid) {
name_valid = true;
const std::vector<INet_Game> & hosts = InternetGaming::ref().games();
for (uint32_t i = 0; i < hosts.size(); ++i) {
if (hosts.at(i).name == realservername)
name_valid = false;
}
- if (not name_valid)
+ if (!name_valid)
realservername += "*";
}
@@ -583,7 +583,7 @@
case SDL_MOUSEMOTION:
m_mouse_position = Point(ev.motion.x, ev.motion.y);
- if ((ev.motion.xrel or ev.motion.yrel) and cb and cb->mouse_move)
+ if ((ev.motion.xrel || ev.motion.yrel) && cb && cb->mouse_move)
cb->mouse_move
(ev.motion.state,
ev.motion.x, ev.motion.y,
@@ -624,7 +624,7 @@
// check if any ALT Key is pressed and if, treat it like a left
// mouse button.
if
- (ev.button.button == SDL_BUTTON_MIDDLE and
+ (ev.button.button == SDL_BUTTON_MIDDLE &&
(get_key_state(SDLK_LALT) || get_key_state(SDLK_RALT)))
{
ev.button.button = SDL_BUTTON_LEFT;
@@ -632,11 +632,11 @@
}
#endif
- if (ev.type == SDL_MOUSEBUTTONDOWN && cb and cb->mouse_press)
+ if (ev.type == SDL_MOUSEBUTTONDOWN && cb && cb->mouse_press)
cb->mouse_press(ev.button.button, ev.button.x, ev.button.y);
else if (ev.type == SDL_MOUSEBUTTONUP) {
- if (cb and cb->mouse_release) {
- if (ev.button.button == SDL_BUTTON_MIDDLE and m_faking_middle_mouse_button) {
+ if (cb && cb->mouse_release) {
+ if (ev.button.button == SDL_BUTTON_MIDDLE && m_faking_middle_mouse_button) {
cb->mouse_release(SDL_BUTTON_LEFT, ev.button.x, ev.button.y);
m_faking_middle_mouse_button = false;
}
@@ -1083,7 +1083,7 @@
if (m_commandline.count("editor")) {
m_filename = m_commandline["editor"];
- if (m_filename.size() and *m_filename.rbegin() == '/')
+ if (m_filename.size() && *m_filename.rbegin() == '/')
m_filename.erase(m_filename.size() - 1);
m_game_type = EDITOR;
m_commandline.erase("editor");
@@ -1093,7 +1093,7 @@
if (m_game_type != NONE)
throw wexception("replay can not be combined with other actions");
m_filename = m_commandline["replay"];
- if (m_filename.size() and *m_filename.rbegin() == '/')
+ if (m_filename.size() && *m_filename.rbegin() == '/')
m_filename.erase(m_filename.size() - 1);
m_game_type = REPLAY;
m_commandline.erase("replay");
@@ -1461,7 +1461,7 @@
case Fullscreen_Menu_NetSetupLAN::JOINGAME: {
IPaddress peer;
- if (not host_address)
+ if (!host_address)
throw warning
("Invalid Address", "%s",
_("The address of the game server is invalid"));
=== modified file 'src/wui/actionconfirm.cc'
--- src/wui/actionconfirm.cc 2014-07-15 10:02:22 +0000
+++ src/wui/actionconfirm.cc 2014-07-25 18:59:12 +0000
@@ -241,11 +241,11 @@
upcast(Widelands::PlayerImmovable, todestroy, m_todestroy.get(egbase));
if
- (not todestroy ||
- not building ||
- not iaplayer().can_act(building->owner().player_number())
- or not
- (building->get_playercaps() & Widelands::Building::PCap_Bulldoze))
+ (!todestroy ||
+ !building ||
+ !iaplayer().can_act(building->owner().player_number())
+ ||
+ !(building->get_playercaps() & Widelands::Building::PCap_Bulldoze))
die();
}
@@ -262,11 +262,11 @@
if
(todestroy &&
building &&
- iaplayer().can_act(building->owner().player_number()) and
+ iaplayer().can_act(building->owner().player_number()) &&
(building->get_playercaps() & Widelands::Building::PCap_Bulldoze))
{
game.send_player_bulldoze
- (*todestroy, get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL));
+ (*todestroy, get_key_state(SDLK_LCTRL) << get_key_state(SDLK_RCTRL));
iaplayer().need_complete_redraw();
}
@@ -304,10 +304,10 @@
upcast(Widelands::Building, building, m_object.get(egbase));
if
- (not building ||
- not iaplayer().can_act(building->owner().player_number())
- or not
- (building->get_playercaps() & Widelands::Building::PCap_Dismantle))
+ (!building ||
+ !iaplayer().can_act(building->owner().player_number())
+ ||
+ !(building->get_playercaps() & Widelands::Building::PCap_Dismantle))
die();
}
@@ -323,7 +323,7 @@
if
(building &&
- iaplayer().can_act(building->owner().player_number()) and
+ iaplayer().can_act(building->owner().player_number()) &&
(building->get_playercaps() & Widelands::Building::PCap_Dismantle))
{
game.send_player_dismantle(*todismantle);
@@ -366,10 +366,10 @@
upcast(Widelands::Building, building, m_object.get(egbase));
if
- (not building ||
- not iaplayer().can_act(building->owner().player_number())
- or not
- (building->get_playercaps() & Widelands::Building::PCap_Enhancable))
+ (!building ||
+ !iaplayer().can_act(building->owner().player_number())
+ ||
+ !(building->get_playercaps() & Widelands::Building::PCap_Enhancable))
die();
}
@@ -384,7 +384,7 @@
if
(building &&
- iaplayer().can_act(building->owner().player_number()) and
+ iaplayer().can_act(building->owner().player_number()) &&
(building->get_playercaps() & Widelands::Building::PCap_Enhancable))
{
game.send_player_enhance_building(*building, m_id);
=== modified file 'src/wui/building_statistics_menu.cc'
--- src/wui/building_statistics_menu.cc 2014-07-20 13:00:05 +0000
+++ src/wui/building_statistics_menu.cc 2014-07-25 18:59:12 +0000
@@ -272,7 +272,7 @@
int32_t const curindex = m_last_building_index;
found = false;
while (validate_pointer(&(--m_last_building_index), vec.size()) != curindex)
- if (not vec[m_last_building_index].is_constructionsite) {
+ if (!vec[m_last_building_index].is_constructionsite) {
if
(upcast
(Widelands::ProductionSite,
@@ -283,7 +283,7 @@
break;
}
}
- if (not found) // Now look at the old
+ if (!found) // Now look at the old
if
(upcast
(Widelands::ProductionSite,
@@ -298,7 +298,7 @@
found = false;
while
(validate_pointer(&(++m_last_building_index), vec.size()) != curindex)
- if (not vec[m_last_building_index].is_constructionsite) {
+ if (!vec[m_last_building_index].is_constructionsite) {
if
(upcast
(Widelands::ProductionSite,
@@ -309,7 +309,7 @@
break;
}
}
- if (not found) // Now look at the old
+ if (!found) // Now look at the old
if
(upcast
(Widelands::ProductionSite,
@@ -381,9 +381,9 @@
const Widelands::Building_Descr & building =
*tribe.get_building_descr(i);
if
- (not (building.is_buildable()
- or building.is_enhanced()
- or building.global()))
+ (!(building.is_buildable()
+ || building.is_enhanced()
+ || building.global()))
continue;
const std::vector<Widelands::Player::Building_Stats> & vec =
@@ -401,7 +401,7 @@
}
// If not in list, add new one, as long as this building is enabled.
- if (not te) {
+ if (!te) {
if (! iplayer().player().is_building_type_allowed(i))
continue;
te = &m_table.add(i);
@@ -425,7 +425,7 @@
}
const bool is_selected = // Is this entry selected?
- m_table.has_selection() and m_table.get_selected() == i;
+ m_table.has_selection() && m_table.get_selected() == i;
if (is_selected) {
m_anim = building.get_ui_anim();
@@ -464,7 +464,7 @@
te->set_picture(Columns::Size, g_gr->images().get(pic));
}
- if (productionsite and nr_owned) {
+ if (productionsite && nr_owned) {
uint32_t const percent =
static_cast<uint32_t>
(static_cast<float>(total_prod) / static_cast<float>(nr_owned));
@@ -497,7 +497,7 @@
}
// disable all buttons, if nothing to select
- if (not m_table.has_selection()) {
+ if (!m_table.has_selection()) {
m_btn[Prev_Owned] ->set_enabled(false);
m_btn[Next_Owned] ->set_enabled(false);
m_btn[Prev_Construction]->set_enabled(false);
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc 2014-07-20 13:00:05 +0000
+++ src/wui/buildingwindow.cc 2014-07-25 18:59:12 +0000
@@ -129,14 +129,14 @@
*/
void Building_Window::think()
{
- if (not igbase().can_see(building().owner().player_number()))
+ if (!igbase().can_see(building().owner().player_number()))
die();
if
- (! m_caps_setup
- or
+ (!m_caps_setup
+ ||
m_capscache_player_number != igbase().player_number()
- or
+ ||
building().get_playercaps() != m_capscache)
{
m_capsbuttons->free_children();
@@ -282,7 +282,7 @@
requires_destruction_separator = true;
}
- if (requires_destruction_separator and can_see) {
+ if (requires_destruction_separator && can_see) {
// Need this as well as the infinite space from the can_see section
// to ensure there is a separation.
UI::Panel * spacer = new UI::Panel(capsbuttons, 0, 0, 17, 34);
@@ -337,7 +337,7 @@
UI::Box::AlignCenter);
if (m_building.descr().has_help_text()) {
- if (not requires_destruction_separator) {
+ if (!requires_destruction_separator) {
// When there was no separation of destruction buttons put
// the infinite space here (e.g. Warehouses)
capsbuttons->add_inf_space();
@@ -370,7 +370,7 @@
*/
void Building_Window::act_bulldoze()
{
- if (get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL)) {
+ if (get_key_state(SDLK_LCTRL) || get_key_state(SDLK_RCTRL)) {
if (m_building.get_playercaps() & Widelands::Building::PCap_Bulldoze)
igbase().game().send_player_bulldoze(m_building);
}
@@ -386,7 +386,7 @@
*/
void Building_Window::act_dismantle()
{
- if (get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL)) {
+ if (get_key_state(SDLK_LCTRL) || get_key_state(SDLK_RCTRL)) {
if (m_building.get_playercaps() & Widelands::Building::PCap_Dismantle)
igbase().game().send_player_dismantle(m_building);
}
@@ -429,7 +429,7 @@
*/
void Building_Window::act_enhance(Widelands::Building_Index id)
{
- if (get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL)) {
+ if (get_key_state(SDLK_LCTRL) || get_key_state(SDLK_RCTRL)) {
if (m_building.get_playercaps() & Widelands::Building::PCap_Enhancable)
igbase().game().send_player_enhance_building(m_building, id);
}
=== modified file 'src/wui/chat_msg_layout.cc'
--- src/wui/chat_msg_layout.cc 2014-07-13 18:51:52 +0000
+++ src/wui/chat_msg_layout.cc 2014-07-25 18:59:12 +0000
@@ -113,7 +113,7 @@
}
} else {
// Normal messages handling
- if (not sanitized.compare(0, 3, "/me")) {
+ if (!sanitized.compare(0, 3, "/me")) {
message += " font-style=italic>-> ";
if (chat_message.sender.size())
message += chat_message.sender;
@@ -210,7 +210,7 @@
}
} else {
// Normal messages handling
- if (not sanitized.compare(0, 3, "/me")) {
+ if (!sanitized.compare(0, 3, "/me")) {
message += " italic=1>-\\> ";
if (chat_message.sender.size())
message += chat_message.sender;
=== modified file 'src/wui/encyclopedia_window.cc'
--- src/wui/encyclopedia_window.cc 2014-07-24 05:21:20 +0000
+++ src/wui/encyclopedia_window.cc 2014-07-25 18:59:12 +0000
@@ -121,8 +121,8 @@
if (upcast(ProductionSite_Descr const, de, &descr)) {
if
- ((descr.is_buildable() or descr.is_enhanced())
- and
+ ((descr.is_buildable() || descr.is_enhanced())
+ &&
de->output_ware_types().count(wares.get_selected()))
{
prodSites.add(de->descname().c_str(), i, de->get_icon());
=== modified file 'src/wui/fieldaction.cc'
--- src/wui/fieldaction.cc 2014-07-14 10:45:44 +0000
+++ src/wui/fieldaction.cc 2014-07-25 18:59:12 +0000
@@ -310,8 +310,8 @@
void FieldActionWindow::think() {
if
- (m_plr and m_plr->vision(m_node.field - &ibase().egbase().map()[0]) <= 1
- and not m_plr->see_all())
+ (m_plr && m_plr->vision(m_node.field - &ibase().egbase().map()[0]) <= 1
+ && !m_plr->see_all())
die();
}
@@ -352,7 +352,7 @@
const Widelands::Player_Number owner = m_node.field->get_owned_by();
- if (not igbase or igbase->can_see(owner)) {
+ if (!igbase || igbase->can_see(owner)) {
Widelands::BaseImmovable * const imm = m_map->get_immovable(m_node);
const bool can_act = igbase ? igbase->can_act(owner) : true;
@@ -420,7 +420,7 @@
_("Destroy a road"));
}
} else if
- (m_plr and
+ (m_plr &&
1
<
m_plr->vision
@@ -499,7 +499,7 @@
*/
void FieldActionWindow::add_buttons_build(int32_t buildcaps, const RGBColor& player_color)
{
- if (not m_plr)
+ if (!m_plr)
return;
BuildGrid * bbg_house[4] = {nullptr, nullptr, nullptr, nullptr};
BuildGrid * bbg_mine = nullptr;
@@ -737,9 +737,9 @@
if (upcast(Widelands::Flag, flag, m_node.field->get_immovable())) {
if (Building * const building = flag->get_building()) {
if (building->get_playercaps() & Building::PCap_Bulldoze) {
- if (get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL)) {
+ if (get_key_state(SDLK_LCTRL) || get_key_state(SDLK_RCTRL)) {
ref_cast<Game, Editor_Game_Base>(egbase).send_player_bulldoze
- (*flag, get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL));
+ (*flag, get_key_state(SDLK_LCTRL) || get_key_state(SDLK_RCTRL));
}
else {
show_bulldoze_confirm
@@ -750,7 +750,7 @@
}
} else {
ref_cast<Game, Editor_Game_Base>(egbase).send_player_bulldoze
- (*flag, get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL));
+ (*flag, get_key_state(SDLK_LCTRL) || get_key_state(SDLK_RCTRL));
ibase().need_complete_redraw();
}
}
@@ -795,7 +795,7 @@
Widelands::Editor_Game_Base & egbase = ibase().egbase();
if (upcast(Widelands::Road, road, egbase.map().get_immovable(m_node)))
ref_cast<Game, Editor_Game_Base>(egbase).send_player_bulldoze
- (*road, get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL));
+ (*road, get_key_state(SDLK_LCTRL) || get_key_state(SDLK_RCTRL));
ibase().need_complete_redraw();
okdialog();
}
@@ -834,7 +834,7 @@
void FieldActionWindow::building_icon_mouse_in
(const Widelands::Building_Index idx)
{
- if (ibase().m_show_workarea_preview and not m_workarea_preview_job_id) {
+ if (ibase().m_show_workarea_preview && !m_workarea_preview_job_id) {
const Workarea_Info & workarea_info =
m_plr->tribe().get_building_descr(Widelands::Building_Index(idx))
->m_workarea_info;
@@ -913,7 +913,7 @@
FieldActionWindow & w = *new FieldActionWindow(ibase, player, registry);
w.add_buttons_road
(target != ibase->get_build_road_start()
- and
+ &&
(player->get_buildcaps(target) & Widelands::BUILDCAPS_FLAG));
return w.init();
}
=== modified file 'src/wui/game_main_menu.cc'
--- src/wui/game_main_menu.cc 2014-06-26 05:24:04 +0000
+++ src/wui/game_main_menu.cc 2014-07-25 18:59:12 +0000
@@ -74,8 +74,8 @@
(boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.stock)));
#define INIT_BTN_HOOKS(registry, btn) \
- assert (not registry.on_create); \
- assert (not registry.on_delete); \
+ assert (!registry.on_create); \
+ assert (!registry.on_delete); \
registry.on_create = std::bind(&UI::Button::set_perm_pressed, &btn, true); \
registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \
if (registry.window) btn.set_perm_pressed(true); \
=== modified file 'src/wui/game_message_menu.cc'
--- src/wui/game_message_menu.cc 2014-07-22 09:54:49 +0000
+++ src/wui/game_message_menu.cc 2014-07-25 18:59:12 +0000
@@ -142,7 +142,7 @@
(Message_Id const id, const Widelands::Message & message)
{
assert(iplayer().player().messages()[id] == &message);
- assert(not list->find(id.value()));
+ assert(!list->find(id.value()));
Message::Status const status = message.status();
if ((mode == Archive) != (status == Message::Archived))
toggle_mode();
@@ -184,7 +184,7 @@
}
if (list->size()) {
- if (not list->has_selection())
+ if (!list->has_selection())
list->select(0);
// TODO(unknown) Workaround for bug #691928: There should
// be a solution without this extra update().
=== modified file 'src/wui/game_objectives_menu.cc'
--- src/wui/game_objectives_menu.cc 2014-04-20 21:07:45 +0000
+++ src/wui/game_objectives_menu.cc 2014-07-25 18:59:12 +0000
@@ -66,7 +66,7 @@
// Adjust the list according to the game state.
for (const auto& pair : iplayer().game().map().objectives()) {
const Objective& obj = *(pair.second);
- bool should_show = obj.visible() and not obj.done();
+ bool should_show = obj.visible() && !obj.done();
uint32_t const list_size = list.size();
for (uint32_t j = 0;; ++j)
if (j == list_size) { // the objective is not in our list
@@ -74,7 +74,7 @@
list.add(obj.descname().c_str(), obj);
break;
} else if (&list[j] == &obj) { // the objective is in our list
- if (not should_show)
+ if (!should_show)
list.remove(j);
else if (list[j].descname() != obj.descname() || list[j].descr() != obj.descr()) {
// Update
@@ -85,7 +85,7 @@
}
}
list.sort();
- if (list.size() and not list.has_selection())
+ if (list.size() && !list.has_selection())
list.select(0);
}
=== modified file 'src/wui/game_options_sound_menu.cc'
--- src/wui/game_options_sound_menu.cc 2014-06-18 13:20:33 +0000
+++ src/wui/game_options_sound_menu.cc 2014-07-25 18:59:12 +0000
@@ -66,8 +66,8 @@
0, g_sound_handler.get_max_volume(), g_sound_handler.get_fx_volume(),
g_gr->images().get("pics/but1.png"))
{
- ingame_music.set_state(not g_sound_handler.get_disable_music());
- ingame_sound.set_state(not g_sound_handler.get_disable_fx ());
+ ingame_music.set_state(!g_sound_handler.get_disable_music());
+ ingame_sound.set_state(!g_sound_handler.get_disable_fx ());
if (g_sound_handler.lock_audio_disabling_) { // disabling sound options
ingame_music .set_enabled(false);
@@ -75,10 +75,10 @@
ingame_music_volume.set_enabled(false);
ingame_sound_volume.set_enabled(false);
} else { // initial widget states
- ingame_music.set_state (not g_sound_handler.get_disable_music());
- ingame_sound.set_state (not g_sound_handler.get_disable_fx ());
- ingame_music_volume.set_enabled(not g_sound_handler.get_disable_music());
- ingame_sound_volume.set_enabled(not g_sound_handler.get_disable_fx ());
+ ingame_music.set_state (!g_sound_handler.get_disable_music());
+ ingame_sound.set_state (!g_sound_handler.get_disable_fx ());
+ ingame_music_volume.set_enabled(!g_sound_handler.get_disable_music());
+ ingame_sound_volume.set_enabled(!g_sound_handler.get_disable_fx ());
}
// ready signals
=== modified file 'src/wui/general_statistics_menu.cc'
--- src/wui/general_statistics_menu.cc 2014-07-23 14:49:10 +0000
+++ src/wui/general_statistics_menu.cc 2014-07-25 18:59:12 +0000
@@ -309,7 +309,7 @@
void General_Statistics_Menu::cb_changed_to(int32_t const id)
{
// This represents our player number
- m_cbs[id - 1]->set_perm_pressed(not m_cbs[id - 1]->get_perm_pressed());
+ m_cbs[id - 1]->set_perm_pressed(!m_cbs[id - 1]->get_perm_pressed());
m_plot.show_plot
((id - 1) * m_ndatasets + m_selected_information,
=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc 2014-07-22 09:54:49 +0000
+++ src/wui/interactive_base.cc 2014-07-25 18:59:12 +0000
@@ -174,7 +174,7 @@
// register sel overlay position
if (m_sel.triangles) {
assert
- (center.triangle.t == TCoords<>::D or
+ (center.triangle.t == TCoords<>::D ||
center.triangle.t == TCoords<>::R);
Widelands::MapTriangleRegion<> mr
(map, Area<TCoords<> >(center.triangle, m_sel.radius));
@@ -198,14 +198,14 @@
if (upcast(Interactive_Player const, iplayer, igbase)) {
const Widelands::Player & player = iplayer->player();
if
- (not player.see_all()
- and
+ (!player.see_all()
+ &&
(1
>=
player.vision
(Widelands::Map::get_index
(center.node, map.get_width()))
- or
+ ||
player.is_hostile(*productionsite->get_owner())))
return set_tooltip("");
}
@@ -401,9 +401,15 @@
===============
*/
void Interactive_Base::draw_overlay(RenderTarget& dst) {
+<<<<<<< TREE
// Blit node information when in debug mode or if the chat window is on.
if (get_display_flag(dfDebug) || !dynamic_cast<const Game*>(&egbase())) {
static format node_format("(%i, %i)");
+=======
+ // Blit node information when in debug mode.
+ if (get_display_flag(dfDebug) || !dynamic_cast<const Game*>(&egbase())) {
+ static format node_format("%3i %3i");
+>>>>>>> MERGE-SOURCE
const std::string node_text = as_uifont
((node_format % m_sel.pos.node.x % m_sel.pos.node.y).str(), UI_FONT_SIZE_SMALL);
dst.blit(
@@ -598,7 +604,7 @@
(Coords _start, Widelands::Player_Number const player)
{
// create an empty path
- assert(not m_buildroad);
+ assert(!m_buildroad);
m_buildroad = new CoordPath(_start);
m_road_build_player = player;
@@ -651,8 +657,8 @@
(*new Widelands::Path(*m_buildroad));
if
- (allow_user_input() and
- (get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL)))
+ (allow_user_input() &&
+ (get_key_state(SDLK_LCTRL) || get_key_state(SDLK_RCTRL)))
{
// place flags
const Map & map = egbase().map();
@@ -793,7 +799,7 @@
OverlayManager & overlay_manager = map.overlay_manager();
// preview of the road
- assert(not m_jobid);
+ assert(!m_jobid);
m_jobid = overlay_manager.get_a_job_id();
const CoordPath::Step_Vector::size_type nr_steps = m_buildroad->get_nsteps();
for (CoordPath::Step_Vector::size_type idx = 0; idx < nr_steps; ++idx) {
@@ -815,7 +821,7 @@
// build hints
Widelands::FCoords endpos = map.get_fcoords(m_buildroad->get_end());
- assert(not m_road_buildhelp_overlay_jobid);
+ assert(!m_road_buildhelp_overlay_jobid);
m_road_buildhelp_overlay_jobid = overlay_manager.get_a_job_id();
for (int32_t dir = 1; dir <= 6; ++dir) {
Widelands::FCoords neighb;
@@ -831,12 +837,15 @@
Widelands::BaseImmovable * const imm = map.get_immovable(neighb);
if (imm && imm->get_size() >= Widelands::BaseImmovable::SMALL) {
if
- (not
- (dynamic_cast<const Widelands::Flag *>(imm)
- or
- (dynamic_cast<const Widelands::Road *>(imm)
- and
- (caps & Widelands::BUILDCAPS_FLAG))))
+ (!(
+ dynamic_cast<const Widelands::Flag *>(imm)
+ ||
+ (
+ dynamic_cast<const Widelands::Road *>(imm)
+ &&
+ (caps & Widelands::BUILDCAPS_FLAG)
+ )
+ ))
continue;
}
=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc 2014-07-22 09:54:49 +0000
+++ src/wui/interactive_player.cc 2014-07-25 18:59:12 +0000
@@ -229,7 +229,7 @@
if (m_flag_to_connect) {
Widelands::Field & field = egbase().map()[m_flag_to_connect];
if (upcast(Widelands::Flag const, flag, field.get_immovable())) {
- if (not flag->has_road() and not is_building_road())
+ if (!flag->has_road() && !is_building_road())
if (m_auto_roadbuild_mode) {
// There might be a fieldaction window open, showing a button
// for roadbuilding. If that dialog remains open so that the
@@ -322,7 +322,7 @@
bool Interactive_Player::can_see(Widelands::Player_Number const p) const
{
- return p == player_number() or player().see_all();
+ return p == player_number() || player().see_all();
}
bool Interactive_Player::can_act(Widelands::Player_Number const p) const
{
=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc 2014-07-14 10:45:44 +0000
+++ src/wui/mapview.cc 2014-07-25 18:59:12 +0000
@@ -59,7 +59,7 @@
// If the user has scrolled the node outside the viewable area, he most
// surely doesn't want to jump there.
- if (p.x < get_w() and p.y < get_h()) {
+ if (p.x < get_w() && p.y < get_h()) {
if (p.x <= 0)
warp_mouse_to_node(Widelands::Coords(c.x + map.get_width (), c.y));
else if (p.y <= 0)
@@ -169,7 +169,7 @@
}
bool Map_View::handle_mouserelease(const uint8_t btn, int32_t, int32_t)
{
- if (btn == SDL_BUTTON_RIGHT and m_dragging)
+ if (btn == SDL_BUTTON_RIGHT && m_dragging)
stop_dragging();
return true;
}
@@ -189,7 +189,7 @@
else stop_dragging();
}
- if (not intbase().get_sel_freeze())
+ if (!intbase().get_sel_freeze())
track_sel(Point(x, y));
g_gr->update_fullscreen();
=== modified file 'src/wui/mapviewpixelfunctions.cc'
--- src/wui/mapviewpixelfunctions.cc 2014-07-14 18:35:09 +0000
+++ src/wui/mapviewpixelfunctions.cc 2014-07-25 18:59:12 +0000
@@ -180,7 +180,7 @@
y;
if (lower_screen_dy < 0) {
row_number = next_row_number;
- slash = not slash;
+ slash = !slash;
} else break;
}
=== modified file 'src/wui/overlay_manager.cc'
--- src/wui/overlay_manager.cc 2014-05-27 11:01:15 +0000
+++ src/wui/overlay_manager.cc 2014-07-25 18:59:12 +0000
@@ -42,7 +42,7 @@
const Registered_Overlays_Map & overlay_map = m_overlays[Widelands::TCoords<>::None];
Registered_Overlays_Map::const_iterator it = overlay_map.lower_bound(c);
- while (it != overlay_map.end() and it->first == c and it->second.level <= MAX_OVERLAYS_PER_NODE)
+ while (it != overlay_map.end() && it->first == c && it->second.level <= MAX_OVERLAYS_PER_NODE)
{
overlays[num_ret].pic = it->second.pic;
overlays[num_ret].hotspot = it->second.hotspot;
@@ -59,7 +59,7 @@
goto end;
}
}
- while (it != overlay_map.end() and it->first == c) {
+ while (it != overlay_map.end() && it->first == c) {
overlays[num_ret].pic = it->second.pic;
overlays[num_ret].hotspot = it->second.hotspot;
if (++num_ret == MAX_OVERLAYS_PER_NODE)
@@ -77,7 +77,7 @@
(Widelands::TCoords<> const c, Overlay_Info * const overlays) const
{
assert(m_are_graphics_loaded);
- assert(c.t == Widelands::TCoords<>::D or c.t == Widelands::TCoords<>::R);
+ assert(c.t == Widelands::TCoords<>::D || c.t == Widelands::TCoords<>::R);
uint8_t num_ret = 0;
@@ -85,9 +85,9 @@
Registered_Overlays_Map::const_iterator it = overlay_map.lower_bound(c);
while
(it != overlay_map.end()
- and
+ &&
it->first == c
- and
+ &&
num_ret < MAX_OVERLAYS_PER_TRIANGLE)
{
overlays[num_ret].pic = it->second.pic;
@@ -141,13 +141,13 @@
Registered_Overlays_Map & overlay_map = m_overlays[c.t];
for
(Registered_Overlays_Map::iterator it = overlay_map.find(c);
- it != overlay_map.end() and it->first == c;
+ it != overlay_map.end() && it->first == c;
++it)
if
(it->second.pic == pic
- and
+ &&
it->second.hotspot == hotspot
- and
+ &&
it->second.level == level)
{
it->second.jobids.insert(jobid);
@@ -193,13 +193,13 @@
if (overlay_map.count(c)) {
Registered_Overlays_Map::iterator it = overlay_map.lower_bound(c);
do {
- if (pic and it->second.pic == pic) {
+ if (pic && it->second.pic == pic) {
overlay_map.erase(it);
it = overlay_map.lower_bound(c);
} else {
++it;
}
- } while (it != overlay_map.end() and it->first == c);
+ } while (it != overlay_map.end() && it->first == c);
}
}
=== modified file 'src/wui/plot_area.cc'
--- src/wui/plot_area.cc 2014-07-05 14:22:44 +0000
+++ src/wui/plot_area.cc 2014-07-25 18:59:12 +0000
@@ -425,7 +425,7 @@
ly -= static_cast<int32_t>(scale_value(yline_length, highest_scale, value));
}
- for (int32_t i = dataset->size() - 1; i > 0 and posx > spacing; --i) {
+ for (int32_t i = dataset->size() - 1; i > 0 && posx > spacing; --i) {
int32_t const curx = static_cast<int32_t>(posx);
int32_t cury = yoffset;
=== modified file 'src/wui/productionsitewindow.cc'
--- src/wui/productionsitewindow.cc 2014-07-23 13:36:49 +0000
+++ src/wui/productionsitewindow.cc 2014-07-25 18:59:12 +0000
@@ -167,8 +167,13 @@
if
(worker->get_current_experience() != -1
+<<<<<<< TREE
and
worker->descr().get_needed_experience () != -1)
+=======
+ &&
+ worker->descr().get_level_experience () != -1)
+>>>>>>> MERGE-SOURCE
{
assert(worker->descr().becomes() != Widelands::INVALID_INDEX);
=== modified file 'src/wui/shipwindow.cc'
--- src/wui/shipwindow.cc 2014-07-14 22:18:03 +0000
+++ src/wui/shipwindow.cc 2014-07-25 18:59:12 +0000
@@ -291,7 +291,7 @@
/// Sink the ship if confirmed
void ShipWindow::act_sink()
{
- if (get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL)) {
+ if (get_key_state(SDLK_LCTRL) || get_key_state(SDLK_RCTRL)) {
m_igbase.game().send_player_sink_ship(m_ship);
}
else {
@@ -302,7 +302,7 @@
/// Cancel expedition if confirmed
void ShipWindow::act_cancel_expedition()
{
- if (get_key_state(SDLK_LCTRL) or get_key_state(SDLK_RCTRL)) {
+ if (get_key_state(SDLK_LCTRL) || get_key_state(SDLK_RCTRL)) {
m_igbase.game().send_player_cancel_expedition_ship(m_ship);
}
else {
=== modified file 'src/wui/transport_ui.cc'
--- src/wui/transport_ui.cc 2014-07-23 14:49:10 +0000
+++ src/wui/transport_ui.cc 2014-07-25 18:59:12 +0000
@@ -89,14 +89,14 @@
if (type == Widelands::wwWORKER) {
Ware_Index nr_wares = m_economy.owner().tribe().get_nrworkers();
for (Ware_Index i = 0; i < nr_wares; ++i) {
- if (not m_economy.owner().tribe().get_worker_descr(i)->has_demand_check()) {
+ if (!m_economy.owner().tribe().get_worker_descr(i)->has_demand_check()) {
hide_ware(i);
}
}
} else {
Ware_Index nr_wares = m_economy.owner().tribe().get_nrwares();
for (Ware_Index i = 0; i < nr_wares; ++i) {
- if (not m_economy.owner().tribe().get_ware_descr(i)->has_demand_check()) {
+ if (!m_economy.owner().tribe().get_ware_descr(i)->has_demand_check()) {
hide_ware(i);
}
}
=== modified file 'src/wui/waresdisplay.cc'
--- src/wui/waresdisplay.cc 2014-07-22 09:54:49 +0000
+++ src/wui/waresdisplay.cc 2014-07-25 18:59:12 +0000
@@ -187,7 +187,7 @@
}
if (i < icons_order().size() && j < icons_order()[i].size()) {
Widelands::Ware_Index ware = icons_order()[i][j];
- if (not m_hidden[ware]) {
+ if (!m_hidden[ware]) {
return ware;
}
}
=== modified file 'src/wui/waresqueuedisplay.cc'
--- src/wui/waresqueuedisplay.cc 2014-06-23 16:38:00 +0000
+++ src/wui/waresqueuedisplay.cc 2014-07-25 18:59:12 +0000
@@ -148,7 +148,7 @@
for (; nr_empty_to_draw; --nr_empty_to_draw, point.x += CellWidth + CellSpacing)
dst.blit(point, m_icon_grey);
- if (not m_show_only) {
+ if (!m_show_only) {
uint16_t pw = m_max_fill_indicator->width();
point.y = Border;
point.x = Border + CellWidth + CellSpacing +
@@ -162,7 +162,7 @@
*/
void WaresQueueDisplay::update_priority_buttons()
{
- if (m_cache_size <= 0 or m_show_only) {
+ if (m_cache_size <= 0 || m_show_only) {
delete m_priority_radiogroup;
m_priority_radiogroup = nullptr;
}
@@ -209,7 +209,7 @@
(boost::bind(&WaresQueueDisplay::radiogroup_changed, this, _1));
bool const can_act = m_igb.can_act(m_building.owner().player_number());
- if (not can_act)
+ if (!can_act)
m_priority_radiogroup->set_enabled(false);
}
@@ -222,7 +222,7 @@
m_increase_max_fill = nullptr;
m_decrease_max_fill = nullptr;
- if (m_cache_size <= 0 or m_show_only)
+ if (m_cache_size <= 0 || m_show_only)
return;
uint32_t x = Border;
@@ -303,7 +303,7 @@
// Disable those buttons for replay watchers
bool const can_act = m_igb.can_act(m_building.owner().player_number());
- if (not can_act) {
+ if (!can_act) {
if (m_increase_max_fill) m_increase_max_fill->set_enabled(false);
if (m_decrease_max_fill) m_decrease_max_fill->set_enabled(false);
} else {
Follow ups