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