Merge lp:~widelands-dev/widelands/bug-1343302 into lp:widelands
- bug-1343302
- Merge into trunk
Proposed by
GunChleoc
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 7129 | ||||
Proposed branch: | lp:~widelands-dev/widelands/bug-1343302 | ||||
Merge into: | lp:widelands | ||||
Diff against target: |
6513 lines (+846/-840) 156 files modified
src/ai/ai_help_structs.cc (+3/-3) src/ai/defaultai.cc (+99/-98) src/base/md5.h (+1/-1) src/base/point.cc (+2/-2) src/economy/cmd_call_economy_balance.cc (+1/-1) src/economy/economy.cc (+4/-4) src/economy/economy_data_packet.cc (+1/-1) src/economy/flag.cc (+3/-3) src/economy/flag.h (+2/-2) src/economy/fleet.cc (+1/-1) src/economy/idleworkersupply.cc (+1/-1) src/economy/request.cc (+8/-8) src/economy/road.cc (+9/-9) src/economy/transfer.cc (+1/-1) src/economy/ware_instance.cc (+1/-1) src/economy/wares_queue.cc (+1/-1) src/editor/editorinteractive.cc (+4/-4) src/editor/map_generator.cc (+4/-4) src/editor/tools/editor_history.cc (+3/-3) src/editor/tools/editor_increase_resources_tool.cc (+3/-3) src/editor/tools/editor_place_bob_tool.cc (+2/-2) src/editor/tools/editor_place_immovable_tool.cc (+4/-4) src/editor/tools/editor_set_resources_tool.cc (+2/-2) src/editor/tools/editor_set_terrain_tool.cc (+4/-4) src/editor/ui_menus/categorized_item_selection_menu.h (+2/-2) src/editor/ui_menus/editor_main_menu_load_map.cc (+4/-4) src/editor/ui_menus/editor_main_menu_save_map.cc (+10/-10) src/editor/ui_menus/editor_player_menu.cc (+3/-3) src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc (+1/-1) src/editor/ui_menus/editor_tool_place_bob_options_menu.cc (+2/-2) src/game_io/game_interactive_player_data_packet.cc (+1/-1) src/game_io/game_map_data_packet.cc (+1/-1) src/game_io/game_player_economies_data_packet.cc (+1/-1) src/game_io/game_player_info_data_packet.cc (+2/-2) src/graphic/animation.cc (+3/-3) src/graphic/color.cc (+1/-1) src/graphic/font_handler.cc (+1/-1) src/graphic/graphic.cc (+5/-5) src/graphic/image_transformations.cc (+1/-1) src/graphic/render/gl_surface_texture.cc (+7/-7) src/graphic/render/minimaprenderer.cc (+5/-5) src/graphic/render/terrain_sdl.h (+5/-5) src/graphic/rendertarget.cc (+1/-1) src/graphic/text/rt_parse.cc (+4/-4) src/graphic/text/sdl_ttf_font.cc (+1/-1) src/graphic/text/test/render_richtext.cc (+1/-1) src/graphic/text/textstream.cc (+3/-3) src/graphic/text_parser.cc (+1/-1) src/io/fileread.cc (+2/-2) src/io/filesystem/disk_filesystem.cc (+5/-5) src/io/filesystem/filesystem.cc (+1/-1) src/io/filesystem/layered_filesystem.cc (+11/-11) src/io/filesystem/zip_filesystem.cc (+1/-1) src/io/filewrite.cc (+1/-1) src/logic/battle.cc (+8/-8) src/logic/bill_of_materials.h (+1/-1) src/logic/bob.cc (+3/-3) src/logic/buildcost.cc (+1/-1) src/logic/building.cc (+8/-8) src/logic/checkstep.cc (+6/-6) src/logic/cmd_queue.cc (+1/-1) src/logic/constructionsite.cc (+2/-2) src/logic/dismantlesite.cc (+3/-3) src/logic/editor_game_base.cc (+7/-7) src/logic/game.cc (+5/-5) src/logic/game_controller.h (+1/-1) src/logic/immovable.cc (+19/-19) src/logic/map.cc (+7/-7) src/logic/mapdifferenceregion.cc (+4/-4) src/logic/mapdifferenceregion.h (+4/-4) src/logic/maphollowregion.cc (+4/-4) src/logic/maptriangleregion.cc (+2/-2) src/logic/militarysite.cc (+6/-6) src/logic/player.cc (+24/-24) src/logic/playercommand.cc (+9/-9) src/logic/production_program.cc (+51/-51) src/logic/productionsite.cc (+7/-7) src/logic/requirements.cc (+3/-3) src/logic/single_player_game_settings_provider.cc (+2/-2) src/logic/soldier.cc (+20/-20) src/logic/trainingsite.cc (+1/-1) src/logic/tribe.cc (+3/-3) src/logic/warehouse.cc (+4/-4) src/logic/warelist.h (+1/-1) src/logic/widelands.h (+9/-9) src/logic/widelands_geometry.cc (+3/-3) src/logic/widelands_geometry.h (+8/-8) src/logic/widelands_geometry_io.cc (+2/-2) src/logic/worker.cc (+14/-14) src/logic/worker.h (+1/-1) src/map_io/s2map.cc (+5/-5) src/map_io/widelands_map_building_data_packet.cc (+1/-1) src/map_io/widelands_map_buildingdata_data_packet.cc (+10/-10) src/map_io/widelands_map_extradata_data_packet.cc (+1/-1) src/map_io/widelands_map_flagdata_data_packet.cc (+4/-4) src/map_io/widelands_map_players_messages_data_packet.cc (+5/-5) src/map_io/widelands_map_players_view_data_packet.cc (+10/-10) src/map_io/widelands_map_road_data_packet.cc (+1/-1) src/map_io/widelands_map_roaddata_data_packet.cc (+10/-10) src/map_io/widelands_map_saver.cc (+1/-1) src/map_io/widelands_map_scripting_data_packet.cc (+1/-1) src/network/internet_gaming.cc (+1/-1) src/network/nethost.cc (+5/-5) src/network/network.cc (+1/-1) src/profile/profile.cc (+10/-10) src/scripting/c_utils.cc (+5/-5) src/scripting/lua_bases.cc (+11/-11) src/scripting/lua_game.cc (+8/-8) src/scripting/lua_globals.cc (+2/-2) src/scripting/lua_map.cc (+3/-3) src/scripting/lua_table.h (+1/-1) src/scripting/lua_ui.cc (+3/-3) src/scripting/scripting.cc (+1/-1) src/sound/sound_handler.cc (+6/-6) src/ui_basic/button.cc (+7/-7) src/ui_basic/checkbox.cc (+6/-6) src/ui_basic/editbox.cc (+3/-3) src/ui_basic/listselect.cc (+5/-5) src/ui_basic/multilineeditbox.cc (+1/-1) src/ui_basic/multilinetextarea.cc (+1/-1) src/ui_basic/panel.cc (+19/-19) src/ui_basic/progresswindow.cc (+1/-1) src/ui_basic/slider.cc (+16/-16) src/ui_basic/table.cc (+4/-4) src/ui_basic/unique_window.cc (+1/-1) src/ui_basic/window.cc (+27/-27) src/ui_fsmenu/editor_mapselect.cc (+4/-4) src/ui_fsmenu/internet_lobby.cc (+1/-1) src/ui_fsmenu/intro.cc (+1/-1) src/ui_fsmenu/launch_spg.cc (+2/-2) src/ui_fsmenu/mapselect.cc (+5/-5) src/ui_fsmenu/netsetup_lan.cc (+1/-1) src/ui_fsmenu/options.cc (+5/-5) src/wlapplication.cc (+9/-9) src/wui/actionconfirm.cc (+17/-17) src/wui/building_statistics_menu.cc (+11/-11) src/wui/buildingwindow.cc (+9/-9) src/wui/chat_msg_layout.cc (+2/-2) src/wui/encyclopedia_window.cc (+2/-2) src/wui/fieldaction.cc (+11/-11) src/wui/game_main_menu.cc (+2/-2) src/wui/game_message_menu.cc (+2/-2) src/wui/game_objectives_menu.cc (+3/-3) src/wui/game_options_sound_menu.cc (+6/-6) src/wui/general_statistics_menu.cc (+1/-1) src/wui/interactive_base.cc (+21/-16) src/wui/interactive_player.cc (+2/-2) src/wui/mapview.cc (+3/-3) src/wui/mapviewpixelfunctions.cc (+1/-1) src/wui/overlay_manager.cc (+10/-10) src/wui/plot_area.cc (+1/-1) src/wui/productionsitewindow.cc (+2/-2) src/wui/shipwindow.cc (+2/-2) src/wui/transport_ui.cc (+2/-2) src/wui/waresdisplay.cc (+1/-1) src/wui/waresqueuedisplay.cc (+5/-5) |
||||
To merge this branch: | bzr merge lp:~widelands-dev/widelands/bug-1343302 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
SirVer | Approve | ||
GunChleoc | Needs Resubmitting | ||
Review via email: mp+227432@code.launchpad.net |
Commit message
Description of the change
The codecheck rule still needs fixing, which is beyond my skills. At the moment, it seriously overgenerates. So, I left some NOCOM comments:
# NOCOM(#GunChleoc) this rule does not exclude string literals, e.g. _(" or ")
# NOCOM(#GunChleoc) this rule does not exclude RST comments or // inline comments added after code
# NOCOM(#GunChleoc) this rule is always triggered twice
The code itself is cleaned up and ready to merge.
To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote : | # |
I have moved the codecheck rule into a new branch, so we can get this code in faster.
review:
Needs Resubmitting
Revision history for this message
SirVer (sirver) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/ai/ai_help_structs.cc' |
2 | --- src/ai/ai_help_structs.cc 2014-07-14 10:45:44 +0000 |
3 | +++ src/ai/ai_help_structs.cc 2014-07-25 13:46:28 +0000 |
4 | @@ -28,8 +28,8 @@ |
5 | |
6 | bool FindNodeWithFlagOrRoad::accept(const Map&, FCoords fc) const { |
7 | if (upcast(PlayerImmovable const, pimm, fc.field->get_immovable())) |
8 | - return pimm->get_economy() != economy and(dynamic_cast<Flag const*>(pimm) |
9 | - or(dynamic_cast<Road const*>(pimm) && |
10 | + return pimm->get_economy() != economy && (dynamic_cast<Flag const*>(pimm) |
11 | + || (dynamic_cast<Road const*>(pimm) && |
12 | (fc.field->nodecaps() & BUILDCAPS_FLAG))); |
13 | return false; |
14 | } |
15 | @@ -53,7 +53,7 @@ |
16 | if (dynamic_cast<Flag const*>(imm)) |
17 | return true; |
18 | |
19 | - if (not dynamic_cast<Road const*>(imm) || !(endcaps & BUILDCAPS_FLAG)) |
20 | + if (!dynamic_cast<Road const*>(imm) || !(endcaps & BUILDCAPS_FLAG)) |
21 | return false; |
22 | } |
23 | |
24 | |
25 | === modified file 'src/ai/defaultai.cc' |
26 | --- src/ai/defaultai.cc 2014-07-23 15:58:57 +0000 |
27 | +++ src/ai/defaultai.cc 2014-07-25 13:46:28 +0000 |
28 | @@ -114,17 +114,17 @@ |
29 | } |
30 | |
31 | DefaultAI::~DefaultAI() { |
32 | - while (not buildable_fields.empty()) { |
33 | + while (!buildable_fields.empty()) { |
34 | delete buildable_fields.back(); |
35 | buildable_fields.pop_back(); |
36 | } |
37 | |
38 | - while (not mineable_fields.empty()) { |
39 | + while (!mineable_fields.empty()) { |
40 | delete mineable_fields.back(); |
41 | mineable_fields.pop_back(); |
42 | } |
43 | |
44 | - while (not economies.empty()) { |
45 | + while (!economies.empty()) { |
46 | delete economies.back(); |
47 | economies.pop_back(); |
48 | } |
49 | @@ -314,7 +314,7 @@ |
50 | bo.prod_build_material_ = bh.prod_build_material(); |
51 | |
52 | // here we identify hunters |
53 | - if (bo.outputs_.size() == 1 and tribe_->safe_ware_index("meat") == bo.outputs_.at(0)) { |
54 | + if (bo.outputs_.size() == 1 && tribe_->safe_ware_index("meat") == bo.outputs_.at(0)) { |
55 | bo.is_hunter_ = true; |
56 | } else |
57 | bo.is_hunter_ = false; |
58 | @@ -364,7 +364,7 @@ |
59 | if (upcast(PlayerImmovable, imm, f.field->get_immovable())) |
60 | |
61 | // Guard by a set - immovables might be on several nodes at once. |
62 | - if (&imm->owner() == player_ and not found_immovables.count(imm)) { |
63 | + if (&imm->owner() == player_ && !found_immovables.count(imm)) { |
64 | found_immovables.insert(imm); |
65 | gain_immovable(*imm); |
66 | } |
67 | @@ -379,7 +379,7 @@ |
68 | * milliseconds if the area the computer owns is big. |
69 | */ |
70 | void DefaultAI::update_all_buildable_fields(const int32_t gametime) { |
71 | - while (not buildable_fields.empty() and buildable_fields.front()->next_update_due_ <= gametime) { |
72 | + while (!buildable_fields.empty() && buildable_fields.front()->next_update_due_ <= gametime) { |
73 | BuildableField& bf = *buildable_fields.front(); |
74 | |
75 | // check whether we lost ownership of the node |
76 | @@ -411,7 +411,7 @@ |
77 | * milliseconds if the area the computer owns is big. |
78 | */ |
79 | void DefaultAI::update_all_mineable_fields(const int32_t gametime) { |
80 | - while (not mineable_fields.empty() and mineable_fields.front()->next_update_due_ <= gametime) { |
81 | + while (!mineable_fields.empty() && mineable_fields.front()->next_update_due_ <= gametime) { |
82 | MineableField* mf = mineable_fields.front(); |
83 | |
84 | // check whether we lost ownership of the node |
85 | @@ -493,7 +493,7 @@ |
86 | } |
87 | |
88 | // to save some CPU |
89 | - if (mines_.size() > 8 and game().get_gametime() % 3 > 0) |
90 | + if (mines_.size() > 8 && game().get_gametime() % 3 > 0) |
91 | field.unowned_mines_pots_nearby_ = 0; |
92 | else |
93 | field.unowned_mines_pots_nearby_ = map.find_fields( |
94 | @@ -534,7 +534,7 @@ |
95 | } |
96 | |
97 | // counting fields with fish |
98 | - if (field.water_nearby_ > 0 and game().get_gametime() % 10 == 0) { |
99 | + if (field.water_nearby_ > 0 && game().get_gametime() % 10 == 0) { |
100 | map.find_fields(Area<FCoords>(field.coords, 6), |
101 | &resource_list, |
102 | FindNodeResource(world.get_resource("fish"))); |
103 | @@ -553,7 +553,7 @@ |
104 | |
105 | if (BaseImmovable const* const imm = fse.field->get_immovable()) |
106 | if (dynamic_cast<Flag const*>(imm) |
107 | - or(dynamic_cast<Road const*>(imm) && (fse.field->nodecaps() & BUILDCAPS_FLAG))) |
108 | + || (dynamic_cast<Road const*>(imm) && (fse.field->nodecaps() & BUILDCAPS_FLAG))) |
109 | field.preferred_ = true; |
110 | |
111 | for (uint32_t i = 0; i < immovables.size(); ++i) { |
112 | @@ -654,7 +654,7 @@ |
113 | const int32_t radius = militarysite->descr().get_conquers() + 4; |
114 | const int32_t v = radius - dist; |
115 | |
116 | - if (v > 0 and dist > 0) { |
117 | + if (v > 0 && dist > 0) { |
118 | |
119 | field.military_capacity_ += militarysite->maxSoldierCapacity(); |
120 | field.military_presence_ += militarysite->stationedSoldiers().size(); |
121 | @@ -685,7 +685,7 @@ |
122 | |
123 | if (BaseImmovable const* const imm = fse.field->get_immovable()) |
124 | if (dynamic_cast<Flag const*>(imm) |
125 | - or(dynamic_cast<Road const*>(imm) && (fse.field->nodecaps() & BUILDCAPS_FLAG))) |
126 | + || (dynamic_cast<Road const*>(imm) && (fse.field->nodecaps() & BUILDCAPS_FLAG))) |
127 | field.preferred_ = true; |
128 | |
129 | container_iterate_const(std::vector<ImmovableFound>, immovables, i) { |
130 | @@ -802,7 +802,7 @@ |
131 | |
132 | if ((militarysites.size() * 2 + 20) < |
133 | productionsites.size() |
134 | - or spots<(3 + (static_cast<int32_t>(productionsites.size()) / 5))or num_constructionsites_>( |
135 | + || spots<(3 + (static_cast<int32_t>(productionsites.size()) / 5)) || num_constructionsites_>( |
136 | (militarysites.size() + productionsites.size()) / 2)) { |
137 | new_buildings_stop_ = true; |
138 | } |
139 | @@ -865,8 +865,9 @@ |
140 | if (!bf->reachable) |
141 | continue; |
142 | |
143 | + // add randomnes and ease AI |
144 | if (time(nullptr) % 5 == 0) |
145 | - continue; // add randomnes and ease AI |
146 | + continue; |
147 | |
148 | // Continue if field is blocked at the moment |
149 | field_blocked = false; |
150 | @@ -902,7 +903,7 @@ |
151 | if (bo.unoccupied_) |
152 | continue; |
153 | |
154 | - if (not(bo.type == BuildingObserver::MILITARYSITE) and bo.cnt_under_construction_ >= 2) |
155 | + if (!(bo.type == BuildingObserver::MILITARYSITE) && bo.cnt_under_construction_ >= 2) |
156 | continue; |
157 | |
158 | // so we are going to seriously evaluate this building on this field, |
159 | @@ -948,7 +949,7 @@ |
160 | if (bo.type == BuildingObserver::PRODUCTIONSITE) { |
161 | |
162 | // exclude spots on border |
163 | - if (bf->near_border_ and not bo.need_trees_ and not bo.need_stones_) |
164 | + if (bf->near_border_ && !bo.need_trees_ && !bo.need_stones_) |
165 | continue; |
166 | |
167 | // this can be only a well (as by now) |
168 | @@ -958,7 +959,7 @@ |
169 | |
170 | if (bo.cnt_under_construction_ + bo.unoccupied_ > 0) |
171 | continue; |
172 | - if ((bo.cnt_built_ + bo.unoccupied_) > 0 and gametime < kBaseInfrastructureTime) |
173 | + if ((bo.cnt_built_ + bo.unoccupied_) > 0 && gametime < kBaseInfrastructureTime) |
174 | continue; |
175 | if (new_buildings_stop_) |
176 | continue; |
177 | @@ -1023,13 +1024,13 @@ |
178 | |
179 | // production hint (f.e. associate forester with logs) |
180 | |
181 | - if (bo.need_water_ and bf->water_nearby_ < 5) // probably some of them needs water |
182 | + if (bo.need_water_ && bf->water_nearby_ < 5) // probably some of them needs water |
183 | continue; |
184 | |
185 | if (bo.plants_trees_) { // RANGERS |
186 | |
187 | // if there are too many trees nearby |
188 | - if (bf->trees_nearby_ > 25 and bo.total_count() >= 2) |
189 | + if (bf->trees_nearby_ > 25 && bo.total_count() >= 2) |
190 | continue; |
191 | |
192 | // sometimes all area is blocked by trees so this is to prevent this |
193 | @@ -1058,8 +1059,8 @@ |
194 | else if (bo.total_count() < bo.cnt_target_) |
195 | prio += 30 + bf->producers_nearby_.at(bo.production_hint_) * 5; |
196 | |
197 | - } else if (gametime > kBaseInfrastructureTime and not |
198 | - new_buildings_stop_) { // gamekeepers or so |
199 | + } else if (gametime > kBaseInfrastructureTime && |
200 | + !new_buildings_stop_) { // gamekeepers or so |
201 | if (bo.stocklevel_time < game().get_gametime() - 5 * 1000) { |
202 | bo.stocklevel_ = |
203 | get_stocklevel_by_hint(static_cast<size_t>(bo.production_hint_)); |
204 | @@ -1077,7 +1078,7 @@ |
205 | prio += bf->producers_nearby_.at(bo.production_hint_) * 10; |
206 | prio += recalc_with_border_range(*bf, prio); |
207 | |
208 | - } else if (bo.stocklevel_ < 50 and not new_buildings_stop_) { |
209 | + } else if (bo.stocklevel_ < 50 && !new_buildings_stop_) { |
210 | prio += bf->producers_nearby_.at(bo.production_hint_) * 5; |
211 | prio += recalc_with_border_range(*bf, prio); // only for not wood producers_ |
212 | } else |
213 | @@ -1086,11 +1087,11 @@ |
214 | |
215 | if (prio <= 0) |
216 | continue; |
217 | - } else if (bo.recruitment_ and gametime > |
218 | - kBaseInfrastructureTime and not new_buildings_stop_) { |
219 | + } else if (bo.recruitment_ && gametime > |
220 | + kBaseInfrastructureTime && !new_buildings_stop_) { |
221 | // this will depend on number of mines_ and productionsites |
222 | if (static_cast<int32_t>((productionsites.size() + mines_.size()) / 30) > |
223 | - bo.total_count() and bo.cnt_under_construction_ == |
224 | + bo.total_count() && bo.cnt_under_construction_ == |
225 | 0) |
226 | prio = 4 + bulgarian_constant; |
227 | } else { // finally normal productionsites |
228 | @@ -1101,36 +1102,36 @@ |
229 | continue; |
230 | |
231 | // if hunter and too little critters nearby skipping |
232 | - if (bo.is_hunter_ and bf->critters_nearby_ < 5) |
233 | + if (bo.is_hunter_ && bf->critters_nearby_ < 5) |
234 | continue; |
235 | // similarly for fishers |
236 | - if (bo.need_water_ and bf->fish_nearby_ <= 1) |
237 | + if (bo.need_water_ && bf->fish_nearby_ <= 1) |
238 | continue; |
239 | |
240 | // first eliminate buildings needing water if there is short supplies |
241 | - if (bo.need_water_ and bf->water_nearby_ < 4) |
242 | + if (bo.need_water_ && bf->water_nearby_ < 4) |
243 | continue; |
244 | |
245 | - if (bo.is_basic_ and bo.total_count() == 0) |
246 | + if (bo.is_basic_ && bo.total_count() == 0) |
247 | prio = 150 + max_preciousness; |
248 | - else if (bo.is_food_basic_ and game().get_gametime() > |
249 | - kPrimaryFoodStartTime and bo.total_count() == |
250 | + else if (bo.is_food_basic_ && game().get_gametime() > |
251 | + kPrimaryFoodStartTime && bo.total_count() == |
252 | 0) { |
253 | prio = 40 + max_preciousness; |
254 | } else if (game().get_gametime() < |
255 | - kBaseInfrastructureTime or |
256 | + kBaseInfrastructureTime || |
257 | new_buildings_stop_) // leave 15 minutes for basic infrastructure only |
258 | continue; |
259 | - else if ((bo.is_basic_ and bo.total_count() <= |
260 | - 1)or(output_is_needed and bo.total_count() == 0)) |
261 | + else if ((bo.is_basic_ && bo.total_count() <= |
262 | + 1) || (output_is_needed && bo.total_count() == 0)) |
263 | prio = 80 + max_preciousness; |
264 | else if (bo.inputs_.size() == 0) { |
265 | bo.cnt_target_ = |
266 | 1 + static_cast<int32_t>(mines_.size() + productionsites.size()) / 8; |
267 | |
268 | if (bo.cnt_built_ > |
269 | - bo.cnt_target_ and not( |
270 | - bo.space_consumer_ or bo.is_food_basic_)) // spaceconsumers_ and basic_s |
271 | + bo.cnt_target_ && |
272 | + !(bo.space_consumer_ || bo.is_food_basic_)) // spaceconsumers_ and basic_s |
273 | // can be built more then target |
274 | continue; |
275 | |
276 | @@ -1145,7 +1146,7 @@ |
277 | if (bo.space_consumer_) // need to consider trees nearby |
278 | prio += 20 - (bf->trees_nearby_ / 3); |
279 | |
280 | - if (not bo.space_consumer_) |
281 | + if (!bo.space_consumer_) |
282 | prio -= bf->producers_nearby_.at(bo.outputs_.at(0)) * |
283 | 20; // leave some free space between them |
284 | |
285 | @@ -1172,18 +1173,18 @@ |
286 | // to have two buildings from everything (intended for upgradeable buildings) |
287 | // but I do not know how to identify such buildings |
288 | if (bo.cnt_built_ == 1 |
289 | - and game().get_gametime() > 60 * 60 * 1000 |
290 | - and bo.desc->enhancement() != INVALID_INDEX |
291 | - and !mines_.empty()) |
292 | + && game().get_gametime() > 60 * 60 * 1000 |
293 | + && bo.desc->enhancement() != INVALID_INDEX |
294 | + && !mines_.empty()) |
295 | { |
296 | prio = max_preciousness + bulgarian_constant; |
297 | } |
298 | // if output is needed and there are no idle buildings |
299 | else if (output_is_needed) { |
300 | - if (bo.cnt_built_ > 0 and bo.current_stats_ > 80) { |
301 | + if (bo.cnt_built_ > 0 && bo.current_stats_ > 80) { |
302 | prio = max_preciousness + bulgarian_constant + 30; |
303 | |
304 | - } else if (bo.cnt_built_ > 0 and bo.current_stats_ > 55) { |
305 | + } else if (bo.cnt_built_ > 0 && bo.current_stats_ > 55) { |
306 | prio = max_preciousness + bulgarian_constant; |
307 | |
308 | } |
309 | @@ -1208,22 +1209,22 @@ |
310 | } // production sites done |
311 | else if (bo.type == BuildingObserver::MILITARYSITE) { |
312 | |
313 | - if (new_military_buildings_stop and not bf->enemy_nearby_) |
314 | - continue; |
315 | - |
316 | - if (near_enemy_b_buildings_stop and bf->enemy_nearby_) |
317 | - continue; |
318 | - |
319 | - if (bf->enemy_nearby_ and bo.fighting_type_) |
320 | + if (new_military_buildings_stop && !bf->enemy_nearby_) |
321 | + continue; |
322 | + |
323 | + if (near_enemy_b_buildings_stop && bf->enemy_nearby_) |
324 | + continue; |
325 | + |
326 | + if (bf->enemy_nearby_ && bo.fighting_type_) |
327 | ; // it is ok, go on |
328 | else if (bf->unowned_mines_pots_nearby_ > |
329 | - 0 and(bo.mountain_conqueror_ or bo.expansion_type_)) |
330 | + 0 && (bo.mountain_conqueror_ || bo.expansion_type_)) |
331 | ; // it is ok, go on |
332 | - else if (bf->unowned_land_nearby_ and bo.expansion_type_) { |
333 | + else if (bf->unowned_land_nearby_ && bo.expansion_type_) { |
334 | // decreasing probability for big buidlings |
335 | - if (bo.desc->get_size() == 2 and gametime % 5 >= 1) |
336 | + if (bo.desc->get_size() == 2 && gametime % 5 >= 1) |
337 | continue; |
338 | - if (bo.desc->get_size() == 3 and gametime % 15 >= 1) |
339 | + if (bo.desc->get_size() == 3 && gametime % 15 >= 1) |
340 | continue; |
341 | } |
342 | // it is ok, go on |
343 | @@ -1231,7 +1232,7 @@ |
344 | continue; // the building is not suitable for situation |
345 | |
346 | if (bo.desc->get_size() == |
347 | - 3 and game().get_gametime() < |
348 | + 3 && game().get_gametime() < |
349 | 15 * 60 * 1000) // do not built fortresses in first half of hour of game |
350 | continue; |
351 | |
352 | @@ -1239,7 +1240,7 @@ |
353 | continue; |
354 | |
355 | // not to build so many military buildings nearby |
356 | - if (!bf->enemy_nearby_ and bf->military_in_constr_nearby_ > 0) |
357 | + if (!bf->enemy_nearby_ && bf->military_in_constr_nearby_ > 0) |
358 | continue; |
359 | |
360 | // here is to consider unowned potential mines |
361 | @@ -1257,7 +1258,7 @@ |
362 | if (bo.desc->get_size() < maxsize) |
363 | prio = prio - 5; // penalty |
364 | |
365 | - if (bf->enemy_nearby_ and bf->military_capacity_ < 12) { |
366 | + if (bf->enemy_nearby_ && bf->military_capacity_ < 12) { |
367 | prio += 100; |
368 | } |
369 | |
370 | @@ -1272,7 +1273,7 @@ |
371 | // chance for a warehouses (containing waiting soldiers or wares |
372 | // needed for soldier training) near the frontier. |
373 | if ((static_cast<int32_t>(productionsites.size() + mines_.size())) / 35 > |
374 | - static_cast<int32_t>(numof_warehouses_) and bo.cnt_under_construction_ == |
375 | + static_cast<int32_t>(numof_warehouses_) && bo.cnt_under_construction_ == |
376 | 0) |
377 | prio = 13; |
378 | |
379 | @@ -1290,7 +1291,7 @@ |
380 | |
381 | // build after 20 production sites and then after each 50 production site |
382 | if (static_cast<int32_t>((productionsites.size() + 30) / 50) > |
383 | - bo.total_count() and bo.cnt_under_construction_ == |
384 | + bo.total_count() && bo.cnt_under_construction_ == |
385 | 0) |
386 | prio = 4; |
387 | |
388 | @@ -1329,7 +1330,7 @@ |
389 | for (uint32_t i = 0; i < buildings_.size() && productionsites.size() > 8; ++i) { |
390 | BuildingObserver& bo = buildings_.at(i); |
391 | |
392 | - if (not bo.mines_marble_ and gametime < |
393 | + if (!bo.mines_marble_ && gametime < |
394 | kBaseInfrastructureTime) // allow only stone mines_ in early stages of game |
395 | continue; |
396 | |
397 | @@ -1352,7 +1353,7 @@ |
398 | } |
399 | |
400 | // Only try to build mines_ that produce needed wares. |
401 | - if (((bo.cnt_built_ - bo.unoccupied_) > 0 and bo.current_stats_ < 20)or bo.stocklevel_ > |
402 | + if (((bo.cnt_built_ - bo.unoccupied_) > 0 && bo.current_stats_ < 20) || bo.stocklevel_ > |
403 | 40 + static_cast<uint32_t>(bo.mines_marble_) * 30) { |
404 | |
405 | continue; |
406 | @@ -1430,7 +1431,7 @@ |
407 | blocked_fields.push_back(blocked); |
408 | |
409 | // if space consumer we block also nearby fields |
410 | - if (best_building->space_consumer_ and not best_building->plants_trees_) { |
411 | + if (best_building->space_consumer_ && !best_building->plants_trees_) { |
412 | Map& map = game().map(); |
413 | |
414 | MapRegion<Area<FCoords>> mr(map, Area<FCoords>(map.get_fcoords(proposed_coords), 3)); |
415 | @@ -1441,7 +1442,7 @@ |
416 | } while (mr.advance(map)); |
417 | } |
418 | |
419 | - if (not(best_building->type == BuildingObserver::MILITARYSITE)) |
420 | + if (!(best_building->type == BuildingObserver::MILITARYSITE)) |
421 | best_building->construction_decision_time_ = gametime; |
422 | else // very ugly hack here |
423 | best_building->construction_decision_time_ = gametime - kBuildingMinInterval / 2; |
424 | @@ -1508,7 +1509,7 @@ |
425 | |
426 | // If the economy consists of just one constructionsite, and the defaultAI |
427 | // failed more than 4 times to connect, we remove the constructionsite |
428 | - if (eo_to_connect->failed_connection_tries > 3 and eo_to_connect->flags.size() == 1) { |
429 | + if (eo_to_connect->failed_connection_tries > 3 && eo_to_connect->flags.size() == 1) { |
430 | Building* bld = eo_to_connect->flags.front()->get_building(); |
431 | |
432 | if (bld) { |
433 | @@ -1732,7 +1733,7 @@ |
434 | Path& path = *new Path(); |
435 | |
436 | if (map.findpath(flag.get_position(), nf.flag->get_position(), 0, path, check) >= |
437 | - 0 and static_cast<int32_t>(2 * path.get_nsteps() + 2) < nf.cost_) { |
438 | + 0 && static_cast<int32_t>(2 * path.get_nsteps() + 2) < nf.cost_) { |
439 | game().send_player_build_road(player_number(), path); |
440 | return true; |
441 | } |
442 | @@ -1855,7 +1856,7 @@ |
443 | // Wells handling |
444 | if (site.bo->mines_water_) { |
445 | if (site.unoccupied_till_ + 6 * 60 * 1000 < game().get_gametime() |
446 | - and site.site->get_statistics_percent() == |
447 | + && site.site->get_statistics_percent() == |
448 | 0) { |
449 | site.bo->last_dismantle_time_ = game().get_gametime(); |
450 | flags_to_be_removed.push_back(site.site->base_flag().get_position()); |
451 | @@ -1882,7 +1883,7 @@ |
452 | } |
453 | |
454 | if (site.unoccupied_till_ + 6 * 60 * 1000 < game().get_gametime() |
455 | - and site.site->get_statistics_percent() == |
456 | + && site.site->get_statistics_percent() == |
457 | 0) { |
458 | // it is possible that there are stones but quary is not able to mine them |
459 | site.bo->last_dismantle_time_ = game().get_gametime(); |
460 | @@ -1897,13 +1898,13 @@ |
461 | |
462 | // All other SPACE_CONSUMERS without input and above target_count |
463 | if (site.bo->inputs_.empty() // does not consume anything |
464 | - and site.bo->production_hint_ == |
465 | + && site.bo->production_hint_ == |
466 | -1 // not a renewing building (forester...) |
467 | - and site.unoccupied_till_ + |
468 | + && site.unoccupied_till_ + |
469 | 10 * 60 * 1000 < |
470 | game().get_gametime() // > 10 minutes old |
471 | - and site.site->can_start_working() // building is occupied |
472 | - and site.bo->space_consumer_ and not site.bo->plants_trees_) { |
473 | + && site.site->can_start_working() // building is occupied |
474 | + && site.bo->space_consumer_ && !site.bo->plants_trees_) { |
475 | |
476 | // if we have more buildings then target |
477 | if (site.bo->cnt_built_ > site.bo->cnt_target_) { |
478 | @@ -1913,7 +1914,7 @@ |
479 | } |
480 | |
481 | if (site.site->get_statistics_percent()< |
482 | - 30 and site.bo->stocklevel_> 100) { // production stats == 0% |
483 | + 30 && site.bo->stocklevel_> 100) { // production stats == 0% |
484 | site.bo->last_dismantle_time_ = game().get_gametime(); |
485 | flags_to_be_removed.push_back(site.site->base_flag().get_position()); |
486 | game().send_player_dismantle(*site.site); |
487 | @@ -1933,10 +1934,10 @@ |
488 | } |
489 | |
490 | // buildings with inputs_, checking if we can a dismantle some due to low performance |
491 | - if (!site.bo->inputs_.empty() and(site.bo->cnt_built_ - site.bo->unoccupied_) >= |
492 | - 3 and site.site->can_start_working() and site.site->get_statistics_percent() < |
493 | - 20 and // statistics for the building |
494 | - site.bo->current_stats_<30 and // overall statistics |
495 | + if (!site.bo->inputs_.empty() && (site.bo->cnt_built_ - site.bo->unoccupied_) >= |
496 | + 3 && site.site->can_start_working() && site.site->get_statistics_percent() < |
497 | + 20 && // statistics for the building |
498 | + site.bo->current_stats_<30 && // overall statistics |
499 | (game().get_gametime() - site.unoccupied_till_)> 10 * |
500 | 60 * 1000) { |
501 | |
502 | @@ -1951,10 +1952,10 @@ |
503 | // first if is only for log, second one is "executive" |
504 | |
505 | if (site.bo->inputs_.size() == |
506 | - 0 and site.bo->production_hint_ < |
507 | - 0 and site.site->can_start_working() |
508 | - and not site.bo->space_consumer_ and site.site->get_statistics_percent() < |
509 | - 10 and((game().get_gametime() - site.built_time_) > 10 * 60 * 1000)) { |
510 | + 0 && site.bo->production_hint_ < |
511 | + 0 && site.site->can_start_working() |
512 | + && !site.bo->space_consumer_ && site.site->get_statistics_percent() < |
513 | + 10 && ((game().get_gametime() - site.built_time_) > 10 * 60 * 1000)) { |
514 | |
515 | site.bo->last_dismantle_time_ = game().get_gametime(); |
516 | flags_to_be_removed.push_back(site.site->base_flag().get_position()); |
517 | @@ -1974,7 +1975,7 @@ |
518 | uint16_t score = site.bo->stocklevel_; |
519 | |
520 | |
521 | - if (score > 150 and site.bo->cnt_built_ > site.bo->cnt_target_) { |
522 | + if (score > 150 && site.bo->cnt_built_ > site.bo->cnt_target_) { |
523 | |
524 | site.bo->last_dismantle_time_ = game().get_gametime(); |
525 | flags_to_be_removed.push_back(site.site->base_flag().get_position()); |
526 | @@ -1982,12 +1983,12 @@ |
527 | return true; |
528 | } |
529 | |
530 | - if (score > 70 and not site.site->is_stopped()) { |
531 | + if (score > 70 && !site.site->is_stopped()) { |
532 | |
533 | game().send_player_start_stop_building(*site.site); |
534 | } |
535 | |
536 | - if (score < 50 and site.site->is_stopped()) { |
537 | + if (score < 50 && site.site->is_stopped()) { |
538 | |
539 | game().send_player_start_stop_building(*site.site); |
540 | } |
541 | @@ -2025,9 +2026,9 @@ |
542 | { |
543 | // forcing first upgrade |
544 | if ((en_bo.cnt_under_construction_ + en_bo.cnt_built_ + en_bo.unoccupied_) == 0 |
545 | - and(site.bo->cnt_built_ - site.bo->unoccupied_) >= 1 |
546 | - and(game().get_gametime() - site.unoccupied_till_) > 30 * 60 * 1000 |
547 | - and !mines_.empty()) |
548 | + && (site.bo->cnt_built_ - site.bo->unoccupied_) >= 1 |
549 | + && (game().get_gametime() - site.unoccupied_till_) > 30 * 60 * 1000 |
550 | + && !mines_.empty()) |
551 | { |
552 | game().send_player_enhance_building(*site.site, enhancement); |
553 | return true; |
554 | @@ -2039,11 +2040,11 @@ |
555 | // now, let consider normal upgrade |
556 | // do not upgrade if candidate production % is too low |
557 | if ((en_bo.cnt_built_ - en_bo.unoccupied_) != 0 |
558 | - or(en_bo.cnt_under_construction_ + en_bo.unoccupied_) <= 0 |
559 | - or en_bo.current_stats_ >= 50) { |
560 | + || (en_bo.cnt_under_construction_ + en_bo.unoccupied_) <= 0 |
561 | + || en_bo.current_stats_ >= 50) { |
562 | |
563 | if (en_bo.current_stats_ > 65 |
564 | - and ((en_bo.current_stats_ - site.bo->current_stats_) + // priority for enhancement |
565 | + && ((en_bo.current_stats_ - site.bo->current_stats_) + // priority for enhancement |
566 | (en_bo.current_stats_ - 65)) > 0) |
567 | { |
568 | enbld = enhancement; |
569 | @@ -2085,7 +2086,7 @@ |
570 | |
571 | // first get rid of mines that are missing workers for some time (5 minutes) |
572 | // released worker (if any) can be usefull elsewhere ! |
573 | - if (site.built_time_ + 5 * 60 * 1000 < gametime and not site.site->can_start_working()) { |
574 | + if (site.built_time_ + 5 * 60 * 1000 < gametime && !site.site->can_start_working()) { |
575 | flags_to_be_removed.push_back(site.site->base_flag().get_position()); |
576 | game().send_player_dismantle(*site.site); |
577 | return true; |
578 | @@ -2123,7 +2124,7 @@ |
579 | if (en_bo.unoccupied_ + en_bo.cnt_under_construction_ <= 0) |
580 | { |
581 | // do not upgrade target building are not working properly (probably do not have food) |
582 | - if (en_bo.cnt_built_ <= 0 and en_bo.current_stats_ >= 60) |
583 | + if (en_bo.cnt_built_ <= 0 && en_bo.current_stats_ >= 60) |
584 | { |
585 | // do not build the same building so soon (kind of duplicity check) |
586 | if (gametime - en_bo.construction_decision_time_ >= kBuildingMinInterval) |
587 | @@ -2258,8 +2259,8 @@ |
588 | update_buildable_field(bf, vision, true); |
589 | const int32_t size_penalty = ms->get_size() - 1; |
590 | |
591 | - if (bf.military_capacity_ > 9 and bf.military_presence_ > |
592 | - 3 and bf.military_loneliness_<160 and bf.military_stationed_>(2 + size_penalty)) { |
593 | + if (bf.military_capacity_ > 9 && bf.military_presence_ > |
594 | + 3 && bf.military_loneliness_<160 && bf.military_stationed_>(2 + size_penalty)) { |
595 | |
596 | if (ms->get_playercaps() & Widelands::Building::PCap_Dismantle) { |
597 | flags_to_be_removed.push_back(ms->base_flag().get_position()); |
598 | @@ -2315,7 +2316,7 @@ |
599 | // NOTE take care about the type of computer player_. The more |
600 | // NOTE aggressive a computer player_ is, the more important is |
601 | // NOTE this check. So we add \var type as bonus. |
602 | - if (bf.enemy_nearby_ and prio > 0) |
603 | + if (bf.enemy_nearby_ && prio > 0) |
604 | prio /= (3 + type_); |
605 | |
606 | return prio; |
607 | @@ -2380,7 +2381,7 @@ |
608 | void DefaultAI::consider_productionsite_influence(BuildableField& field, |
609 | Coords coords, |
610 | const BuildingObserver& bo) { |
611 | - if (bo.space_consumer_ and game().map().calc_distance(coords, field.coords) < 4) |
612 | + if (bo.space_consumer_ && game().map().calc_distance(coords, field.coords) < 4) |
613 | ++field.space_consumers_nearby_; |
614 | |
615 | for (size_t i = 0; i < bo.inputs_.size(); ++i) |
616 | @@ -2627,7 +2628,7 @@ |
617 | |
618 | } |
619 | |
620 | - if (not any_attackable) { |
621 | + if (!any_attackable) { |
622 | next_attack_consideration_due_ = 120 * 1000 + (gametime % 30 + 2) * 1000 + gametime; |
623 | return false; |
624 | } |
625 | @@ -2638,7 +2639,7 @@ |
626 | Map& map = game().map(); |
627 | |
628 | uint16_t position = 0; |
629 | - for (uint32_t i = 0; i < attempts && not any_attacked; ++i) { |
630 | + for (uint32_t i = 0; i < attempts && !any_attacked; ++i) { |
631 | position = (game().get_gametime() + (3 * i)) % militarysites.size(); |
632 | |
633 | // picking random military sites |
634 | @@ -2661,7 +2662,7 @@ |
635 | // uint8_t retreat = ms->owner().get_retreat_percentage(); |
636 | |
637 | // skipping if based on "enemies nearby" there are probably no enemies nearby |
638 | - if (not mso->enemies_nearby and gametime % 8 > 0) { |
639 | + if (!mso->enemies_nearby && gametime % 8 > 0) { |
640 | continue; // go on with next attempt |
641 | } |
642 | |
643 | @@ -2680,7 +2681,7 @@ |
644 | |
645 | mso->enemies_nearby = true; |
646 | |
647 | - if (not player_attackable[bld->owner().player_number() - 1]) { |
648 | + if (!player_attackable[bld->owner().player_number() - 1]) { |
649 | continue; |
650 | } |
651 | |
652 | |
653 | === modified file 'src/base/md5.h' |
654 | --- src/base/md5.h 2014-07-05 16:41:51 +0000 |
655 | +++ src/base/md5.h 2014-07-25 13:46:28 +0000 |
656 | @@ -52,7 +52,7 @@ |
657 | return memcmp(data, o.data, sizeof(data)) == 0; |
658 | } |
659 | |
660 | - bool operator!= (const md5_checksum & o) const {return not (*this == o);} |
661 | + bool operator!= (const md5_checksum & o) const {return !(*this == o);} |
662 | }; |
663 | |
664 | // Note that the implementation of MD5Checksum is basically just |
665 | |
666 | === modified file 'src/base/point.cc' |
667 | --- src/base/point.cc 2014-06-24 20:21:13 +0000 |
668 | +++ src/base/point.cc 2014-07-25 13:46:28 +0000 |
669 | @@ -30,10 +30,10 @@ |
670 | } |
671 | |
672 | bool Point::operator == (const Point& other) const { |
673 | - return x == other.x and y == other.y; |
674 | + return x == other.x && y == other.y; |
675 | } |
676 | bool Point::operator != (const Point& other) const { |
677 | - return not(*this == other); |
678 | + return !(*this == other); |
679 | } |
680 | |
681 | Point Point::operator +(const Point& other) const { |
682 | |
683 | === modified file 'src/economy/cmd_call_economy_balance.cc' |
684 | --- src/economy/cmd_call_economy_balance.cc 2014-06-01 18:00:48 +0000 |
685 | +++ src/economy/cmd_call_economy_balance.cc 2014-07-25 13:46:28 +0000 |
686 | @@ -68,7 +68,7 @@ |
687 | GameLogicCommand::Read(fr, egbase, mol); |
688 | uint8_t const player_number = fr.Unsigned8(); |
689 | if (Player * const player = egbase.get_player(player_number)) { |
690 | - if (not fr.Unsigned8()) |
691 | + if (!fr.Unsigned8()) |
692 | throw wexception("0 is not allowed here"); |
693 | uint16_t const economy_number = fr.Unsigned16(); |
694 | if (economy_number < player->get_nr_economies()) |
695 | |
696 | === modified file 'src/economy/economy.cc' |
697 | --- src/economy/economy.cc 2014-07-22 09:54:49 +0000 |
698 | +++ src/economy/economy.cc 2014-07-25 13:46:28 +0000 |
699 | @@ -130,7 +130,7 @@ |
700 | |
701 | Economy * e = f1.get_economy(); |
702 | // No economy in the editor. |
703 | - if (not e) |
704 | + if (!e) |
705 | return; |
706 | |
707 | e->m_split_checks.push_back(std::make_pair(OPtr<Flag>(&f1), OPtr<Flag>(&f2))); |
708 | @@ -549,8 +549,8 @@ |
709 | // window for *this where the options window for e is, to give the user |
710 | // some continuity. |
711 | if |
712 | - (e.m_optionswindow_registry.window and |
713 | - not m_optionswindow_registry.window) |
714 | + (e.m_optionswindow_registry.window && |
715 | + !m_optionswindow_registry.window) |
716 | { |
717 | m_optionswindow_registry.x = e.m_optionswindow_registry.x; |
718 | m_optionswindow_registry.y = e.m_optionswindow_registry.y; |
719 | @@ -841,7 +841,7 @@ |
720 | // Requests for heroes should not trigger the creation of more rookies |
721 | if (soldier_level_check) |
722 | { |
723 | - if (not (req.get_requirements().check(*m_soldier_prototype))) |
724 | + if (!(req.get_requirements().check(*m_soldier_prototype))) |
725 | continue; |
726 | } |
727 | |
728 | |
729 | === modified file 'src/economy/economy_data_packet.cc' |
730 | --- src/economy/economy_data_packet.cc 2014-05-11 07:38:01 +0000 |
731 | +++ src/economy/economy_data_packet.cc 2014-07-25 13:46:28 +0000 |
732 | @@ -36,7 +36,7 @@ |
733 | uint16_t const version = fr.Unsigned16(); |
734 | |
735 | try { |
736 | - if (1 <= version and version <= CURRENT_ECONOMY_VERSION) { |
737 | + if (1 <= version && version <= CURRENT_ECONOMY_VERSION) { |
738 | if (2 <= version) |
739 | try { |
740 | const Tribe_Descr & tribe = m_eco->owner().tribe(); |
741 | |
742 | === modified file 'src/economy/flag.cc' |
743 | --- src/economy/flag.cc 2014-07-14 14:40:42 +0000 |
744 | +++ src/economy/flag.cc 2014-07-25 13:46:28 +0000 |
745 | @@ -80,7 +80,7 @@ |
746 | auto should_be_deleted = [&egbase, this](const OPtr<Worker>& r) { |
747 | Worker& worker = *r.get(egbase); |
748 | Bob::State const* const state = worker.get_state(Worker::taskWaitforcapacity); |
749 | - if (not state) { |
750 | + if (!state) { |
751 | log("WARNING: worker %u is in the capacity wait queue of flag %u but " |
752 | "does not have a waitforcapacity task! Removing from queue.\n", |
753 | worker.serial(), |
754 | @@ -138,7 +138,7 @@ |
755 | |
756 | init(egbase); |
757 | |
758 | - if (road and game) |
759 | + if (road && game) |
760 | road->postsplit(*game, *this); |
761 | } |
762 | |
763 | @@ -498,7 +498,7 @@ |
764 | while (!m_capacity_wait.empty()) { |
765 | Worker * const w = m_capacity_wait[0].get(game); |
766 | m_capacity_wait.erase(m_capacity_wait.begin()); |
767 | - if (w and w->wakeup_flag_capacity(game, *this)) |
768 | + if (w && w->wakeup_flag_capacity(game, *this)) |
769 | break; |
770 | } |
771 | } |
772 | |
773 | === modified file 'src/economy/flag.h' |
774 | --- src/economy/flag.h 2014-07-14 14:40:42 +0000 |
775 | +++ src/economy/flag.h 2014-07-25 13:46:28 +0000 |
776 | @@ -86,8 +86,8 @@ |
777 | |
778 | bool has_road() const { |
779 | return |
780 | - m_roads[0] or m_roads[1] or m_roads[2] or |
781 | - m_roads[3] or m_roads[4] or m_roads[5]; |
782 | + m_roads[0] or m_roads[1] || m_roads[2] || |
783 | + m_roads[3] or m_roads[4] || m_roads[5]; |
784 | } |
785 | Road * get_road(uint8_t const dir) const {return m_roads[dir - 1];} |
786 | uint8_t nr_of_roads() const; |
787 | |
788 | === modified file 'src/economy/fleet.cc' |
789 | --- src/economy/fleet.cc 2014-07-22 09:54:49 +0000 |
790 | +++ src/economy/fleet.cc 2014-07-25 13:46:28 +0000 |
791 | @@ -204,7 +204,7 @@ |
792 | */ |
793 | void Fleet::merge(Editor_Game_Base & egbase, Fleet * other) |
794 | { |
795 | - if (m_ports.empty() and not other->m_ports.empty()) { |
796 | + if (m_ports.empty() && !other->m_ports.empty()) { |
797 | other->merge(egbase, this); |
798 | return; |
799 | } |
800 | |
801 | === modified file 'src/economy/idleworkersupply.cc' |
802 | --- src/economy/idleworkersupply.cc 2014-07-14 20:09:27 +0000 |
803 | +++ src/economy/idleworkersupply.cc 2014-07-25 13:46:28 +0000 |
804 | @@ -94,7 +94,7 @@ |
805 | uint32_t IdleWorkerSupply::nr_supplies(const Game &, const Request & req) const |
806 | { |
807 | assert |
808 | - (req.get_type() != wwWORKER or |
809 | + (req.get_type() != wwWORKER || |
810 | req.get_index() < m_worker.descr().tribe().get_nrworkers()); |
811 | if |
812 | (req.get_type() == wwWORKER && |
813 | |
814 | === modified file 'src/economy/request.cc' |
815 | --- src/economy/request.cc 2014-07-14 10:45:44 +0000 |
816 | +++ src/economy/request.cc 2014-07-25 13:46:28 +0000 |
817 | @@ -68,13 +68,13 @@ |
818 | m_required_interval(0), |
819 | m_last_request_time(m_required_time) |
820 | { |
821 | - assert(m_type == wwWARE or m_type == wwWORKER); |
822 | - if (w == wwWARE and _target.owner().tribe().get_nrwares() <= index) |
823 | + assert(m_type == wwWARE || m_type == wwWORKER); |
824 | + if (w == wwWARE && _target.owner().tribe().get_nrwares() <= index) |
825 | throw wexception |
826 | ("creating ware request with index %u, but tribe has only %u " |
827 | "ware types", |
828 | index, _target.owner().tribe().get_nrwares ()); |
829 | - if (w == wwWORKER and _target.owner().tribe().get_nrworkers() <= index) |
830 | + if (w == wwWORKER && _target.owner().tribe().get_nrworkers() <= index) |
831 | throw wexception |
832 | ("creating worker request with index %u, but tribe has only %u " |
833 | "worker types", |
834 | @@ -86,7 +86,7 @@ |
835 | Request::~Request() |
836 | { |
837 | // Remove from the economy |
838 | - if (is_open() and m_economy) |
839 | + if (is_open() && m_economy) |
840 | m_economy->remove_request(*this); |
841 | |
842 | // Cancel all ongoing transfers |
843 | @@ -184,10 +184,10 @@ |
844 | |
845 | // Target and econmy should be set. Same is true for callback stuff. |
846 | |
847 | - assert(m_type == wwWARE or m_type == wwWORKER); |
848 | + assert(m_type == wwWARE || m_type == wwWORKER); |
849 | const Tribe_Descr & tribe = m_target.owner().tribe(); |
850 | - assert(m_type != wwWARE or m_index < tribe.get_nrwares ()); |
851 | - assert(m_type != wwWORKER or m_index < tribe.get_nrworkers()); |
852 | + assert(m_type != wwWARE || m_index < tribe.get_nrwares ()); |
853 | + assert(m_type != wwWORKER || m_index < tribe.get_nrworkers()); |
854 | fw.CString |
855 | (m_type == wwWARE ? |
856 | tribe.get_ware_descr (m_index)->name() : |
857 | @@ -230,7 +230,7 @@ |
858 | (Editor_Game_Base & egbase, uint32_t const nr) const |
859 | { |
860 | if (m_count <= nr) { |
861 | - if (not(m_count == 1 and nr == 1)) { |
862 | + if (!(m_count == 1 && nr == 1)) { |
863 | log |
864 | ("Request::get_base_required_time: WARNING nr = %u but count is %u, " |
865 | "which is not allowed according to the comment for this function\n", |
866 | |
867 | === modified file 'src/economy/road.cc' |
868 | --- src/economy/road.cc 2014-07-23 14:49:10 +0000 |
869 | +++ src/economy/road.cc 2014-07-25 13:46:28 +0000 |
870 | @@ -289,8 +289,8 @@ |
871 | carrier->set_location (this); |
872 | carrier->update_task_road(*game); |
873 | } else if |
874 | - (not i.current->carrier_request and |
875 | - (i.current->carrier_type == 1 or |
876 | + (!i.current->carrier_request && |
877 | + (i.current->carrier_type == 1 || |
878 | m_type == Road_Busy)) |
879 | _request_carrier(*i.current); |
880 | } |
881 | @@ -543,8 +543,8 @@ |
882 | j.current->carrier = nullptr; |
883 | container_iterate(SlotVector, newroad.m_carrier_slots, k) |
884 | if |
885 | - (not k.current->carrier.get(game) and |
886 | - not k.current->carrier_request and |
887 | + (!k.current->carrier.get(game) && |
888 | + !k.current->carrier_request && |
889 | k.current->carrier_type == j.current->carrier_type) |
890 | { |
891 | k.current->carrier = &ref_cast<Carrier, Worker> (w); |
892 | @@ -571,9 +571,9 @@ |
893 | // work correctly |
894 | container_iterate(SlotVector, m_carrier_slots, i) |
895 | if |
896 | - (not i.current->carrier.get(game) and |
897 | - not i.current->carrier_request and |
898 | - (i.current->carrier_type == 1 or |
899 | + (!i.current->carrier.get(game) && |
900 | + !i.current->carrier_request && |
901 | + (i.current->carrier_type == 1 || |
902 | m_type == Road_Busy)) |
903 | _request_carrier(*i.current); |
904 | |
905 | @@ -639,8 +639,8 @@ |
906 | _mark_map(game); |
907 | container_iterate(SlotVector, m_carrier_slots, i) |
908 | if |
909 | - (not i.current->carrier.get(game) and |
910 | - not i.current->carrier_request and |
911 | + (!i.current->carrier.get(game) && |
912 | + !i.current->carrier_request && |
913 | i.current->carrier_type != 1) |
914 | _request_carrier(*i.current); |
915 | } |
916 | |
917 | === modified file 'src/economy/transfer.cc' |
918 | --- src/economy/transfer.cc 2014-07-03 19:26:30 +0000 |
919 | +++ src/economy/transfer.cc 2014-07-25 13:46:28 +0000 |
920 | @@ -224,7 +224,7 @@ |
921 | assert(&m_route.get_flag(m_game, 0) == location); |
922 | |
923 | // special rule to get wares into buildings |
924 | - if (m_ware and m_route.get_nrsteps() == 1) |
925 | + if (m_ware && m_route.get_nrsteps() == 1) |
926 | if (dynamic_cast<Building const *>(destination)) { |
927 | assert(&m_route.get_flag(m_game, 1) == &destflag); |
928 | |
929 | |
930 | === modified file 'src/economy/ware_instance.cc' |
931 | --- src/economy/ware_instance.cc 2014-07-23 14:49:10 +0000 |
932 | +++ src/economy/ware_instance.cc 2014-07-25 13:46:28 +0000 |
933 | @@ -230,7 +230,7 @@ |
934 | */ |
935 | void WareInstance::set_economy(Economy * const e) |
936 | { |
937 | - if (m_descr_index == INVALID_INDEX or m_economy == e) |
938 | + if (m_descr_index == INVALID_INDEX || m_economy == e) |
939 | return; |
940 | |
941 | if (m_economy) |
942 | |
943 | === modified file 'src/economy/wares_queue.cc' |
944 | --- src/economy/wares_queue.cc 2014-07-22 09:54:49 +0000 |
945 | +++ src/economy/wares_queue.cc 2014-07-25 13:46:28 +0000 |
946 | @@ -258,7 +258,7 @@ |
947 | { |
948 | uint16_t const packet_version = fr.Unsigned16(); |
949 | try { |
950 | - if (packet_version == WARES_QUEUE_DATA_PACKET_VERSION or packet_version == 1) { |
951 | + if (packet_version == WARES_QUEUE_DATA_PACKET_VERSION || packet_version == 1) { |
952 | delete m_request; |
953 | m_ware = owner().tribe().ware_index(fr.CString ()); |
954 | m_max_size = fr.Unsigned32(); |
955 | |
956 | === modified file 'src/editor/editorinteractive.cc' |
957 | --- src/editor/editorinteractive.cc 2014-07-22 09:54:49 +0000 |
958 | +++ src/editor/editorinteractive.cc 2014-07-25 13:46:28 +0000 |
959 | @@ -185,7 +185,7 @@ |
960 | m_history.reset(); |
961 | |
962 | std::unique_ptr<Widelands::Map_Loader> ml(map.get_correct_loader(filename)); |
963 | - if (not ml.get()) |
964 | + if (!ml.get()) |
965 | throw warning |
966 | (_("Unsupported format"), |
967 | _("Widelands could not load the file \"%s\". The file format seems to be incompatible."), |
968 | @@ -300,7 +300,7 @@ |
969 | tools.current().operates_on_triangles() ? |
970 | sel.triangle != get_sel_pos().triangle : sel.node != get_sel_pos().node; |
971 | Interactive_Base::set_sel_pos(sel); |
972 | - if (target_changed and m_left_mouse_button_is_down) |
973 | + if (target_changed && m_left_mouse_button_is_down) |
974 | map_clicked(true); |
975 | } |
976 | |
977 | @@ -500,7 +500,7 @@ |
978 | |
979 | void Editor_Interactive::select_tool |
980 | (Editor_Tool & primary, Editor_Tool::Tool_Index const which) { |
981 | - if (which == Editor_Tool::First and & primary != tools.current_pointer) { |
982 | + if (which == Editor_Tool::First && & primary != tools.current_pointer) { |
983 | if (primary.has_size_one()) |
984 | set_sel_radius_and_update_menu(0); |
985 | Widelands::Map & map = egbase().map(); |
986 | @@ -548,7 +548,7 @@ |
987 | references.end(); |
988 | if (player) { |
989 | for (; it < references_end; ++it) |
990 | - if (it->player == player and it->object == data) { |
991 | + if (it->player == player && it->object == data) { |
992 | references.erase(it); |
993 | break; |
994 | } |
995 | |
996 | === modified file 'src/editor/map_generator.cc' |
997 | --- src/editor/map_generator.cc 2014-07-22 09:54:49 +0000 |
998 | +++ src/editor/map_generator.cc 2014-07-25 13:46:28 +0000 |
999 | @@ -80,7 +80,7 @@ |
1000 | |
1001 | const MapGenBobCategory * bobCategory = landResource.getBobCategory(terrType); |
1002 | |
1003 | - if (not bobCategory) // no bobs defined here... |
1004 | + if (!bobCategory) // no bobs defined here... |
1005 | return; |
1006 | |
1007 | uint32_t immovDens = landResource.getImmovableDensity(); |
1008 | @@ -100,14 +100,14 @@ |
1009 | |
1010 | // Set bob according to bob area |
1011 | |
1012 | - if (set_immovable and (num = bobCategory->num_immovables())) |
1013 | + if (set_immovable && (num = bobCategory->num_immovables())) |
1014 | egbase_.create_immovable |
1015 | (fc, |
1016 | bobCategory->get_immovable |
1017 | (static_cast<size_t>(rng.rand() / (kMaxElevation / num))), |
1018 | nullptr); |
1019 | |
1020 | - if (set_moveable and (num = bobCategory->num_critters())) |
1021 | + if (set_moveable && (num = bobCategory->num_critters())) |
1022 | egbase_.create_bob |
1023 | (fc, |
1024 | egbase_.world().get_bob |
1025 | @@ -286,7 +286,7 @@ |
1026 | for (uint32_t x = 0; x < w; x += 16) |
1027 | for (uint32_t y = 0; y < h; y += 16) { |
1028 | values[x + y * w] = rng.rand(); |
1029 | - if (x % 32 or y % 32) { |
1030 | + if (x % 32 || y % 32) { |
1031 | values[x + y * w] += kAverageElevation; |
1032 | values[x + y * w] /= 2; |
1033 | } |
1034 | |
1035 | === modified file 'src/editor/tools/editor_history.cc' |
1036 | --- src/editor/tools/editor_history.cc 2014-03-01 17:09:07 +0000 |
1037 | +++ src/editor/tools/editor_history.cc 2014-07-25 13:46:28 +0000 |
1038 | @@ -38,7 +38,7 @@ |
1039 | |
1040 | Editor_Action_Args::~Editor_Action_Args() |
1041 | { |
1042 | - while (not draw_actions.empty()) { |
1043 | + while (!draw_actions.empty()) { |
1044 | delete draw_actions.back(); |
1045 | draw_actions.pop_back(); |
1046 | } |
1047 | @@ -105,7 +105,7 @@ |
1048 | map, center, parent, tool.format_args(ind, parent)); |
1049 | if (draw && tool.is_unduable()) { |
1050 | if |
1051 | - (undo_stack.empty() or |
1052 | + (undo_stack.empty() || |
1053 | undo_stack.front().tool.get_sel_impl() != std::string(m_draw_tool.get_sel_impl())) |
1054 | { |
1055 | Editor_Tool_Action da |
1056 | @@ -113,7 +113,7 @@ |
1057 | map, center, parent, |
1058 | m_draw_tool.format_args(Editor_Tool::First, parent)); |
1059 | |
1060 | - if (not undo_stack.empty()) { |
1061 | + if (!undo_stack.empty()) { |
1062 | m_draw_tool.add_action(undo_stack.front(), *da.args); |
1063 | undo_stack.pop_front(); |
1064 | } |
1065 | |
1066 | === modified file 'src/editor/tools/editor_increase_resources_tool.cc' |
1067 | --- src/editor/tools/editor_increase_resources_tool.cc 2014-06-05 05:40:53 +0000 |
1068 | +++ src/editor/tools/editor_increase_resources_tool.cc 2014-07-25 13:46:28 +0000 |
1069 | @@ -108,8 +108,8 @@ |
1070 | args.orgRes.push_back(mr.location().field->get_resources_amount()); |
1071 | |
1072 | if |
1073 | - ((res == args.cur_res or not mr.location().field->get_resources_amount()) |
1074 | - and |
1075 | + ((res == args.cur_res || !mr.location().field->get_resources_amount()) |
1076 | + && |
1077 | Editor_Change_Resource_Tool_Callback(mr.location(), map, world, args.cur_res)) |
1078 | { |
1079 | // Ok, we're doing something. First remove the current overlays. |
1080 | @@ -119,7 +119,7 @@ |
1081 | (mr.location().field->get_resources_amount())); |
1082 | overlay_manager.remove_overlay(mr.location(), pic); |
1083 | |
1084 | - if (not amount) { |
1085 | + if (!amount) { |
1086 | mr.location().field->set_resources(0, 0); |
1087 | mr.location().field->set_starting_res_amount(0); |
1088 | } else { |
1089 | |
1090 | === modified file 'src/editor/tools/editor_place_bob_tool.cc' |
1091 | --- src/editor/tools/editor_place_bob_tool.cc 2014-04-01 17:30:12 +0000 |
1092 | +++ src/editor/tools/editor_place_bob_tool.cc 2014-07-25 13:46:28 +0000 |
1093 | @@ -48,7 +48,7 @@ |
1094 | } while (mr.advance(map)); |
1095 | } |
1096 | |
1097 | - if (not args.nbob_type.empty()) { |
1098 | + if (!args.nbob_type.empty()) { |
1099 | Widelands::Editor_Game_Base & egbase = parent.egbase(); |
1100 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
1101 | (map, |
1102 | @@ -75,7 +75,7 @@ |
1103 | Widelands::Node_and_Triangle<Widelands::Coords> center, |
1104 | Editor_Interactive& parent, |
1105 | Editor_Action_Args& args) { |
1106 | - if (not args.nbob_type.empty()) { |
1107 | + if (!args.nbob_type.empty()) { |
1108 | Widelands::Editor_Game_Base & egbase = parent.egbase(); |
1109 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
1110 | (map, |
1111 | |
1112 | === modified file 'src/editor/tools/editor_place_immovable_tool.cc' |
1113 | --- src/editor/tools/editor_place_immovable_tool.cc 2014-07-03 19:26:30 +0000 |
1114 | +++ src/editor/tools/editor_place_immovable_tool.cc 2014-07-25 13:46:28 +0000 |
1115 | @@ -38,7 +38,7 @@ |
1116 | Editor_Interactive& parent, |
1117 | Editor_Action_Args& args) { |
1118 | const int32_t radius = args.sel_radius; |
1119 | - if (not get_nr_enabled()) |
1120 | + if (!get_nr_enabled()) |
1121 | return radius; |
1122 | Widelands::Editor_Game_Base & egbase = parent.egbase(); |
1123 | if (args.oimmov_types.empty()) |
1124 | @@ -54,7 +54,7 @@ |
1125 | } while (mr.advance(map)); |
1126 | } |
1127 | |
1128 | - if (not args.nimmov_types.empty()) |
1129 | + if (!args.nimmov_types.empty()) |
1130 | { |
1131 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
1132 | (map, |
1133 | @@ -63,8 +63,8 @@ |
1134 | std::list<int32_t>::iterator i = args.nimmov_types.begin(); |
1135 | do { |
1136 | if |
1137 | - (not mr.location().field->get_immovable() |
1138 | - and |
1139 | + (!mr.location().field->get_immovable() |
1140 | + && |
1141 | (mr.location().field->nodecaps() & Widelands::MOVECAPS_WALK)) |
1142 | egbase.create_immovable(mr.location(), *i, nullptr); |
1143 | ++i; |
1144 | |
1145 | === modified file 'src/editor/tools/editor_set_resources_tool.cc' |
1146 | --- src/editor/tools/editor_set_resources_tool.cc 2014-06-05 05:40:53 +0000 |
1147 | +++ src/editor/tools/editor_set_resources_tool.cc 2014-07-25 13:46:28 +0000 |
1148 | @@ -61,7 +61,7 @@ |
1149 | (world.get_resource(res)->get_editor_pic (mr.location().field->get_resources_amount())); |
1150 | overlay_manager.remove_overlay(mr.location(), pic); |
1151 | |
1152 | - if (not amount) { |
1153 | + if (!amount) { |
1154 | mr.location().field->set_resources(0, 0); |
1155 | mr.location().field->set_starting_res_amount(0); |
1156 | } else { |
1157 | @@ -105,7 +105,7 @@ |
1158 | (world.get_resource(res)->get_editor_pic(mr.location().field->get_resources_amount())); |
1159 | overlay_manager.remove_overlay(mr.location(), pic); |
1160 | |
1161 | - if (not amount) { |
1162 | + if (!amount) { |
1163 | mr.location().field->set_resources(0, 0); |
1164 | mr.location().field->set_starting_res_amount(0); |
1165 | } else { |
1166 | |
1167 | === modified file 'src/editor/tools/editor_set_terrain_tool.cc' |
1168 | --- src/editor/tools/editor_set_terrain_tool.cc 2014-03-01 17:09:07 +0000 |
1169 | +++ src/editor/tools/editor_set_terrain_tool.cc 2014-07-25 13:46:28 +0000 |
1170 | @@ -31,7 +31,7 @@ |
1171 | Editor_Interactive& /* parent */, |
1172 | Editor_Action_Args& args) { |
1173 | assert |
1174 | - (center.triangle.t == TCoords<>::D or center.triangle.t == TCoords<>::R); |
1175 | + (center.triangle.t == TCoords<>::D || center.triangle.t == TCoords<>::R); |
1176 | uint16_t const radius = args.sel_radius; |
1177 | int32_t max = 0; |
1178 | |
1179 | @@ -50,7 +50,7 @@ |
1180 | } while (mr.advance(map)); |
1181 | } |
1182 | |
1183 | - if (not args.terrainType.empty()) { |
1184 | + if (!args.terrainType.empty()) { |
1185 | Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr |
1186 | (map, Widelands::Area<TCoords<Widelands::FCoords> > |
1187 | (TCoords<Widelands::FCoords> |
1188 | @@ -74,9 +74,9 @@ |
1189 | Editor_Interactive& /* parent */, |
1190 | Editor_Action_Args& args) { |
1191 | assert |
1192 | - (center.triangle.t == TCoords<>::D or center.triangle.t == TCoords<>::R); |
1193 | + (center.triangle.t == TCoords<>::D || center.triangle.t == TCoords<>::R); |
1194 | uint16_t const radius = args.sel_radius; |
1195 | - if (not args.terrainType.empty()) { |
1196 | + if (!args.terrainType.empty()) { |
1197 | int32_t max = 0; |
1198 | Widelands::MapTriangleRegion<TCoords<Widelands::FCoords> > mr |
1199 | (map, |
1200 | |
1201 | === modified file 'src/editor/ui_menus/categorized_item_selection_menu.h' |
1202 | --- src/editor/ui_menus/categorized_item_selection_menu.h 2014-07-22 09:54:49 +0000 |
1203 | +++ src/editor/ui_menus/categorized_item_selection_menu.h 2014-07-25 13:46:28 +0000 |
1204 | @@ -145,10 +145,10 @@ |
1205 | // needs is the key state at the time the mouse was clicked. See the |
1206 | // usage comment for get_key_state. |
1207 | const bool multiselect = get_key_state(SDLK_LCTRL) | get_key_state(SDLK_RCTRL); |
1208 | - if (not t and(not multiselect or tool_->get_nr_enabled() == 1)) |
1209 | + if (!t and(!multiselect || tool_->get_nr_enabled() == 1)) |
1210 | checkboxes_[n]->set_state(true); |
1211 | else { |
1212 | - if (not multiselect) { |
1213 | + if (!multiselect) { |
1214 | for (uint32_t i = 0; tool_->get_nr_enabled(); ++i) |
1215 | tool_->enable(i, false); |
1216 | // disable all checkboxes |
1217 | |
1218 | === modified file 'src/editor/ui_menus/editor_main_menu_load_map.cc' |
1219 | --- src/editor/ui_menus/editor_main_menu_load_map.cc 2014-06-21 10:24:12 +0000 |
1220 | +++ src/editor/ui_menus/editor_main_menu_load_map.cc 2014-07-25 13:46:28 +0000 |
1221 | @@ -220,10 +220,10 @@ |
1222 | { |
1223 | const char * const name = pname->c_str(); |
1224 | if |
1225 | - (strcmp(FileSystem::FS_Filename(name), ".") and |
1226 | - strcmp(FileSystem::FS_Filename(name), "..") and |
1227 | - g_fs->IsDirectory(name) and |
1228 | - not WL_Map_Loader::is_widelands_map(name)) |
1229 | + (strcmp(FileSystem::FS_Filename(name), ".") && |
1230 | + strcmp(FileSystem::FS_Filename(name), "..") && |
1231 | + g_fs->IsDirectory(name) && |
1232 | + !WL_Map_Loader::is_widelands_map(name)) |
1233 | |
1234 | m_ls->add |
1235 | (FileSystem::FS_Filename(name), |
1236 | |
1237 | === modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc' |
1238 | --- src/editor/ui_menus/editor_main_menu_save_map.cc 2014-07-05 14:22:44 +0000 |
1239 | +++ src/editor/ui_menus/editor_main_menu_save_map.cc 2014-07-25 13:46:28 +0000 |
1240 | @@ -172,14 +172,14 @@ |
1241 | fill_list(); |
1242 | } else { // Ok, save this map |
1243 | Widelands::Map & map = eia().egbase().map(); |
1244 | - if (not strcmp(map.get_name(), _("No Name"))) { |
1245 | + if (!strcmp(map.get_name(), _("No Name"))) { |
1246 | std::string::size_type const filename_size = filename.size(); |
1247 | map.set_name |
1248 | ((4 <= filename_size |
1249 | - and filename[filename_size - 1] == 'f' |
1250 | - and filename[filename_size - 2] == 'm' |
1251 | - and filename[filename_size - 3] == 'w' |
1252 | - and filename[filename_size - 4] == '.' |
1253 | + && filename[filename_size - 1] == 'f' |
1254 | + && filename[filename_size - 2] == 'm' |
1255 | + && filename[filename_size - 3] == 'w' |
1256 | + && filename[filename_size - 4] == '.' |
1257 | ? |
1258 | filename.substr(0, filename_size - 4) : filename) |
1259 | .c_str()); |
1260 | @@ -301,10 +301,10 @@ |
1261 | { |
1262 | const char * const name = pname->c_str(); |
1263 | if |
1264 | - (strcmp(FileSystem::FS_Filename(name), ".") and |
1265 | - strcmp(FileSystem::FS_Filename(name), "..") and |
1266 | - g_fs->IsDirectory(name) and |
1267 | - not Widelands::WL_Map_Loader::is_widelands_map(name)) |
1268 | + (strcmp(FileSystem::FS_Filename(name), ".") && |
1269 | + strcmp(FileSystem::FS_Filename(name), "..") && |
1270 | + g_fs->IsDirectory(name) && |
1271 | + !Widelands::WL_Map_Loader::is_widelands_map(name)) |
1272 | |
1273 | m_ls->add |
1274 | (FileSystem::FS_Filename(name), |
1275 | @@ -379,7 +379,7 @@ |
1276 | % FileSystem::FS_Filename(filename.c_str())).str(); |
1277 | UI::WLMessageBox mbox |
1278 | (&eia(), _("Error Saving Map!"), s, UI::WLMessageBox::YESNO); |
1279 | - if (not mbox.run()) |
1280 | + if (!mbox.run()) |
1281 | return false; |
1282 | |
1283 | g_fs->Unlink(complete_filename); |
1284 | |
1285 | === modified file 'src/editor/ui_menus/editor_player_menu.cc' |
1286 | --- src/editor/ui_menus/editor_player_menu.cc 2014-07-22 09:54:49 +0000 |
1287 | +++ src/editor/ui_menus/editor_player_menu.cc 2014-07-25 13:46:28 +0000 |
1288 | @@ -227,7 +227,7 @@ |
1289 | Widelands::Player_Number const nr_players = old_nr_players - 1; |
1290 | assert(1 <= nr_players); |
1291 | |
1292 | - if (not menu.is_player_tribe_referenced(old_nr_players)) { |
1293 | + if (!menu.is_player_tribe_referenced(old_nr_players)) { |
1294 | if (const Widelands::Coords sp = map.get_starting_pos(old_nr_players)) { |
1295 | // Remove starting position marker. |
1296 | char picsname[] = "pics/editor_player_00_starting_pos.png"; |
1297 | @@ -309,7 +309,7 @@ |
1298 | void Editor_Player_Menu::player_tribe_clicked(uint8_t n) { |
1299 | Editor_Interactive & menu = |
1300 | ref_cast<Editor_Interactive, UI::Panel>(*get_parent()); |
1301 | - if (not menu.is_player_tribe_referenced(n + 1)) { |
1302 | + if (!menu.is_player_tribe_referenced(n + 1)) { |
1303 | std::string t = m_plr_set_tribes_buts[n]->get_title(); |
1304 | if (!Widelands::Tribe_Descr::exists_tribe(t)) |
1305 | throw wexception |
1306 | @@ -412,7 +412,7 @@ |
1307 | const Widelands::Player_Number player_number = p->player_number(); |
1308 | const Widelands::Coords starting_pos = map.get_starting_pos(player_number); |
1309 | Widelands::BaseImmovable * const imm = map[starting_pos].get_immovable(); |
1310 | - if (not imm) { |
1311 | + if (!imm) { |
1312 | // place HQ |
1313 | const Widelands::Tribe_Descr & tribe = p->tribe(); |
1314 | const Widelands::Building_Index idx = |
1315 | |
1316 | === modified file 'src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc' |
1317 | --- src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2014-07-20 13:00:05 +0000 |
1318 | +++ src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2014-07-25 13:46:28 +0000 |
1319 | @@ -113,7 +113,7 @@ |
1320 | for (Building_Index i = 0; i < nr_buildings; ++i) { |
1321 | const Widelands::Building_Descr & building = |
1322 | *tribe.get_building_descr(i); |
1323 | - if (not building.is_enhanced() and not building.is_buildable()) |
1324 | + if (!building.is_enhanced() && !building.is_buildable()) |
1325 | continue; |
1326 | (m_player.is_building_type_allowed(i) ? m_allowed : m_forbidden).add |
1327 | (building.descname().c_str(), i, building.get_icon()); |
1328 | |
1329 | === modified file 'src/editor/ui_menus/editor_tool_place_bob_options_menu.cc' |
1330 | --- src/editor/ui_menus/editor_tool_place_bob_options_menu.cc 2014-07-22 09:54:49 +0000 |
1331 | +++ src/editor/ui_menus/editor_tool_place_bob_options_menu.cc 2014-07-25 13:46:28 +0000 |
1332 | @@ -125,12 +125,12 @@ |
1333 | // TODO(unknown) usage comment for get_key_state. |
1334 | const bool multiselect = |
1335 | get_key_state(SDLK_LCTRL) | get_key_state(SDLK_RCTRL); |
1336 | - if (not t and (not multiselect or m_pit.get_nr_enabled() == 1)) { |
1337 | + if (!t && (!multiselect || m_pit.get_nr_enabled() == 1)) { |
1338 | m_checkboxes[n]->set_state(true); |
1339 | return; |
1340 | } |
1341 | |
1342 | - if (not multiselect) { |
1343 | + if (!multiselect) { |
1344 | for (uint32_t i = 0; m_pit.get_nr_enabled(); ++i) m_pit.enable(i, false); |
1345 | |
1346 | // disable all checkboxes |
1347 | |
1348 | === modified file 'src/game_io/game_interactive_player_data_packet.cc' |
1349 | --- src/game_io/game_interactive_player_data_packet.cc 2014-05-11 07:38:01 +0000 |
1350 | +++ src/game_io/game_interactive_player_data_packet.cc 2014-07-25 13:46:28 +0000 |
1351 | @@ -47,7 +47,7 @@ |
1352 | throw game_data_error("Invalid player number: %i.", player_number); |
1353 | } |
1354 | |
1355 | - if (not game.get_player(player_number)) { |
1356 | + if (!game.get_player(player_number)) { |
1357 | // This happens if the player, that saved the game, was a spectator |
1358 | // and the slot for player 1 was not used in the game. |
1359 | // So now we try to create an InteractivePlayer object for another |
1360 | |
1361 | === modified file 'src/game_io/game_map_data_packet.cc' |
1362 | --- src/game_io/game_map_data_packet.cc 2014-06-11 05:06:42 +0000 |
1363 | +++ src/game_io/game_map_data_packet.cc 2014-07-25 13:46:28 +0000 |
1364 | @@ -37,7 +37,7 @@ |
1365 | void Game_Map_Data_Packet::Read |
1366 | (FileSystem & fs, Game & game, Map_Map_Object_Loader * const) |
1367 | { |
1368 | - if (not fs.FileExists("map") or not fs.IsDirectory("map")) |
1369 | + if (!fs.FileExists("map") || !fs.IsDirectory("map")) |
1370 | throw game_data_error("no map"); |
1371 | |
1372 | // Now Load the map as it would be a normal map saving. |
1373 | |
1374 | === modified file 'src/game_io/game_player_economies_data_packet.cc' |
1375 | --- src/game_io/game_player_economies_data_packet.cc 2014-07-03 19:26:30 +0000 |
1376 | +++ src/game_io/game_player_economies_data_packet.cc 2014-07-25 13:46:28 +0000 |
1377 | @@ -46,7 +46,7 @@ |
1378 | FileRead fr; |
1379 | fr.Open(fs, "binary/player_economies"); |
1380 | uint16_t const packet_version = fr.Unsigned16(); |
1381 | - if (3 <= packet_version and packet_version <= CURRENT_PACKET_VERSION) { |
1382 | + if (3 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) { |
1383 | iterate_players_existing(p, nr_players, game, player) |
1384 | try { |
1385 | Player::Economies & economies = player->m_economies; |
1386 | |
1387 | === modified file 'src/game_io/game_player_info_data_packet.cc' |
1388 | --- src/game_io/game_player_info_data_packet.cc 2014-07-05 14:22:44 +0000 |
1389 | +++ src/game_io/game_player_info_data_packet.cc 2014-07-25 13:46:28 +0000 |
1390 | @@ -40,7 +40,7 @@ |
1391 | FileRead fr; |
1392 | fr.Open(fs, "binary/player_info"); |
1393 | uint16_t const packet_version = fr.Unsigned16(); |
1394 | - if (5 <= packet_version and packet_version <= CURRENT_PACKET_VERSION) { |
1395 | + if (5 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) { |
1396 | uint32_t const max_players = fr.Unsigned16(); |
1397 | for (uint32_t i = 1; i < max_players + 1; ++i) { |
1398 | game.remove_player(i); |
1399 | @@ -48,7 +48,7 @@ |
1400 | bool const see_all = fr.Unsigned8(); |
1401 | |
1402 | int32_t const plnum = fr.Unsigned8(); |
1403 | - if (plnum < 1 or MAX_PLAYERS < plnum) |
1404 | + if (plnum < 1 || MAX_PLAYERS < plnum) |
1405 | throw game_data_error |
1406 | ("player number (%i) is out of range (1 .. %u)", |
1407 | plnum, MAX_PLAYERS); |
1408 | |
1409 | === modified file 'src/graphic/animation.cc' |
1410 | --- src/graphic/animation.cc 2014-07-22 09:54:49 +0000 |
1411 | +++ src/graphic/animation.cc 2014-07-25 13:46:28 +0000 |
1412 | @@ -272,7 +272,7 @@ |
1413 | if (image_files_.empty()) |
1414 | throw wexception("animation without pictures."); |
1415 | |
1416 | - if (pc_mask_image_files_.size() and pc_mask_image_files_.size() != image_files_.size()) |
1417 | + if (pc_mask_image_files_.size() && pc_mask_image_files_.size() != image_files_.size()) |
1418 | throw wexception |
1419 | ("animation has %" PRIuS " frames but playercolor mask has %" PRIuS " frames", |
1420 | image_files_.size(), pc_mask_image_files_.size()); |
1421 | @@ -280,7 +280,7 @@ |
1422 | for (const std::string& filename : image_files_) { |
1423 | const Image* image = g_gr->images().get(filename); |
1424 | if (frames_.size() && |
1425 | - (frames_[0]->width() != image->width() or frames_[0]->height() != image->height())) { |
1426 | + (frames_[0]->width() != image->width() || frames_[0]->height() != image->height())) { |
1427 | throw wexception("wrong size: (%u, %u), should be (%u, %u) like the first frame", |
1428 | image->width(), |
1429 | image->height(), |
1430 | @@ -294,7 +294,7 @@ |
1431 | // TODO(unknown) Do not load playercolor mask as opengl texture or use it as |
1432 | // opengl texture. |
1433 | const Image* pc_image = g_gr->images().get(filename); |
1434 | - if (frames_[0]->width() != pc_image->width() or frames_[0]->height() != pc_image->height()) { |
1435 | + if (frames_[0]->width() != pc_image->width() || frames_[0]->height() != pc_image->height()) { |
1436 | // TODO(unknown): see bug #1324642 |
1437 | throw wexception("playercolor mask has wrong size: (%u, %u), should " |
1438 | "be (%u, %u) like the animation frame", |
1439 | |
1440 | === modified file 'src/graphic/color.cc' |
1441 | --- src/graphic/color.cc 2014-07-14 10:45:44 +0000 |
1442 | +++ src/graphic/color.cc 2014-07-25 13:46:28 +0000 |
1443 | @@ -34,7 +34,7 @@ |
1444 | } |
1445 | |
1446 | bool RGBColor::operator == (const RGBColor& other) const { |
1447 | - return r == other.r and g == other.g and b == other.b; |
1448 | + return r == other.r && g == other.g && b == other.b; |
1449 | } |
1450 | bool RGBColor::operator != (const RGBColor& other) const { |
1451 | return !(*this == other); |
1452 | |
1453 | === modified file 'src/graphic/font_handler.cc' |
1454 | --- src/graphic/font_handler.cc 2014-06-01 18:00:48 +0000 |
1455 | +++ src/graphic/font_handler.cc 2014-07-25 13:46:28 +0000 |
1456 | @@ -180,7 +180,7 @@ |
1457 | // Work around an Issue in SDL_TTF that dies when the surface |
1458 | // has zero width |
1459 | int width = 0; |
1460 | - if (TTF_SizeUTF8(font, lce.text.c_str(), &width, nullptr) < 0 or !width) { |
1461 | + if (TTF_SizeUTF8(font, lce.text.c_str(), &width, nullptr) < 0 || !width) { |
1462 | lce.width = 0; |
1463 | lce.height = TTF_FontHeight(font); |
1464 | return; |
1465 | |
1466 | === modified file 'src/graphic/graphic.cc' |
1467 | --- src/graphic/graphic.cc 2014-07-22 09:54:49 +0000 |
1468 | +++ src/graphic/graphic.cc 2014-07-25 13:46:28 +0000 |
1469 | @@ -114,7 +114,7 @@ |
1470 | sdlsurface = SDL_SetVideoMode(w, h, 32, flags); |
1471 | |
1472 | // If we tried opengl and it was not successful try without opengl |
1473 | - if (!sdlsurface and opengl) |
1474 | + if (!sdlsurface && opengl) |
1475 | { |
1476 | log("Graphics: Could not set videomode: %s, trying without opengl\n", SDL_GetError()); |
1477 | flags &= ~SDL_OPENGL; |
1478 | @@ -138,7 +138,7 @@ |
1479 | // setting the videomode was successful. Print some information now |
1480 | log("Graphics: Setting video mode was successful\n"); |
1481 | |
1482 | - if (opengl and 0 != (sdlsurface->flags & SDL_GL_DOUBLEBUFFER)) |
1483 | + if (opengl && 0 != (sdlsurface->flags & SDL_GL_DOUBLEBUFFER)) |
1484 | log("Graphics: OPENGL DOUBLE BUFFERING ENABLED\n"); |
1485 | if (0 != (sdlsurface->flags & SDL_FULLSCREEN)) |
1486 | log("Graphics: FULLSCREEN ENABLED\n"); |
1487 | @@ -220,7 +220,7 @@ |
1488 | |
1489 | // extensions will be valid if we ever succeeded in runnning glewInit. |
1490 | m_caps.gl.tex_power_of_two = |
1491 | - (m_caps.gl.major_version < 2) and |
1492 | + (m_caps.gl.major_version < 2) && |
1493 | (strstr(extensions, "GL_ARB_texture_non_power_of_two") == nullptr); |
1494 | log("Graphics: OpenGL: Textures "); |
1495 | log |
1496 | @@ -228,7 +228,7 @@ |
1497 | "may have any size\n"); |
1498 | |
1499 | m_caps.gl.multitexture = |
1500 | - ((strstr(extensions, "GL_ARB_multitexture") != nullptr) and |
1501 | + ((strstr(extensions, "GL_ARB_multitexture") != nullptr) && |
1502 | (strstr(extensions, "GL_ARB_texture_env_combine") != nullptr)); |
1503 | log("Graphics: OpenGL: Multitexture capabilities "); |
1504 | log(m_caps.gl.multitexture ? "sufficient\n" : "insufficient, only basic terrain rendering possible\n"); |
1505 | @@ -443,7 +443,7 @@ |
1506 | return; |
1507 | } |
1508 | |
1509 | - if (force or m_update_fullscreen) { |
1510 | + if (force || m_update_fullscreen) { |
1511 | //flip defaults to SDL_UpdateRect(m_surface, 0, 0, 0, 0); |
1512 | SDL_Flip(m_sdl_screen); |
1513 | } else |
1514 | |
1515 | === modified file 'src/graphic/image_transformations.cc' |
1516 | --- src/graphic/image_transformations.cc 2014-07-14 10:45:44 +0000 |
1517 | +++ src/graphic/image_transformations.cc 2014-07-25 13:46:28 +0000 |
1518 | @@ -425,7 +425,7 @@ |
1519 | } |
1520 | |
1521 | const Image* resize(const Image* original, uint16_t w, uint16_t h) { |
1522 | - if (original->width() == w and original->height() == h) |
1523 | + if (original->width() == w && original->height() == h) |
1524 | return original; |
1525 | |
1526 | const string new_hash = (boost::format("%s:%i:%i") % original->hash() % w % h).str(); |
1527 | |
1528 | === modified file 'src/graphic/render/gl_surface_texture.cc' |
1529 | --- src/graphic/render/gl_surface_texture.cc 2014-06-25 05:42:44 +0000 |
1530 | +++ src/graphic/render/gl_surface_texture.cc 2014-07-25 13:46:28 +0000 |
1531 | @@ -85,9 +85,9 @@ |
1532 | uint8_t bpp = surface->format->BytesPerPixel; |
1533 | |
1534 | if |
1535 | - (surface->format->palette or (surface->format->colorkey > 0) or |
1536 | - m_tex_w != static_cast<uint32_t>(surface->w) or |
1537 | - m_tex_h != static_cast<uint32_t>(surface->h) or |
1538 | + (surface->format->palette || (surface->format->colorkey > 0) || |
1539 | + m_tex_w != static_cast<uint32_t>(surface->w) || |
1540 | + m_tex_h != static_cast<uint32_t>(surface->h) || |
1541 | (bpp != 3 && bpp != 4)) |
1542 | { |
1543 | SDL_Surface * converted = SDL_CreateRGBSurface |
1544 | @@ -109,7 +109,7 @@ |
1545 | |
1546 | if (bpp == 4) { |
1547 | if |
1548 | - (fmt.Rmask == 0x000000ff and fmt.Gmask == 0x0000ff00 and |
1549 | + (fmt.Rmask == 0x000000ff && fmt.Gmask == 0x0000ff00 && |
1550 | fmt.Bmask == 0x00ff0000) |
1551 | { |
1552 | if (fmt.Amask == 0xff000000) { |
1553 | @@ -121,7 +121,7 @@ |
1554 | glPixelTransferi(GL_ALPHA_BIAS, 1.0f); |
1555 | } |
1556 | } else if |
1557 | - (fmt.Bmask == 0x000000ff and fmt.Gmask == 0x0000ff00 and |
1558 | + (fmt.Bmask == 0x000000ff && fmt.Gmask == 0x0000ff00 && |
1559 | fmt.Rmask == 0x00ff0000) |
1560 | { |
1561 | if (fmt.Amask == 0xff000000) { |
1562 | @@ -136,12 +136,12 @@ |
1563 | throw wexception("OpenGL: Unknown pixel format"); |
1564 | } else if (bpp == 3) { |
1565 | if |
1566 | - (fmt.Rmask == 0x000000ff and fmt.Gmask == 0x0000ff00 and |
1567 | + (fmt.Rmask == 0x000000ff && fmt.Gmask == 0x0000ff00 && |
1568 | fmt.Bmask == 0x00ff0000) |
1569 | { |
1570 | pixels_format = GL_RGB; |
1571 | } else if |
1572 | - (fmt.Bmask == 0x000000ff and fmt.Gmask == 0x0000ff00 and |
1573 | + (fmt.Bmask == 0x000000ff && fmt.Gmask == 0x0000ff00 && |
1574 | fmt.Rmask == 0x00ff0000) |
1575 | { |
1576 | pixels_format = GL_BGR; |
1577 | |
1578 | === modified file 'src/graphic/render/minimaprenderer.cc' |
1579 | --- src/graphic/render/minimaprenderer.cc 2014-07-22 09:54:49 +0000 |
1580 | +++ src/graphic/render/minimaprenderer.cc 2014-07-25 13:46:28 +0000 |
1581 | @@ -87,15 +87,15 @@ |
1582 | // * winterland -> orange |
1583 | |
1584 | if (upcast(PlayerImmovable const, immovable, f.field->get_immovable())) { |
1585 | - if ((layers & MiniMapLayer::Road) and dynamic_cast<Road const *>(immovable)) { |
1586 | + if ((layers & MiniMapLayer::Road) && dynamic_cast<Road const *>(immovable)) { |
1587 | pixelcolor = blend_color(format, pixelcolor, 255, 255, 255); |
1588 | } |
1589 | |
1590 | if |
1591 | - (((layers & MiniMapLayer::Flag) and dynamic_cast<Flag const *>(immovable)) |
1592 | - or |
1593 | + (((layers & MiniMapLayer::Flag) && dynamic_cast<Flag const *>(immovable)) |
1594 | + || |
1595 | ((layers & MiniMapLayer::Building) |
1596 | - and |
1597 | + && |
1598 | dynamic_cast<Widelands::Building const *>(immovable))) |
1599 | { |
1600 | pixelcolor = SDL_MapRGB(&const_cast<SDL_PixelFormat&>(format), 255, 255, 255); |
1601 | @@ -187,7 +187,7 @@ |
1602 | uint32_t modx = pbottomright.x % 2; |
1603 | uint32_t mody = pbottomright.y % 2; |
1604 | |
1605 | - if (not player or player->see_all()) { |
1606 | + if (!player || player->see_all()) { |
1607 | for (uint32_t y = 0; y < surface_h; ++y) { |
1608 | uint8_t * pix = pixels + y * pitch; |
1609 | Widelands::FCoords f |
1610 | |
1611 | === modified file 'src/graphic/render/terrain_sdl.h' |
1612 | --- src/graphic/render/terrain_sdl.h 2014-07-23 14:49:10 +0000 |
1613 | +++ src/graphic/render/terrain_sdl.h 2014-07-25 13:46:28 +0000 |
1614 | @@ -540,7 +540,7 @@ |
1615 | continue; |
1616 | |
1617 | for (int32_t i = 0, y = (centery >> 16) - 2; i < 5; ++i, ++y) |
1618 | - if (0 < y and y < dsth) |
1619 | + if (0 < y && y < dsth) |
1620 | reinterpret_cast<T *> |
1621 | (static_cast<uint8_t *>(dst.get_pixels()) + y * dst.get_pitch()) |
1622 | [x] |
1623 | @@ -567,7 +567,7 @@ |
1624 | continue; |
1625 | |
1626 | for (int32_t i = 0, x = (centerx >> 16) - 2; i < 5; ++i, ++x) |
1627 | - if (0 < x and x < dstw) |
1628 | + if (0 < x && x < dstw) |
1629 | reinterpret_cast<T *> |
1630 | (static_cast<uint8_t *>(dst.get_pixels()) + y * dst.get_pitch()) |
1631 | [x] |
1632 | @@ -604,7 +604,7 @@ |
1633 | uint8_t road; |
1634 | |
1635 | road = (roads >> Widelands::Road_East) & Widelands::Road_Mask; |
1636 | - if (-128 < f_vert.b or -128 < r_vert.b) { |
1637 | + if (-128 < f_vert.b || -128 < r_vert.b) { |
1638 | if (road) { |
1639 | switch (road) { |
1640 | case Widelands::Road_Normal: |
1641 | @@ -623,7 +623,7 @@ |
1642 | } |
1643 | |
1644 | road = (roads >> Widelands::Road_SouthEast) & Widelands::Road_Mask; |
1645 | - if (-128 < f_vert.b or -128 < br_vert.b) { |
1646 | + if (-128 < f_vert.b || -128 < br_vert.b) { |
1647 | if (road) { |
1648 | switch (road) { |
1649 | case Widelands::Road_Normal: |
1650 | @@ -642,7 +642,7 @@ |
1651 | } |
1652 | |
1653 | road = (roads >> Widelands::Road_SouthWest) & Widelands::Road_Mask; |
1654 | - if (-128 < f_vert.b or -128 < bl_vert.b) { |
1655 | + if (-128 < f_vert.b || -128 < bl_vert.b) { |
1656 | if (road) { |
1657 | switch (road) { |
1658 | case Widelands::Road_Normal: |
1659 | |
1660 | === modified file 'src/graphic/rendertarget.cc' |
1661 | --- src/graphic/rendertarget.cc 2014-07-23 14:49:10 +0000 |
1662 | +++ src/graphic/rendertarget.cc 2014-07-25 13:46:28 +0000 |
1663 | @@ -367,7 +367,7 @@ |
1664 | r.x += m_rect.x; |
1665 | r.y += m_rect.y; |
1666 | |
1667 | - return r.w and r.h; |
1668 | + return r.w && r.h; |
1669 | } |
1670 | |
1671 | /** |
1672 | |
1673 | === modified file 'src/graphic/text/rt_parse.cc' |
1674 | --- src/graphic/text/rt_parse.cc 2014-07-14 10:45:44 +0000 |
1675 | +++ src/graphic/text/rt_parse.cc 2014-07-25 13:46:28 +0000 |
1676 | @@ -50,7 +50,7 @@ |
1677 | } |
1678 | |
1679 | bool Attr::get_bool() const { |
1680 | - if (m_value == "true" or m_value == "1" or m_value == "yes") |
1681 | + if (m_value == "true" || m_value == "1" || m_value == "yes") |
1682 | return true; |
1683 | return false; |
1684 | } |
1685 | @@ -132,13 +132,13 @@ |
1686 | TagConstraint tc = tcs[m_name]; |
1687 | |
1688 | for (;;) { |
1689 | - if (not tc.text_allowed) |
1690 | + if (!tc.text_allowed) |
1691 | ts.skip_ws(); |
1692 | |
1693 | size_t line = ts.line(), col = ts.col(); |
1694 | std::string text = ts.till_any("<"); |
1695 | if (text != "") { |
1696 | - if (not tc.text_allowed) |
1697 | + if (!tc.text_allowed) |
1698 | throw SyntaxError_Impl(line, col, "no text, as only tags are allowed here", text, ts.peek(100)); |
1699 | m_childs.push_back(new Child(text)); |
1700 | } |
1701 | @@ -151,7 +151,7 @@ |
1702 | child->parse(ts, tcs, allowed_tags); |
1703 | if (!tc.allowed_childs.count(child->name())) |
1704 | throw SyntaxError_Impl(line, col, "an allowed tag", child->name(), ts.peek(100, cpos)); |
1705 | - if (!allowed_tags.empty() and !allowed_tags.count(child->name())) |
1706 | + if (!allowed_tags.empty() && !allowed_tags.count(child->name())) |
1707 | throw SyntaxError_Impl(line, col, "an allowed tag", child->name(), ts.peek(100, cpos)); |
1708 | |
1709 | m_childs.push_back(new Child(child)); |
1710 | |
1711 | === modified file 'src/graphic/text/sdl_ttf_font.cc' |
1712 | --- src/graphic/text/sdl_ttf_font.cc 2014-07-14 10:45:44 +0000 |
1713 | +++ src/graphic/text/sdl_ttf_font.cc 2014-07-25 13:46:28 +0000 |
1714 | @@ -115,7 +115,7 @@ |
1715 | } else |
1716 | text_surface = TTF_RenderUTF8_Blended(font_, txt.c_str(), sdlclr); |
1717 | |
1718 | - if (not text_surface) |
1719 | + if (!text_surface) |
1720 | throw RenderError((format("Rendering '%s' gave the error: %s") % txt % TTF_GetError()).str()); |
1721 | |
1722 | return *surface_cache->insert(hash, Surface::create(text_surface), true); |
1723 | |
1724 | === modified file 'src/graphic/text/test/render_richtext.cc' |
1725 | --- src/graphic/text/test/render_richtext.cc 2014-07-01 07:12:55 +0000 |
1726 | +++ src/graphic/text/test/render_richtext.cc 2014-07-25 13:46:28 +0000 |
1727 | @@ -41,7 +41,7 @@ |
1728 | |
1729 | std::string read_stdin() { |
1730 | std::string txt; |
1731 | - while (not std::cin.eof()) { |
1732 | + while (!std::cin.eof()) { |
1733 | std::string line; |
1734 | getline(std::cin, line); |
1735 | txt += line + "\n"; |
1736 | |
1737 | === modified file 'src/graphic/text/textstream.cc' |
1738 | --- src/graphic/text/textstream.cc 2013-07-26 20:19:36 +0000 |
1739 | +++ src/graphic/text/textstream.cc 2014-07-25 13:46:28 +0000 |
1740 | @@ -53,11 +53,11 @@ |
1741 | * r* means skip_ws starting from the back of the string |
1742 | */ |
1743 | void TextStream::skip_ws() { |
1744 | - while (m_i < m_end and isspace(m_t[m_i])) |
1745 | + while (m_i < m_end && isspace(m_t[m_i])) |
1746 | m_consume(1); |
1747 | } |
1748 | void TextStream::rskip_ws() { |
1749 | - while (m_i < m_end and isspace(m_t[m_end - 1])) |
1750 | + while (m_i < m_end && isspace(m_t[m_end - 1])) |
1751 | --m_end; |
1752 | } |
1753 | |
1754 | @@ -133,7 +133,7 @@ |
1755 | */ |
1756 | string TextStream::parse_string() { |
1757 | string delim = peek(1); |
1758 | - if (delim == "'" or delim == "\"") { |
1759 | + if (delim == "'" || delim == "\"") { |
1760 | m_consume(1); |
1761 | string rv = till_any(delim); |
1762 | m_consume(1); |
1763 | |
1764 | === modified file 'src/graphic/text_parser.cc' |
1765 | --- src/graphic/text_parser.cc 2014-07-05 14:22:44 +0000 |
1766 | +++ src/graphic/text_parser.cc 2014-07-25 13:46:28 +0000 |
1767 | @@ -181,7 +181,7 @@ |
1768 | } |
1769 | |
1770 | block.erase(0, block_start.size()); |
1771 | - if (block.size() and *block.begin() == ' ') |
1772 | + if (block.size() && *block.begin() == ' ') |
1773 | block.erase(0, 1); |
1774 | |
1775 | const std::string::size_type format_end_pos = block.find(format_end); |
1776 | |
1777 | === modified file 'src/io/fileread.cc' |
1778 | --- src/io/fileread.cc 2014-06-18 14:23:22 +0000 |
1779 | +++ src/io/fileread.cc 2014-07-25 13:46:28 +0000 |
1780 | @@ -71,7 +71,7 @@ |
1781 | size_t FileRead::Data(void* dst, size_t bufsize) { |
1782 | assert(data_); |
1783 | size_t read = 0; |
1784 | - for (; read < bufsize and filepos_ < length_; ++read, ++filepos_) { |
1785 | + for (; read < bufsize && filepos_ < length_; ++read, ++filepos_) { |
1786 | static_cast<char*>(dst)[read] = data_[filepos_]; |
1787 | } |
1788 | return read; |
1789 | @@ -114,7 +114,7 @@ |
1790 | if (EndOfFile()) |
1791 | return nullptr; |
1792 | char* result = data_ + filepos_; |
1793 | - for (; data_[filepos_] and data_[filepos_] != '\n'; ++filepos_) |
1794 | + for (; data_[filepos_] && data_[filepos_] != '\n'; ++filepos_) |
1795 | if (data_[filepos_] == '\r') { |
1796 | data_[filepos_] = '\0'; |
1797 | ++filepos_; |
1798 | |
1799 | === modified file 'src/io/filesystem/disk_filesystem.cc' |
1800 | --- src/io/filesystem/disk_filesystem.cc 2014-07-23 14:49:10 +0000 |
1801 | +++ src/io/filesystem/disk_filesystem.cc 2014-07-25 13:46:28 +0000 |
1802 | @@ -60,7 +60,7 @@ |
1803 | struct stat st; |
1804 | |
1805 | m_exists = (stat(c_str(), &st) != -1); |
1806 | - m_isDirectory = m_exists and S_ISDIR(st.st_mode); |
1807 | + m_isDirectory = m_exists && S_ISDIR(st.st_mode); |
1808 | } |
1809 | }; |
1810 | |
1811 | @@ -291,7 +291,7 @@ |
1812 | it = dirname.find(m_filesep, it); |
1813 | |
1814 | FileSystemPath fspath(FS_CanonicalizeName(dirname.substr(0, it))); |
1815 | - if (fspath.m_exists and !fspath.m_isDirectory) |
1816 | + if (fspath.m_exists && !fspath.m_isDirectory) |
1817 | throw wexception |
1818 | ("%s exists and is not a directory", |
1819 | dirname.substr(0, it).c_str()); |
1820 | @@ -353,7 +353,7 @@ |
1821 | |
1822 | try { |
1823 | file = fopen(fullname.c_str(), "rb"); |
1824 | - if (not file) |
1825 | + if (!file) |
1826 | throw File_error("RealFSImpl::Load", fullname.c_str()); |
1827 | |
1828 | // determine the size of the file (rather quirky, but it doesn't require |
1829 | @@ -374,7 +374,7 @@ |
1830 | // allocate a buffer and read the entire file into it |
1831 | data = malloc(size + 1); // TODO(unknown) memory leak! |
1832 | int result = fread(data, size, 1, file); |
1833 | - if (size and (result != 1)) { |
1834 | + if (size && (result != 1)) { |
1835 | throw wexception |
1836 | ("RealFSImpl::Load: read failed for %s (%s) with size %" PRIuS "", |
1837 | fname.c_str(), fullname.c_str(), size); |
1838 | @@ -416,7 +416,7 @@ |
1839 | size_t const c = fwrite(data, length, 1, f); |
1840 | fclose(f); |
1841 | |
1842 | - if (length and c != 1) // data might be 0 blocks long |
1843 | + if (length && c != 1) // data might be 0 blocks long |
1844 | throw wexception |
1845 | ("Write to %s (%s) failed", fname.c_str(), fullname.c_str()); |
1846 | } |
1847 | |
1848 | === modified file 'src/io/filesystem/filesystem.cc' |
1849 | --- src/io/filesystem/filesystem.cc 2014-07-23 14:49:10 +0000 |
1850 | +++ src/io/filesystem/filesystem.cc 2014-07-25 13:46:28 +0000 |
1851 | @@ -161,7 +161,7 @@ |
1852 | // their own "standards"? |
1853 | #define TRY_USE_AS_HOMEDIR(name) \ |
1854 | homedir = getenv(name); \ |
1855 | - if (homedir.size() and check_writeable_for_data(homedir.c_str())) \ |
1856 | + if (homedir.size() && check_writeable_for_data(homedir.c_str())) \ |
1857 | return homedir; \ |
1858 | |
1859 | TRY_USE_AS_HOMEDIR("USERPROFILE"); |
1860 | |
1861 | === modified file 'src/io/filesystem/layered_filesystem.cc' |
1862 | --- src/io/filesystem/layered_filesystem.cc 2014-07-23 14:49:10 +0000 |
1863 | +++ src/io/filesystem/layered_filesystem.cc 2014-07-25 13:46:28 +0000 |
1864 | @@ -103,7 +103,7 @@ |
1865 | * Returns true if the file can be found in at least one of the sub-filesystems |
1866 | */ |
1867 | bool LayeredFileSystem::FileExists(const std::string & path) { |
1868 | - if (m_home and m_home->FileExists(path)) |
1869 | + if (m_home && m_home->FileExists(path)) |
1870 | return true; |
1871 | for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it) |
1872 | if ((*it)->FileExists(path)) |
1873 | @@ -117,7 +117,7 @@ |
1874 | */ |
1875 | // TODO(unknown): What if it's a file in some and a dir in others????? |
1876 | bool LayeredFileSystem::IsDirectory(const std::string & path) { |
1877 | - if (m_home and m_home->IsDirectory(path)) |
1878 | + if (m_home && m_home->IsDirectory(path)) |
1879 | return true; |
1880 | |
1881 | for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it) |
1882 | @@ -153,7 +153,7 @@ |
1883 | void LayeredFileSystem::Write |
1884 | (const std::string & fname, void const * const data, int32_t const length) |
1885 | { |
1886 | - if (m_home and m_home->IsWritable()) |
1887 | + if (m_home && m_home->IsWritable()) |
1888 | return m_home->Write(fname, data, length); |
1889 | |
1890 | for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it) |
1891 | @@ -225,11 +225,11 @@ |
1892 | */ |
1893 | FileSystem * LayeredFileSystem::MakeSubFileSystem(const std::string & dirname) |
1894 | { |
1895 | - if (m_home and m_home->IsWritable() and m_home->FileExists(dirname)) |
1896 | + if (m_home && m_home->IsWritable() && m_home->FileExists(dirname)) |
1897 | return m_home->MakeSubFileSystem(dirname); |
1898 | |
1899 | for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it) |
1900 | - if ((*it)->IsWritable() and (*it)->FileExists(dirname)) |
1901 | + if ((*it)->IsWritable() && (*it)->FileExists(dirname)) |
1902 | return (*it)->MakeSubFileSystem(dirname); |
1903 | |
1904 | throw wexception("LayeredFileSystem: unable to create sub filesystem"); |
1905 | @@ -240,11 +240,11 @@ |
1906 | */ |
1907 | FileSystem * LayeredFileSystem::CreateSubFileSystem(const std::string & dirname, Type const type) |
1908 | { |
1909 | - if (m_home and m_home->IsWritable() and not m_home->FileExists(dirname)) |
1910 | + if (m_home && m_home->IsWritable() && !m_home->FileExists(dirname)) |
1911 | return m_home->CreateSubFileSystem(dirname, type); |
1912 | |
1913 | for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it) |
1914 | - if ((*it)->IsWritable() and not (*it)->FileExists(dirname)) |
1915 | + if ((*it)->IsWritable() && !(*it)->FileExists(dirname)) |
1916 | return (*it)->CreateSubFileSystem(dirname, type); |
1917 | |
1918 | throw wexception("LayeredFileSystem: unable to create sub filesystem"); |
1919 | @@ -257,12 +257,12 @@ |
1920 | if (!FileExists(file)) |
1921 | return; |
1922 | |
1923 | - if (m_home and m_home->IsWritable() and m_home->FileExists(file)) { |
1924 | + if (m_home && m_home->IsWritable() && m_home->FileExists(file)) { |
1925 | m_home->Unlink(file); |
1926 | return; |
1927 | } |
1928 | for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it) |
1929 | - if ((*it)->IsWritable() and (*it)->FileExists(file)) { |
1930 | + if ((*it)->IsWritable() && (*it)->FileExists(file)) { |
1931 | (*it)->Unlink(file); |
1932 | return; |
1933 | } |
1934 | @@ -273,12 +273,12 @@ |
1935 | { |
1936 | if (!FileExists(old_name)) |
1937 | return; |
1938 | - if (m_home and m_home->IsWritable() and m_home->FileExists(old_name)) { |
1939 | + if (m_home && m_home->IsWritable() && m_home->FileExists(old_name)) { |
1940 | m_home->Rename(old_name, new_name); |
1941 | return; |
1942 | } |
1943 | for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it) |
1944 | - if ((*it)->IsWritable() and (*it)->FileExists(old_name)) { |
1945 | + if ((*it)->IsWritable() && (*it)->FileExists(old_name)) { |
1946 | (*it)->Rename(old_name, new_name); |
1947 | return; |
1948 | } |
1949 | |
1950 | === modified file 'src/io/filesystem/zip_filesystem.cc' |
1951 | --- src/io/filesystem/zip_filesystem.cc 2014-07-23 14:49:10 +0000 |
1952 | +++ src/io/filesystem/zip_filesystem.cc 2014-07-25 13:46:28 +0000 |
1953 | @@ -341,7 +341,7 @@ |
1954 | unzCloseCurrentFile(m_unzipfile); |
1955 | |
1956 | void * const result = malloc(totallen + 1); |
1957 | - if (not result) |
1958 | + if (!result) |
1959 | throw std::bad_alloc(); |
1960 | unzOpenCurrentFile(m_unzipfile); |
1961 | unzReadCurrentFile(m_unzipfile, result, totallen); |
1962 | |
1963 | === modified file 'src/io/filewrite.cc' |
1964 | --- src/io/filewrite.cc 2014-07-14 10:45:44 +0000 |
1965 | +++ src/io/filewrite.cc 2014-07-25 13:46:28 +0000 |
1966 | @@ -55,7 +55,7 @@ |
1967 | } |
1968 | |
1969 | void FileWrite::Data(const void* const src, const size_t size, Pos const pos = Pos::Null()) { |
1970 | - assert(data_ or not length_); |
1971 | + assert(data_ || !length_); |
1972 | |
1973 | Pos i = pos; |
1974 | if (pos.isNull()) { |
1975 | |
1976 | === modified file 'src/logic/battle.cc' |
1977 | --- src/logic/battle.cc 2014-07-22 09:54:49 +0000 |
1978 | +++ src/logic/battle.cc 2014-07-25 13:46:28 +0000 |
1979 | @@ -68,7 +68,7 @@ |
1980 | } |
1981 | |
1982 | // Ensures only live soldiers eganges in a battle |
1983 | - assert(First.get_current_hitpoints() and Second.get_current_hitpoints()); |
1984 | + assert(First.get_current_hitpoints() && Second.get_current_hitpoints()); |
1985 | |
1986 | init(game); |
1987 | } |
1988 | @@ -133,7 +133,7 @@ |
1989 | |
1990 | Soldier * Battle::opponent(Soldier& soldier) |
1991 | { |
1992 | - assert(m_first == &soldier or m_second == &soldier); |
1993 | + assert(m_first == &soldier || m_second == &soldier); |
1994 | Soldier* other_soldier = m_first == &soldier ? m_second : m_first; |
1995 | return other_soldier; |
1996 | } |
1997 | @@ -148,7 +148,7 @@ |
1998 | // Identify what soldier is calling the routine |
1999 | uint8_t const this_soldier_is = &soldier == m_first ? 1 : 2; |
2000 | |
2001 | - assert(m_first->getBattle() == this or m_second->getBattle() == this); |
2002 | + assert(m_first->getBattle() == this || m_second->getBattle() == this); |
2003 | |
2004 | // Created this three 'states' of the battle: |
2005 | // *First time entered, one enters : |
2006 | @@ -159,12 +159,12 @@ |
2007 | // roundFighted, reset m_readyflags |
2008 | bool const oneReadyToFight = (m_readyflags == 0); |
2009 | bool const roundFighted = (m_readyflags == 3); |
2010 | - bool const bothReadyToFight = ((this_soldier_is | m_readyflags) == 3) and |
2011 | + bool const bothReadyToFight = ((this_soldier_is | m_readyflags) == 3) && |
2012 | (!roundFighted); |
2013 | std::string what_anim; |
2014 | |
2015 | // Apply pending damage |
2016 | - if (m_damage and oneReadyToFight) { |
2017 | + if (m_damage && oneReadyToFight) { |
2018 | // Current attacker is last defender, so damage goes to current attacker |
2019 | if (m_first_strikes) |
2020 | m_first ->damage(m_damage); |
2021 | @@ -183,7 +183,7 @@ |
2022 | return schedule_destroy(game); |
2023 | } |
2024 | |
2025 | - if (!m_first or !m_second) |
2026 | + if (!m_first || !m_second) |
2027 | return soldier.skip_act(); |
2028 | |
2029 | // So both soldiers are alive; are we ready to trade the next blow? |
2030 | @@ -216,8 +216,8 @@ |
2031 | // Time for one of us to hurt the other. Which one is on turn is decided |
2032 | // by calculateRound. |
2033 | assert |
2034 | - ((m_readyflags == 1 and this_soldier_is == 2) or |
2035 | - (m_readyflags == 2 and this_soldier_is == 1)); |
2036 | + ((m_readyflags == 1 && this_soldier_is == 2) || |
2037 | + (m_readyflags == 2 && this_soldier_is == 1)); |
2038 | |
2039 | // Both are now ready, mark flags, so our opponent can get new animation |
2040 | m_readyflags = 3; |
2041 | |
2042 | === modified file 'src/logic/bill_of_materials.h' |
2043 | --- src/logic/bill_of_materials.h 2014-07-05 16:41:51 +0000 |
2044 | +++ src/logic/bill_of_materials.h 2014-07-25 13:46:28 +0000 |
2045 | @@ -37,7 +37,7 @@ |
2046 | ++i; ++current; return *this; |
2047 | } |
2048 | bool empty() const {return current == end;} |
2049 | - operator bool() const {return not empty();} |
2050 | + operator bool() const {return !empty();} |
2051 | |
2052 | uint8_t i; |
2053 | BillOfMaterials::const_iterator current; |
2054 | |
2055 | === modified file 'src/logic/bob.cc' |
2056 | --- src/logic/bob.cc 2014-07-15 10:02:22 +0000 |
2057 | +++ src/logic/bob.cc 2014-07-25 13:46:28 +0000 |
2058 | @@ -260,7 +260,7 @@ |
2059 | */ |
2060 | void Bob::push_task(Game & game, const Task & task, uint32_t const tdelta) |
2061 | { |
2062 | - assert(not task.unique or not get_state(task)); |
2063 | + assert(!task.unique || !get_state(task)); |
2064 | assert(m_in_act || m_stack.empty()); |
2065 | |
2066 | m_stack.push_back(State(&task)); |
2067 | @@ -707,7 +707,7 @@ |
2068 | |
2069 | if |
2070 | (state.ivar2 |
2071 | - and |
2072 | + && |
2073 | static_cast<Path::Step_Vector::size_type>(state.ivar1) + 1 |
2074 | == |
2075 | path->get_nsteps()) |
2076 | @@ -891,7 +891,7 @@ |
2077 | |
2078 | // Always call checkNodeBlocked, because it might communicate with other |
2079 | // bobs (as is the case for soldiers on the battlefield). |
2080 | - if (checkNodeBlocked(game, newnode, true) and !force) |
2081 | + if (checkNodeBlocked(game, newnode, true) && !force) |
2082 | return -2; |
2083 | |
2084 | // Move is go |
2085 | |
2086 | === modified file 'src/logic/buildcost.cc' |
2087 | --- src/logic/buildcost.cc 2014-06-01 18:00:48 +0000 |
2088 | +++ src/logic/buildcost.cc 2014-07-25 13:46:28 +0000 |
2089 | @@ -38,7 +38,7 @@ |
2090 | ("a buildcost item of this ware type has already been " |
2091 | "defined"); |
2092 | int32_t const value = val->get_int(); |
2093 | - if (value < 1 or 255 < value) |
2094 | + if (value < 1 || 255 < value) |
2095 | throw wexception("count is out of range 1 .. 255"); |
2096 | insert(std::pair<Ware_Index, uint8_t>(idx, value)); |
2097 | } else |
2098 | |
2099 | === modified file 'src/logic/building.cc' |
2100 | --- src/logic/building.cc 2014-07-24 05:21:20 +0000 |
2101 | +++ src/logic/building.cc 2014-07-25 13:46:28 +0000 |
2102 | @@ -90,7 +90,7 @@ |
2103 | } |
2104 | |
2105 | m_helptext_script = directory + "/help.lua"; |
2106 | - if (not g_fs->FileExists(m_helptext_script)) |
2107 | + if (!g_fs->FileExists(m_helptext_script)) |
2108 | m_helptext_script = ""; |
2109 | |
2110 | // Parse build options |
2111 | @@ -293,7 +293,7 @@ |
2112 | } |
2113 | |
2114 | Bob::State const* const state = worker.get_state(Worker::taskLeavebuilding); |
2115 | - if (not state) { |
2116 | + if (!state) { |
2117 | log |
2118 | ("WARNING: worker %u is in the leave queue of building %u but " |
2119 | "does not have a leavebuilding task! Removing from queue.\n", |
2120 | @@ -341,7 +341,7 @@ |
2121 | const Building_Descr & tmp_descr = descr(); |
2122 | if (tmp_descr.is_destructible()) { |
2123 | caps |= PCap_Bulldoze; |
2124 | - if (tmp_descr.is_buildable() or tmp_descr.is_enhanced()) |
2125 | + if (tmp_descr.is_buildable() || tmp_descr.is_enhanced()) |
2126 | caps |= PCap_Dismantle; |
2127 | } |
2128 | if (tmp_descr.enhancement() != INVALID_INDEX) |
2129 | @@ -388,7 +388,7 @@ |
2130 | map.get_brn(m_position, &neighb); |
2131 | { |
2132 | Flag * flag = dynamic_cast<Flag *>(map.get_immovable(neighb)); |
2133 | - if (not flag) |
2134 | + if (!flag) |
2135 | flag = |
2136 | new Flag (egbase, owner(), neighb); |
2137 | m_flag = flag; |
2138 | @@ -834,7 +834,7 @@ |
2139 | |
2140 | |
2141 | void Building::add_worker(Worker & worker) { |
2142 | - if (not get_workers().size()) { |
2143 | + if (!get_workers().size()) { |
2144 | if (worker.descr().name() != "builder") |
2145 | set_seeing(true); |
2146 | } |
2147 | @@ -845,7 +845,7 @@ |
2148 | |
2149 | void Building::remove_worker(Worker & worker) { |
2150 | PlayerImmovable::remove_worker(worker); |
2151 | - if (not get_workers().size()) |
2152 | + if (!get_workers().size()) |
2153 | set_seeing(false); |
2154 | workers_changed(); |
2155 | } |
2156 | @@ -914,8 +914,8 @@ |
2157 | rt_description += img; |
2158 | { |
2159 | std::string::iterator it = rt_description.end() - 1; |
2160 | - for (; it != rt_description.begin() and *it != '?'; --it) {} |
2161 | - for (; *it == '?'; --it) |
2162 | + for (; it != rt_description.begin() && *it != '?'; --it) {} |
2163 | + for (; *it == '?'; --it) |
2164 | *it = '0'; |
2165 | } |
2166 | rt_description += "><p font-size=14 font-face=DejaVuSerif>"; |
2167 | |
2168 | === modified file 'src/logic/checkstep.cc' |
2169 | --- src/logic/checkstep.cc 2013-07-26 20:19:36 +0000 |
2170 | +++ src/logic/checkstep.cc 2014-07-25 13:46:28 +0000 |
2171 | @@ -168,11 +168,11 @@ |
2172 | |
2173 | // Calculate cost and passability |
2174 | if |
2175 | - (not (endcaps & m_movecaps) |
2176 | - and |
2177 | - not |
2178 | + (!(endcaps & m_movecaps) |
2179 | + && |
2180 | + ! |
2181 | ((endcaps & MOVECAPS_WALK) |
2182 | - and |
2183 | + && |
2184 | (m_player.get_buildcaps(start) & m_movecaps & MOVECAPS_SWIM))) |
2185 | return false; |
2186 | |
2187 | @@ -184,8 +184,8 @@ |
2188 | |
2189 | return |
2190 | dynamic_cast<Flag const *>(imm) |
2191 | - or |
2192 | - (dynamic_cast<Road const *>(imm) and (endcaps & BUILDCAPS_FLAG)); |
2193 | + || |
2194 | + (dynamic_cast<Road const *>(imm) && (endcaps & BUILDCAPS_FLAG)); |
2195 | } |
2196 | |
2197 | return true; |
2198 | |
2199 | === modified file 'src/logic/cmd_queue.cc' |
2200 | --- src/logic/cmd_queue.cc 2014-07-23 14:49:10 +0000 |
2201 | +++ src/logic/cmd_queue.cc 2014-07-25 13:46:28 +0000 |
2202 | @@ -55,7 +55,7 @@ |
2203 | // Note: Order of destruction of Items is not guaranteed |
2204 | void Cmd_Queue::flush() { |
2205 | uint32_t cbucket = 0; |
2206 | - while (m_ncmds and cbucket < CMD_QUEUE_BUCKET_SIZE) { |
2207 | + while (m_ncmds && cbucket < CMD_QUEUE_BUCKET_SIZE) { |
2208 | std::priority_queue<cmditem> & current_cmds = m_cmds[cbucket]; |
2209 | |
2210 | while (!current_cmds.empty()) { |
2211 | |
2212 | === modified file 'src/logic/constructionsite.cc' |
2213 | --- src/logic/constructionsite.cc 2014-07-22 09:54:49 +0000 |
2214 | +++ src/logic/constructionsite.cc 2014-07-25 13:46:28 +0000 |
2215 | @@ -204,7 +204,7 @@ |
2216 | if (m_work_completed >= m_work_steps) |
2217 | return false; // completed, so don't burn |
2218 | |
2219 | - return m_work_completed or !m_old_buildings.empty(); |
2220 | + return m_work_completed || !m_old_buildings.empty(); |
2221 | } |
2222 | |
2223 | /* |
2224 | @@ -237,7 +237,7 @@ |
2225 | return true; |
2226 | } |
2227 | |
2228 | - if (not m_work_steps) // Happens for building without buildcost. |
2229 | + if (!m_work_steps) // Happens for building without buildcost. |
2230 | schedule_destroy(game); // Complete the building immediately. |
2231 | |
2232 | // Check if one step has completed |
2233 | |
2234 | === modified file 'src/logic/dismantlesite.cc' |
2235 | --- src/logic/dismantlesite.cc 2014-07-15 07:44:14 +0000 |
2236 | +++ src/logic/dismantlesite.cc 2014-07-25 13:46:28 +0000 |
2237 | @@ -177,11 +177,11 @@ |
2238 | return true; |
2239 | } |
2240 | |
2241 | - if (not m_work_steps) // Happens for building without buildcost. |
2242 | + if (!m_work_steps) // Happens for building without buildcost. |
2243 | schedule_destroy(game); // Complete the building immediately. |
2244 | |
2245 | // Check if one step has completed |
2246 | - if (static_cast<int32_t>(game.get_gametime() - m_work_steptime) >= 0 and m_working) { |
2247 | + if (static_cast<int32_t>(game.get_gametime() - m_work_steptime) >= 0 && m_working) { |
2248 | ++m_work_completed; |
2249 | |
2250 | for (uint32_t i = 0; i < m_wares.size(); ++i) { |
2251 | @@ -217,7 +217,7 @@ |
2252 | worker.descr().get_right_walk_anims(false), |
2253 | true); |
2254 | worker.set_location(nullptr); |
2255 | - } else if (not m_working) { |
2256 | + } else if (!m_working) { |
2257 | m_work_steptime = game.get_gametime() + DISMANTLESITE_STEP_TIME; |
2258 | worker.start_task_idle |
2259 | (game, worker.descr().get_animation("work"), DISMANTLESITE_STEP_TIME); |
2260 | |
2261 | === modified file 'src/logic/editor_game_base.cc' |
2262 | --- src/logic/editor_game_base.cc 2014-07-22 09:54:49 +0000 |
2263 | +++ src/logic/editor_game_base.cc 2014-07-25 13:46:28 +0000 |
2264 | @@ -70,7 +70,7 @@ |
2265 | map_ (nullptr), |
2266 | lasttrackserial_ (0) |
2267 | { |
2268 | - if (not lua_) // TODO(SirVer): this is sooo ugly, I can't say |
2269 | + if (!lua_) // TODO(SirVer): this is sooo ugly, I can't say |
2270 | lua_.reset(new LuaEditorInterface(this)); |
2271 | |
2272 | g_sound_handler.egbase_ = this; |
2273 | @@ -198,7 +198,7 @@ |
2274 | void Editor_Game_Base::inform_players_about_immovable |
2275 | (Map_Index const i, Map_Object_Descr const * const descr) |
2276 | { |
2277 | - if (not Road::IsRoadDescr(descr)) |
2278 | + if (!Road::IsRoadDescr(descr)) |
2279 | iterate_players_existing_const(plnum, MAX_PLAYERS, *this, p) { |
2280 | Player::Field & player_field = p->m_fields[i]; |
2281 | if (1 < player_field.vision) { |
2282 | @@ -249,7 +249,7 @@ |
2283 | if |
2284 | (pid <= MAX_PLAYERS |
2285 | || |
2286 | - not dynamic_cast<const Game *>(this)) |
2287 | + !dynamic_cast<const Game *>(this)) |
2288 | { // if this is editor, load the tribe anyways |
2289 | // the tribe is used, postload it |
2290 | tribes_[id]->postload(*this); |
2291 | @@ -695,7 +695,7 @@ |
2292 | assert (player_area.player_number <= map().get_nrplayers()); |
2293 | assert (preferred_player <= map().get_nrplayers()); |
2294 | assert(preferred_player != player_area.player_number); |
2295 | - assert(not conquer || not preferred_player); |
2296 | + assert(!conquer || !preferred_player); |
2297 | Player & conquering_player = player(player_area.player_number); |
2298 | MapRegion<Area<FCoords> > mr(map(), player_area); |
2299 | do { |
2300 | @@ -709,12 +709,12 @@ |
2301 | // adds the influence |
2302 | Military_Influence new_influence_modified = conquering_player.military_influence(index) += |
2303 | influence; |
2304 | - if (owner && not conquer_guarded_location_by_superior_influence) |
2305 | + if (owner && !conquer_guarded_location_by_superior_influence) |
2306 | new_influence_modified = 1; |
2307 | if (!owner || player(owner).military_influence(index) < new_influence_modified) { |
2308 | change_field_owner(mr.location(), player_area.player_number); |
2309 | } |
2310 | - } else if (not(conquering_player.military_influence(index) -= influence) && |
2311 | + } else if (!(conquering_player.military_influence(index) -= influence) && |
2312 | owner == player_area.player_number) { |
2313 | // The player completely lost influence over the location, which he |
2314 | // owned. Now we must see if some other player has influence and if |
2315 | @@ -772,7 +772,7 @@ |
2316 | PlayerImmovable & imm = |
2317 | ref_cast<PlayerImmovable, BaseImmovable>(*i.current->object); |
2318 | if |
2319 | - (not |
2320 | + (! |
2321 | m[i.current->coords].is_interior(imm.owner().player_number())) |
2322 | if |
2323 | (std::find(burnlist.begin(), burnlist.end(), &imm) |
2324 | |
2325 | === modified file 'src/logic/game.cc' |
2326 | --- src/logic/game.cc 2014-07-23 14:49:10 +0000 |
2327 | +++ src/logic/game.cc 2014-07-25 13:46:28 +0000 |
2328 | @@ -192,7 +192,7 @@ |
2329 | // this is to ensure we do not crash because of diskspace |
2330 | // still this is only possibe to go from true->false |
2331 | // still probally should not do this with an assert but with better checks |
2332 | - assert(m_state == gs_notrunning || not wr); |
2333 | + assert(m_state == gs_notrunning || !wr); |
2334 | |
2335 | m_writereplay = wr; |
2336 | } |
2337 | @@ -478,7 +478,7 @@ |
2338 | } else { |
2339 | // Is a scenario! |
2340 | iterate_players_existing_novar(p, nr_players, *this) { |
2341 | - if (not map().get_starting_pos(p)) |
2342 | + if (!map().get_starting_pos(p)) |
2343 | throw warning |
2344 | (_("Missing starting position"), |
2345 | _ |
2346 | @@ -540,7 +540,7 @@ |
2347 | if (m_writereplay) { |
2348 | log("Starting replay writer\n"); |
2349 | |
2350 | - assert(not m_replaywriter); |
2351 | + assert(!m_replaywriter); |
2352 | m_replaywriter = new ReplayWriter(*this, fname); |
2353 | |
2354 | log("Replay writer has started\n"); |
2355 | @@ -626,7 +626,7 @@ |
2356 | |
2357 | /// (Only) called by the dedicated server, to end a game once all players left |
2358 | void Game::end_dedicated_game() { |
2359 | - assert(not g_gr); |
2360 | + assert(!g_gr); |
2361 | m_state = gs_notrunning; |
2362 | } |
2363 | |
2364 | @@ -995,7 +995,7 @@ |
2365 | workerid < tribe_workers; |
2366 | ++workerid) |
2367 | if |
2368 | - (not |
2369 | + (! |
2370 | dynamic_cast<Carrier::Descr const *> |
2371 | (tribe.get_worker_descr(workerid))) |
2372 | wostock += eco->stock_worker(workerid); |
2373 | |
2374 | === modified file 'src/logic/game_controller.h' |
2375 | --- src/logic/game_controller.h 2014-07-05 16:41:51 +0000 |
2376 | +++ src/logic/game_controller.h 2014-07-25 13:46:28 +0000 |
2377 | @@ -80,7 +80,7 @@ |
2378 | * Toggle pause state (convenience function) |
2379 | */ |
2380 | void togglePaused() { |
2381 | - setPaused(not isPaused()); |
2382 | + setPaused(!isPaused()); |
2383 | } |
2384 | |
2385 | /** |
2386 | |
2387 | === modified file 'src/logic/immovable.cc' |
2388 | --- src/logic/immovable.cc 2014-07-16 08:23:42 +0000 |
2389 | +++ src/logic/immovable.cc 2014-07-25 13:46:28 +0000 |
2390 | @@ -142,7 +142,7 @@ |
2391 | Section& program_s = prof.get_safe_section(_name.c_str()); |
2392 | while (Section::Value* const v = program_s.get_next_val()) { |
2393 | Action* action; |
2394 | - if (not strcmp(v->get_name(), "animate")) { |
2395 | + if (!strcmp(v->get_name(), "animate")) { |
2396 | // Copying, as next_word() modifies the string..... Awful design. |
2397 | std::unique_ptr<char []> arguments(new char[strlen(v->get_string()) + 1]); |
2398 | strncpy(arguments.get(), v->get_string(), strlen(v->get_string()) + 1); |
2399 | @@ -156,17 +156,17 @@ |
2400 | g_gr->animations().load(directory, prof.get_safe_section(animation_name))); |
2401 | } |
2402 | action = new ActAnimate(v->get_string(), immovable); |
2403 | - } else if (not strcmp(v->get_name(), "transform")) { |
2404 | + } else if (!strcmp(v->get_name(), "transform")) { |
2405 | action = new ActTransform(v->get_string(), immovable); |
2406 | - } else if (not strcmp(v->get_name(), "grow")) { |
2407 | + } else if (!strcmp(v->get_name(), "grow")) { |
2408 | action = new ActGrow(v->get_string(), immovable); |
2409 | - } else if (not strcmp(v->get_name(), "remove")) { |
2410 | + } else if (!strcmp(v->get_name(), "remove")) { |
2411 | action = new ActRemove(v->get_string(), immovable); |
2412 | - } else if (not strcmp(v->get_name(), "seed")) { |
2413 | + } else if (!strcmp(v->get_name(), "seed")) { |
2414 | action = new ActSeed(v->get_string(), immovable); |
2415 | - } else if (not strcmp(v->get_name(), "playFX")) { |
2416 | + } else if (!strcmp(v->get_name(), "playFX")) { |
2417 | action = new ActPlayFX(directory, v->get_string(), immovable); |
2418 | - } else if (not strcmp(v->get_name(), "construction")) { |
2419 | + } else if (!strcmp(v->get_name(), "construction")) { |
2420 | action = new ActConstruction(v->get_string(), immovable, directory, prof); |
2421 | } else { |
2422 | throw game_data_error("unknown command type \"%s\"", v->get_name()); |
2423 | @@ -769,7 +769,7 @@ |
2424 | try { |
2425 | // The header has been peeled away by the caller |
2426 | uint8_t const version = fr.Unsigned8(); |
2427 | - if (1 <= version and version <= IMMOVABLE_SAVEGAME_VERSION) { |
2428 | + if (1 <= version && version <= IMMOVABLE_SAVEGAME_VERSION) { |
2429 | |
2430 | const std::string owner_name = fr.CString(); |
2431 | const std::string old_name = fr.CString(); |
2432 | @@ -822,10 +822,10 @@ |
2433 | } |
2434 | m_id = descr.get_animation(animation_name); |
2435 | |
2436 | - if (not reached_end) { // The next parameter is the duration. |
2437 | + if (!reached_end) { // The next parameter is the duration. |
2438 | char * endp; |
2439 | long int const value = strtol(parameters, &endp, 0); |
2440 | - if (*endp or value <= 0) |
2441 | + if (*endp || value <= 0) |
2442 | throw game_data_error("expected %s but found \"%s\"", "duration in ms", parameters); |
2443 | m_duration = value; |
2444 | } else { |
2445 | @@ -856,11 +856,11 @@ |
2446 | std::string filename = next_word(parameters, reached_end); |
2447 | name = directory + "/" + filename; |
2448 | |
2449 | - if (not reached_end) { |
2450 | + if (!reached_end) { |
2451 | char * endp; |
2452 | unsigned long long int const value = strtoull(parameters, &endp, 0); |
2453 | priority = value; |
2454 | - if (*endp or priority != value) |
2455 | + if (*endp || priority != value) |
2456 | throw game_data_error |
2457 | ("expected %s but found \"%s\"", "priority", parameters); |
2458 | } else |
2459 | @@ -899,7 +899,7 @@ |
2460 | bob = false; |
2461 | else if (params[i][0] >= '0' && params[i][0] <= '9') { |
2462 | long int const value = atoi(params[i].c_str()); |
2463 | - if (value < 1 or 254 < value) |
2464 | + if (value < 1 || 254 < value) |
2465 | throw game_data_error |
2466 | ("expected %s but found \"%s\"", "probability in range [1, 254]", |
2467 | params[i].c_str()); |
2468 | @@ -939,7 +939,7 @@ |
2469 | void ImmovableProgram::ActTransform::execute |
2470 | (Game & game, Immovable & immovable) const |
2471 | { |
2472 | - if (probability == 0 or game.logic_rand() % 256 < probability) { |
2473 | + if (probability == 0 || game.logic_rand() % 256 < probability) { |
2474 | Player * player = immovable.get_owner(); |
2475 | Coords const c = immovable.get_position(); |
2476 | Tribe_Descr const * const owner_tribe = |
2477 | @@ -974,7 +974,7 @@ |
2478 | *p = '\0'; |
2479 | ++p; |
2480 | Tribe_Descr const * const owner_tribe = descr.get_owner_tribe(); |
2481 | - if (not owner_tribe) |
2482 | + if (!owner_tribe) |
2483 | throw game_data_error |
2484 | ( |
2485 | "immovable type not in tribe but target type has scope " |
2486 | @@ -1027,7 +1027,7 @@ |
2487 | if (*parameters) { |
2488 | char * endp; |
2489 | long int const value = strtol(parameters, &endp, 0); |
2490 | - if (*endp or value < 1 or 254 < value) |
2491 | + if (*endp || value < 1 || 254 < value) |
2492 | throw game_data_error |
2493 | ("expected %s but found \"%s\"", |
2494 | "probability in range [1, 254]", parameters); |
2495 | @@ -1042,7 +1042,7 @@ |
2496 | void ImmovableProgram::ActRemove::execute |
2497 | (Game & game, Immovable & immovable) const |
2498 | { |
2499 | - if (probability == 0 or game.logic_rand() % 256 < probability) |
2500 | + if (probability == 0 || game.logic_rand() % 256 < probability) |
2501 | immovable.remove(game); // Now immovable is a dangling reference! |
2502 | else |
2503 | immovable.program_step(game); |
2504 | @@ -1059,7 +1059,7 @@ |
2505 | *p = '\0'; |
2506 | ++p; |
2507 | Tribe_Descr const * const owner_tribe = descr.get_owner_tribe(); |
2508 | - if (not owner_tribe) |
2509 | + if (!owner_tribe) |
2510 | throw game_data_error |
2511 | ( |
2512 | "immovable type not in tribe but target type has scope " |
2513 | @@ -1080,7 +1080,7 @@ |
2514 | ++p; |
2515 | char * endp; |
2516 | long int const value = strtol(p, &endp, 0); |
2517 | - if (*endp or value < 1 or 254 < value) |
2518 | + if (*endp || value < 1 || 254 < value) |
2519 | throw game_data_error |
2520 | ("expected %s but found \"%s\"", "probability in range [1, 254]", |
2521 | p); |
2522 | |
2523 | === modified file 'src/logic/map.cc' |
2524 | --- src/logic/map.cc 2014-07-23 14:49:10 +0000 |
2525 | +++ src/logic/map.cc 2014-07-25 13:46:28 +0000 |
2526 | @@ -270,7 +270,7 @@ |
2527 | } |
2528 | amount /= 6; |
2529 | |
2530 | - if (res == -1 or not amount) { |
2531 | + if (res == -1 || !amount) { |
2532 | f.field->set_resources(0, 0); |
2533 | f.field->set_starting_res_amount(0); |
2534 | } else { |
2535 | @@ -631,10 +631,10 @@ |
2536 | (pathfields->fields[neighb.field - m_fields.get()].cycle |
2537 | != |
2538 | pathfields->cycle |
2539 | - and |
2540 | + && |
2541 | // node within the radius? |
2542 | calc_distance(area, neighb) <= area.radius |
2543 | - and |
2544 | + && |
2545 | // allowed to move onto this node? |
2546 | checkstep.allowed |
2547 | (*this, |
2548 | @@ -1084,7 +1084,7 @@ |
2549 | // we cannot build anything on it. Exception: we can build flags on roads. |
2550 | if (BaseImmovable * const imm = get_immovable(f)) |
2551 | if |
2552 | - (not dynamic_cast<Road const *>(imm) |
2553 | + (!dynamic_cast<Road const *>(imm) |
2554 | && |
2555 | imm->get_size() >= BaseImmovable::SMALL) |
2556 | { |
2557 | @@ -1698,7 +1698,7 @@ |
2558 | return 0; // duh... |
2559 | } |
2560 | |
2561 | - if (not checkstep.reachabledest(*this, end)) |
2562 | + if (!checkstep.reachabledest(*this, end)) |
2563 | return -1; |
2564 | |
2565 | if (!persist) |
2566 | @@ -1755,7 +1755,7 @@ |
2567 | |
2568 | // Check passability |
2569 | if |
2570 | - (not |
2571 | + (! |
2572 | checkstep.allowed |
2573 | (*this, |
2574 | cur, |
2575 | @@ -1870,7 +1870,7 @@ |
2576 | do { |
2577 | if |
2578 | (difference < 0 |
2579 | - and |
2580 | + && |
2581 | mr.location().field->height |
2582 | < |
2583 | static_cast<uint8_t>(-difference)) |
2584 | |
2585 | === modified file 'src/logic/mapdifferenceregion.cc' |
2586 | --- src/logic/mapdifferenceregion.cc 2013-09-23 18:47:02 +0000 |
2587 | +++ src/logic/mapdifferenceregion.cc 2014-07-25 13:46:28 +0000 |
2588 | @@ -30,9 +30,9 @@ |
2589 | --m_remaining_in_edge; |
2590 | return true; |
2591 | } else { |
2592 | - if (not m_passed_corner) { |
2593 | + if (!m_passed_corner) { |
2594 | m_passed_corner = true; |
2595 | - --m_direction; if (not m_direction) m_direction = 6; |
2596 | + --m_direction; if (!m_direction) m_direction = 6; |
2597 | m_remaining_in_edge = m_area.radius; |
2598 | return advance(map); |
2599 | } |
2600 | @@ -46,7 +46,7 @@ |
2601 | assert(1 <= m_direction); |
2602 | assert (m_direction <= 6); |
2603 | assert(m_passed_corner); |
2604 | - --m_direction; if (not m_direction) m_direction = 6; |
2605 | + --m_direction; if (!m_direction) m_direction = 6; |
2606 | Area<FCoords>::Radius_type steps_left = m_area.radius + 1; |
2607 | switch (m_direction) { |
2608 | #define DIRECTION_CASE(dir, neighbour_function) \ |
2609 | @@ -63,7 +63,7 @@ |
2610 | DIRECTION_CASE(WALK_W, get_ln); |
2611 | default: assert(false); |
2612 | } |
2613 | - --m_direction; if (not m_direction) m_direction = 6; |
2614 | + --m_direction; if (!m_direction) m_direction = 6; |
2615 | m_remaining_in_edge = m_area.radius; |
2616 | m_passed_corner = false; |
2617 | } |
2618 | |
2619 | === modified file 'src/logic/mapdifferenceregion.h' |
2620 | --- src/logic/mapdifferenceregion.h 2014-07-05 16:41:51 +0000 |
2621 | +++ src/logic/mapdifferenceregion.h 2014-07-25 13:46:28 +0000 |
2622 | @@ -44,8 +44,8 @@ |
2623 | { |
2624 | assert(1 <= direction); |
2625 | assert (direction <= 6); |
2626 | - --direction; if (not direction) direction = 6; |
2627 | - --direction; if (not direction) direction = 6; |
2628 | + --direction; if (!direction) direction = 6; |
2629 | + --direction; if (!direction) direction = 6; |
2630 | switch (direction) { |
2631 | #define DIRECTION_CASE(dir, neighbour_function) \ |
2632 | case dir: \ |
2633 | @@ -61,8 +61,8 @@ |
2634 | DIRECTION_CASE(WALK_W, get_ln); |
2635 | #undef DIRECTION_CASE |
2636 | } |
2637 | - --direction; if (not direction) direction = 6; |
2638 | - --direction; if (not direction) direction = 6; |
2639 | + --direction; if (!direction) direction = 6; |
2640 | + --direction; if (!direction) direction = 6; |
2641 | m_direction = direction; |
2642 | } |
2643 | |
2644 | |
2645 | === modified file 'src/logic/maphollowregion.cc' |
2646 | --- src/logic/maphollowregion.cc 2013-09-23 18:47:02 +0000 |
2647 | +++ src/logic/maphollowregion.cc 2014-07-25 13:46:28 +0000 |
2648 | @@ -44,7 +44,7 @@ |
2649 | ++m_rowpos; |
2650 | if (m_rowpos < m_rowwidth) { |
2651 | map.get_rn(m_hollow_area, &m_hollow_area); |
2652 | - if ((m_phase & (Upper|Lower)) and m_rowpos == m_delta_radius) { |
2653 | + if ((m_phase & (Upper|Lower)) && m_rowpos == m_delta_radius) { |
2654 | // Jump over the hole. |
2655 | const uint32_t holewidth = m_rowwidth - 2 * m_delta_radius; |
2656 | for (uint32_t i = 0; i < holewidth; ++i) |
2657 | @@ -53,13 +53,13 @@ |
2658 | } |
2659 | } else { |
2660 | ++m_row; |
2661 | - if (m_phase == Top and m_row == m_delta_radius) |
2662 | + if (m_phase == Top && m_row == m_delta_radius) |
2663 | m_phase = Upper; |
2664 | |
2665 | // If we completed the widest, center line, switch into lower mode |
2666 | // There are m_radius+1 lines in the upper "half", because the upper |
2667 | // half includes the center line. |
2668 | - else if (m_phase == Upper and m_row > m_hollow_area.radius) { |
2669 | + else if (m_phase == Upper && m_row > m_hollow_area.radius) { |
2670 | m_row = 1; |
2671 | m_phase = Lower; |
2672 | } |
2673 | @@ -72,7 +72,7 @@ |
2674 | if (m_row > m_hollow_area.radius) { |
2675 | m_phase = None; |
2676 | return true; // early out |
2677 | - } else if (m_phase == Lower and m_row > m_hollow_area.hole_radius) |
2678 | + } else if (m_phase == Lower && m_row > m_hollow_area.hole_radius) |
2679 | m_phase = Bottom; |
2680 | |
2681 | map.get_brn(m_left, &m_hollow_area); |
2682 | |
2683 | === modified file 'src/logic/maptriangleregion.cc' |
2684 | --- src/logic/maptriangleregion.cc 2013-09-23 18:47:02 +0000 |
2685 | +++ src/logic/maptriangleregion.cc 2014-07-25 13:46:28 +0000 |
2686 | @@ -25,7 +25,7 @@ |
2687 | (const Map & map, Area<TCoords<> > area) |
2688 | : m_radius_is_odd(area.radius & 1) |
2689 | { |
2690 | - assert(area.t == TCoords<>::R or area.t == TCoords<>::D); |
2691 | + assert(area.t == TCoords<>::R || area.t == TCoords<>::D); |
2692 | const uint16_t radius_plus_1 = area.radius + 1; |
2693 | const uint16_t half_radius_rounded_down = area.radius / 2; |
2694 | m_row_length = radius_plus_1; |
2695 | @@ -151,7 +151,7 @@ |
2696 | (const Map & map, Area<TCoords<FCoords> > area) |
2697 | : m_radius_is_odd(area.radius & 1) |
2698 | { |
2699 | - assert(area.t == TCoords<FCoords>::R or area.t == TCoords<FCoords>::D); |
2700 | + assert(area.t == TCoords<FCoords>::R || area.t == TCoords<FCoords>::D); |
2701 | const uint16_t radius_plus_1 = area.radius + 1; |
2702 | const uint16_t half_radius_rounded_down = area.radius / 2; |
2703 | m_row_length = radius_plus_1; |
2704 | |
2705 | === modified file 'src/logic/militarysite.cc' |
2706 | --- src/logic/militarysite.cc 2014-07-23 15:58:57 +0000 |
2707 | +++ src/logic/militarysite.cc 2014-07-25 13:46:28 +0000 |
2708 | @@ -523,10 +523,10 @@ |
2709 | } |
2710 | else // not doing upgrade request |
2711 | { |
2712 | - if ((capacity != stationed) or (m_normal_soldier_request)) |
2713 | + if ((capacity != stationed) || (m_normal_soldier_request)) |
2714 | update_normal_soldier_request(); |
2715 | |
2716 | - if ((capacity == stationed) and (! m_normal_soldier_request)) |
2717 | + if ((capacity == stationed) && (! m_normal_soldier_request)) |
2718 | { |
2719 | if (presentSoldiers().size() == capacity) |
2720 | { |
2721 | @@ -922,9 +922,9 @@ |
2722 | for (uint32_t i = 0; i < immovables.size(); ++i) |
2723 | if (upcast(MilitarySite const, militarysite, immovables[i].object)) |
2724 | if |
2725 | - (this != militarysite and |
2726 | - &owner () == &militarysite->owner() and |
2727 | - get_size() <= militarysite->get_size() and |
2728 | + (this != militarysite && |
2729 | + &owner () == &militarysite->owner() && |
2730 | + get_size() <= militarysite->get_size() && |
2731 | militarysite->m_didconquer) |
2732 | return true; |
2733 | return false; |
2734 | @@ -1060,7 +1060,7 @@ |
2735 | bool maxchanged = reqmax != soldier_upgrade_required_max; |
2736 | bool minchanged = reqmin != soldier_upgrade_required_min; |
2737 | |
2738 | - if (maxchanged or minchanged) |
2739 | + if (maxchanged || minchanged) |
2740 | { |
2741 | if (m_upgrade_soldier_request && (m_upgrade_soldier_request->is_open())) |
2742 | { |
2743 | |
2744 | === modified file 'src/logic/player.cc' |
2745 | --- src/logic/player.cc 2014-07-23 14:49:10 +0000 |
2746 | +++ src/logic/player.cc 2014-07-25 13:46:28 +0000 |
2747 | @@ -348,8 +348,8 @@ |
2748 | Coords const position = m .position (); |
2749 | container_iterate_const(MessageQueue, messages(), i) |
2750 | if |
2751 | - (i.current->second->sender() == m.sender() and |
2752 | - gametime < i.current->second->sent() + timeout and |
2753 | + (i.current->second->sender() == m.sender() && |
2754 | + gametime < i.current->second->sent() + timeout && |
2755 | map.calc_distance(i.current->second->position(), position) <= radius) |
2756 | { |
2757 | delete &m; |
2758 | @@ -382,25 +382,25 @@ |
2759 | const Map & map = egbase().map(); |
2760 | uint8_t buildcaps = fc.field->nodecaps(); |
2761 | |
2762 | - if (not fc.field->is_interior(m_plnum)) |
2763 | + if (!fc.field->is_interior(m_plnum)) |
2764 | buildcaps = 0; |
2765 | |
2766 | // Check if a building's flag can't be build due to ownership |
2767 | else if (buildcaps & BUILDCAPS_BUILDINGMASK) { |
2768 | FCoords flagcoords; |
2769 | map.get_brn(fc, &flagcoords); |
2770 | - if (not flagcoords.field->is_interior(m_plnum)) |
2771 | + if (!flagcoords.field->is_interior(m_plnum)) |
2772 | buildcaps &= ~BUILDCAPS_BUILDINGMASK; |
2773 | |
2774 | // Prevent big buildings that would swell over borders. |
2775 | if |
2776 | ((buildcaps & BUILDCAPS_BIG) == BUILDCAPS_BIG |
2777 | - and |
2778 | - (not map.tr_n(fc).field->is_interior(m_plnum) |
2779 | - or |
2780 | - not map.tl_n(fc).field->is_interior(m_plnum) |
2781 | - or |
2782 | - not map. l_n(fc).field->is_interior(m_plnum))) |
2783 | + && |
2784 | + (!map.tr_n(fc).field->is_interior(m_plnum) |
2785 | + || |
2786 | + !map.tl_n(fc).field->is_interior(m_plnum) |
2787 | + || |
2788 | + !map. l_n(fc).field->is_interior(m_plnum))) |
2789 | buildcaps &= ~BUILDCAPS_SMALL; |
2790 | } |
2791 | |
2792 | @@ -428,7 +428,7 @@ |
2793 | if (upcast(Flag, existing_flag, immovable)) { |
2794 | if (&existing_flag->owner() == this) |
2795 | return *existing_flag; |
2796 | - } else if (not dynamic_cast<Road const *>(immovable)) // A road is OK. |
2797 | + } else if (!dynamic_cast<Road const *>(immovable)) // A road is OK. |
2798 | immovable->remove(egbase()); // Make room for the flag. |
2799 | } |
2800 | MapRegion<Area<FCoords> > mr(map, Area<FCoords>(c, 1)); |
2801 | @@ -734,7 +734,7 @@ |
2802 | (Building * building, Building_Index const index_of_new_building) |
2803 | { |
2804 | if (&building->owner() == |
2805 | - this and(index_of_new_building == INVALID_INDEX || |
2806 | + this &&(index_of_new_building == INVALID_INDEX || |
2807 | building->descr().enhancement() == index_of_new_building)) { |
2808 | Building::FormerBuildings former_buildings = building->get_former_buildings(); |
2809 | const Coords position = building->get_position(); |
2810 | @@ -791,7 +791,7 @@ |
2811 | |
2812 | void Player::allow_worker_type(Ware_Index const i, bool const allow) { |
2813 | assert(i < m_allowed_worker_types.size()); |
2814 | - assert(not allow or tribe().get_worker_descr(i)->is_buildable()); |
2815 | + assert(!allow || tribe().get_worker_descr(i)->is_buildable()); |
2816 | m_allowed_worker_types[i] = allow; |
2817 | } |
2818 | |
2819 | @@ -811,7 +811,7 @@ |
2820 | */ |
2821 | void Player::add_economy(Economy & economy) |
2822 | { |
2823 | - if (not has_economy(economy)) |
2824 | + if (!has_economy(economy)) |
2825 | m_economies.push_back(&economy); |
2826 | } |
2827 | |
2828 | @@ -924,7 +924,7 @@ |
2829 | present.begin(), present.begin() + nr_taken); |
2830 | count += nr_taken; |
2831 | nr_wanted -= nr_taken; |
2832 | - if (not nr_wanted) |
2833 | + if (!nr_wanted) |
2834 | break; |
2835 | } |
2836 | } |
2837 | @@ -1014,17 +1014,17 @@ |
2838 | |
2839 | field.border = f.field->is_border(); |
2840 | field.border_r = |
2841 | - ((1 | r_vision) and (r_owner_number == field.owner) |
2842 | - and |
2843 | - ((tr_owner_number == field.owner) xor (br_owner_number == field.owner))); |
2844 | + ((1 | r_vision) && (r_owner_number == field.owner) |
2845 | + && |
2846 | + ((tr_owner_number == field.owner) ^ (br_owner_number == field.owner))); |
2847 | field.border_br = |
2848 | - ((1 | bl_vision) and (bl_owner_number == field.owner) |
2849 | - and |
2850 | - ((l_owner_number == field.owner) xor (br_owner_number == field.owner))); |
2851 | + ((1 | bl_vision) && (bl_owner_number == field.owner) |
2852 | + && |
2853 | + ((l_owner_number == field.owner) ^ (br_owner_number == field.owner))); |
2854 | field.border_bl = |
2855 | - ((1 | br_vision) and (br_owner_number == field.owner) |
2856 | - and |
2857 | - ((r_owner_number == field.owner) xor (bl_owner_number == field.owner))); |
2858 | + ((1 | br_vision) && (br_owner_number == field.owner) |
2859 | + && |
2860 | + ((r_owner_number == field.owner) ^ (bl_owner_number == field.owner))); |
2861 | |
2862 | { // map_object_descr[TCoords::None] |
2863 | |
2864 | |
2865 | === modified file 'src/logic/playercommand.cc' |
2866 | --- src/logic/playercommand.cc 2014-07-14 21:52:13 +0000 |
2867 | +++ src/logic/playercommand.cc 2014-07-25 13:46:28 +0000 |
2868 | @@ -156,10 +156,10 @@ |
2869 | { |
2870 | try { |
2871 | const uint16_t packet_version = fr.Unsigned16(); |
2872 | - if (2 <= packet_version and packet_version <= PLAYER_COMMAND_VERSION) { |
2873 | + if (2 <= packet_version && packet_version <= PLAYER_COMMAND_VERSION) { |
2874 | GameLogicCommand::Read(fr, egbase, mol); |
2875 | m_sender = fr.Unsigned8 (); |
2876 | - if (not egbase.get_player(m_sender)) |
2877 | + if (!egbase.get_player(m_sender)) |
2878 | throw game_data_error("player %u does not exist", m_sender); |
2879 | m_cmdserial = fr.Unsigned32(); |
2880 | } else |
2881 | @@ -198,7 +198,7 @@ |
2882 | try { |
2883 | const uint16_t packet_version = fr.Unsigned16(); |
2884 | if |
2885 | - (1 <= packet_version and |
2886 | + (1 <= packet_version && |
2887 | packet_version <= PLAYER_CMD_BULLDOZE_VERSION) |
2888 | { |
2889 | PlayerCommand::Read(fr, egbase, mol); |
2890 | @@ -1251,7 +1251,7 @@ |
2891 | { |
2892 | Player & player = game.player(sender()); |
2893 | if |
2894 | - (economy () < player.get_nr_economies() and |
2895 | + (economy () < player.get_nr_economies() && |
2896 | ware_type() < player.tribe().get_nrwares()) |
2897 | player.get_economy_by_number(economy())->set_ware_target_quantity |
2898 | (ware_type(), m_permanent, duetime()); |
2899 | @@ -1314,7 +1314,7 @@ |
2900 | Player & player = game.player(sender()); |
2901 | const Tribe_Descr & tribe = player.tribe(); |
2902 | if |
2903 | - (economy () < player.get_nr_economies() and |
2904 | + (economy () < player.get_nr_economies() && |
2905 | ware_type() < tribe.get_nrwares()) |
2906 | { |
2907 | const int32_t count = |
2908 | @@ -1373,7 +1373,7 @@ |
2909 | { |
2910 | Player & player = game.player(sender()); |
2911 | if |
2912 | - (economy () < player.get_nr_economies() and |
2913 | + (economy () < player.get_nr_economies() && |
2914 | ware_type() < player.tribe().get_nrwares()) |
2915 | player.get_economy_by_number(economy())->set_worker_target_quantity |
2916 | (ware_type(), m_permanent, duetime()); |
2917 | @@ -1436,7 +1436,7 @@ |
2918 | Player & player = game.player(sender()); |
2919 | const Tribe_Descr & tribe = player.tribe(); |
2920 | if |
2921 | - (economy () < player.get_nr_economies() and |
2922 | + (economy () < player.get_nr_economies() && |
2923 | ware_type() < tribe.get_nrwares()) |
2924 | { |
2925 | const int32_t count = |
2926 | @@ -1682,7 +1682,7 @@ |
2927 | if (const Building * const building = flag->get_building()) { |
2928 | if |
2929 | (player.is_hostile(flag->owner()) |
2930 | - and |
2931 | + && |
2932 | 1 |
2933 | < |
2934 | player.vision |
2935 | @@ -1759,7 +1759,7 @@ |
2936 | if (packet_version == PLAYER_MESSAGE_CMD_VERSION) { |
2937 | PlayerCommand::Read(fr, egbase, mol); |
2938 | m_message_id = Message_Id(fr.Unsigned32()); |
2939 | - if (not m_message_id) |
2940 | + if (!m_message_id) |
2941 | throw game_data_error |
2942 | ("(player %u): message id is null", sender()); |
2943 | } else |
2944 | |
2945 | === modified file 'src/logic/production_program.cc' |
2946 | --- src/logic/production_program.cc 2014-07-23 15:58:57 +0000 |
2947 | +++ src/logic/production_program.cc 2014-07-25 13:46:28 +0000 |
2948 | @@ -83,7 +83,7 @@ |
2949 | /// now candidate points to " 75" and result is true |
2950 | bool match(char* & candidate, const char* pattern) { |
2951 | for (char* p = candidate;; ++p, ++pattern) |
2952 | - if (not * pattern) { |
2953 | + if (!*pattern) { |
2954 | candidate = p; |
2955 | return true; |
2956 | } else if (*p != *pattern) |
2957 | @@ -129,7 +129,7 @@ |
2958 | /// throws _wexception |
2959 | bool match_force_skip(char* & candidate, const char* pattern) { |
2960 | for (char* p = candidate;; ++p, ++pattern) |
2961 | - if (not * pattern) { |
2962 | + if (!*pattern) { |
2963 | force_skip(p); |
2964 | candidate = p; |
2965 | return true; |
2966 | @@ -164,8 +164,8 @@ |
2967 | for (;;) { |
2968 | char const * ware = parameters; |
2969 | while |
2970 | - (*parameters and *parameters != ',' and |
2971 | - *parameters != ':' and *parameters != ' ') |
2972 | + (*parameters && *parameters != ',' && |
2973 | + *parameters != ':' && *parameters != ' ') |
2974 | ++parameters; |
2975 | char const terminator = *parameters; |
2976 | *parameters = '\0'; |
2977 | @@ -181,7 +181,7 @@ |
2978 | count_max += i.front().second; |
2979 | break; |
2980 | } |
2981 | - if (group.first.size() and ware_index <= *group.first.begin()) |
2982 | + if (group.first.size() && ware_index <= *group.first.begin()) |
2983 | throw game_data_error |
2984 | ( |
2985 | "wrong order of ware types within group: ware type %s appears " |
2986 | @@ -196,7 +196,7 @@ |
2987 | char * endp; |
2988 | unsigned long long int const value = strtoull(parameters, &endp, 0); |
2989 | count = value; |
2990 | - if ((*endp and *endp != ' ') or value < 1 or count != value) |
2991 | + if ((*endp && *endp != ' ') || value < 1 || count != value) |
2992 | throw game_data_error |
2993 | ("expected %s but found \"%s\"", "count", parameters); |
2994 | parameters = endp; |
2995 | @@ -233,7 +233,7 @@ |
2996 | bool ProductionProgram::ActReturn::Negation::evaluate |
2997 | (const ProductionSite & ps) const |
2998 | { |
2999 | - return not operand->evaluate(ps); |
3000 | + return !operand->evaluate(ps); |
3001 | } |
3002 | std::string ProductionProgram::ActReturn::Negation::description |
3003 | (const Tribe_Descr & tribe) const |
3004 | @@ -438,7 +438,7 @@ |
3005 | m_conditions.push_back(create_condition(parameters, descr)); |
3006 | if (*parameters) { |
3007 | skip(parameters); |
3008 | - if (not match_force_skip(parameters, "and")) |
3009 | + if (!match_force_skip(parameters, "and")) |
3010 | throw game_data_error |
3011 | ("expected \"%s\" or end of input", "and"); |
3012 | } else |
3013 | @@ -447,13 +447,13 @@ |
3014 | } else if (match_force_skip(parameters, "unless")) { |
3015 | m_is_when = false; |
3016 | for (;;) { |
3017 | - if (not *parameters) |
3018 | + if (!*parameters) |
3019 | throw game_data_error |
3020 | ("expected condition at end of input"); |
3021 | m_conditions.push_back(create_condition(parameters, descr)); |
3022 | if (*parameters) { |
3023 | skip(parameters); |
3024 | - if (not match_force_skip(parameters, "or")) |
3025 | + if (!match_force_skip(parameters, "or")) |
3026 | throw game_data_error |
3027 | ("expected \"%s\" or end of input", "or"); |
3028 | } else |
3029 | @@ -497,7 +497,7 @@ |
3030 | std::string condition_string = ""; |
3031 | for (wl_const_range<Conditions> i(m_conditions); i;) |
3032 | { |
3033 | - if (not (i.front()->evaluate(ps))) // A condition is false, |
3034 | + if (!(i.front()->evaluate(ps))) // A condition is false, |
3035 | return ps.program_step(game); // continue program. |
3036 | |
3037 | condition_string += i.front()->description(ps.owner().tribe()); |
3038 | @@ -573,7 +573,7 @@ |
3039 | } |
3040 | |
3041 | // Override with specified handling methods. |
3042 | - while (not reached_end) { |
3043 | + while (!reached_end) { |
3044 | skip(parameters); |
3045 | match_force_skip(parameters, "on"); |
3046 | log("found \"on \": parameters = \"%s\"\n", parameters); |
3047 | @@ -614,7 +614,7 @@ |
3048 | "{\"fail\"|\"complete\"|\"skip\"|\"repeat\"}", |
3049 | parameters); |
3050 | m_handling_methods[result_to_set_method_for - 1] = handling_method; |
3051 | - reached_end = not *parameters; |
3052 | + reached_end = !*parameters; |
3053 | log |
3054 | ("read handling method for result %u: %u, parameters = \"%s\", " |
3055 | "reached_end = %u\n", |
3056 | @@ -722,7 +722,7 @@ |
3057 | char * endp; |
3058 | long long int const value = strtoll(parameters, &endp, 0); |
3059 | m_duration = value; |
3060 | - if (*endp or value <= 0 or m_duration != value) |
3061 | + if (*endp || value <= 0 || m_duration != value) |
3062 | throw game_data_error |
3063 | ("expected %s but found \"%s\"", |
3064 | "duration in ms", parameters); |
3065 | @@ -777,7 +777,7 @@ |
3066 | try { |
3067 | bool reached_end; |
3068 | char * const animation_name = next_word(parameters, reached_end); |
3069 | - if (not strcmp(animation_name, "idle")) |
3070 | + if (!strcmp(animation_name, "idle")) |
3071 | throw game_data_error |
3072 | ("idle animation is default; calling is not allowed"); |
3073 | if (descr->is_animation_known(animation_name)) |
3074 | @@ -786,11 +786,11 @@ |
3075 | m_id = g_gr->animations().load(directory.c_str(), prof.get_safe_section(animation_name)); |
3076 | descr->add_animation(animation_name, m_id); |
3077 | } |
3078 | - if (not reached_end) { // The next parameter is the duration. |
3079 | + if (!reached_end) { // The next parameter is the duration. |
3080 | char * endp; |
3081 | long long int const value = strtoll(parameters, &endp, 0); |
3082 | m_duration = value; |
3083 | - if (*endp or value <= 0 or m_duration != value) |
3084 | + if (*endp || value <= 0 || m_duration != value) |
3085 | throw game_data_error |
3086 | ("expected %s but found \"%s\"", |
3087 | "duration in ms", parameters); |
3088 | @@ -819,7 +819,7 @@ |
3089 | m_groups.resize(m_groups.size() + 1); |
3090 | parse_ware_type_group |
3091 | (parameters, *m_groups.rbegin(), tribe, descr.inputs()); |
3092 | - if (not *parameters) |
3093 | + if (!*parameters) |
3094 | break; |
3095 | force_skip(parameters); |
3096 | } |
3097 | @@ -957,9 +957,9 @@ |
3098 | strtoull(parameters, &endp, 0); |
3099 | item.second = value; |
3100 | if |
3101 | - ((*endp and *endp != ' ') |
3102 | - or |
3103 | - value < 1 or item.second != value) |
3104 | + ((*endp && *endp != ' ') |
3105 | + || |
3106 | + value < 1 || item.second != value) |
3107 | throw game_data_error |
3108 | ("expected %s but found \"%s\"", |
3109 | "count", parameters); |
3110 | @@ -972,7 +972,7 @@ |
3111 | more = *parameters != '\0'; |
3112 | *parameters = '\0'; |
3113 | if |
3114 | - (not |
3115 | + (! |
3116 | descr.is_output_ware_type |
3117 | (item.first = tribe.safe_ware_index(ware))) |
3118 | throw game_data_error |
3119 | @@ -1058,9 +1058,9 @@ |
3120 | strtoull(parameters, &endp, 0); |
3121 | item.second = value; |
3122 | if |
3123 | - ((*endp and *endp != ' ') |
3124 | - or |
3125 | - value < 1 or item.second != value) |
3126 | + ((*endp && *endp != ' ') |
3127 | + || |
3128 | + value < 1 || item.second != value) |
3129 | throw game_data_error |
3130 | ("expected %s but found \"%s\"", |
3131 | "count", parameters); |
3132 | @@ -1073,7 +1073,7 @@ |
3133 | more = *parameters != '\0'; |
3134 | *parameters = '\0'; |
3135 | if |
3136 | - (not |
3137 | + (! |
3138 | descr.is_output_worker_type |
3139 | (item.first = tribe.safe_worker_index(worker))) |
3140 | throw game_data_error |
3141 | @@ -1141,7 +1141,7 @@ |
3142 | char * endp; |
3143 | unsigned long long int const value = strtoull(parameters, &endp, 0); |
3144 | m_distance = value; |
3145 | - if (*endp != ' ' or m_distance != value) |
3146 | + if (*endp != ' ' || m_distance != value) |
3147 | throw game_data_error |
3148 | ("expected %s but found \"%s\"", "distance", parameters); |
3149 | parameters = endp; |
3150 | @@ -1151,7 +1151,7 @@ |
3151 | char * endp; |
3152 | unsigned long long int const value = strtoull(parameters, &endp, 0); |
3153 | m_max = value; |
3154 | - if (*endp != ' ' or value < 1 or 100 < value) |
3155 | + if (*endp != ' ' || value < 1 || 100 < value) |
3156 | throw game_data_error |
3157 | ("expected %s but found \"%s\"", |
3158 | "percentage", parameters); |
3159 | @@ -1162,7 +1162,7 @@ |
3160 | char * endp; |
3161 | unsigned long long int const value = strtoull(parameters, &endp, 0); |
3162 | m_chance = value; |
3163 | - if (*endp != ' ' or value < 1 or 100 < value) |
3164 | + if (*endp != ' ' || value < 1 || 100 < value) |
3165 | throw game_data_error |
3166 | ("expected %s but found \"%s\"", |
3167 | "percentage", parameters); |
3168 | @@ -1172,7 +1172,7 @@ |
3169 | char * endp; |
3170 | unsigned long long int const value = strtoull(parameters, &endp, 0); |
3171 | m_training = value; |
3172 | - if (*endp or value < 1 or 100 < value) |
3173 | + if (*endp || value < 1 || 100 < value) |
3174 | throw game_data_error |
3175 | ("expected %s but found \"%s\"", |
3176 | "percentage", parameters); |
3177 | @@ -1235,7 +1235,7 @@ |
3178 | int32_t digged_percentage = 100; |
3179 | if (totalstart) |
3180 | digged_percentage = 100 - totalres * 100 / totalstart; |
3181 | - if (not totalres) |
3182 | + if (!totalres) |
3183 | digged_percentage = 100; |
3184 | |
3185 | if (digged_percentage < m_max) { |
3186 | @@ -1326,7 +1326,7 @@ |
3187 | ProductionProgram::ActCheck_Soldier::ActCheck_Soldier(char* parameters) { |
3188 | // TODO(unknown) This is currently hardcoded for "soldier", but should allow any |
3189 | // soldier type name. |
3190 | - if (not match_force_skip(parameters, "soldier")) |
3191 | + if (!match_force_skip(parameters, "soldier")) |
3192 | throw game_data_error |
3193 | ("expected %s but found \"%s\"", "soldier type", parameters); |
3194 | try { |
3195 | @@ -1346,7 +1346,7 @@ |
3196 | char * endp; |
3197 | unsigned long long int const value = strtoull(parameters, &endp, 0); |
3198 | level = value; |
3199 | - if (*endp or level != value) |
3200 | + if (*endp || level != value) |
3201 | throw game_data_error |
3202 | ("expected %s but found \"%s\"", "level", parameters); |
3203 | } catch (const _wexception & e) { |
3204 | @@ -1402,7 +1402,7 @@ |
3205 | ProductionProgram::ActTrain::ActTrain(char* parameters) { |
3206 | // TODO(unknown) This is currently hardcoded for "soldier", but should allow any |
3207 | // soldier type name. |
3208 | - if (not match_force_skip(parameters, "soldier")) |
3209 | + if (!match_force_skip(parameters, "soldier")) |
3210 | throw game_data_error |
3211 | ("expected %s but found \"%s\"", "soldier type", parameters); |
3212 | try { |
3213 | @@ -1423,7 +1423,7 @@ |
3214 | char * endp; |
3215 | unsigned long long int const value = strtoull(parameters, &endp, 0); |
3216 | level = value; |
3217 | - if (*endp != ' ' or level != value) |
3218 | + if (*endp != ' ' || level != value) |
3219 | throw game_data_error |
3220 | ("expected %s but found \"%s\"", "level", parameters); |
3221 | parameters = endp; |
3222 | @@ -1433,7 +1433,7 @@ |
3223 | char * endp; |
3224 | unsigned long long int const value = strtoull(parameters, &endp, 0); |
3225 | target_level = value; |
3226 | - if (*endp or target_level != value or target_level <= level) |
3227 | + if (*endp || target_level != value || target_level <= level) |
3228 | throw game_data_error |
3229 | ("expected level > %u but found \"%s\"", level, parameters); |
3230 | } |
3231 | @@ -1509,11 +1509,11 @@ |
3232 | std::string filename = next_word(parameters, reached_end); |
3233 | name = directory + "/" + filename; |
3234 | |
3235 | - if (not reached_end) { |
3236 | + if (!reached_end) { |
3237 | char * endp; |
3238 | unsigned long long int const value = strtoull(parameters, &endp, 0); |
3239 | priority = value; |
3240 | - if (*endp or priority != value) |
3241 | + if (*endp || priority != value) |
3242 | throw game_data_error |
3243 | ("expected %s but found \"%s\"", "priority", parameters); |
3244 | } else |
3245 | @@ -1689,31 +1689,31 @@ |
3246 | ProductionProgram::Action* action; |
3247 | if (not strcmp(v->get_name(), "return")) |
3248 | action = new ActReturn(v->get_string(), *building); |
3249 | - else if (not strcmp(v->get_name(), "call")) |
3250 | + else if (!strcmp(v->get_name(), "call")) |
3251 | action = new ActCall(v->get_string(), *building); |
3252 | - else if (not strcmp(v->get_name(), "sleep")) |
3253 | + else if (!strcmp(v->get_name(), "sleep")) |
3254 | action = new ActSleep(v->get_string()); |
3255 | - else if (not strcmp(v->get_name(), "animate")) |
3256 | + else if (!strcmp(v->get_name(), "animate")) |
3257 | action = new ActAnimate(v->get_string(), directory, prof, building); |
3258 | - else if (not strcmp(v->get_name(), "consume")) |
3259 | + else if (!strcmp(v->get_name(), "consume")) |
3260 | action = new ActConsume(v->get_string(), *building); |
3261 | - else if (not strcmp(v->get_name(), "produce")) |
3262 | + else if (!strcmp(v->get_name(), "produce")) |
3263 | action = new ActProduce(v->get_string(), *building); |
3264 | - else if (not strcmp(v->get_name(), "recruit")) |
3265 | + else if (!strcmp(v->get_name(), "recruit")) |
3266 | action = new ActRecruit(v->get_string(), *building); |
3267 | - else if (not strcmp(v->get_name(), "worker")) |
3268 | + else if (!strcmp(v->get_name(), "worker")) |
3269 | action = new ActWorker(v->get_string(), _name, building); |
3270 | - else if (not strcmp(v->get_name(), "mine")) |
3271 | + else if (!strcmp(v->get_name(), "mine")) |
3272 | action = new ActMine(v->get_string(), world, _name, building); |
3273 | - else if (not strcmp(v->get_name(), "check_soldier")) |
3274 | + else if (!strcmp(v->get_name(), "check_soldier")) |
3275 | action = new ActCheck_Soldier(v->get_string()); |
3276 | - else if (not strcmp(v->get_name(), "train")) |
3277 | + else if (!strcmp(v->get_name(), "train")) |
3278 | action = new ActTrain(v->get_string()); |
3279 | - else if (not strcmp(v->get_name(), "playFX")) |
3280 | + else if (!strcmp(v->get_name(), "playFX")) |
3281 | action = new ActPlayFX(directory, v->get_string()); |
3282 | - else if (not strcmp(v->get_name(), "construct")) |
3283 | + else if (!strcmp(v->get_name(), "construct")) |
3284 | action = new ActConstruct(v->get_string(), _name, building); |
3285 | - else if (not strcmp(v->get_name(), "check_map")) |
3286 | + else if (!strcmp(v->get_name(), "check_map")) |
3287 | action = new ActCheck_Map(v->get_string()); |
3288 | else |
3289 | throw game_data_error("unknown command type \"%s\"", v->get_name()); |
3290 | |
3291 | === modified file 'src/logic/productionsite.cc' |
3292 | --- src/logic/productionsite.cc 2014-07-23 04:47:30 +0000 |
3293 | +++ src/logic/productionsite.cc 2014-07-25 13:46:28 +0000 |
3294 | @@ -100,7 +100,7 @@ |
3295 | if (i.current->first == idx) |
3296 | throw wexception("duplicated"); |
3297 | int32_t const value = val->get_int(); |
3298 | - if (value < 1 or 255 < value) |
3299 | + if (value < 1 || 255 < value) |
3300 | throw wexception("count is out of range 1 .. 255"); |
3301 | m_inputs.push_back(std::pair<Ware_Index, uint8_t>(idx, value)); |
3302 | } else |
3303 | @@ -126,7 +126,7 @@ |
3304 | } catch (const _wexception & e) { |
3305 | throw wexception("%s=\"%s\": %s", v->get_name(), v->get_string(), e.what()); |
3306 | } |
3307 | - if (working_positions().empty() and not global_s.has_val("max_soldiers")) |
3308 | + if (working_positions().empty() && !global_s.has_val("max_soldiers")) |
3309 | throw wexception("no working/soldier positions"); |
3310 | |
3311 | // Get programs |
3312 | @@ -297,7 +297,7 @@ |
3313 | unsigned int lastPercOk = (lastOk * 100) / (STATISTICS_VECTOR_LENGTH / 2); |
3314 | |
3315 | std::string color; |
3316 | - if (percOk > (m_crude_percent / 10000) and percOk - (m_crude_percent / 10000) > 50) |
3317 | + if (percOk > (m_crude_percent / 10000) && percOk - (m_crude_percent / 10000) > 50) |
3318 | color = UI_FONT_CLR_IDLE_HEX; |
3319 | else if (percOk < 33) |
3320 | color = UI_FONT_CLR_BAD_HEX; |
3321 | @@ -322,7 +322,7 @@ |
3322 | const std::string trend_str = |
3323 | (boost::format("<font color=%s>%s</font>") % color % trend).str(); |
3324 | |
3325 | - if (0 < percOk and percOk < 100) { |
3326 | + if (0 < percOk && percOk < 100) { |
3327 | snprintf |
3328 | (m_statistics_buffer, sizeof(m_statistics_buffer), |
3329 | "%s %s", perc_str.c_str(), trend_str.c_str()); |
3330 | @@ -452,7 +452,7 @@ |
3331 | assigned = true; |
3332 | break; |
3333 | } |
3334 | - if (not assigned) |
3335 | + if (!assigned) |
3336 | return -1; |
3337 | |
3338 | if (upcast(Game, game, &egbase)) |
3339 | @@ -595,7 +595,7 @@ |
3340 | |
3341 | if |
3342 | (m_program_timer |
3343 | - and |
3344 | + && |
3345 | static_cast<int32_t>(game.get_gametime() - m_program_time) >= 0) |
3346 | { |
3347 | m_program_timer = false; |
3348 | @@ -689,7 +689,7 @@ |
3349 | |
3350 | |
3351 | void ProductionSite::try_start_working(Game & game) { |
3352 | - if (can_start_working() and descr().working_positions().size()) { |
3353 | + if (can_start_working() && descr().working_positions().size()) { |
3354 | Worker & main_worker = *m_working_positions[0].worker; |
3355 | main_worker.reset_tasks(game); |
3356 | main_worker.start_task_buildingwork(game); |
3357 | |
3358 | === modified file 'src/logic/requirements.cc' |
3359 | --- src/logic/requirements.cc 2014-07-05 12:17:03 +0000 |
3360 | +++ src/logic/requirements.cc 2014-07-25 13:46:28 +0000 |
3361 | @@ -30,7 +30,7 @@ |
3362 | |
3363 | bool Requirements::check(const Map_Object & obj) const |
3364 | { |
3365 | - return !m or m->check(obj); |
3366 | + return !m || m->check(obj); |
3367 | } |
3368 | |
3369 | #define REQUIREMENTS_VERSION 3 |
3370 | @@ -227,8 +227,8 @@ |
3371 | { |
3372 | tAttribute const at = static_cast<tAttribute>(fr.Unsigned32()); |
3373 | if |
3374 | - (at != atrHP and at != atrAttack and at != atrDefense and at != atrEvade |
3375 | - and |
3376 | + (at != atrHP && at != atrAttack && at != atrDefense && at != atrEvade |
3377 | + && |
3378 | at != atrTotal) |
3379 | throw game_data_error |
3380 | ( |
3381 | |
3382 | === modified file 'src/logic/single_player_game_settings_provider.cc' |
3383 | --- src/logic/single_player_game_settings_provider.cc 2014-07-16 19:23:38 +0000 |
3384 | +++ src/logic/single_player_game_settings_provider.cc 2014-07-25 13:46:28 +0000 |
3385 | @@ -220,8 +220,8 @@ |
3386 | PlayerSettings const position = settings().players.at(number); |
3387 | PlayerSettings const player = settings().players.at(settings().playernum); |
3388 | if |
3389 | - (number < settings().players.size() and |
3390 | - (position.state == PlayerSettings::stateOpen or |
3391 | + (number < settings().players.size() && |
3392 | + (position.state == PlayerSettings::stateOpen || |
3393 | position.state == PlayerSettings::stateComputer)) |
3394 | { |
3395 | setPlayer(number, player); |
3396 | |
3397 | === modified file 'src/logic/soldier.cc' |
3398 | --- src/logic/soldier.cc 2014-07-16 08:25:35 +0000 |
3399 | +++ src/logic/soldier.cc 2014-07-25 13:46:28 +0000 |
3400 | @@ -60,10 +60,10 @@ |
3401 | * remove spaces at the beginning or the end of a string |
3402 | */ |
3403 | void remove_spaces(std::string& s) { |
3404 | - while (s[0] == ' ' or s[0] == '\t' or s[0] == '\n') |
3405 | + while (s[0] == ' ' || s[0] == '\t' || s[0] == '\n') |
3406 | s.erase(0, 1); |
3407 | |
3408 | - while (*s.rbegin() == ' ' or * s.rbegin() == '\t' or * s.rbegin() == '\n') |
3409 | + while (*s.rbegin() == ' ' || * s.rbegin() == '\t' || * s.rbegin() == '\n') |
3410 | s.erase(s.size() - 1, 1); |
3411 | } |
3412 | |
3413 | @@ -91,12 +91,12 @@ |
3414 | remove_spaces(*i.current); |
3415 | char * endp; |
3416 | m_min_attack = strtol(list[0].c_str(), &endp, 0); |
3417 | - if (*endp or 0 == m_min_attack) |
3418 | + if (*endp || 0 == m_min_attack) |
3419 | throw game_data_error |
3420 | ("expected %s but found \"%s\"", |
3421 | "positive integer", list[0].c_str()); |
3422 | m_max_attack = strtol(list[1].c_str(), &endp, 0); |
3423 | - if (*endp or m_max_attack < m_min_attack) |
3424 | + if (*endp || m_max_attack < m_min_attack) |
3425 | throw game_data_error |
3426 | ("expected positive integer >= %u but found \"%s\"", |
3427 | m_min_attack, list[1].c_str()); |
3428 | @@ -988,13 +988,13 @@ |
3429 | } |
3430 | |
3431 | if |
3432 | - (!enemy or |
3433 | - ((state.ivar1 & CF_RETREAT_WHEN_INJURED) and |
3434 | - state.ui32var3 > get_current_hitpoints() and |
3435 | + (!enemy || |
3436 | + ((state.ivar1 & CF_RETREAT_WHEN_INJURED) && |
3437 | + state.ui32var3 > get_current_hitpoints() && |
3438 | defenders > 0)) |
3439 | { |
3440 | // Injured soldiers will try to return to safe site at home. |
3441 | - if (state.ui32var3 > get_current_hitpoints() and defenders) { |
3442 | + if (state.ui32var3 > get_current_hitpoints() && defenders) { |
3443 | state.coords = Coords::Null(); |
3444 | state.objvar1 = nullptr; |
3445 | } |
3446 | @@ -1004,12 +1004,12 @@ |
3447 | if (state.coords) { |
3448 | BaseImmovable * const newimm = game.map()[state.coords].get_immovable(); |
3449 | upcast(MilitarySite, newsite, newimm); |
3450 | - if (newsite and (&newsite->owner() == &owner())) { |
3451 | + if (newsite && (&newsite->owner() == &owner())) { |
3452 | if (upcast(SoldierControl, ctrl, newsite)) { |
3453 | state.objvar1 = nullptr; |
3454 | // We may also have our location destroyed in between |
3455 | if |
3456 | - (ctrl->stationedSoldiers().size() < ctrl->soldierCapacity() and |
3457 | + (ctrl->stationedSoldiers().size() < ctrl->soldierCapacity() && |
3458 | (!location || location->base_flag().get_position() |
3459 | != |
3460 | newsite ->base_flag().get_position())) |
3461 | @@ -1078,8 +1078,8 @@ |
3462 | { |
3463 | if (upcast(Soldier, soldier, bob)) { |
3464 | return |
3465 | - soldier->get_current_hitpoints() and |
3466 | - soldier->is_attacking_player(game, player) and |
3467 | + soldier->get_current_hitpoints() && |
3468 | + soldier->is_attacking_player(game, player) && |
3469 | soldier->owner().is_hostile(player); |
3470 | } |
3471 | return false; |
3472 | @@ -1169,7 +1169,7 @@ |
3473 | * Attempt to fix a crash when player bulldozes a building being defended |
3474 | * by soldiers. |
3475 | */ |
3476 | - if (not location) |
3477 | + if (!location) |
3478 | return pop_task(game); |
3479 | |
3480 | Flag & baseflag = location->base_flag(); |
3481 | @@ -1186,7 +1186,7 @@ |
3482 | |
3483 | // If we only are defending our home ... |
3484 | if (state.ivar1 & CF_DEFEND_STAYHOME) { |
3485 | - if (position == location and state.ivar2 == 1) { |
3486 | + if (position == location && state.ivar2 == 1) { |
3487 | molog("[defense] stayhome: returned home\n"); |
3488 | return pop_task_or_fight(game); |
3489 | } |
3490 | @@ -1233,8 +1233,8 @@ |
3491 | FindBobSoldierAttackingPlayer(game, *get_owner())); |
3492 | |
3493 | if |
3494 | - (soldiers.empty() or |
3495 | - ((state.ivar1 & CF_RETREAT_WHEN_INJURED) and |
3496 | + (soldiers.empty() || |
3497 | + ((state.ivar1 & CF_RETREAT_WHEN_INJURED) && |
3498 | get_current_hitpoints() < state.ui32var3)) |
3499 | { |
3500 | |
3501 | @@ -1290,7 +1290,7 @@ |
3502 | // Check soldier, be sure that we can fight against soldier. |
3503 | // Soldiers can not go over enemy land when defending. |
3504 | if |
3505 | - ((soldier->canBeChallenged()) and |
3506 | + ((soldier->canBeChallenged()) && |
3507 | (f.get_owned_by() == get_owner()->player_number())) |
3508 | { |
3509 | uint32_t thisDist = game.map().calc_distance |
3510 | @@ -1510,7 +1510,7 @@ |
3511 | } |
3512 | } |
3513 | } else { |
3514 | - if (opponent.stayHome() and (this == m_battle->second())) { |
3515 | + if (opponent.stayHome() && (this == m_battle->second())) { |
3516 | // Wait until correct roles are assigned |
3517 | new Battle(game, *m_battle->second(), *m_battle->first()); |
3518 | return schedule_act(game, 10); |
3519 | @@ -1682,7 +1682,7 @@ |
3520 | { |
3521 | if (upcast(Soldier, soldier, bob)) |
3522 | return |
3523 | - soldier->isOnBattlefield() and |
3524 | + soldier->isOnBattlefield() && |
3525 | soldier->get_current_hitpoints(); |
3526 | return false; |
3527 | } |
3528 | @@ -1703,7 +1703,7 @@ |
3529 | |
3530 | if |
3531 | (!attackdefense || |
3532 | - ((attackdefense->ivar1 & CF_RETREAT_WHEN_INJURED) and |
3533 | + ((attackdefense->ivar1 & CF_RETREAT_WHEN_INJURED) && |
3534 | attackdefense->ui32var3 > get_current_hitpoints())) |
3535 | { |
3536 | // Retreating or non-combatant soldiers act like normal bobs |
3537 | |
3538 | === modified file 'src/logic/trainingsite.cc' |
3539 | --- src/logic/trainingsite.cc 2014-07-22 09:54:49 +0000 |
3540 | +++ src/logic/trainingsite.cc 2014-07-25 13:46:28 +0000 |
3541 | @@ -208,7 +208,7 @@ |
3542 | |
3543 | container_iterate_const(std::vector<Soldier *>, m_soldiers, i) { |
3544 | (*i.current)->set_location_initially(*this); |
3545 | - assert(not (*i.current)->get_state()); // Should be newly created. |
3546 | + assert(!(*i.current)->get_state()); // Should be newly created. |
3547 | |
3548 | if (game) |
3549 | (*i.current)->start_task_idle(*game, 0, -1); |
3550 | |
3551 | === modified file 'src/logic/tribe.cc' |
3552 | --- src/logic/tribe.cc 2014-07-22 09:54:49 +0000 |
3553 | +++ src/logic/tribe.cc 2014-07-25 13:46:28 +0000 |
3554 | @@ -105,7 +105,7 @@ |
3555 | (_name, _descname, path, prof, global_s, *this); \ |
3556 | Ware_Index const worker_idx = m_workers.add(&worker_descr); \ |
3557 | if \ |
3558 | - (worker_descr.is_buildable() and \ |
3559 | + (worker_descr.is_buildable() && \ |
3560 | worker_descr.buildcost().empty()) \ |
3561 | m_worker_types_without_cost.push_back(worker_idx); \ |
3562 | PARSE_MAP_OBJECT_TYPES_END; |
3563 | @@ -384,7 +384,7 @@ |
3564 | uint32_t Tribe_Descr::get_resource_indicator |
3565 | (ResourceDescription const * const res, uint32_t const amount) const |
3566 | { |
3567 | - if (not res or not amount) { |
3568 | + if (!res || !amount) { |
3569 | int32_t idx = get_immovable_index("resi_none"); |
3570 | if (idx == -1) |
3571 | throw game_data_error |
3572 | @@ -405,7 +405,7 @@ |
3573 | ++num_indicators; |
3574 | } |
3575 | |
3576 | - if (not num_indicators) |
3577 | + if (!num_indicators) |
3578 | throw game_data_error |
3579 | ("tribe %s does not declare a resource indicator for resource %s", |
3580 | name().c_str(), |
3581 | |
3582 | === modified file 'src/logic/warehouse.cc' |
3583 | --- src/logic/warehouse.cc 2014-07-22 09:54:49 +0000 |
3584 | +++ src/logic/warehouse.cc 2014-07-25 13:46:28 +0000 |
3585 | @@ -372,7 +372,7 @@ |
3586 | for (uint8_t i = worker_types_without_cost.size(); i;) { |
3587 | Ware_Index const worker_index = worker_types_without_cost.at(--i); |
3588 | if |
3589 | - (owner().is_worker_type_allowed(worker_index) and |
3590 | + (owner().is_worker_type_allowed(worker_index) && |
3591 | m_next_worker_without_cost_spawn[i] == static_cast<uint32_t>(Never())) |
3592 | { |
3593 | if (next_spawn == static_cast<uint32_t>(Never())) |
3594 | @@ -610,7 +610,7 @@ |
3595 | Soldier * soldier = static_cast<Soldier *>(*it); |
3596 | |
3597 | // Soldier dead ... |
3598 | - if (not soldier or soldier->get_current_hitpoints() == 0) { |
3599 | + if (!soldier || soldier->get_current_hitpoints() == 0) { |
3600 | it = soldiers.erase(it); |
3601 | m_supply->remove_workers(ware, 1); |
3602 | continue; |
3603 | @@ -950,14 +950,14 @@ |
3604 | |
3605 | |
3606 | bool Warehouse::can_create_worker(Game &, Ware_Index const worker) const { |
3607 | - if (not (worker < m_supply->get_workers().get_nrwareids())) |
3608 | + if (!(worker < m_supply->get_workers().get_nrwareids())) |
3609 | throw wexception |
3610 | ("worker type %d does not exists (max is %d)", |
3611 | worker, m_supply->get_workers().get_nrwareids()); |
3612 | |
3613 | const Worker_Descr & w_desc = *descr().tribe().get_worker_descr(worker); |
3614 | assert(&w_desc); |
3615 | - if (not w_desc.is_buildable()) |
3616 | + if (!w_desc.is_buildable()) |
3617 | return false; |
3618 | |
3619 | // see if we have the resources |
3620 | |
3621 | === modified file 'src/logic/warelist.h' |
3622 | --- src/logic/warelist.h 2014-07-05 16:41:51 +0000 |
3623 | +++ src/logic/warelist.h 2014-07-25 13:46:28 +0000 |
3624 | @@ -59,7 +59,7 @@ |
3625 | } |
3626 | |
3627 | bool operator== (const WareList &) const; |
3628 | - bool operator!= (const WareList & wl) const {return not (*this == wl);} |
3629 | + bool operator!= (const WareList & wl) const {return !(*this == wl);} |
3630 | |
3631 | mutable boost::signals2::signal<void ()> changed; |
3632 | |
3633 | |
3634 | === modified file 'src/logic/widelands.h' |
3635 | --- src/logic/widelands.h 2014-07-22 09:54:49 +0000 |
3636 | +++ src/logic/widelands.h 2014-07-25 13:46:28 +0000 |
3637 | @@ -72,19 +72,19 @@ |
3638 | uint8_t hp, attack, defense, evade; |
3639 | bool operator== (const Soldier_Strength & other) const { |
3640 | return |
3641 | - hp == other.hp and |
3642 | - attack == other.attack and |
3643 | - defense == other.defense and |
3644 | + hp == other.hp && |
3645 | + attack == other.attack && |
3646 | + defense == other.defense && |
3647 | evade == other.evade; |
3648 | } |
3649 | bool operator< (const Soldier_Strength & other) const { |
3650 | return |
3651 | - hp < other.hp or |
3652 | - (hp == other.hp and |
3653 | - (attack < other.attack or |
3654 | - (attack == other.attack and |
3655 | - (defense < other.defense or |
3656 | - (defense == other.defense and |
3657 | + hp < other.hp || |
3658 | + (hp == other.hp && |
3659 | + (attack < other.attack || |
3660 | + (attack == other.attack && |
3661 | + (defense < other.defense || |
3662 | + (defense == other.defense && |
3663 | evade < other.evade))))); |
3664 | } |
3665 | }; |
3666 | |
3667 | === modified file 'src/logic/widelands_geometry.cc' |
3668 | --- src/logic/widelands_geometry.cc 2014-06-21 16:01:35 +0000 |
3669 | +++ src/logic/widelands_geometry.cc 2014-07-25 13:46:28 +0000 |
3670 | @@ -28,11 +28,11 @@ |
3671 | {} |
3672 | |
3673 | bool Coords::operator== (const Coords& other) const { |
3674 | - return x == other.x and y == other.y; |
3675 | + return x == other.x && y == other.y; |
3676 | } |
3677 | |
3678 | bool Coords::operator!= (const Coords & other) const { |
3679 | - return not (*this == other); |
3680 | + return !(*this == other); |
3681 | } |
3682 | |
3683 | Coords::operator bool() const { |
3684 | @@ -44,7 +44,7 @@ |
3685 | if (y < new_origin.y) |
3686 | y += extent.h; |
3687 | y -= new_origin.y; |
3688 | - if ((y & 1)and(new_origin.y & 1) and++ new_origin.x == extent.w) |
3689 | + if ((y & 1) && (new_origin.y & 1) && ++ new_origin.x == extent.w) |
3690 | new_origin.x = 0; |
3691 | if (x < new_origin.x) |
3692 | x += extent.w; |
3693 | |
3694 | === modified file 'src/logic/widelands_geometry.h' |
3695 | --- src/logic/widelands_geometry.h 2014-07-05 16:41:51 +0000 |
3696 | +++ src/logic/widelands_geometry.h 2014-07-25 13:46:28 +0000 |
3697 | @@ -79,10 +79,10 @@ |
3698 | {} |
3699 | |
3700 | bool operator== (const Area& other) const { |
3701 | - return Coords_type::operator== (other) and radius == other.radius; |
3702 | + return Coords_type::operator== (other) && radius == other.radius; |
3703 | } |
3704 | bool operator!= (const Area& other) const { |
3705 | - return Coords_type::operator!= (other) or radius != other.radius; |
3706 | + return Coords_type::operator!= (other) || radius != other.radius; |
3707 | } |
3708 | |
3709 | Radius_type radius; |
3710 | @@ -96,10 +96,10 @@ |
3711 | |
3712 | bool operator== (const HollowArea& other) const { |
3713 | return |
3714 | - Area_type::operator== (other) and hole_radius == other.hole_radius; |
3715 | + Area_type::operator== (other) && hole_radius == other.hole_radius; |
3716 | } |
3717 | bool operator!= (const HollowArea& other) const { |
3718 | - return not (*this == other); |
3719 | + return !(*this == other); |
3720 | } |
3721 | |
3722 | typename Area_type::Radius_type hole_radius; |
3723 | @@ -133,10 +133,10 @@ |
3724 | {} |
3725 | |
3726 | bool operator== (const TCoords& other) const { |
3727 | - return Coords_type::operator== (other) and t == other.t; |
3728 | + return Coords_type::operator== (other) && t == other.t; |
3729 | } |
3730 | bool operator!= (const TCoords& other) const { |
3731 | - return Coords_type::operator!= (other) or t != other.t; |
3732 | + return Coords_type::operator!= (other) || t != other.t; |
3733 | } |
3734 | |
3735 | TriangleIndex t; |
3736 | @@ -155,10 +155,10 @@ |
3737 | {} |
3738 | |
3739 | bool operator== (Node_and_Triangle<> const other) const { |
3740 | - return node == other.node and triangle == other.triangle; |
3741 | + return node == other.node && triangle == other.triangle; |
3742 | } |
3743 | bool operator!= (Node_and_Triangle<> const other) const { |
3744 | - return not (*this == other); |
3745 | + return !(*this == other); |
3746 | } |
3747 | |
3748 | Node_Coords_type node; |
3749 | |
3750 | === modified file 'src/logic/widelands_geometry_io.cc' |
3751 | --- src/logic/widelands_geometry_io.cc 2014-05-11 07:38:01 +0000 |
3752 | +++ src/logic/widelands_geometry_io.cc 2014-07-25 13:46:28 +0000 |
3753 | @@ -94,8 +94,8 @@ |
3754 | } |
3755 | |
3756 | void WriteCoords32(StreamWrite* wr, const Coords& c) { |
3757 | - assert(static_cast<uint16_t>(c.x) < 0x8000 or c.x == -1); |
3758 | - assert(static_cast<uint16_t>(c.y) < 0x8000 or c.y == -1); |
3759 | + assert(static_cast<uint16_t>(c.x) < 0x8000 || c.x == -1); |
3760 | + assert(static_cast<uint16_t>(c.y) < 0x8000 || c.y == -1); |
3761 | { |
3762 | uint16_t const x = Little16(c.x); |
3763 | wr->Data(&x, 2); |
3764 | |
3765 | === modified file 'src/logic/worker.cc' |
3766 | --- src/logic/worker.cc 2014-07-24 05:21:20 +0000 |
3767 | +++ src/logic/worker.cc 2014-07-25 13:46:28 +0000 |
3768 | @@ -646,7 +646,7 @@ |
3769 | |
3770 | // Walk towards it |
3771 | if |
3772 | - (not |
3773 | + (! |
3774 | start_task_movepath |
3775 | (game, |
3776 | dest, |
3777 | @@ -1072,7 +1072,7 @@ |
3778 | */ |
3779 | void Worker::set_location(PlayerImmovable * const location) |
3780 | { |
3781 | - assert(not location or Object_Ptr(location).get(owner().egbase())); |
3782 | + assert(!location || Object_Ptr(location).get(owner().egbase())); |
3783 | |
3784 | PlayerImmovable * const oldlocation = get_location(owner().egbase()); |
3785 | if (oldlocation == location) |
3786 | @@ -1486,7 +1486,7 @@ |
3787 | } else if (upcast(Road, road, nextstep)) { // Flag to Road |
3788 | if |
3789 | (&road->get_flag(Road::FlagStart) != location |
3790 | - and |
3791 | + && |
3792 | &road->get_flag(Road::FlagEnd) != location) |
3793 | throw wexception |
3794 | ("MO(%u): [transfer]: nextstep is road, but we are nowhere near", |
3795 | @@ -1696,7 +1696,7 @@ |
3796 | // state pointer might become invalid |
3797 | state.ivar1 = 1; |
3798 | |
3799 | - if (not building->get_building_work(game, *this, success)) { |
3800 | + if (!building->get_building_work(game, *this, success)) { |
3801 | set_animation(game, 0); |
3802 | return skip_act(); |
3803 | } |
3804 | @@ -1820,7 +1820,7 @@ |
3805 | // Determine the building's flag and move to it |
3806 | |
3807 | if |
3808 | - (not |
3809 | + (! |
3810 | start_task_movepath |
3811 | (game, |
3812 | location->base_flag().get_position(), |
3813 | @@ -2185,7 +2185,7 @@ |
3814 | |
3815 | state.ivar1 = 1; // force return to building |
3816 | |
3817 | - if (not location) { |
3818 | + if (!location) { |
3819 | // this can happen if the flag (and the building) is destroyed while |
3820 | // the worker leaves the building. |
3821 | molog |
3822 | @@ -2216,7 +2216,7 @@ |
3823 | descr().get_right_walk_anims(does_carry_ware()), true); |
3824 | } |
3825 | |
3826 | - if (not dynamic_cast<Building const *>(location)) { |
3827 | + if (!dynamic_cast<Building const *>(location)) { |
3828 | // This can happen "naturally" if the building gets destroyed, but the |
3829 | // flag is still there and the worker tries to enter from that flag. |
3830 | // E.g. the player destroyed the building, it is destroyed, through an |
3831 | @@ -2510,7 +2510,7 @@ |
3832 | |
3833 | // check whether we're on a flag and it's time to return home |
3834 | if (upcast(Flag, flag, map[get_position()].get_immovable())) { |
3835 | - if (&flag->owner() == &owner() and flag->economy().warehouses().size()) { |
3836 | + if (&flag->owner() == &owner() && flag->economy().warehouses().size()) { |
3837 | set_location(flag); |
3838 | return pop_task(game); |
3839 | } |
3840 | @@ -2650,11 +2650,11 @@ |
3841 | BaseImmovable * const imm = map.get_immovable(get_position()); |
3842 | |
3843 | if |
3844 | - (not imm |
3845 | - or |
3846 | + (!imm |
3847 | + || |
3848 | (imm->get_size() == BaseImmovable::NONE |
3849 | - and |
3850 | - not imm->has_attribute(RESI))) |
3851 | + && |
3852 | + !imm->has_attribute(RESI))) |
3853 | { |
3854 | --state.ivar1; |
3855 | return start_task_program(game, state.svar1); |
3856 | @@ -2732,7 +2732,7 @@ |
3857 | return pop_task(game); |
3858 | |
3859 | if |
3860 | - (not |
3861 | + (! |
3862 | start_task_movepath |
3863 | (game, owner_area, 0, descr().get_right_walk_anims(does_carry_ware()))) |
3864 | { |
3865 | @@ -2854,7 +2854,7 @@ |
3866 | |
3867 | if |
3868 | (dist > oldest_distance |
3869 | - || (dist == oldest_distance and time < oldest_time)) |
3870 | + || (dist == oldest_distance && time < oldest_time)) |
3871 | { |
3872 | oldest_distance = dist; |
3873 | oldest_time = time; |
3874 | |
3875 | === modified file 'src/logic/worker.h' |
3876 | --- src/logic/worker.h 2014-07-23 16:01:30 +0000 |
3877 | +++ src/logic/worker.h 2014-07-25 13:46:28 +0000 |
3878 | @@ -92,7 +92,7 @@ |
3879 | /// should be there already). The worker must already be in the same economy |
3880 | /// as the location. |
3881 | void set_location_initially(PlayerImmovable & location) { |
3882 | - assert(not m_location.is_set()); |
3883 | + assert(!m_location.is_set()); |
3884 | assert(location.serial()); |
3885 | assert(m_economy); |
3886 | assert(m_economy == location.get_economy()); |
3887 | |
3888 | === modified file 'src/map_io/s2map.cc' |
3889 | --- src/map_io/s2map.cc 2014-07-23 14:49:10 +0000 |
3890 | +++ src/map_io/s2map.cc 2014-07-25 13:46:28 +0000 |
3891 | @@ -174,11 +174,11 @@ |
3892 | std::unique_ptr<uint8_t[]> section; |
3893 | memcpy(buffer, fr.Data(6), 6); |
3894 | if |
3895 | - (buffer[0] != 0x10 or |
3896 | - buffer[1] != 0x27 or |
3897 | - buffer[2] != 0x00 or |
3898 | - buffer[3] != 0x00 or |
3899 | - buffer[4] != 0x00 or |
3900 | + (buffer[0] != 0x10 || |
3901 | + buffer[1] != 0x27 || |
3902 | + buffer[2] != 0x00 || |
3903 | + buffer[3] != 0x00 || |
3904 | + buffer[4] != 0x00 || |
3905 | buffer[5] != 0x00) |
3906 | { |
3907 | cerr << "Section marker not found" << endl; |
3908 | |
3909 | === modified file 'src/map_io/widelands_map_building_data_packet.cc' |
3910 | --- src/map_io/widelands_map_building_data_packet.cc 2014-07-14 21:52:13 +0000 |
3911 | +++ src/map_io/widelands_map_building_data_packet.cc 2014-07-25 13:46:28 +0000 |
3912 | @@ -131,7 +131,7 @@ |
3913 | Extent const extent = map.extent(); |
3914 | iterate_Map_FCoords(map, extent, fc) { |
3915 | upcast(Building const, building, fc.field->get_immovable()); |
3916 | - if (building and building->get_position() == fc) { |
3917 | + if (building && building->get_position() == fc) { |
3918 | // We only write Buildings. |
3919 | // Buildings can life on only one main position. |
3920 | assert(!mos.is_object_known(*building)); |
3921 | |
3922 | === modified file 'src/map_io/widelands_map_buildingdata_data_packet.cc' |
3923 | --- src/map_io/widelands_map_buildingdata_data_packet.cc 2014-07-16 08:25:35 +0000 |
3924 | +++ src/map_io/widelands_map_buildingdata_data_packet.cc 2014-07-25 13:46:28 +0000 |
3925 | @@ -80,13 +80,13 @@ |
3926 | |
3927 | try { |
3928 | uint16_t const packet_version = fr.Unsigned16(); |
3929 | - if (1 <= packet_version and packet_version <= CURRENT_PACKET_VERSION) { |
3930 | + if (1 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) { |
3931 | for (;;) { |
3932 | - if (2 <= packet_version and fr.EndOfFile()) |
3933 | + if (2 <= packet_version && fr.EndOfFile()) |
3934 | break; |
3935 | Serial const serial = fr.Unsigned32(); |
3936 | - if (packet_version < 2 and serial == 0xffffffff) { |
3937 | - if (not fr.EndOfFile()) |
3938 | + if (packet_version < 2 && serial == 0xffffffff) { |
3939 | + if (!fr.EndOfFile()) |
3940 | throw game_data_error |
3941 | ("expected end of file after serial 0xffffffff"); |
3942 | break; |
3943 | @@ -478,7 +478,7 @@ |
3944 | try { |
3945 | uint16_t const packet_version = fr.Unsigned16(); |
3946 | if |
3947 | - (1 <= packet_version and |
3948 | + (1 <= packet_version && |
3949 | packet_version <= CURRENT_WAREHOUSE_PACKET_VERSION) |
3950 | { |
3951 | Ware_Index const nr_wares = warehouse.descr().tribe().get_nrwares(); |
3952 | @@ -617,7 +617,7 @@ |
3953 | } else |
3954 | for (;;) { |
3955 | char const * const worker_typename = fr.CString (); |
3956 | - if (not *worker_typename) // encountered the terminator ("") |
3957 | + if (!*worker_typename) // encountered the terminator ("") |
3958 | break; |
3959 | uint32_t const next_spawn = fr.Unsigned32(); |
3960 | Ware_Index const worker_index = |
3961 | @@ -852,7 +852,7 @@ |
3962 | try { |
3963 | uint16_t const packet_version = fr.Unsigned16(); |
3964 | if |
3965 | - (1 <= packet_version and |
3966 | + (1 <= packet_version && |
3967 | packet_version <= CURRENT_PRODUCTIONSITE_PACKET_VERSION) |
3968 | { |
3969 | ProductionSite::Working_Position & wp_begin = |
3970 | @@ -923,9 +923,9 @@ |
3971 | uint32_t count = j->second; |
3972 | assert(count); |
3973 | if (worker_descr.can_act_as(j->first)) { |
3974 | - while (wp->worker or wp->worker_request) { |
3975 | + while (wp->worker || wp->worker_request) { |
3976 | ++wp; |
3977 | - if (not --count) |
3978 | + if (!--count) |
3979 | goto end_working_position; |
3980 | } |
3981 | break; |
3982 | @@ -1504,7 +1504,7 @@ |
3983 | fw.Unsigned16(nr_workers); |
3984 | for (ProductionSite::Working_Position const * i = &begin; i < &end; ++i) |
3985 | if (Worker const * const w = i->worker) { |
3986 | - assert(not i->worker_request); |
3987 | + assert(!i->worker_request); |
3988 | assert(mos.is_object_known(*w)); |
3989 | fw.Unsigned32(mos.get_object_file_index(*w)); |
3990 | } |
3991 | |
3992 | === modified file 'src/map_io/widelands_map_extradata_data_packet.cc' |
3993 | --- src/map_io/widelands_map_extradata_data_packet.cc 2014-07-15 18:38:06 +0000 |
3994 | +++ src/map_io/widelands_map_extradata_data_packet.cc 2014-07-25 13:46:28 +0000 |
3995 | @@ -47,7 +47,7 @@ |
3996 | prof.get_safe_section("global").get_safe_int("packet_version"); |
3997 | if (packet_version == CURRENT_PACKET_VERSION) { |
3998 | // Read all pics. |
3999 | - if (fs.FileExists("pics") and fs.IsDirectory("pics")) { |
4000 | + if (fs.FileExists("pics") && fs.IsDirectory("pics")) { |
4001 | filenameset_t pictures = fs.ListDirectory("pics"); |
4002 | for |
4003 | (filenameset_t::iterator pname = pictures.begin(); |
4004 | |
4005 | === modified file 'src/map_io/widelands_map_flagdata_data_packet.cc' |
4006 | --- src/map_io/widelands_map_flagdata_data_packet.cc 2014-07-03 19:26:30 +0000 |
4007 | +++ src/map_io/widelands_map_flagdata_data_packet.cc 2014-07-25 13:46:28 +0000 |
4008 | @@ -54,15 +54,15 @@ |
4009 | |
4010 | try { |
4011 | uint16_t const packet_version = fr.Unsigned16(); |
4012 | - if (1 <= packet_version and packet_version <= CURRENT_PACKET_VERSION) { |
4013 | + if (1 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) { |
4014 | const Map & map = egbase.map(); |
4015 | Extent const extent = map.extent(); |
4016 | for (;;) { |
4017 | - if (2 <= packet_version and fr.EndOfFile()) |
4018 | + if (2 <= packet_version && fr.EndOfFile()) |
4019 | break; |
4020 | Serial const serial = fr.Unsigned32(); |
4021 | - if (packet_version < 2 and serial == 0xffffffff) { |
4022 | - if (not fr.EndOfFile()) |
4023 | + if (packet_version < 2 && serial == 0xffffffff) { |
4024 | + if (!fr.EndOfFile()) |
4025 | throw game_data_error |
4026 | ("expected end of file after serial 0xffffffff"); |
4027 | break; |
4028 | |
4029 | === modified file 'src/map_io/widelands_map_players_messages_data_packet.cc' |
4030 | --- src/map_io/widelands_map_players_messages_data_packet.cc 2014-06-08 21:02:17 +0000 |
4031 | +++ src/map_io/widelands_map_players_messages_data_packet.cc 2014-07-25 13:46:28 +0000 |
4032 | @@ -123,9 +123,9 @@ |
4033 | Message::Status status = Message::Archived; // default status |
4034 | if (char const * const status_string = s->get_string("status")) { |
4035 | try { |
4036 | - if (not strcmp(status_string, "new")) |
4037 | + if (!strcmp(status_string, "new")) |
4038 | status = Message::New; |
4039 | - else if (not strcmp(status_string, "read")) |
4040 | + else if (!strcmp(status_string, "read")) |
4041 | status = Message::Read; |
4042 | else |
4043 | throw game_data_error |
4044 | @@ -184,10 +184,10 @@ |
4045 | const Message & message = *i.current->second; |
4046 | assert(message.sent() <= static_cast<uint32_t>(egbase.get_gametime())); |
4047 | assert |
4048 | - (message.duration() == Forever() or |
4049 | + (message.duration() == Forever() || |
4050 | message.sent() < message.sent() + message.duration()); |
4051 | if |
4052 | - (message.duration() != Forever() and |
4053 | + (message.duration() != Forever() && |
4054 | message.sent() + message.duration() |
4055 | < |
4056 | static_cast<uint32_t>(egbase.get_gametime())) |
4057 | @@ -208,7 +208,7 @@ |
4058 | message.status() == Message::Read ? "read" : |
4059 | message.status() == Message::Archived ? "archived" : "ERROR"); |
4060 | assert |
4061 | - (message.duration() == Forever() or |
4062 | + (message.duration() == Forever() || |
4063 | static_cast<uint32_t>(egbase.get_gametime()) |
4064 | <= |
4065 | message.sent() + message.duration()); |
4066 | |
4067 | === modified file 'src/map_io/widelands_map_players_view_data_packet.cc' |
4068 | --- src/map_io/widelands_map_players_view_data_packet.cc 2014-07-23 14:49:10 +0000 |
4069 | +++ src/map_io/widelands_map_players_view_data_packet.cc 2014-07-25 13:46:28 +0000 |
4070 | @@ -162,7 +162,7 @@ |
4071 | } |
4072 | |
4073 | #define CHECK_TRAILING_BYTES(file, filename) \ |
4074 | - if (not(file).EndOfFile()) \ |
4075 | + if (!(file).EndOfFile()) \ |
4076 | throw game_data_error("Map_Players_View_Data_Packet::Read: player %u:" \ |
4077 | "Found %lu trailing bytes in \"%s\"", \ |
4078 | plnum, \ |
4079 | @@ -171,7 +171,7 @@ |
4080 | |
4081 | // TODO(unknown) Legacy code deprecated since build18 |
4082 | template <uint8_t const Size> struct BitInBuffer { |
4083 | - static_assert(Size == 1 or Size == 2 or Size == 4, "Unexpected Size."); |
4084 | + static_assert(Size == 1 || Size == 2 || Size == 4, "Unexpected Size."); |
4085 | BitInBuffer(FileRead* fr) : buffer(0), mask(0x00) { |
4086 | m_fr = fr; |
4087 | } |
4088 | @@ -991,10 +991,10 @@ |
4089 | { |
4090 | Map_Object_Descr const * const map_object_descr = map_object_data->map_object_descr; |
4091 | const Player::Constructionsite_Information & csi = map_object_data->csi; |
4092 | - assert(not Road::IsRoadDescr(map_object_descr)); |
4093 | + assert(!Road::IsRoadDescr(map_object_descr)); |
4094 | uint8_t immovable_kind = 255; |
4095 | |
4096 | - if (not map_object_descr) |
4097 | + if (!map_object_descr) |
4098 | immovable_kind = 0; |
4099 | else if (upcast(Immovable_Descr const, immovable_descr, map_object_descr)) { |
4100 | immovable_kind = 1; |
4101 | @@ -1094,7 +1094,7 @@ |
4102 | |
4103 | vision_file.Unsigned32(f_player_field.vision); |
4104 | |
4105 | - if (not f_seen) { |
4106 | + if (!f_seen) { |
4107 | |
4108 | if (f_everseen) { // node |
4109 | unseen_times_file.Unsigned32 |
4110 | @@ -1119,7 +1119,7 @@ |
4111 | if |
4112 | // the player does not see the D triangle now but has |
4113 | // seen it |
4114 | - (not bl_seen & not br_seen & |
4115 | + (!bl_seen & !br_seen & |
4116 | (f_everseen | bl_everseen | br_everseen)) |
4117 | { |
4118 | terrains_file.Unsigned8(f_player_field.terrains.d); |
4119 | @@ -1130,7 +1130,7 @@ |
4120 | if |
4121 | // the player does not see the R triangle now but has |
4122 | // seen it |
4123 | - (not br_seen & not r_seen & |
4124 | + (!br_seen & !r_seen & |
4125 | (f_everseen | br_everseen | r_everseen)) |
4126 | { |
4127 | terrains_file.Unsigned8(f_player_field.terrains.r); |
4128 | @@ -1140,11 +1140,11 @@ |
4129 | } |
4130 | |
4131 | // edges |
4132 | - if (not bl_seen & (f_everseen | bl_everseen)) |
4133 | + if (!bl_seen & (f_everseen | bl_everseen)) |
4134 | roads_file.Unsigned8(f_player_field.road_sw()); |
4135 | - if (not br_seen & (f_everseen | br_everseen)) |
4136 | + if (!br_seen & (f_everseen | br_everseen)) |
4137 | roads_file.Unsigned8(f_player_field.road_se()); |
4138 | - if (not r_seen & (f_everseen | r_everseen)) |
4139 | + if (!r_seen & (f_everseen | r_everseen)) |
4140 | roads_file.Unsigned8(f_player_field.road_e ()); |
4141 | } |
4142 | |
4143 | |
4144 | === modified file 'src/map_io/widelands_map_road_data_packet.cc' |
4145 | --- src/map_io/widelands_map_road_data_packet.cc 2014-07-03 19:26:30 +0000 |
4146 | +++ src/map_io/widelands_map_road_data_packet.cc 2014-07-25 13:46:28 +0000 |
4147 | @@ -85,7 +85,7 @@ |
4148 | for (; field < fields_end; ++field) |
4149 | if (upcast(Road const, road, field->get_immovable())) // only roads |
4150 | // Roads can life on multiple positions. |
4151 | - if (not mos.is_object_known(*road)) |
4152 | + if (!mos.is_object_known(*road)) |
4153 | fw.Unsigned32(mos.register_object(*road)); |
4154 | fw.Unsigned32(0xffffffff); |
4155 | |
4156 | |
4157 | === modified file 'src/map_io/widelands_map_roaddata_data_packet.cc' |
4158 | --- src/map_io/widelands_map_roaddata_data_packet.cc 2014-07-22 09:54:49 +0000 |
4159 | +++ src/map_io/widelands_map_roaddata_data_packet.cc 2014-07-25 13:46:28 +0000 |
4160 | @@ -55,15 +55,15 @@ |
4161 | |
4162 | try { |
4163 | uint16_t const packet_version = fr.Unsigned16(); |
4164 | - if (1 <= packet_version and packet_version <= CURRENT_PACKET_VERSION) { |
4165 | + if (1 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) { |
4166 | const Map & map = egbase.map(); |
4167 | Player_Number const nr_players = map.get_nrplayers(); |
4168 | for (;;) { |
4169 | - if (2 <= packet_version and fr.EndOfFile()) |
4170 | + if (2 <= packet_version && fr.EndOfFile()) |
4171 | break; |
4172 | Serial const serial = fr.Unsigned32(); |
4173 | - if (packet_version < 2 and serial == 0xffffffff) { |
4174 | - if (not fr.EndOfFile()) |
4175 | + if (packet_version < 2 && serial == 0xffffffff) { |
4176 | + if (!fr.EndOfFile()) |
4177 | throw game_data_error |
4178 | ("expected end of file after serial 0xffffffff"); |
4179 | break; |
4180 | @@ -108,7 +108,7 @@ |
4181 | road.m_cost[0] = fr.Unsigned32(); |
4182 | road.m_cost[1] = fr.Unsigned32(); |
4183 | Path::Step_Vector::size_type const nr_steps = fr.Unsigned16(); |
4184 | - if (not nr_steps) |
4185 | + if (!nr_steps) |
4186 | throw game_data_error("nr_steps = 0"); |
4187 | Path p(road.m_flags[0]->get_position()); |
4188 | for (Path::Step_Vector::size_type i = nr_steps; i; --i) |
4189 | @@ -129,9 +129,9 @@ |
4190 | road.m_idle_index = fr.Unsigned32(); |
4191 | |
4192 | uint32_t const count = fr.Unsigned32(); |
4193 | - if (not count) |
4194 | + if (!count) |
4195 | throw game_data_error("no carrier slot"); |
4196 | - if (packet_version <= 2 and 1 < count) |
4197 | + if (packet_version <= 2 && 1 < count) |
4198 | throw game_data_error |
4199 | ( |
4200 | "expected 1 but found %u carrier slots in road saved " |
4201 | @@ -176,13 +176,13 @@ |
4202 | packet_version < 3 ? 1 : fr.Unsigned32(); |
4203 | |
4204 | if |
4205 | - (i < road.m_carrier_slots.size() and |
4206 | + (i < road.m_carrier_slots.size() && |
4207 | road.m_carrier_slots[i].carrier_type == carrier_type) |
4208 | { |
4209 | assert(!road.m_carrier_slots[i].carrier.get(egbase)); |
4210 | |
4211 | road.m_carrier_slots[i].carrier = carrier; |
4212 | - if (carrier or carrier_request) { |
4213 | + if (carrier || carrier_request) { |
4214 | delete road.m_carrier_slots[i].carrier_request; |
4215 | road.m_carrier_slots[i].carrier_request = |
4216 | carrier_request; |
4217 | @@ -226,7 +226,7 @@ |
4218 | const Field & fields_end = map[map.max_index()]; |
4219 | for (Field const * field = &map[0]; field < &fields_end; ++field) |
4220 | if (upcast(Road const, r, field->get_immovable())) |
4221 | - if (not mos.is_object_saved(*r)) { |
4222 | + if (!mos.is_object_saved(*r)) { |
4223 | assert(mos.is_object_known(*r)); |
4224 | |
4225 | fw.Unsigned32(mos.get_object_file_index(*r)); |
4226 | |
4227 | === modified file 'src/map_io/widelands_map_saver.cc' |
4228 | --- src/map_io/widelands_map_saver.cc 2014-07-05 13:14:42 +0000 |
4229 | +++ src/map_io/widelands_map_saver.cc 2014-07-25 13:46:28 +0000 |
4230 | @@ -136,7 +136,7 @@ |
4231 | iterate_players_existing_const(plnum, nr_players, m_egbase, player) { |
4232 | Building_Index const nr_buildings = player->tribe().get_nrbuildings(); |
4233 | for (Building_Index i = 0; i < nr_buildings; ++i) |
4234 | - if (not player->is_building_type_allowed(i)) { |
4235 | + if (!player->is_building_type_allowed(i)) { |
4236 | log("Writing Allowed Building Types Data ... "); |
4237 | Map_Allowed_Building_Types_Data_Packet p; |
4238 | p .Write(m_fs, m_egbase, *m_mos); |
4239 | |
4240 | === modified file 'src/map_io/widelands_map_scripting_data_packet.cc' |
4241 | --- src/map_io/widelands_map_scripting_data_packet.cc 2014-07-03 19:26:30 +0000 |
4242 | +++ src/map_io/widelands_map_scripting_data_packet.cc 2014-07-25 13:46:28 +0000 |
4243 | @@ -56,7 +56,7 @@ |
4244 | // wise this makes no sense. |
4245 | upcast(Game, g, &egbase); |
4246 | FileRead fr; |
4247 | - if (g and fr.TryOpen(fs, "scripting/globals.dump")) |
4248 | + if (g && fr.TryOpen(fs, "scripting/globals.dump")) |
4249 | { |
4250 | const uint32_t sentinel = fr.Unsigned32(); |
4251 | const uint32_t packet_version = fr.Unsigned32(); |
4252 | |
4253 | === modified file 'src/network/internet_gaming.cc' |
4254 | --- src/network/internet_gaming.cc 2014-07-14 10:45:44 +0000 |
4255 | +++ src/network/internet_gaming.cc 2014-07-25 13:46:28 +0000 |
4256 | @@ -97,7 +97,7 @@ |
4257 | |
4258 | /// \returns the one and only InternetGaming instance. |
4259 | InternetGaming & InternetGaming::ref() { |
4260 | - if (not ig) |
4261 | + if (!ig) |
4262 | ig = new InternetGaming(); |
4263 | return * ig; |
4264 | } |
4265 | |
4266 | === modified file 'src/network/nethost.cc' |
4267 | --- src/network/nethost.cc 2014-07-22 09:54:49 +0000 |
4268 | +++ src/network/nethost.cc 2014-07-25 13:46:28 +0000 |
4269 | @@ -281,7 +281,7 @@ |
4270 | |
4271 | virtual void setPlayerNumber(uint8_t const number) override { |
4272 | if |
4273 | - (number == UserSettings::none() or |
4274 | + (number == UserSettings::none() || |
4275 | number < h->settings().players.size()) |
4276 | h->setPlayerNumber(number); |
4277 | } |
4278 | @@ -765,7 +765,7 @@ |
4279 | // Setup by the users |
4280 | log ("[Dedicated] Entering set up mode, waiting for user interaction!\n"); |
4281 | |
4282 | - while (not d->dedicated_start) { |
4283 | + while (!d->dedicated_start) { |
4284 | handle_network(); |
4285 | // TODO(unknown) this should be improved. |
4286 | #ifndef _WIN32 |
4287 | @@ -1303,7 +1303,7 @@ |
4288 | } |
4289 | |
4290 | void NetHost::dserver_send_maps_and_saves(Client & client) { |
4291 | - assert (not d->game); |
4292 | + assert (!d->game); |
4293 | |
4294 | if (d->settings.maps.empty()) { |
4295 | // Read in maps |
4296 | @@ -2014,7 +2014,7 @@ |
4297 | */ |
4298 | bool NetHost::haveUserName(const std::string & name, uint8_t ignoreplayer) { |
4299 | for (uint32_t i = 0; i < d->settings.users.size(); ++i) |
4300 | - if (i != ignoreplayer and d->settings.users.at(i).name == name) |
4301 | + if (i != ignoreplayer && d->settings.users.at(i).name == name) |
4302 | return true; |
4303 | |
4304 | // Computer players are not handled like human users, |
4305 | @@ -2022,7 +2022,7 @@ |
4306 | if (ignoreplayer < d->settings.users.size()) |
4307 | ignoreplayer = d->settings.users.at(ignoreplayer).position; |
4308 | for (uint32_t i = 0; i < d->settings.players.size(); ++i) |
4309 | - if (i != ignoreplayer and d->settings.players.at(i).name == name) |
4310 | + if (i != ignoreplayer && d->settings.players.at(i).name == name) |
4311 | return true; |
4312 | |
4313 | return false; |
4314 | |
4315 | === modified file 'src/network/network.cc' |
4316 | --- src/network/network.cc 2014-06-23 21:07:36 +0000 |
4317 | +++ src/network/network.cc 2014-07-25 13:46:28 +0000 |
4318 | @@ -195,7 +195,7 @@ |
4319 | |
4320 | queue.insert(queue.end(), &buffer[0], &buffer[bytes]); |
4321 | |
4322 | - return queue.size() < 2 or 2 <= (queue[0] << 8 | queue[1]); |
4323 | + return queue.size() < 2 || 2 <= (queue[0] << 8 | queue[1]); |
4324 | } |
4325 | |
4326 | /** |
4327 | |
4328 | === modified file 'src/profile/profile.cc' |
4329 | --- src/profile/profile.cc 2014-06-23 20:17:05 +0000 |
4330 | +++ src/profile/profile.cc 2014-07-25 13:46:28 +0000 |
4331 | @@ -109,7 +109,7 @@ |
4332 | { |
4333 | char * endp; |
4334 | long long int i = strtoll(m_value, &endp, 0); |
4335 | - if (*endp or i < 0) |
4336 | + if (*endp || i < 0) |
4337 | throw wexception("%s: '%s' is not natural", get_name(), m_value); |
4338 | return i; |
4339 | } |
4340 | @@ -119,7 +119,7 @@ |
4341 | { |
4342 | char * endp; |
4343 | long long int i = strtoll(m_value, &endp, 0); |
4344 | - if (*endp or i < 1) |
4345 | + if (*endp || i < 1) |
4346 | throw wexception("%s: '%s' is not positive", get_name(), m_value); |
4347 | return i; |
4348 | } |
4349 | @@ -217,7 +217,7 @@ |
4350 | void Section::check_used() const |
4351 | { |
4352 | container_iterate_const(Value_list, m_values, i) |
4353 | - if (not i.current->is_used()) |
4354 | + if (!i.current->is_used()) |
4355 | m_profile->error |
4356 | ("Section [%s], key '%s' not used (did you spell the name " |
4357 | "correctly?)", |
4358 | @@ -228,7 +228,7 @@ |
4359 | bool Section::has_val(char const * const name) const |
4360 | { |
4361 | container_iterate_const(Value_list, m_values, i) |
4362 | - if (not strcasecmp(i.current->get_name(), name)) |
4363 | + if (!strcasecmp(i.current->get_name(), name)) |
4364 | return true; |
4365 | return false; |
4366 | } |
4367 | @@ -260,7 +260,7 @@ |
4368 | Section::Value * Section::get_next_val(char const * const name) |
4369 | { |
4370 | container_iterate(Value_list, m_values, i) |
4371 | - if (not i.current->is_used()) |
4372 | + if (!i.current->is_used()) |
4373 | if (!name || !strcasecmp(i.current->get_name(), name)) { |
4374 | i.current->mark_used(); |
4375 | return &*i.current; |
4376 | @@ -634,7 +634,7 @@ |
4377 | Section * Profile::get_next_section(char const * const name) |
4378 | { |
4379 | container_iterate(Section_list, m_sections, i) |
4380 | - if (not i.current->is_used()) |
4381 | + if (!i.current->is_used()) |
4382 | if (!name || !strcasecmp(i.current->get_name(), name)) { |
4383 | i.current->mark_used(); |
4384 | return &*i.current; |
4385 | @@ -769,9 +769,9 @@ |
4386 | |
4387 | // first, check for multiline string |
4388 | if |
4389 | - ((tail[0] == '\'' or tail[0] == '"') |
4390 | - and |
4391 | - (tail[1] == '\'' or tail[1] == '"')) |
4392 | + ((tail[0] == '\'' || tail[0] == '"') |
4393 | + && |
4394 | + (tail[1] == '\'' || tail[1] == '"')) |
4395 | { |
4396 | reading_multiline = true; |
4397 | tail += 2; |
4398 | @@ -826,7 +826,7 @@ |
4399 | } |
4400 | |
4401 | // Make sure that the requested global section exists, even if it is empty. |
4402 | - if (global_section and not get_section(global_section)) |
4403 | + if (global_section && !get_section(global_section)) |
4404 | create_section_duplicate(global_section); |
4405 | } |
4406 | |
4407 | |
4408 | === modified file 'src/scripting/c_utils.cc' |
4409 | --- src/scripting/c_utils.cc 2014-06-05 05:40:53 +0000 |
4410 | +++ src/scripting/c_utils.cc 2014-07-25 13:46:28 +0000 |
4411 | @@ -32,7 +32,7 @@ |
4412 | Factory * fac = static_cast<Factory *>(lua_touserdata(L, -1)); |
4413 | lua_pop(L, 1); // pop this userdata |
4414 | |
4415 | - if (not fac) |
4416 | + if (!fac) |
4417 | throw LuaError("\"factory\" field was nil, which should be impossible!"); |
4418 | |
4419 | return *fac; |
4420 | @@ -43,7 +43,7 @@ |
4421 | Widelands::Game * g = static_cast<Widelands::Game *>(lua_touserdata(L, -1)); |
4422 | lua_pop(L, 1); // pop this userdata |
4423 | |
4424 | - if (not g) |
4425 | + if (!g) |
4426 | throw LuaError |
4427 | ("\"game\" field was nil. get_game was not called in a game."); |
4428 | |
4429 | @@ -56,7 +56,7 @@ |
4430 | (lua_touserdata(L, -1)); |
4431 | lua_pop(L, 1); // pop this userdata |
4432 | |
4433 | - if (not g) |
4434 | + if (!g) |
4435 | throw LuaError |
4436 | ("\"egbase\" field was nil. This should be impossible."); |
4437 | |
4438 | @@ -73,7 +73,7 @@ |
4439 | |
4440 | lua_pop(L, 1); // pop this userdata |
4441 | |
4442 | - if (not mol) |
4443 | + if (!mol) |
4444 | throw LuaError |
4445 | ("\"mol\" field was nil. This should be impossible."); |
4446 | |
4447 | @@ -89,7 +89,7 @@ |
4448 | |
4449 | lua_pop(L, 1); // pop this userdata |
4450 | |
4451 | - if (not mos) |
4452 | + if (!mos) |
4453 | throw LuaError |
4454 | ("\"mos\" field was nil. This should be impossible."); |
4455 | |
4456 | |
4457 | === modified file 'src/scripting/lua_bases.cc' |
4458 | --- src/scripting/lua_bases.cc 2014-07-11 22:53:34 +0000 |
4459 | +++ src/scripting/lua_bases.cc 2014-07-25 13:46:28 +0000 |
4460 | @@ -127,7 +127,7 @@ |
4461 | uint32_t idx = 1; |
4462 | for (Player_Number i = 1; i <= MAX_PLAYERS; i++) { |
4463 | Player * rv = egbase.get_player(i); |
4464 | - if (not rv) |
4465 | + if (!rv) |
4466 | continue; |
4467 | |
4468 | lua_pushuint32(L, idx++); |
4469 | @@ -349,7 +349,7 @@ |
4470 | force = luaL_checkboolean(L, 3); |
4471 | |
4472 | Flag * f; |
4473 | - if (not force) { |
4474 | + if (!force) { |
4475 | f = get(L, get_egbase(L)).build_flag(c->fcoords(L)); |
4476 | if (!f) |
4477 | report_error(L, "Couldn't build flag!"); |
4478 | @@ -398,22 +398,22 @@ |
4479 | for (int32_t i = 3; i <= lua_gettop(L); i++) { |
4480 | std::string d = luaL_checkstring(L, i); |
4481 | |
4482 | - if (d == "ne" or d == "tr") { |
4483 | + if (d == "ne" || d == "tr") { |
4484 | path.append(map, 1); |
4485 | map.get_trn(current, ¤t); |
4486 | - } else if (d == "e" or d == "r") { |
4487 | + } else if (d == "e" || d == "r") { |
4488 | path.append(map, 2); |
4489 | map.get_rn(current, ¤t); |
4490 | - } else if (d == "se" or d == "br") { |
4491 | + } else if (d == "se" || d == "br") { |
4492 | path.append(map, 3); |
4493 | map.get_brn(current, ¤t); |
4494 | - } else if (d == "sw" or d == "bl") { |
4495 | + } else if (d == "sw" || d == "bl") { |
4496 | path.append(map, 4); |
4497 | map.get_bln(current, ¤t); |
4498 | - } else if (d == "w" or d == "l") { |
4499 | + } else if (d == "w" || d == "l") { |
4500 | path.append(map, 5); |
4501 | map.get_ln(current, ¤t); |
4502 | - } else if (d == "nw" or d == "tl") { |
4503 | + } else if (d == "nw" || d == "tl") { |
4504 | path.append(map, 6); |
4505 | map.get_tln(current, ¤t); |
4506 | } else |
4507 | @@ -438,11 +438,11 @@ |
4508 | r = &get(L, egbase).force_road(path); |
4509 | } else { |
4510 | BaseImmovable * bi = map.get_immovable(current); |
4511 | - if (!bi or bi->get_type() != Map_Object::FLAG) { |
4512 | + if (!bi || bi->get_type() != Map_Object::FLAG) { |
4513 | if (!get(L, egbase).build_flag(current)) |
4514 | report_error(L, "Could not place end flag!"); |
4515 | } |
4516 | - if (bi and bi == starting_flag) |
4517 | + if (bi && bi == starting_flag) |
4518 | report_error(L, "Cannot build a closed loop!"); |
4519 | |
4520 | r = get(L, egbase).build_road(path); |
4521 | @@ -508,7 +508,7 @@ |
4522 | b = get(L, get_egbase(L)).build |
4523 | (c->coords(), i, constructionsite, former_buildings); |
4524 | } |
4525 | - if (not b) |
4526 | + if (!b) |
4527 | report_error(L, "Couldn't place building!"); |
4528 | |
4529 | LuaMap::upcasted_immovable_to_lua(L, b); |
4530 | |
4531 | === modified file 'src/scripting/lua_game.cc' |
4532 | --- src/scripting/lua_game.cc 2014-07-05 14:22:44 +0000 |
4533 | +++ src/scripting/lua_game.cc 2014-07-25 13:46:28 +0000 |
4534 | @@ -305,17 +305,17 @@ |
4535 | if (n == 4) { |
4536 | // Optional arguments |
4537 | lua_getfield(L, 4, "duration"); |
4538 | - if (not lua_isnil(L, -1)) |
4539 | + if (!lua_isnil(L, -1)) |
4540 | d = luaL_checkuint32(L, -1); |
4541 | lua_pop(L, 1); |
4542 | |
4543 | lua_getfield(L, 4, "field"); |
4544 | - if (not lua_isnil(L, -1)) |
4545 | + if (!lua_isnil(L, -1)) |
4546 | c = (*get_user_class<L_Field>(L, -1))->coords(); |
4547 | lua_pop(L, 1); |
4548 | |
4549 | lua_getfield(L, 4, "status"); |
4550 | - if (not lua_isnil(L, -1)) { |
4551 | + if (!lua_isnil(L, -1)) { |
4552 | std::string s = luaL_checkstring(L, -1); |
4553 | if (s == "new") st = Message::New; |
4554 | else if (s == "read") st = Message::Read; |
4555 | @@ -325,12 +325,12 @@ |
4556 | lua_pop(L, 1); |
4557 | |
4558 | lua_getfield(L, 4, "sender"); |
4559 | - if (not lua_isnil(L, -1)) |
4560 | + if (!lua_isnil(L, -1)) |
4561 | sender = luaL_checkstring(L, -1); |
4562 | lua_pop(L, 1); |
4563 | |
4564 | lua_getfield(L, 4, "popup"); |
4565 | - if (not lua_isnil(L, -1)) |
4566 | + if (!lua_isnil(L, -1)) |
4567 | popup = luaL_checkboolean(L, -1); |
4568 | lua_pop(L, 1); |
4569 | } |
4570 | @@ -406,7 +406,7 @@ |
4571 | |
4572 | #define CHECK_ARG(var, type) \ |
4573 | lua_getfield(L, -1, #var); \ |
4574 | - if (not lua_isnil(L, -1)) var = luaL_check ## type(L, -1); \ |
4575 | + if (!lua_isnil(L, -1)) var = luaL_check ## type(L, -1); \ |
4576 | lua_pop(L, 1); |
4577 | |
4578 | if (lua_gettop(L) == 4) { |
4579 | @@ -418,7 +418,7 @@ |
4580 | |
4581 | // This must be done manually |
4582 | lua_getfield(L, 4, "field"); |
4583 | - if (not lua_isnil(L, -1)) { |
4584 | + if (!lua_isnil(L, -1)) { |
4585 | Coords c = (*get_user_class<L_Field>(L, -1))->coords(); |
4586 | game.get_ipl()->move_view_to(c); |
4587 | } |
4588 | @@ -774,7 +774,7 @@ |
4589 | |
4590 | for (Ware_Index i = 0; i < tribe.get_nrworkers(); ++i) { |
4591 | const Worker_Descr & worker_descr = *tribe.get_worker_descr(i); |
4592 | - if (not worker_descr.is_buildable()) |
4593 | + if (!worker_descr.is_buildable()) |
4594 | continue; |
4595 | |
4596 | player.allow_worker_type(i, true); |
4597 | |
4598 | === modified file 'src/scripting/lua_globals.cc' |
4599 | --- src/scripting/lua_globals.cc 2014-07-16 08:23:42 +0000 |
4600 | +++ src/scripting/lua_globals.cc 2014-07-25 13:46:28 +0000 |
4601 | @@ -149,7 +149,7 @@ |
4602 | static int L__(lua_State * L) { |
4603 | lua_getglobal(L, "__TEXTDOMAIN"); |
4604 | |
4605 | - if (not lua_isnil(L, -1)) { |
4606 | + if (!lua_isnil(L, -1)) { |
4607 | i18n::Textdomain dom(luaL_checkstring(L, -1)); |
4608 | lua_pushstring(L, i18n::translate(luaL_checkstring(L, 1))); |
4609 | } else { |
4610 | @@ -181,7 +181,7 @@ |
4611 | const uint32_t n = luaL_checkuint32(L, 3); |
4612 | |
4613 | lua_getglobal(L, "__TEXTDOMAIN"); |
4614 | - if (not lua_isnil(L, -1)) { |
4615 | + if (!lua_isnil(L, -1)) { |
4616 | i18n::Textdomain dom(luaL_checkstring(L, -1)); |
4617 | lua_pushstring(L, ngettext(msgid.c_str(), msgid_plural.c_str(), n)); |
4618 | } else { |
4619 | |
4620 | === modified file 'src/scripting/lua_map.cc' |
4621 | --- src/scripting/lua_map.cc 2014-07-24 05:21:20 +0000 |
4622 | +++ src/scripting/lua_map.cc 2014-07-25 13:46:28 +0000 |
4623 | @@ -166,7 +166,7 @@ |
4624 | (lua_State * L, const Tribe_Descr & tribe) \ |
4625 | { \ |
4626 | int32_t nargs = lua_gettop(L); \ |
4627 | - if (nargs != 2 and nargs != 3) \ |
4628 | + if (nargs != 2 && nargs != 3) \ |
4629 | report_error(L, "Wrong number of arguments to set_" #type "!"); \ |
4630 | btype##sMap rv; \ |
4631 | if (nargs == 3) { \ |
4632 | @@ -2069,7 +2069,7 @@ |
4633 | |
4634 | // Both objects are destroyed: they are equal |
4635 | if (me == you) lua_pushboolean(L, true); |
4636 | - else if (!me or !you) // One of the objects is destroyed: they are distinct |
4637 | + else if (!me || !you) // One of the objects is destroyed: they are distinct |
4638 | lua_pushboolean(L, false); |
4639 | else // Compare them |
4640 | lua_pushboolean |
4641 | @@ -3619,7 +3619,7 @@ |
4642 | int32_t amount = luaL_checkint32(L, -1); |
4643 | int32_t max_amount = get_egbase(L).world().get_resource(res)->max_amount(); |
4644 | |
4645 | - if (amount < 0 or amount > max_amount) |
4646 | + if (amount < 0 || amount > max_amount) |
4647 | report_error(L, "Illegal amount: %i, must be >= 0 and <= %i", amount, max_amount); |
4648 | |
4649 | field->set_resources(res, amount); |
4650 | |
4651 | === modified file 'src/scripting/lua_table.h' |
4652 | --- src/scripting/lua_table.h 2014-07-05 16:41:51 +0000 |
4653 | +++ src/scripting/lua_table.h 2014-07-25 13:46:28 +0000 |
4654 | @@ -167,7 +167,7 @@ |
4655 | lua_xmove(t, L_, 1); |
4656 | } |
4657 | |
4658 | - if (not lua_isthread(L_, -1)) { |
4659 | + if (!lua_isthread(L_, -1)) { |
4660 | lua_pop(L_, 1); |
4661 | throw LuaError(boost::lexical_cast<std::string>(key) + " is not a function value."); |
4662 | } |
4663 | |
4664 | === modified file 'src/scripting/lua_ui.cc' |
4665 | --- src/scripting/lua_ui.cc 2014-07-05 12:48:58 +0000 |
4666 | +++ src/scripting/lua_ui.cc 2014-07-25 13:46:28 +0000 |
4667 | @@ -107,7 +107,7 @@ |
4668 | static void _put_all_visible_buttons_into_table |
4669 | (lua_State * L, UI::Panel * g) |
4670 | { |
4671 | - if (not g) return; |
4672 | + if (!g) return; |
4673 | |
4674 | for (UI::Panel * f = g->get_first_child(); f; f = f->get_next_sibling()) |
4675 | { |
4676 | @@ -138,7 +138,7 @@ |
4677 | static void _put_all_tabs_into_table |
4678 | (lua_State * L, UI::Panel * g) |
4679 | { |
4680 | - if (not g) return; |
4681 | + if (!g) return; |
4682 | |
4683 | for (UI::Panel * f = g->get_first_child(); f; f = f->get_next_sibling()) |
4684 | { |
4685 | @@ -171,7 +171,7 @@ |
4686 | static void _put_all_visible_windows_into_table |
4687 | (lua_State * L, UI::Panel * g) |
4688 | { |
4689 | - if (not g) return; |
4690 | + if (!g) return; |
4691 | |
4692 | for (UI::Panel * f = g->get_first_child(); f; f = f->get_next_sibling()) |
4693 | { |
4694 | |
4695 | === modified file 'src/scripting/scripting.cc' |
4696 | --- src/scripting/scripting.cc 2014-06-26 05:53:49 +0000 |
4697 | +++ src/scripting/scripting.cc 2014-07-25 13:46:28 +0000 |
4698 | @@ -111,7 +111,7 @@ |
4699 | lua_pop(L, 1); // No return value from script |
4700 | lua_newtable(L); // Push an empty table |
4701 | } |
4702 | - if (not lua_istable(L, -1)) |
4703 | + if (!lua_istable(L, -1)) |
4704 | throw LuaError("Script did not return a table!"); |
4705 | |
4706 | // Restore old value of __file__. |
4707 | |
4708 | === modified file 'src/sound/sound_handler.cc' |
4709 | --- src/sound/sound_handler.cc 2014-07-23 14:49:10 +0000 |
4710 | +++ src/sound/sound_handler.cc 2014-07-25 13:46:28 +0000 |
4711 | @@ -118,7 +118,7 @@ |
4712 | |
4713 | if |
4714 | (SDL_InitSubSystem(SDL_INIT_AUDIO) == -1 |
4715 | - or |
4716 | + || |
4717 | Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, bufsize) == -1) |
4718 | { |
4719 | SDL_QuitSubSystem(SDL_INIT_AUDIO); |
4720 | @@ -277,7 +277,7 @@ |
4721 | if (nosound_) |
4722 | return; |
4723 | |
4724 | - if (not fr.TryOpen(*g_fs, path)) { |
4725 | + if (!fr.TryOpen(*g_fs, path)) { |
4726 | log("WARNING: Could not open %s for reading!\n", path); |
4727 | return; |
4728 | } |
4729 | @@ -535,7 +535,7 @@ |
4730 | void Sound_Handler::start_music |
4731 | (const std::string & songset_name, int32_t fadein_ms) |
4732 | { |
4733 | - if (get_disable_music() or nosound_) |
4734 | + if (get_disable_music() || nosound_) |
4735 | return; |
4736 | |
4737 | if (fadein_ms == 0) fadein_ms = 250; // avoid clicks |
4738 | @@ -565,7 +565,7 @@ |
4739 | */ |
4740 | void Sound_Handler::stop_music(int32_t fadeout_ms) |
4741 | { |
4742 | - if (get_disable_music() or nosound_) |
4743 | + if (get_disable_music() || nosound_) |
4744 | return; |
4745 | |
4746 | if (fadeout_ms == 0) fadeout_ms = 250; // avoid clicks |
4747 | @@ -658,7 +658,7 @@ |
4748 | * \param volume The new music volume. |
4749 | */ |
4750 | void Sound_Handler::set_music_volume(int32_t volume) { |
4751 | - if (not lock_audio_disabling_ and not nosound_) { |
4752 | + if (!lock_audio_disabling_ && !nosound_) { |
4753 | music_volume_ = volume; |
4754 | Mix_VolumeMusic(volume); |
4755 | g_options.pull_section("global").set_int("music_volume", volume); |
4756 | @@ -673,7 +673,7 @@ |
4757 | * \param volume The new music volume. |
4758 | */ |
4759 | void Sound_Handler::set_fx_volume(int32_t volume) { |
4760 | - if (not lock_audio_disabling_ and not nosound_) { |
4761 | + if (!lock_audio_disabling_ && !nosound_) { |
4762 | fx_volume_ = volume; |
4763 | Mix_Volume(-1, volume); |
4764 | g_options.pull_section("global").set_int("fx_volume", volume); |
4765 | |
4766 | === modified file 'src/ui_basic/button.cc' |
4767 | --- src/ui_basic/button.cc 2014-07-14 10:45:44 +0000 |
4768 | +++ src/ui_basic/button.cc 2014-07-25 13:46:28 +0000 |
4769 | @@ -164,13 +164,13 @@ |
4770 | void Button::draw(RenderTarget & dst) |
4771 | { |
4772 | // Draw the background |
4773 | - if (not m_flat or m_draw_flat_background) { |
4774 | + if (!m_flat || m_draw_flat_background) { |
4775 | assert(m_pic_background); |
4776 | dst.fill_rect(Rect(Point(0, 0), get_w(), get_h()), RGBAColor(0, 0, 0, 255)); |
4777 | dst.tile(Rect(Point(0, 0), get_w(), get_h()), m_pic_background, Point(get_x(), get_y())); |
4778 | } |
4779 | |
4780 | - if (m_enabled and m_highlighted and not m_flat) |
4781 | + if (m_enabled && m_highlighted && !m_flat) |
4782 | dst.brighten_rect |
4783 | (Rect(Point(0, 0), get_w(), get_h()), MOUSE_OVER_BRIGHT_FACTOR); |
4784 | |
4785 | @@ -207,14 +207,14 @@ |
4786 | RGBAColor black(0, 0, 0, 255); |
4787 | |
4788 | // m_permpressed is true, we invert the behaviour on m_pressed |
4789 | - bool draw_pressed = m_permpressed ? not (m_pressed and m_highlighted) |
4790 | - : (m_pressed and m_highlighted); |
4791 | + bool draw_pressed = m_permpressed ? !(m_pressed && m_highlighted) |
4792 | + : (m_pressed && m_highlighted); |
4793 | |
4794 | - if (not m_flat) { |
4795 | + if (!m_flat) { |
4796 | assert(2 <= get_w()); |
4797 | assert(2 <= get_h()); |
4798 | // button is a normal one, not flat |
4799 | - if (not draw_pressed) { |
4800 | + if (!draw_pressed) { |
4801 | // top edge |
4802 | dst.brighten_rect |
4803 | (Rect(Point(0, 0), get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR); |
4804 | @@ -246,7 +246,7 @@ |
4805 | } else { |
4806 | // Button is flat, do not draw borders, instead, if it is pressed, draw |
4807 | // a box around it. |
4808 | - if (m_enabled and m_highlighted) |
4809 | + if (m_enabled && m_highlighted) |
4810 | { |
4811 | RGBAColor shade(100, 100, 100, 80); |
4812 | dst.fill_rect(Rect(Point(0, 0), get_w(), 2), shade); |
4813 | |
4814 | === modified file 'src/ui_basic/checkbox.cc' |
4815 | --- src/ui_basic/checkbox.cc 2014-07-14 10:45:44 +0000 |
4816 | +++ src/ui_basic/checkbox.cc 2014-07-25 13:46:28 +0000 |
4817 | @@ -64,15 +64,15 @@ |
4818 | */ |
4819 | void Statebox::set_enabled(bool const enabled) |
4820 | { |
4821 | - if (((m_flags & Is_Enabled) > 1) and enabled) |
4822 | + if (((m_flags & Is_Enabled) > 1) && enabled) |
4823 | return; |
4824 | |
4825 | set_flags(Is_Enabled, enabled); |
4826 | |
4827 | - if (not (m_flags & Has_Custom_Picture)) { |
4828 | + if (!(m_flags & Has_Custom_Picture)) { |
4829 | m_pic_graphics = g_gr->images().get(enabled ? "pics/checkbox_light.png" : "pics/checkbox.png"); |
4830 | set_flags |
4831 | - (Is_Highlighted, (m_flags & Is_Highlighted) and (m_flags & Is_Enabled)); |
4832 | + (Is_Highlighted, (m_flags & Is_Highlighted) && (m_flags & Is_Enabled)); |
4833 | } |
4834 | |
4835 | update(); |
4836 | @@ -85,7 +85,7 @@ |
4837 | * Args: on true if the checkbox should be checked |
4838 | */ |
4839 | void Statebox::set_state(bool const on) { |
4840 | - if (on xor ((m_flags & Is_Checked) > 1)) { |
4841 | + if (on ^ ((m_flags & Is_Checked) > 1)) { |
4842 | set_flags(Is_Checked, on); |
4843 | changed(); |
4844 | changedto(on); |
4845 | @@ -136,7 +136,7 @@ |
4846 | */ |
4847 | void Statebox::handle_mousein(bool const inside) { |
4848 | bool oldhl = m_flags & Is_Highlighted; |
4849 | - set_flags(Is_Highlighted, inside and (m_flags & Is_Enabled)); |
4850 | + set_flags(Is_Highlighted, inside && (m_flags & Is_Enabled)); |
4851 | |
4852 | if (oldhl != (m_flags & Is_Highlighted)) |
4853 | update(); |
4854 | @@ -147,7 +147,7 @@ |
4855 | * Left-click: Toggle checkbox state |
4856 | */ |
4857 | bool Statebox::handle_mousepress(const uint8_t btn, int32_t, int32_t) { |
4858 | - if (btn == SDL_BUTTON_LEFT and (m_flags & Is_Enabled)) { |
4859 | + if (btn == SDL_BUTTON_LEFT && (m_flags & Is_Enabled)) { |
4860 | clicked(); |
4861 | return true; |
4862 | } else |
4863 | |
4864 | === modified file 'src/ui_basic/editbox.cc' |
4865 | --- src/ui_basic/editbox.cc 2014-07-23 14:49:10 +0000 |
4866 | +++ src/ui_basic/editbox.cc 2014-07-25 13:46:28 +0000 |
4867 | @@ -281,7 +281,7 @@ |
4868 | while ((m->text[--m->caret] & 0xc0) == 0x80) {}; |
4869 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) |
4870 | for (uint32_t new_caret = m->caret;; m->caret = new_caret) |
4871 | - if (0 == new_caret or isspace(m->text[--new_caret])) |
4872 | + if (0 == new_caret || isspace(m->text[--new_caret])) |
4873 | break; |
4874 | |
4875 | check_caret(); |
4876 | @@ -303,7 +303,7 @@ |
4877 | for (uint32_t new_caret = m->caret;; ++new_caret) |
4878 | if |
4879 | (new_caret == m->text.size() |
4880 | - or |
4881 | + || |
4882 | isspace(m->text[new_caret - 1])) |
4883 | { |
4884 | m->caret = new_caret; |
4885 | @@ -390,7 +390,7 @@ |
4886 | // example ~ + o results in a o with a tilde over it. The ~ is reported |
4887 | // as a 0 on keystroke, the o then as the unicode character. We simply |
4888 | // ignore the 0. |
4889 | - if (is_printable(code) and code.unicode) { |
4890 | + if (is_printable(code) && code.unicode) { |
4891 | insert(code); |
4892 | return true; |
4893 | } |
4894 | |
4895 | === modified file 'src/ui_basic/listselect.cc' |
4896 | --- src/ui_basic/listselect.cc 2014-07-14 10:45:44 +0000 |
4897 | +++ src/ui_basic/listselect.cc 2014-07-25 13:46:28 +0000 |
4898 | @@ -374,7 +374,7 @@ |
4899 | } |
4900 | assert(2 <= get_eff_w()); |
4901 | // Make the area a bit more white and more transparent |
4902 | - if (r.w > 0 and r.h > 0) |
4903 | + if (r.w > 0 && r.h > 0) |
4904 | { |
4905 | dst.brighten_rect(r, - ms_darken_value * 2); |
4906 | } |
4907 | @@ -433,7 +433,7 @@ |
4908 | m_last_click_time = time; |
4909 | |
4910 | y = (y + m_scrollpos) / get_lineheight(); |
4911 | - if (y < 0 or static_cast<int32_t>(m_entry_records.size()) <= y) |
4912 | + if (y < 0 || static_cast<int32_t>(m_entry_records.size()) <= y) |
4913 | return false; |
4914 | play_click(); |
4915 | select(y); |
4916 | @@ -441,9 +441,9 @@ |
4917 | |
4918 | if // check if doubleclicked |
4919 | (time - real_last_click_time < DOUBLE_CLICK_INTERVAL |
4920 | - and |
4921 | + && |
4922 | m_last_selection == m_selection |
4923 | - and |
4924 | + && |
4925 | m_selection != no_selection_index()) |
4926 | double_clicked(m_selection); |
4927 | |
4928 | @@ -461,7 +461,7 @@ |
4929 | |
4930 | bool BaseListselect::handle_mousemove(uint8_t, int32_t, int32_t y, int32_t, int32_t) { |
4931 | y = (y + m_scrollpos) / get_lineheight(); |
4932 | - if (y < 0 or static_cast<int32_t>(m_entry_records.size()) <= y) { |
4933 | + if (y < 0 || static_cast<int32_t>(m_entry_records.size()) <= y) { |
4934 | set_tooltip(""); |
4935 | return false; |
4936 | } |
4937 | |
4938 | === modified file 'src/ui_basic/multilineeditbox.cc' |
4939 | --- src/ui_basic/multilineeditbox.cc 2014-07-05 14:22:44 +0000 |
4940 | +++ src/ui_basic/multilineeditbox.cc 2014-07-25 13:46:28 +0000 |
4941 | @@ -436,7 +436,7 @@ |
4942 | // example ~ + o results in a o with a tilde over it. The ~ is reported |
4943 | // as a 0 on keystroke, the o then as the unicode character. We simply |
4944 | // ignore the 0. |
4945 | - if (is_printable(code) and code.unicode) { |
4946 | + if (is_printable(code) && code.unicode) { |
4947 | insert(code); |
4948 | } |
4949 | break; |
4950 | |
4951 | === modified file 'src/ui_basic/multilinetextarea.cc' |
4952 | --- src/ui_basic/multilinetextarea.cc 2014-07-14 10:45:44 +0000 |
4953 | +++ src/ui_basic/multilinetextarea.cc 2014-07-25 13:46:28 +0000 |
4954 | @@ -194,7 +194,7 @@ |
4955 | (uint8_t const btn, int32_t const x, int32_t const y) |
4956 | { |
4957 | return |
4958 | - btn == SDL_BUTTON_WHEELUP or btn == SDL_BUTTON_WHEELDOWN ? |
4959 | + btn == SDL_BUTTON_WHEELUP || btn == SDL_BUTTON_WHEELDOWN ? |
4960 | m_scrollbar.handle_mousepress(btn, x, y) : false; |
4961 | } |
4962 | |
4963 | |
4964 | === modified file 'src/ui_basic/panel.cc' |
4965 | --- src/ui_basic/panel.cc 2014-07-22 09:54:49 +0000 |
4966 | +++ src/ui_basic/panel.cc 2014-07-25 13:46:28 +0000 |
4967 | @@ -499,9 +499,9 @@ |
4968 | void Panel::update(int32_t x, int32_t y, int32_t w, int32_t h) |
4969 | { |
4970 | if |
4971 | - (x >= static_cast<int32_t>(_w) or x + w <= 0 |
4972 | - or |
4973 | - y >= static_cast<int32_t>(_h) or y + h <= 0) |
4974 | + (x >= static_cast<int32_t>(_w) || x + w <= 0 |
4975 | + || |
4976 | + y >= static_cast<int32_t>(_h) || y + h <= 0) |
4977 | return; |
4978 | |
4979 | _needdraw = true; |
4980 | @@ -950,9 +950,9 @@ |
4981 | if (!child->get_handle_mouse() || !child->is_visible()) |
4982 | continue; |
4983 | if |
4984 | - (x < child->_x + static_cast<int32_t>(child->_w) and x >= child->_x |
4985 | - and |
4986 | - y < child->_y + static_cast<int32_t>(child->_h) and y >= child->_y) |
4987 | + (x < child->_x + static_cast<int32_t>(child->_w) && x >= child->_x |
4988 | + && |
4989 | + y < child->_y + static_cast<int32_t>(child->_h) && y >= child->_y) |
4990 | break; |
4991 | } |
4992 | |
4993 | @@ -971,7 +971,7 @@ |
4994 | */ |
4995 | void Panel::do_mousein(bool const inside) |
4996 | { |
4997 | - if (not _g_allow_user_input) |
4998 | + if (!_g_allow_user_input) |
4999 | return; |
5000 |
The diff has been truncated for viewing.
Awesome!
I have a bunch of comments about the rule itself, I did not look over the rest of the code yet.