Merge lp:~widelands-dev/widelands/bug-1823612-llvm8-build-errors into lp:widelands
- bug-1823612-llvm8-build-errors
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 9042 | ||||
Proposed branch: | lp:~widelands-dev/widelands/bug-1823612-llvm8-build-errors | ||||
Merge into: | lp:widelands | ||||
Diff against target: |
2084 lines (+414/-372) 40 files modified
src/ai/ai_help_structs.cc (+4/-4) src/ai/defaultai.cc (+15/-17) src/ai/defaultai_warfare.cc (+0/-1) src/economy/economy.cc (+2/-2) src/economy/ware_instance.cc (+2/-2) src/editor/tools/info_tool.cc (+1/-1) src/editor/ui_menus/tool_menu.cc (+8/-8) src/graphic/gl/initialize.cc (+24/-24) src/graphic/gl/utils.cc (+2/-2) src/io/filesystem/test/test_filesystem.cc (+70/-70) src/logic/map_objects/bob.cc (+8/-8) src/logic/map_objects/immovable.cc (+4/-4) src/logic/map_objects/tribes/building.cc (+4/-4) src/logic/map_objects/tribes/production_program.cc (+65/-55) src/logic/map_objects/tribes/productionsite.cc (+11/-10) src/logic/map_objects/tribes/productionsite.h (+3/-3) src/logic/map_objects/tribes/program_result.h (+19/-3) src/logic/map_objects/tribes/trainingsite.cc (+2/-2) src/logic/map_objects/tribes/tribe_descr.cc (+1/-1) src/logic/map_objects/tribes/worker.cc (+10/-10) src/logic/map_objects/world/terrain_description.h (+9/-1) src/logic/mapdifferenceregion.h (+6/-6) src/logic/maphollowregion.cc (+14/-11) src/logic/maphollowregion.h (+16/-8) src/logic/maptriangleregion.cc (+26/-26) src/logic/maptriangleregion.h (+1/-1) src/logic/player.cc (+2/-2) src/map_io/map_buildingdata_packet.cc (+3/-2) src/map_io/map_players_view_packet.cc (+47/-47) src/map_io/s2map.cc (+1/-1) src/scripting/lua_bases.cc (+1/-1) src/scripting/lua_game.cc (+7/-7) src/scripting/lua_map.cc (+17/-17) src/sound/sound_handler.cc (+1/-1) src/ui_basic/box.cc (+1/-1) src/ui_basic/editbox.cc (+4/-3) src/ui_basic/unique_window.h (+0/-3) src/ui_fsmenu/main.cc (+1/-1) src/ui_fsmenu/netsetup_lan.cc (+1/-1) src/wui/interactive_player.cc (+1/-1) |
||||
To merge this branch: | bzr merge lp:~widelands-dev/widelands/bug-1823612-llvm8-build-errors | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
hessenfarmer | test | Approve | |
GunChleoc | Needs Resubmitting | ||
Review via email: mp+365644@code.launchpad.net |
Commit message
Fix compile errors for clang 8.
Description of the change
I am still on Clang 6, so we have to wait for Travis to see if this is indeed fixed.
bunnybot (widelandsofficial) wrote : | # |
GunChleoc (gunchleoc) wrote : | # |
This is ready for review now, targeted at Build 20.
hessenfarmer (stephan-lutz) wrote : | # |
Found at least one questionable change in ai code see inline.
needs intensive testing of programs especially for the mines
TiborB (tiborb95) wrote : | # |
Yes, it is obviously a typo but I suggest not to touch it unless it is followed by some training. BTW, I plan to came return and spend some time on AI in about two months....
hessenfarmer (stephan-lutz) wrote : | # |
BTW: what was the reason for change the Program result code, as the previous revision did already compile with clang 8?
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 4706. State: errored. Details: https:/
Appveyor build 4492. State: success. Details: https:/
GunChleoc (gunchleoc) wrote : | # |
Which changes do you mean exactly? Please point me to the commit in the commit log for this branch, or to the line in the code.
All that the AI change does is to assign a value to the same element only once instead of twice. Do you want me to record the value assignment that I deleted in a comment?
TiborB (tiborb95) wrote : | # |
@Gun, I am not sure whom you are asking, but still I left the comment in the code....
hessenfarmer (stephan-lutz) wrote : | # |
@Tibor:
I think that was addressed to my question. I was just wondering what is the reason behind commit 9048. I am a little bit concerned due to the commit message whether the programs still work as desired. Especially whether the statistics fix (result no-stats) still works.
hessenfarmer (stephan-lutz) wrote : | # |
for the AI part we could leave this as it is now (i.e. nothing has changed) and record a bug to fix inputs[19] in this part of the code.
TiborB (tiborb95) wrote : | # |
@hessenfarmer - the bug is too much as no real harm is done here, todo in the code would be enough....
GunChleoc (gunchleoc) wrote : | # |
I have added a TODO to the AI code.
I have verified that no_stats is not affected by the bugfix in the production programs. I don't know if we ever entered the buggy state, but if we did, this will actually fix the stats: If duration was not set for these programs, Widelands would have picked a duration between 0 and 3 ms, depending on the ID of the current program state (Failed, Skipped, Completed..). Now, the duration is always 0 ms like it should be.
hessenfarmer (stephan-lutz) wrote : | # |
ok thanks for the explanation.
did some playtesting. Found no anomalies.
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 4709. State: passed. Details: https:/
Appveyor build 4495. State: success. Details: https:/
GunChleoc (gunchleoc) wrote : | # |
Thanks!
Let's have it.
@bunnybot merge
Preview Diff
1 | === modified file 'src/ai/ai_help_structs.cc' | |||
2 | --- src/ai/ai_help_structs.cc 2019-02-23 11:00:49 +0000 | |||
3 | +++ src/ai/ai_help_structs.cc 2019-04-10 16:40:56 +0000 | |||
4 | @@ -1148,12 +1148,12 @@ | |||
5 | 1148 | if (this_player_team != mytn) { | 1148 | if (this_player_team != mytn) { |
6 | 1149 | log("%2d: Team changed %d -> %d\n", pn, this_player_team, mytn); | 1149 | log("%2d: Team changed %d -> %d\n", pn, this_player_team, mytn); |
7 | 1150 | this_player_team = mytn; | 1150 | this_player_team = mytn; |
9 | 1151 | }; | 1151 | } |
10 | 1152 | if (all_stats[opn].team_number != pltn) { | 1152 | if (all_stats[opn].team_number != pltn) { |
11 | 1153 | log("%2d: Team changed for player %d: %d -> %d\n", pn, opn, all_stats[opn].team_number, | 1153 | log("%2d: Team changed for player %d: %d -> %d\n", pn, opn, all_stats[opn].team_number, |
12 | 1154 | pltn); | 1154 | pltn); |
13 | 1155 | all_stats[opn].team_number = pltn; | 1155 | all_stats[opn].team_number = pltn; |
15 | 1156 | }; | 1156 | } |
16 | 1157 | } | 1157 | } |
17 | 1158 | } | 1158 | } |
18 | 1159 | 1159 | ||
19 | @@ -1248,7 +1248,7 @@ | |||
20 | 1248 | uint32_t PlayersStrengths::get_player_power(Widelands::PlayerNumber pn) { | 1248 | uint32_t PlayersStrengths::get_player_power(Widelands::PlayerNumber pn) { |
21 | 1249 | if (all_stats.count(pn) > 0) { | 1249 | if (all_stats.count(pn) > 0) { |
22 | 1250 | return all_stats[pn].players_power; | 1250 | return all_stats[pn].players_power; |
24 | 1251 | }; | 1251 | } |
25 | 1252 | return 0; | 1252 | return 0; |
26 | 1253 | } | 1253 | } |
27 | 1254 | 1254 | ||
28 | @@ -1256,7 +1256,7 @@ | |||
29 | 1256 | uint32_t PlayersStrengths::get_player_land(Widelands::PlayerNumber pn) { | 1256 | uint32_t PlayersStrengths::get_player_land(Widelands::PlayerNumber pn) { |
30 | 1257 | if (all_stats.count(pn) > 0) { | 1257 | if (all_stats.count(pn) > 0) { |
31 | 1258 | return all_stats[pn].players_land; | 1258 | return all_stats[pn].players_land; |
33 | 1259 | }; | 1259 | } |
34 | 1260 | return 0; | 1260 | return 0; |
35 | 1261 | } | 1261 | } |
36 | 1262 | 1262 | ||
37 | 1263 | 1263 | ||
38 | === modified file 'src/ai/defaultai.cc' | |||
39 | --- src/ai/defaultai.cc 2019-03-24 13:13:34 +0000 | |||
40 | +++ src/ai/defaultai.cc 2019-04-10 16:40:56 +0000 | |||
41 | @@ -327,7 +327,7 @@ | |||
42 | 327 | case SchedulerTaskId::kRoadCheck: | 327 | case SchedulerTaskId::kRoadCheck: |
43 | 328 | if (check_economies()) { // is a must | 328 | if (check_economies()) { // is a must |
44 | 329 | return; | 329 | return; |
46 | 330 | }; | 330 | } |
47 | 331 | set_taskpool_task_time(gametime + 1000, SchedulerTaskId::kRoadCheck); | 331 | set_taskpool_task_time(gametime + 1000, SchedulerTaskId::kRoadCheck); |
48 | 332 | // testing 5 roads | 332 | // testing 5 roads |
49 | 333 | { | 333 | { |
50 | @@ -337,7 +337,7 @@ | |||
51 | 337 | if (improve_roads(gametime)) { | 337 | if (improve_roads(gametime)) { |
52 | 338 | // if significant change takes place do not go on | 338 | // if significant change takes place do not go on |
53 | 339 | break; | 339 | break; |
55 | 340 | }; | 340 | } |
56 | 341 | } | 341 | } |
57 | 342 | } | 342 | } |
58 | 343 | break; | 343 | break; |
59 | @@ -380,7 +380,7 @@ | |||
60 | 380 | if (check_productionsites(gametime)) { | 380 | if (check_productionsites(gametime)) { |
61 | 381 | // if significant change takes place do not go on | 381 | // if significant change takes place do not go on |
62 | 382 | break; | 382 | break; |
64 | 383 | }; | 383 | } |
65 | 384 | } | 384 | } |
66 | 385 | } | 385 | } |
67 | 386 | break; | 386 | break; |
68 | @@ -413,7 +413,7 @@ | |||
69 | 413 | if (check_mines_(gametime)) { | 413 | if (check_mines_(gametime)) { |
70 | 414 | // if significant change takes place do not go on | 414 | // if significant change takes place do not go on |
71 | 415 | break; | 415 | break; |
73 | 416 | }; | 416 | } |
74 | 417 | } | 417 | } |
75 | 418 | } | 418 | } |
76 | 419 | break; | 419 | break; |
77 | @@ -460,7 +460,7 @@ | |||
78 | 460 | if (get_land_owner(game().map(), coords) == player_number()) { | 460 | if (get_land_owner(game().map(), coords) == player_number()) { |
79 | 461 | ++conquered_wh; | 461 | ++conquered_wh; |
80 | 462 | } | 462 | } |
82 | 463 | }; | 463 | } |
83 | 464 | if (!basic_economy_established) { | 464 | if (!basic_economy_established) { |
84 | 465 | assert(!persistent_data->remaining_basic_buildings.empty()); | 465 | assert(!persistent_data->remaining_basic_buildings.empty()); |
85 | 466 | log("%2d: Basic economy not achieved, %" PRIuS " building(s) missing, f.e.: %s\n", | 466 | log("%2d: Basic economy not achieved, %" PRIuS " building(s) missing, f.e.: %s\n", |
86 | @@ -3078,7 +3078,6 @@ | |||
87 | 3078 | (bf->military_in_constr_nearby + bf->military_unstationed) < | 3078 | (bf->military_in_constr_nearby + bf->military_unstationed) < |
88 | 3079 | concurent_ms_in_constr_no_enemy) { | 3079 | concurent_ms_in_constr_no_enemy) { |
89 | 3080 | // it will conquer new buildable spots for buildings or mines | 3080 | // it will conquer new buildable spots for buildings or mines |
90 | 3081 | ; | ||
91 | 3082 | } else if (bf->defense_msite_allowed && | 3081 | } else if (bf->defense_msite_allowed && |
92 | 3083 | (bf->military_in_constr_nearby + bf->military_unstationed) < | 3082 | (bf->military_in_constr_nearby + bf->military_unstationed) < |
93 | 3084 | concurent_ms_in_constr_enemy_nearby) { | 3083 | concurent_ms_in_constr_enemy_nearby) { |
94 | @@ -3514,15 +3513,15 @@ | |||
95 | 3514 | if (!has_building && flag.nr_of_roads() == 1) { | 3513 | if (!has_building && flag.nr_of_roads() == 1) { |
96 | 3515 | return false; | 3514 | return false; |
97 | 3516 | } else if (is_warehouse && flag.nr_of_roads() <= 3) { | 3515 | } else if (is_warehouse && flag.nr_of_roads() <= 3) { |
99 | 3517 | ; | 3516 | // Do nothing |
100 | 3518 | } else if (needs_warehouse) { | 3517 | } else if (needs_warehouse) { |
102 | 3519 | ; | 3518 | // Do nothing |
103 | 3520 | } else if (flag.current_wares() > 5) { | 3519 | } else if (flag.current_wares() > 5) { |
105 | 3521 | ; | 3520 | // Do nothing |
106 | 3522 | } else if (has_building && std::rand() % 3 == 0) { | 3521 | } else if (has_building && std::rand() % 3 == 0) { |
108 | 3523 | ; | 3522 | // Do nothing |
109 | 3524 | } else if (std::rand() % 10 == 0) { | 3523 | } else if (std::rand() % 10 == 0) { |
111 | 3525 | ; | 3524 | // Do nothing |
112 | 3526 | } else { | 3525 | } else { |
113 | 3527 | return false; | 3526 | return false; |
114 | 3528 | } | 3527 | } |
115 | @@ -3753,8 +3752,6 @@ | |||
116 | 3753 | // if we are within grace time, it is OK, just go on | 3752 | // if we are within grace time, it is OK, just go on |
117 | 3754 | if (eco->dismantle_grace_time > gametime && | 3753 | if (eco->dismantle_grace_time > gametime && |
118 | 3755 | eco->dismantle_grace_time != std::numeric_limits<uint32_t>::max()) { | 3754 | eco->dismantle_grace_time != std::numeric_limits<uint32_t>::max()) { |
119 | 3756 | ; | ||
120 | 3757 | |||
121 | 3758 | // if grace time is not set, this is probably first time without a warehouse and we must | 3755 | // if grace time is not set, this is probably first time without a warehouse and we must |
122 | 3759 | // set it | 3756 | // set it |
123 | 3760 | } else if (eco->dismantle_grace_time == std::numeric_limits<uint32_t>::max()) { | 3757 | } else if (eco->dismantle_grace_time == std::numeric_limits<uint32_t>::max()) { |
124 | @@ -5458,10 +5455,11 @@ | |||
125 | 5458 | inputs[14] = (bo.current_stats - 50) / 10; | 5455 | inputs[14] = (bo.current_stats - 50) / 10; |
126 | 5459 | inputs[15] = management_data.get_military_number_at(123) / 10; | 5456 | inputs[15] = management_data.get_military_number_at(123) / 10; |
127 | 5460 | inputs[16] = 0; | 5457 | inputs[16] = 0; |
129 | 5461 | inputs[17] = (inputs_on_stock) ? 0 : -2; | 5458 | // TODO(GunChleoc): This is overwritten below due to a typo |
130 | 5459 | // inputs[17] = (inputs_on_stock) ? 0 : -2; | ||
131 | 5462 | inputs[18] = (suppliers_exist) ? 0 : -3; | 5460 | inputs[18] = (suppliers_exist) ? 0 : -3; |
132 | 5463 | ; | ||
133 | 5464 | inputs[17] = (inputs_on_stock) ? 0 : -4; | 5461 | inputs[17] = (inputs_on_stock) ? 0 : -4; |
134 | 5462 | // Nothing on inputs[19] | ||
135 | 5465 | inputs[20] = | 5463 | inputs[20] = |
136 | 5466 | (mines_per_type[bo.mines].in_construction + mines_per_type[bo.mines].finished == 1) ? | 5464 | (mines_per_type[bo.mines].in_construction + mines_per_type[bo.mines].finished == 1) ? |
137 | 5467 | 3 : | 5465 | 3 : |
138 | @@ -6060,7 +6058,7 @@ | |||
139 | 6060 | // 2. in new flags to be processed yet | 6058 | // 2. in new flags to be processed yet |
140 | 6061 | if (remove_from_dqueue<Widelands::Flag>(new_flags, flag)) { | 6059 | if (remove_from_dqueue<Widelands::Flag>(new_flags, flag)) { |
141 | 6062 | return; | 6060 | return; |
143 | 6063 | }; | 6061 | } |
144 | 6064 | 6062 | ||
145 | 6065 | // 3. Or in neither of them | 6063 | // 3. Or in neither of them |
146 | 6066 | } else if (upcast(Road const, road, &pi)) { | 6064 | } else if (upcast(Road const, road, &pi)) { |
147 | @@ -6152,7 +6150,7 @@ | |||
148 | 6152 | // (used when testing possible port location) | 6150 | // (used when testing possible port location) |
149 | 6153 | if (f->nodecaps() & BUILDCAPS_MINE) { | 6151 | if (f->nodecaps() & BUILDCAPS_MINE) { |
150 | 6154 | mineable_fields_count += 1; | 6152 | mineable_fields_count += 1; |
152 | 6155 | }; | 6153 | } |
153 | 6156 | 6154 | ||
154 | 6157 | // add neighbours to a queue (duplicates are no problem) | 6155 | // add neighbours to a queue (duplicates are no problem) |
155 | 6158 | // to relieve AI/CPU we skip every second field in each direction | 6156 | // to relieve AI/CPU we skip every second field in each direction |
156 | 6159 | 6157 | ||
157 | === modified file 'src/ai/defaultai_warfare.cc' | |||
158 | --- src/ai/defaultai_warfare.cc 2019-02-23 11:00:49 +0000 | |||
159 | +++ src/ai/defaultai_warfare.cc 2019-04-10 16:40:56 +0000 | |||
160 | @@ -266,7 +266,6 @@ | |||
161 | 266 | inputs[3] = (is_warehouse) ? 2 : 0; | 266 | inputs[3] = (is_warehouse) ? 2 : 0; |
162 | 267 | inputs[4] = (site->second.attack_soldiers_competency > 15) ? 2 : 0; | 267 | inputs[4] = (site->second.attack_soldiers_competency > 15) ? 2 : 0; |
163 | 268 | inputs[5] = (site->second.attack_soldiers_competency > 25) ? 4 : 0; | 268 | inputs[5] = (site->second.attack_soldiers_competency > 25) ? 4 : 0; |
164 | 269 | ; | ||
165 | 270 | inputs[6] = | 269 | inputs[6] = |
166 | 271 | (2 * site->second.defenders_strength > 3 * site->second.attack_soldiers_strength) ? | 270 | (2 * site->second.defenders_strength > 3 * site->second.attack_soldiers_strength) ? |
167 | 272 | 2 : | 271 | 2 : |
168 | 273 | 272 | ||
169 | === modified file 'src/economy/economy.cc' | |||
170 | --- src/economy/economy.cc 2019-02-23 11:00:49 +0000 | |||
171 | +++ src/economy/economy.cc 2019-04-10 16:40:56 +0000 | |||
172 | @@ -434,9 +434,9 @@ | |||
173 | 434 | RequestList::iterator const it = std::find(requests_.begin(), requests_.end(), &req); | 434 | RequestList::iterator const it = std::find(requests_.begin(), requests_.end(), &req); |
174 | 435 | 435 | ||
175 | 436 | if (it == requests_.end()) { | 436 | if (it == requests_.end()) { |
177 | 437 | FORMAT_WARNINGS_OFF; | 437 | FORMAT_WARNINGS_OFF |
178 | 438 | log("WARNING: remove_request(%p) not in list\n", &req); | 438 | log("WARNING: remove_request(%p) not in list\n", &req); |
180 | 439 | FORMAT_WARNINGS_ON; | 439 | FORMAT_WARNINGS_ON |
181 | 440 | return; | 440 | return; |
182 | 441 | } | 441 | } |
183 | 442 | 442 | ||
184 | 443 | 443 | ||
185 | === modified file 'src/economy/ware_instance.cc' | |||
186 | --- src/economy/ware_instance.cc 2019-02-23 11:00:49 +0000 | |||
187 | +++ src/economy/ware_instance.cc 2019-04-10 16:40:56 +0000 | |||
188 | @@ -187,9 +187,9 @@ | |||
189 | 187 | 187 | ||
190 | 188 | WareInstance::~WareInstance() { | 188 | WareInstance::~WareInstance() { |
191 | 189 | if (supply_) { | 189 | if (supply_) { |
193 | 190 | FORMAT_WARNINGS_OFF; | 190 | FORMAT_WARNINGS_OFF |
194 | 191 | molog("Ware %u still has supply %p\n", descr_index_, supply_); | 191 | molog("Ware %u still has supply %p\n", descr_index_, supply_); |
196 | 192 | FORMAT_WARNINGS_ON; | 192 | FORMAT_WARNINGS_ON |
197 | 193 | delete supply_; | 193 | delete supply_; |
198 | 194 | } | 194 | } |
199 | 195 | } | 195 | } |
200 | 196 | 196 | ||
201 | === modified file 'src/editor/tools/info_tool.cc' | |||
202 | --- src/editor/tools/info_tool.cc 2019-02-23 11:00:49 +0000 | |||
203 | +++ src/editor/tools/info_tool.cc 2019-04-10 16:40:56 +0000 | |||
204 | @@ -74,7 +74,7 @@ | |||
205 | 74 | } break; | 74 | } break; |
206 | 75 | default: | 75 | default: |
207 | 76 | break; | 76 | break; |
209 | 77 | }; | 77 | } |
210 | 78 | 78 | ||
211 | 79 | if (caps & Widelands::BUILDCAPS_FLAG) { | 79 | if (caps & Widelands::BUILDCAPS_FLAG) { |
212 | 80 | /** TRANSLATORS: Editor terrain property: space for a flag */ | 80 | /** TRANSLATORS: Editor terrain property: space for a flag */ |
213 | 81 | 81 | ||
214 | === modified file 'src/editor/ui_menus/tool_menu.cc' | |||
215 | --- src/editor/ui_menus/tool_menu.cc 2019-02-23 11:00:49 +0000 | |||
216 | +++ src/editor/ui_menus/tool_menu.cc 2019-04-10 16:40:56 +0000 | |||
217 | @@ -56,15 +56,15 @@ | |||
218 | 56 | this, pos, g_gr->images().get("images/wui/editor/editor_menu_tool_" pic ".png"), tooltip); \ | 56 | this, pos, g_gr->images().get("images/wui/editor/editor_menu_tool_" pic ".png"), tooltip); \ |
219 | 57 | pos.x += width + spacing; | 57 | pos.x += width + spacing; |
220 | 58 | 58 | ||
228 | 59 | ADD_BUTTON("change_height", _("Change height")); | 59 | ADD_BUTTON("change_height", _("Change height")) |
229 | 60 | ADD_BUTTON("noise_height", _("Random height")); | 60 | ADD_BUTTON("noise_height", _("Random height")) |
230 | 61 | ADD_BUTTON("set_terrain", _("Terrain")); | 61 | ADD_BUTTON("set_terrain", _("Terrain")) |
231 | 62 | ADD_BUTTON("place_immovable", _("Immovables")); | 62 | ADD_BUTTON("place_immovable", _("Immovables")) |
232 | 63 | ADD_BUTTON("place_bob", _("Animals")); | 63 | ADD_BUTTON("place_bob", _("Animals")) |
233 | 64 | ADD_BUTTON("change_resources", _("Resources")); | 64 | ADD_BUTTON("change_resources", _("Resources")) |
234 | 65 | ADD_BUTTON("set_port_space", _("Set port space")); | 65 | ADD_BUTTON("set_port_space", _("Set port space")) |
235 | 66 | ADD_BUTTON("set_origin", _("Set the position that will have the coordinates (0, 0). This will " | 66 | ADD_BUTTON("set_origin", _("Set the position that will have the coordinates (0, 0). This will " |
237 | 67 | "be the top-left corner of a generated minimap.")); | 67 | "be the top-left corner of a generated minimap.")) |
238 | 68 | 68 | ||
239 | 69 | set_inner_size(offs.x + (width + spacing) * num_tools, offs.y + (height + spacing)); | 69 | set_inner_size(offs.x + (width + spacing) * num_tools, offs.y + (height + spacing)); |
240 | 70 | 70 | ||
241 | 71 | 71 | ||
242 | === modified file 'src/graphic/gl/initialize.cc' | |||
243 | --- src/graphic/gl/initialize.cc 2019-02-23 22:42:03 +0000 | |||
244 | +++ src/graphic/gl/initialize.cc 2019-04-10 16:40:56 +0000 | |||
245 | @@ -101,17 +101,17 @@ | |||
246 | 101 | glbinding::setAfterCallback([](const glbinding::FunctionCall& call) { | 101 | glbinding::setAfterCallback([](const glbinding::FunctionCall& call) { |
247 | 102 | log("%s(", call.function->name()); | 102 | log("%s(", call.function->name()); |
248 | 103 | for (size_t i = 0; i < call.parameters.size(); ++i) { | 103 | for (size_t i = 0; i < call.parameters.size(); ++i) { |
250 | 104 | FORMAT_WARNINGS_OFF; | 104 | FORMAT_WARNINGS_OFF |
251 | 105 | log("%p", call.parameters[i].get()); | 105 | log("%p", call.parameters[i].get()); |
253 | 106 | FORMAT_WARNINGS_ON; | 106 | FORMAT_WARNINGS_ON |
254 | 107 | if (i < call.parameters.size() - 1) | 107 | if (i < call.parameters.size() - 1) |
255 | 108 | log(", "); | 108 | log(", "); |
256 | 109 | } | 109 | } |
257 | 110 | log(")"); | 110 | log(")"); |
258 | 111 | if (call.returnValue) { | 111 | if (call.returnValue) { |
260 | 112 | FORMAT_WARNINGS_OFF; | 112 | FORMAT_WARNINGS_OFF |
261 | 113 | log(" -> %p", call.returnValue.get()); | 113 | log(" -> %p", call.returnValue.get()); |
263 | 114 | FORMAT_WARNINGS_ON; | 114 | FORMAT_WARNINGS_ON |
264 | 115 | } | 115 | } |
265 | 116 | const auto error = glGetError(); | 116 | const auto error = glGetError(); |
266 | 117 | log(" [%s]\n", gl_error_to_string(error)); | 117 | log(" [%s]\n", gl_error_to_string(error)); |
267 | @@ -151,26 +151,26 @@ | |||
268 | 151 | 151 | ||
269 | 152 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_RED_SIZE) | 152 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_RED_SIZE) |
270 | 153 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_GREEN_SIZE) | 153 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_GREEN_SIZE) |
291 | 154 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_BLUE_SIZE); | 154 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_BLUE_SIZE) |
292 | 155 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ALPHA_SIZE); | 155 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ALPHA_SIZE) |
293 | 156 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_BUFFER_SIZE); | 156 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_BUFFER_SIZE) |
294 | 157 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_DOUBLEBUFFER); | 157 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_DOUBLEBUFFER) |
295 | 158 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_DEPTH_SIZE); | 158 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_DEPTH_SIZE) |
296 | 159 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_STENCIL_SIZE); | 159 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_STENCIL_SIZE) |
297 | 160 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ACCUM_RED_SIZE); | 160 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ACCUM_RED_SIZE) |
298 | 161 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ACCUM_GREEN_SIZE); | 161 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ACCUM_GREEN_SIZE) |
299 | 162 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ACCUM_BLUE_SIZE); | 162 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ACCUM_BLUE_SIZE) |
300 | 163 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ACCUM_ALPHA_SIZE); | 163 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ACCUM_ALPHA_SIZE) |
301 | 164 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_STEREO); | 164 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_STEREO) |
302 | 165 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_MULTISAMPLEBUFFERS); | 165 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_MULTISAMPLEBUFFERS) |
303 | 166 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_MULTISAMPLESAMPLES); | 166 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_MULTISAMPLESAMPLES) |
304 | 167 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ACCELERATED_VISUAL); | 167 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_ACCELERATED_VISUAL) |
305 | 168 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_CONTEXT_MAJOR_VERSION); | 168 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_CONTEXT_MAJOR_VERSION) |
306 | 169 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_CONTEXT_MINOR_VERSION); | 169 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_CONTEXT_MINOR_VERSION) |
307 | 170 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_CONTEXT_FLAGS); | 170 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_CONTEXT_FLAGS) |
308 | 171 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_CONTEXT_PROFILE_MASK); | 171 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_CONTEXT_PROFILE_MASK) |
309 | 172 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_SHARE_WITH_CURRENT_CONTEXT); | 172 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_SHARE_WITH_CURRENT_CONTEXT) |
310 | 173 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE); | 173 | LOG_SDL_GL_ATTRIBUTE(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE) |
311 | 174 | #undef LOG_SDL_GL_ATTRIBUTE | 174 | #undef LOG_SDL_GL_ATTRIBUTE |
312 | 175 | 175 | ||
313 | 176 | GLboolean glBool; | 176 | GLboolean glBool; |
314 | 177 | 177 | ||
315 | === modified file 'src/graphic/gl/utils.cc' | |||
316 | --- src/graphic/gl/utils.cc 2017-11-28 17:29:49 +0000 | |||
317 | +++ src/graphic/gl/utils.cc 2019-04-10 16:40:56 +0000 | |||
318 | @@ -57,7 +57,7 @@ | |||
319 | 57 | } // namespace | 57 | } // namespace |
320 | 58 | 58 | ||
321 | 59 | const char* gl_error_to_string(const GLenum err) { | 59 | const char* gl_error_to_string(const GLenum err) { |
323 | 60 | CLANG_DIAG_OFF("-Wswitch-enum"); | 60 | CLANG_DIAG_OFF("-Wswitch-enum") |
324 | 61 | #define LOG(a) \ | 61 | #define LOG(a) \ |
325 | 62 | case a: \ | 62 | case a: \ |
326 | 63 | return #a | 63 | return #a |
327 | @@ -74,7 +74,7 @@ | |||
328 | 74 | break; | 74 | break; |
329 | 75 | } | 75 | } |
330 | 76 | #undef LOG | 76 | #undef LOG |
332 | 77 | CLANG_DIAG_ON("-Wswitch-enum"); | 77 | CLANG_DIAG_ON("-Wswitch-enum") |
333 | 78 | return "unknown"; | 78 | return "unknown"; |
334 | 79 | } | 79 | } |
335 | 80 | 80 | ||
336 | 81 | 81 | ||
337 | === modified file 'src/io/filesystem/test/test_filesystem.cc' | |||
338 | --- src/io/filesystem/test/test_filesystem.cc 2019-02-23 11:00:49 +0000 | |||
339 | +++ src/io/filesystem/test/test_filesystem.cc 2019-04-10 16:40:56 +0000 | |||
340 | @@ -65,66 +65,66 @@ | |||
341 | 65 | 65 | ||
342 | 66 | // RealFSImpl is constructed with a root directory... | 66 | // RealFSImpl is constructed with a root directory... |
343 | 67 | 67 | ||
346 | 68 | TEST_CANONICALIZE_NAME("", "path", cwd + "/path"); | 68 | TEST_CANONICALIZE_NAME("", "path", cwd + "/path") |
347 | 69 | TEST_CANONICALIZE_NAME(".", "path", cwd + "/path"); | 69 | TEST_CANONICALIZE_NAME(".", "path", cwd + "/path") |
348 | 70 | 70 | ||
353 | 71 | TEST_CANONICALIZE_NAME("/home", "path", "/home/path"); | 71 | TEST_CANONICALIZE_NAME("/home", "path", "/home/path") |
354 | 72 | TEST_CANONICALIZE_NAME("/opt", "path", "/opt/path"); | 72 | TEST_CANONICALIZE_NAME("/opt", "path", "/opt/path") |
355 | 73 | TEST_CANONICALIZE_NAME("/opt/test", "path", "/opt/test/path"); | 73 | TEST_CANONICALIZE_NAME("/opt/test", "path", "/opt/test/path") |
356 | 74 | TEST_CANONICALIZE_NAME("/opt", "some/path", "/opt/some/path"); | 74 | TEST_CANONICALIZE_NAME("/opt", "some/path", "/opt/some/path") |
357 | 75 | 75 | ||
358 | 76 | // single dot is removed (root path)... | 76 | // single dot is removed (root path)... |
359 | 77 | 77 | ||
363 | 78 | TEST_CANONICALIZE_NAME("./home/me", "path", cwd + "/home/me/path"); | 78 | TEST_CANONICALIZE_NAME("./home/me", "path", cwd + "/home/me/path") |
364 | 79 | TEST_CANONICALIZE_NAME("/home/./you", "path", "/home/you/path"); | 79 | TEST_CANONICALIZE_NAME("/home/./you", "path", "/home/you/path") |
365 | 80 | TEST_CANONICALIZE_NAME("/home/us/.", "path", "/home/us/path"); | 80 | TEST_CANONICALIZE_NAME("/home/us/.", "path", "/home/us/path") |
366 | 81 | 81 | ||
367 | 82 | // single dot is removed (file path)... | 82 | // single dot is removed (file path)... |
368 | 83 | 83 | ||
372 | 84 | TEST_CANONICALIZE_NAME("/opt", "./no/where", "/opt/no/where"); | 84 | TEST_CANONICALIZE_NAME("/opt", "./no/where", "/opt/no/where") |
373 | 85 | TEST_CANONICALIZE_NAME("/opt", "some/./where", "/opt/some/where"); | 85 | TEST_CANONICALIZE_NAME("/opt", "some/./where", "/opt/some/where") |
374 | 86 | TEST_CANONICALIZE_NAME("/opt", "any/where/.", "/opt/any/where"); | 86 | TEST_CANONICALIZE_NAME("/opt", "any/where/.", "/opt/any/where") |
375 | 87 | 87 | ||
376 | 88 | // empty path nodes are removed (root path)... | 88 | // empty path nodes are removed (root path)... |
377 | 89 | 89 | ||
382 | 90 | TEST_CANONICALIZE_NAME("//usr/empty", "path", "/usr/empty/path"); | 90 | TEST_CANONICALIZE_NAME("//usr/empty", "path", "/usr/empty/path") |
383 | 91 | TEST_CANONICALIZE_NAME("/usr//empty", "path", "/usr/empty/path"); | 91 | TEST_CANONICALIZE_NAME("/usr//empty", "path", "/usr/empty/path") |
384 | 92 | TEST_CANONICALIZE_NAME("/usr/empty/", "path", "/usr/empty/path"); | 92 | TEST_CANONICALIZE_NAME("/usr/empty/", "path", "/usr/empty/path") |
385 | 93 | TEST_CANONICALIZE_NAME("/usr/empty//", "path", "/usr/empty/path"); | 93 | TEST_CANONICALIZE_NAME("/usr/empty//", "path", "/usr/empty/path") |
386 | 94 | 94 | ||
387 | 95 | // empty path nodes are removed (file path)... | 95 | // empty path nodes are removed (file path)... |
388 | 96 | 96 | ||
394 | 97 | TEST_CANONICALIZE_NAME("/usr", "/empty/path", "/usr/empty/path"); | 97 | TEST_CANONICALIZE_NAME("/usr", "/empty/path", "/usr/empty/path") |
395 | 98 | TEST_CANONICALIZE_NAME("/usr", "//empty/path", "/usr/empty/path"); | 98 | TEST_CANONICALIZE_NAME("/usr", "//empty/path", "/usr/empty/path") |
396 | 99 | TEST_CANONICALIZE_NAME("/usr", "empty//path", "/usr/empty/path"); | 99 | TEST_CANONICALIZE_NAME("/usr", "empty//path", "/usr/empty/path") |
397 | 100 | TEST_CANONICALIZE_NAME("/usr", "empty/path/", "/usr/empty/path"); | 100 | TEST_CANONICALIZE_NAME("/usr", "empty/path/", "/usr/empty/path") |
398 | 101 | TEST_CANONICALIZE_NAME("/usr", "empty/path//", "/usr/empty/path"); | 101 | TEST_CANONICALIZE_NAME("/usr", "empty/path//", "/usr/empty/path") |
399 | 102 | 102 | ||
400 | 103 | // '..' moves up a directory in the path (root path)... | 103 | // '..' moves up a directory in the path (root path)... |
401 | 104 | 104 | ||
407 | 105 | TEST_CANONICALIZE_NAME("/usr/../home", "path", "/home/path"); | 105 | TEST_CANONICALIZE_NAME("/usr/../home", "path", "/home/path") |
408 | 106 | TEST_CANONICALIZE_NAME("/usr/../../home", "path", "/home/path"); | 106 | TEST_CANONICALIZE_NAME("/usr/../../home", "path", "/home/path") |
409 | 107 | TEST_CANONICALIZE_NAME("/usr/test/..", "path", "/usr/path"); | 107 | TEST_CANONICALIZE_NAME("/usr/test/..", "path", "/usr/path") |
410 | 108 | TEST_CANONICALIZE_NAME("/usr/one/../two/..", "path", "/usr/path"); | 108 | TEST_CANONICALIZE_NAME("/usr/one/../two/..", "path", "/usr/path") |
411 | 109 | TEST_CANONICALIZE_NAME("/usr/one/../a/b/..", "path", "/usr/a/path"); | 109 | TEST_CANONICALIZE_NAME("/usr/one/../a/b/..", "path", "/usr/a/path") |
412 | 110 | 110 | ||
413 | 111 | // '..' moves up a directory in the path (file path)... | 111 | // '..' moves up a directory in the path (file path)... |
414 | 112 | 112 | ||
426 | 113 | TEST_CANONICALIZE_NAME("/home/test", "../path", "/home/path"); | 113 | TEST_CANONICALIZE_NAME("/home/test", "../path", "/home/path") |
427 | 114 | TEST_CANONICALIZE_NAME("/home/test", "../../path", "/path"); | 114 | TEST_CANONICALIZE_NAME("/home/test", "../../path", "/path") |
428 | 115 | TEST_CANONICALIZE_NAME("/home/test", "../../../path", "/path"); | 115 | TEST_CANONICALIZE_NAME("/home/test", "../../../path", "/path") |
429 | 116 | 116 | ||
430 | 117 | TEST_CANONICALIZE_NAME("/home/test", "path/..", "/home/test"); | 117 | TEST_CANONICALIZE_NAME("/home/test", "path/..", "/home/test") |
431 | 118 | TEST_CANONICALIZE_NAME("/home/test", "path/../..", "/home"); | 118 | TEST_CANONICALIZE_NAME("/home/test", "path/../..", "/home") |
432 | 119 | 119 | ||
433 | 120 | TEST_CANONICALIZE_NAME("/home/test", "path/../one", "/home/test/one"); | 120 | TEST_CANONICALIZE_NAME("/home/test", "path/../one", "/home/test/one") |
434 | 121 | TEST_CANONICALIZE_NAME("/home/test", "path/../../one", "/home/one"); | 121 | TEST_CANONICALIZE_NAME("/home/test", "path/../../one", "/home/one") |
435 | 122 | TEST_CANONICALIZE_NAME("/home/test", "path/../../../one", "/one"); | 122 | TEST_CANONICALIZE_NAME("/home/test", "path/../../../one", "/one") |
436 | 123 | TEST_CANONICALIZE_NAME("/home/test", "path/../../../../one", "/one"); | 123 | TEST_CANONICALIZE_NAME("/home/test", "path/../../../../one", "/one") |
437 | 124 | 124 | ||
438 | 125 | // ...but not a '..' coming from two different strings... | 125 | // ...but not a '..' coming from two different strings... |
439 | 126 | 126 | ||
441 | 127 | TEST_CANONICALIZE_NAME("/home/test/.", "./path", "/home/test/path"); | 127 | TEST_CANONICALIZE_NAME("/home/test/.", "./path", "/home/test/path") |
442 | 128 | 128 | ||
443 | 129 | #ifdef _WIN32 | 129 | #ifdef _WIN32 |
444 | 130 | // Check drive letter handling. | 130 | // Check drive letter handling. |
445 | @@ -140,53 +140,53 @@ | |||
446 | 140 | setenv("HOME", "/my/home", 1); | 140 | setenv("HOME", "/my/home", 1); |
447 | 141 | std::string cwd = RealFSImpl("").get_working_directory(); | 141 | std::string cwd = RealFSImpl("").get_working_directory(); |
448 | 142 | 142 | ||
451 | 143 | TEST_CANONICALIZE_NAME("~", "path", "/my/home/path"); | 143 | TEST_CANONICALIZE_NAME("~", "path", "/my/home/path") |
452 | 144 | TEST_CANONICALIZE_NAME("~/test", "path", "/my/home/test/path"); | 144 | TEST_CANONICALIZE_NAME("~/test", "path", "/my/home/test/path") |
453 | 145 | 145 | ||
454 | 146 | setenv("HOME", "/somewhere", 1); | 146 | setenv("HOME", "/somewhere", 1); |
456 | 147 | TEST_CANONICALIZE_NAME("~", "path", "/somewhere/path"); | 147 | TEST_CANONICALIZE_NAME("~", "path", "/somewhere/path") |
457 | 148 | 148 | ||
458 | 149 | // ~ at the start of the path overrides the root | 149 | // ~ at the start of the path overrides the root |
459 | 150 | 150 | ||
463 | 151 | TEST_CANONICALIZE_NAME("~", "~", "/somewhere"); | 151 | TEST_CANONICALIZE_NAME("~", "~", "/somewhere") |
464 | 152 | TEST_CANONICALIZE_NAME("~/vanish", "~", "/somewhere"); | 152 | TEST_CANONICALIZE_NAME("~/vanish", "~", "/somewhere") |
465 | 153 | TEST_CANONICALIZE_NAME("~/fs", "~/sf", "/somewhere/sf"); | 153 | TEST_CANONICALIZE_NAME("~/fs", "~/sf", "/somewhere/sf") |
466 | 154 | 154 | ||
467 | 155 | // ~ anywhere other than at the start of a path does not get expanded | 155 | // ~ anywhere other than at the start of a path does not get expanded |
468 | 156 | 156 | ||
471 | 157 | TEST_CANONICALIZE_NAME("/opt/~", "path", "/opt/~/path"); | 157 | TEST_CANONICALIZE_NAME("/opt/~", "path", "/opt/~/path") |
472 | 158 | TEST_CANONICALIZE_NAME("/opt/~/the", "path", "/opt/~/the/path"); | 158 | TEST_CANONICALIZE_NAME("/opt/~/the", "path", "/opt/~/the/path") |
473 | 159 | 159 | ||
476 | 160 | TEST_CANONICALIZE_NAME("/opt", "path/~", "/opt/path/~"); | 160 | TEST_CANONICALIZE_NAME("/opt", "path/~", "/opt/path/~") |
477 | 161 | TEST_CANONICALIZE_NAME("/opt", "path/~/here", "/opt/path/~/here"); | 161 | TEST_CANONICALIZE_NAME("/opt", "path/~/here", "/opt/path/~/here") |
478 | 162 | 162 | ||
479 | 163 | // ~ as part of a root-path spec segment name does not get expanded | 163 | // ~ as part of a root-path spec segment name does not get expanded |
480 | 164 | 164 | ||
492 | 165 | TEST_CANONICALIZE_NAME("~a", "path", cwd + "/~a/path"); | 165 | TEST_CANONICALIZE_NAME("~a", "path", cwd + "/~a/path") |
493 | 166 | TEST_CANONICALIZE_NAME("a~", "path", cwd + "/a~/path"); | 166 | TEST_CANONICALIZE_NAME("a~", "path", cwd + "/a~/path") |
494 | 167 | 167 | ||
495 | 168 | TEST_CANONICALIZE_NAME("/opt/~a", "path", "/opt/~a/path"); | 168 | TEST_CANONICALIZE_NAME("/opt/~a", "path", "/opt/~a/path") |
496 | 169 | TEST_CANONICALIZE_NAME("/opt/a~", "path", "/opt/a~/path"); | 169 | TEST_CANONICALIZE_NAME("/opt/a~", "path", "/opt/a~/path") |
497 | 170 | 170 | ||
498 | 171 | TEST_CANONICALIZE_NAME("~a/b", "path", cwd + "/~a/b/path"); | 171 | TEST_CANONICALIZE_NAME("~a/b", "path", cwd + "/~a/b/path") |
499 | 172 | TEST_CANONICALIZE_NAME("a~/b", "path", cwd + "/a~/b/path"); | 172 | TEST_CANONICALIZE_NAME("a~/b", "path", cwd + "/a~/b/path") |
500 | 173 | 173 | ||
501 | 174 | TEST_CANONICALIZE_NAME("/opt/~the/test", "path", "/opt/~the/test/path"); | 174 | TEST_CANONICALIZE_NAME("/opt/~the/test", "path", "/opt/~the/test/path") |
502 | 175 | TEST_CANONICALIZE_NAME("/opt/the~/test", "path", "/opt/the~/test/path"); | 175 | TEST_CANONICALIZE_NAME("/opt/the~/test", "path", "/opt/the~/test/path") |
503 | 176 | 176 | ||
504 | 177 | // ~ as part of a path spec segment name does not get expanded | 177 | // ~ as part of a path spec segment name does not get expanded |
505 | 178 | 178 | ||
517 | 179 | TEST_CANONICALIZE_NAME("/opt", "~path", "/opt/~path"); | 179 | TEST_CANONICALIZE_NAME("/opt", "~path", "/opt/~path") |
518 | 180 | TEST_CANONICALIZE_NAME("/opt", "path~", "/opt/path~"); | 180 | TEST_CANONICALIZE_NAME("/opt", "path~", "/opt/path~") |
519 | 181 | 181 | ||
520 | 182 | TEST_CANONICALIZE_NAME("/opt", "some/~path", "/opt/some/~path"); | 182 | TEST_CANONICALIZE_NAME("/opt", "some/~path", "/opt/some/~path") |
521 | 183 | TEST_CANONICALIZE_NAME("/opt", "some/path~", "/opt/some/path~"); | 183 | TEST_CANONICALIZE_NAME("/opt", "some/path~", "/opt/some/path~") |
522 | 184 | 184 | ||
523 | 185 | TEST_CANONICALIZE_NAME("/opt", "~path/here", "/opt/~path/here"); | 185 | TEST_CANONICALIZE_NAME("/opt", "~path/here", "/opt/~path/here") |
524 | 186 | TEST_CANONICALIZE_NAME("/opt", "path~/here", "/opt/path~/here"); | 186 | TEST_CANONICALIZE_NAME("/opt", "path~/here", "/opt/path~/here") |
525 | 187 | 187 | ||
526 | 188 | TEST_CANONICALIZE_NAME("/opt", "a/~path/here", "/opt/a/~path/here"); | 188 | TEST_CANONICALIZE_NAME("/opt", "a/~path/here", "/opt/a/~path/here") |
527 | 189 | TEST_CANONICALIZE_NAME("/opt", "a/path~/here", "/opt/a/path~/here"); | 189 | TEST_CANONICALIZE_NAME("/opt", "a/path~/here", "/opt/a/path~/here") |
528 | 190 | } | 190 | } |
529 | 191 | #endif | 191 | #endif |
530 | 192 | BOOST_AUTO_TEST_SUITE_END() | 192 | BOOST_AUTO_TEST_SUITE_END() |
531 | 193 | 193 | ||
532 | === modified file 'src/logic/map_objects/bob.cc' | |||
533 | --- src/logic/map_objects/bob.cc 2019-02-27 17:19:00 +0000 | |||
534 | +++ src/logic/map_objects/bob.cc 2019-04-10 16:40:56 +0000 | |||
535 | @@ -903,9 +903,9 @@ | |||
536 | 903 | 903 | ||
537 | 904 | /// Give debug information. | 904 | /// Give debug information. |
538 | 905 | void Bob::log_general_info(const EditorGameBase& egbase) const { | 905 | void Bob::log_general_info(const EditorGameBase& egbase) const { |
540 | 906 | FORMAT_WARNINGS_OFF; | 906 | FORMAT_WARNINGS_OFF |
541 | 907 | molog("Owner: %p\n", owner_); | 907 | molog("Owner: %p\n", owner_); |
543 | 908 | FORMAT_WARNINGS_ON; | 908 | FORMAT_WARNINGS_ON |
544 | 909 | molog("Postition: (%i, %i)\n", position_.x, position_.y); | 909 | molog("Postition: (%i, %i)\n", position_.x, position_.y); |
545 | 910 | molog("ActID: %i\n", actid_); | 910 | molog("ActID: %i\n", actid_); |
546 | 911 | molog("ActScheduled: %s\n", actscheduled_ ? "true" : "false"); | 911 | molog("ActScheduled: %s\n", actscheduled_ ? "true" : "false"); |
547 | @@ -929,9 +929,9 @@ | |||
548 | 929 | molog("* ivar2: %i\n", stack_[i].ivar2); | 929 | molog("* ivar2: %i\n", stack_[i].ivar2); |
549 | 930 | molog("* ivar3: %i\n", stack_[i].ivar3); | 930 | molog("* ivar3: %i\n", stack_[i].ivar3); |
550 | 931 | 931 | ||
552 | 932 | FORMAT_WARNINGS_OFF; | 932 | FORMAT_WARNINGS_OFF |
553 | 933 | molog("* object pointer: %p\n", stack_[i].objvar1.get(egbase)); | 933 | molog("* object pointer: %p\n", stack_[i].objvar1.get(egbase)); |
555 | 934 | FORMAT_WARNINGS_ON; | 934 | FORMAT_WARNINGS_ON |
556 | 935 | molog("* svar1: %s\n", stack_[i].svar1.c_str()); | 935 | molog("* svar1: %s\n", stack_[i].svar1.c_str()); |
557 | 936 | 936 | ||
558 | 937 | molog("* coords: (%i, %i)\n", stack_[i].coords.x, stack_[i].coords.y); | 937 | molog("* coords: (%i, %i)\n", stack_[i].coords.x, stack_[i].coords.y); |
559 | @@ -939,9 +939,9 @@ | |||
560 | 939 | for (Direction dir = FIRST_DIRECTION; dir <= LAST_DIRECTION; ++dir) { | 939 | for (Direction dir = FIRST_DIRECTION; dir <= LAST_DIRECTION; ++dir) { |
561 | 940 | molog(" %d", stack_[i].diranims.get_animation(dir)); | 940 | molog(" %d", stack_[i].diranims.get_animation(dir)); |
562 | 941 | } | 941 | } |
564 | 942 | FORMAT_WARNINGS_OFF; | 942 | FORMAT_WARNINGS_OFF |
565 | 943 | molog("\n* path: %p\n", stack_[i].path); | 943 | molog("\n* path: %p\n", stack_[i].path); |
567 | 944 | FORMAT_WARNINGS_ON; | 944 | FORMAT_WARNINGS_ON |
568 | 945 | if (stack_[i].path) { | 945 | if (stack_[i].path) { |
569 | 946 | const Path& path = *stack_[i].path; | 946 | const Path& path = *stack_[i].path; |
570 | 947 | molog("** Path length: %" PRIuS "\n", path.get_nsteps()); | 947 | molog("** Path length: %" PRIuS "\n", path.get_nsteps()); |
571 | @@ -953,10 +953,10 @@ | |||
572 | 953 | molog("* (%i, %i)\n", coords.x, coords.y); | 953 | molog("* (%i, %i)\n", coords.x, coords.y); |
573 | 954 | } | 954 | } |
574 | 955 | } | 955 | } |
576 | 956 | FORMAT_WARNINGS_OFF; | 956 | FORMAT_WARNINGS_OFF |
577 | 957 | molog("* route: %p\n", stack_[i].route); | 957 | molog("* route: %p\n", stack_[i].route); |
578 | 958 | molog("* program: %p\n", stack_[i].route); | 958 | molog("* program: %p\n", stack_[i].route); |
580 | 959 | FORMAT_WARNINGS_ON; | 959 | FORMAT_WARNINGS_ON |
581 | 960 | } | 960 | } |
582 | 961 | } | 961 | } |
583 | 962 | 962 | ||
584 | 963 | 963 | ||
585 | === modified file 'src/logic/map_objects/immovable.cc' | |||
586 | --- src/logic/map_objects/immovable.cc 2019-02-27 17:19:00 +0000 | |||
587 | +++ src/logic/map_objects/immovable.cc 2019-04-10 16:40:56 +0000 | |||
588 | @@ -1337,14 +1337,14 @@ | |||
589 | 1337 | void PlayerImmovable::log_general_info(const EditorGameBase& egbase) const { | 1337 | void PlayerImmovable::log_general_info(const EditorGameBase& egbase) const { |
590 | 1338 | BaseImmovable::log_general_info(egbase); | 1338 | BaseImmovable::log_general_info(egbase); |
591 | 1339 | 1339 | ||
593 | 1340 | FORMAT_WARNINGS_OFF; | 1340 | FORMAT_WARNINGS_OFF |
594 | 1341 | molog("this: %p\n", this); | 1341 | molog("this: %p\n", this); |
595 | 1342 | molog("owner_: %p\n", owner_); | 1342 | molog("owner_: %p\n", owner_); |
597 | 1343 | FORMAT_WARNINGS_ON; | 1343 | FORMAT_WARNINGS_ON |
598 | 1344 | molog("player_number: %i\n", owner_->player_number()); | 1344 | molog("player_number: %i\n", owner_->player_number()); |
600 | 1345 | FORMAT_WARNINGS_OFF; | 1345 | FORMAT_WARNINGS_OFF |
601 | 1346 | molog("economy_: %p\n", economy_); | 1346 | molog("economy_: %p\n", economy_); |
603 | 1347 | FORMAT_WARNINGS_ON; | 1347 | FORMAT_WARNINGS_ON |
604 | 1348 | } | 1348 | } |
605 | 1349 | 1349 | ||
606 | 1350 | constexpr uint8_t kCurrentPacketVersionPlayerImmovable = 1; | 1350 | constexpr uint8_t kCurrentPacketVersionPlayerImmovable = 1; |
607 | 1351 | 1351 | ||
608 | === modified file 'src/logic/map_objects/tribes/building.cc' | |||
609 | --- src/logic/map_objects/tribes/building.cc 2019-02-28 12:22:36 +0000 | |||
610 | +++ src/logic/map_objects/tribes/building.cc 2019-04-10 16:40:56 +0000 | |||
611 | @@ -681,9 +681,9 @@ | |||
612 | 681 | PlayerImmovable::log_general_info(egbase); | 681 | PlayerImmovable::log_general_info(egbase); |
613 | 682 | 682 | ||
614 | 683 | molog("position: (%i, %i)\n", position_.x, position_.y); | 683 | molog("position: (%i, %i)\n", position_.x, position_.y); |
616 | 684 | FORMAT_WARNINGS_OFF; | 684 | FORMAT_WARNINGS_OFF |
617 | 685 | molog("flag: %p\n", flag_); | 685 | molog("flag: %p\n", flag_); |
619 | 686 | FORMAT_WARNINGS_ON; | 686 | FORMAT_WARNINGS_ON |
620 | 687 | molog("* position: (%i, %i)\n", flag_->get_position().x, flag_->get_position().y); | 687 | molog("* position: (%i, %i)\n", flag_->get_position().x, flag_->get_position().y); |
621 | 688 | 688 | ||
622 | 689 | molog("anim: %s\n", descr().get_animation_name(anim_).c_str()); | 689 | molog("anim: %s\n", descr().get_animation_name(anim_).c_str()); |
623 | @@ -692,9 +692,9 @@ | |||
624 | 692 | molog("leave_time: %i\n", leave_time_); | 692 | molog("leave_time: %i\n", leave_time_); |
625 | 693 | 693 | ||
626 | 694 | molog("leave_queue.size(): %" PRIuS "\n", leave_queue_.size()); | 694 | molog("leave_queue.size(): %" PRIuS "\n", leave_queue_.size()); |
628 | 695 | FORMAT_WARNINGS_OFF; | 695 | FORMAT_WARNINGS_OFF |
629 | 696 | molog("leave_allow.get(): %p\n", leave_allow_.get(egbase)); | 696 | molog("leave_allow.get(): %p\n", leave_allow_.get(egbase)); |
631 | 697 | FORMAT_WARNINGS_ON; | 697 | FORMAT_WARNINGS_ON |
632 | 698 | } | 698 | } |
633 | 699 | 699 | ||
634 | 700 | void Building::add_worker(Worker& worker) { | 700 | void Building::add_worker(Worker& worker) { |
635 | 701 | 701 | ||
636 | === modified file 'src/logic/map_objects/tribes/production_program.cc' | |||
637 | --- src/logic/map_objects/tribes/production_program.cc 2019-02-23 11:00:49 +0000 | |||
638 | +++ src/logic/map_objects/tribes/production_program.cc 2019-04-10 16:40:56 +0000 | |||
639 | @@ -133,7 +133,7 @@ | |||
640 | 133 | char const* const type_name = next_word(parameters, reached_end); | 133 | char const* const type_name = next_word(parameters, reached_end); |
641 | 134 | const DescriptionIndex& wareindex = tribes.ware_index(type_name); | 134 | const DescriptionIndex& wareindex = tribes.ware_index(type_name); |
642 | 135 | if (tribes.ware_exists(wareindex)) { | 135 | if (tribes.ware_exists(wareindex)) { |
644 | 136 | for (int i = 0; i < static_cast<int>(tribes.nrtribes()); ++i) { | 136 | for (size_t i = 0; i < tribes.nrtribes(); ++i) { |
645 | 137 | const TribeDescr& tribe_descr = *tribes.get_tribe_descr(i); | 137 | const TribeDescr& tribe_descr = *tribes.get_tribe_descr(i); |
646 | 138 | if (tribe_descr.has_ware(wareindex)) { | 138 | if (tribe_descr.has_ware(wareindex)) { |
647 | 139 | tribes.set_ware_type_has_demand_check(wareindex, tribe_descr.name()); | 139 | tribes.set_ware_type_has_demand_check(wareindex, tribe_descr.name()); |
648 | @@ -142,7 +142,7 @@ | |||
649 | 142 | return new ProductionProgram::ActReturn::EconomyNeedsWare(wareindex); | 142 | return new ProductionProgram::ActReturn::EconomyNeedsWare(wareindex); |
650 | 143 | } else if (tribes.worker_exists(tribes.worker_index(type_name))) { | 143 | } else if (tribes.worker_exists(tribes.worker_index(type_name))) { |
651 | 144 | const DescriptionIndex& workerindex = tribes.worker_index(type_name); | 144 | const DescriptionIndex& workerindex = tribes.worker_index(type_name); |
653 | 145 | for (int i = 0; i < static_cast<int>(tribes.nrtribes()); ++i) { | 145 | for (size_t i = 0; i < tribes.nrtribes(); ++i) { |
654 | 146 | const TribeDescr* tribe_descr = tribes.get_tribe_descr(i); | 146 | const TribeDescr* tribe_descr = tribes.get_tribe_descr(i); |
655 | 147 | if (tribe_descr->has_worker(workerindex)) { | 147 | if (tribe_descr->has_worker(workerindex)) { |
656 | 148 | tribes.set_worker_type_has_demand_check(workerindex); | 148 | tribes.set_worker_type_has_demand_check(workerindex); |
657 | @@ -462,13 +462,13 @@ | |||
658 | 462 | const Tribes& tribes) { | 462 | const Tribes& tribes) { |
659 | 463 | try { | 463 | try { |
660 | 464 | if (match(parameters, "failed")) | 464 | if (match(parameters, "failed")) |
662 | 465 | result_ = Failed; | 465 | result_ = ProgramResult::kFailed; |
663 | 466 | else if (match(parameters, "completed")) | 466 | else if (match(parameters, "completed")) |
665 | 467 | result_ = Completed; | 467 | result_ = ProgramResult::kCompleted; |
666 | 468 | else if (match(parameters, "skipped")) | 468 | else if (match(parameters, "skipped")) |
668 | 469 | result_ = Skipped; | 469 | result_ = ProgramResult::kSkipped; |
669 | 470 | else if (match(parameters, "no_stats")) | 470 | else if (match(parameters, "no_stats")) |
671 | 471 | result_ = None; | 471 | result_ = ProgramResult::kNone; |
672 | 472 | else | 472 | else |
673 | 473 | throw GameDataError("expected %s but found \"%s\"", | 473 | throw GameDataError("expected %s but found \"%s\"", |
674 | 474 | "{\"failed\"|\"completed\"|\"skipped\"|\"no_stats\"}", parameters); | 474 | "{\"failed\"|\"completed\"|\"skipped\"|\"no_stats\"}", parameters); |
675 | @@ -539,22 +539,33 @@ | |||
676 | 539 | i18n::localize_list(condition_list, i18n::ConcatenateWith::AND); | 539 | i18n::localize_list(condition_list, i18n::ConcatenateWith::AND); |
677 | 540 | 540 | ||
678 | 541 | std::string result_string; | 541 | std::string result_string; |
680 | 542 | if (result_ == Failed) { | 542 | switch (result_) { |
681 | 543 | case ProgramResult::kFailed: { | ||
682 | 543 | /** TRANSLATORS: "Did not start working because the economy needs the ware ‘%s’" */ | 544 | /** TRANSLATORS: "Did not start working because the economy needs the ware ‘%s’" */ |
683 | 544 | result_string = (boost::format(_("Did not start %1$s because %2$s")) % | 545 | result_string = (boost::format(_("Did not start %1$s because %2$s")) % |
684 | 545 | ps.top_state().program->descname() % condition_string) | 546 | ps.top_state().program->descname() % condition_string) |
685 | 546 | .str(); | 547 | .str(); |
687 | 547 | } else if (result_ == Completed) { | 548 | } break; |
688 | 549 | case ProgramResult::kCompleted: { | ||
689 | 548 | /** TRANSLATORS: "Completed working because the economy needs the ware ‘%s’" */ | 550 | /** TRANSLATORS: "Completed working because the economy needs the ware ‘%s’" */ |
690 | 549 | result_string = (boost::format(_("Completed %1$s because %2$s")) % | 551 | result_string = (boost::format(_("Completed %1$s because %2$s")) % |
691 | 550 | ps.top_state().program->descname() % condition_string) | 552 | ps.top_state().program->descname() % condition_string) |
692 | 551 | .str(); | 553 | .str(); |
694 | 552 | } else { | 554 | } break; |
695 | 555 | case ProgramResult::kSkipped: { | ||
696 | 553 | /** TRANSLATORS: "Skipped working because the economy needs the ware ‘%s’" */ | 556 | /** TRANSLATORS: "Skipped working because the economy needs the ware ‘%s’" */ |
697 | 554 | result_string = (boost::format(_("Skipped %1$s because %2$s")) % | 557 | result_string = (boost::format(_("Skipped %1$s because %2$s")) % |
698 | 555 | ps.top_state().program->descname() % condition_string) | 558 | ps.top_state().program->descname() % condition_string) |
699 | 556 | .str(); | 559 | .str(); |
701 | 557 | } | 560 | } break; |
702 | 561 | case ProgramResult::kNone: { | ||
703 | 562 | // TODO(GunChleoc): Same as skipped - is this on purpose? | ||
704 | 563 | result_string = (boost::format(_("Skipped %1$s because %2$s")) % | ||
705 | 564 | ps.top_state().program->descname() % condition_string) | ||
706 | 565 | .str(); | ||
707 | 566 | } | ||
708 | 567 | } | ||
709 | 568 | |||
710 | 558 | ps.set_production_result(result_string); | 569 | ps.set_production_result(result_string); |
711 | 559 | } | 570 | } |
712 | 560 | return ps.program_end(game, result_); | 571 | return ps.program_end(game, result_); |
713 | @@ -562,9 +573,9 @@ | |||
714 | 562 | 573 | ||
715 | 563 | ProductionProgram::ActCall::ActCall(char* parameters, const ProductionSiteDescr& descr) { | 574 | ProductionProgram::ActCall::ActCall(char* parameters, const ProductionSiteDescr& descr) { |
716 | 564 | // Initialize with default handling methods. | 575 | // Initialize with default handling methods. |
720 | 565 | handling_methods_[Failed - 1] = Continue; | 576 | handling_methods_[program_result_index(ProgramResult::kFailed)] = ProgramResultHandlingMethod::kContinue; |
721 | 566 | handling_methods_[Completed - 1] = Continue; | 577 | handling_methods_[program_result_index(ProgramResult::kCompleted)] = ProgramResultHandlingMethod::kContinue; |
722 | 567 | handling_methods_[Skipped - 1] = Continue; | 578 | handling_methods_[program_result_index(ProgramResult::kSkipped)] = ProgramResultHandlingMethod::kContinue; |
723 | 568 | 579 | ||
724 | 569 | try { | 580 | try { |
725 | 570 | bool reached_end; | 581 | bool reached_end; |
726 | @@ -586,34 +597,34 @@ | |||
727 | 586 | 597 | ||
728 | 587 | ProgramResult result_to_set_method_for; | 598 | ProgramResult result_to_set_method_for; |
729 | 588 | if (match_force_skip(parameters, "failure")) { | 599 | if (match_force_skip(parameters, "failure")) { |
731 | 589 | if (handling_methods_[Failed - 1] != Continue) | 600 | if (handling_methods_[program_result_index(ProgramResult::kFailed)] != ProgramResultHandlingMethod::kContinue) |
732 | 590 | throw GameDataError("%s handling method already defined", "failure"); | 601 | throw GameDataError("%s handling method already defined", "failure"); |
734 | 591 | result_to_set_method_for = Failed; | 602 | result_to_set_method_for = ProgramResult::kFailed; |
735 | 592 | } else if (match_force_skip(parameters, "completion")) { | 603 | } else if (match_force_skip(parameters, "completion")) { |
737 | 593 | if (handling_methods_[Completed - 1] != Continue) | 604 | if (handling_methods_[program_result_index(ProgramResult::kCompleted)] != ProgramResultHandlingMethod::kContinue) |
738 | 594 | throw GameDataError("%s handling method already defined", "completion"); | 605 | throw GameDataError("%s handling method already defined", "completion"); |
740 | 595 | result_to_set_method_for = Completed; | 606 | result_to_set_method_for = ProgramResult::kCompleted; |
741 | 596 | } else if (match_force_skip(parameters, "skip")) { | 607 | } else if (match_force_skip(parameters, "skip")) { |
743 | 597 | if (handling_methods_[Skipped - 1] != Continue) | 608 | if (handling_methods_[program_result_index(ProgramResult::kSkipped)] != ProgramResultHandlingMethod::kContinue) |
744 | 598 | throw GameDataError("%s handling method already defined", "skip"); | 609 | throw GameDataError("%s handling method already defined", "skip"); |
746 | 599 | result_to_set_method_for = Skipped; | 610 | result_to_set_method_for = ProgramResult::kSkipped; |
747 | 600 | } else | 611 | } else |
748 | 601 | throw GameDataError( | 612 | throw GameDataError( |
749 | 602 | "expected %s but found \"%s\"", "{\"failure\"|\"completion\"|\"skip\"}", parameters); | 613 | "expected %s but found \"%s\"", "{\"failure\"|\"completion\"|\"skip\"}", parameters); |
750 | 603 | 614 | ||
751 | 604 | ProgramResultHandlingMethod handling_method; | 615 | ProgramResultHandlingMethod handling_method; |
752 | 605 | if (match(parameters, "fail")) | 616 | if (match(parameters, "fail")) |
754 | 606 | handling_method = Fail; | 617 | handling_method = ProgramResultHandlingMethod::kFail; |
755 | 607 | else if (match(parameters, "complete")) | 618 | else if (match(parameters, "complete")) |
757 | 608 | handling_method = Complete; | 619 | handling_method = ProgramResultHandlingMethod::kComplete; |
758 | 609 | else if (match(parameters, "skip")) | 620 | else if (match(parameters, "skip")) |
760 | 610 | handling_method = Skip; | 621 | handling_method = ProgramResultHandlingMethod::kSkip; |
761 | 611 | else if (match(parameters, "repeat")) | 622 | else if (match(parameters, "repeat")) |
763 | 612 | handling_method = Repeat; | 623 | handling_method = ProgramResultHandlingMethod::kRepeat; |
764 | 613 | else | 624 | else |
765 | 614 | throw GameDataError("expected %s but found \"%s\"", | 625 | throw GameDataError("expected %s but found \"%s\"", |
766 | 615 | "{\"fail\"|\"complete\"|\"skip\"|\"repeat\"}", parameters); | 626 | "{\"fail\"|\"complete\"|\"skip\"|\"repeat\"}", parameters); |
768 | 616 | handling_methods_[result_to_set_method_for - 1] = handling_method; | 627 | handling_methods_[program_result_index(result_to_set_method_for)] = handling_method; |
769 | 617 | reached_end = !*parameters; | 628 | reached_end = !*parameters; |
770 | 618 | } | 629 | } |
771 | 619 | } catch (const WException& e) { | 630 | } catch (const WException& e) { |
772 | @@ -622,21 +633,21 @@ | |||
773 | 622 | } | 633 | } |
774 | 623 | 634 | ||
775 | 624 | void ProductionProgram::ActCall::execute(Game& game, ProductionSite& ps) const { | 635 | void ProductionProgram::ActCall::execute(Game& game, ProductionSite& ps) const { |
777 | 625 | ProgramResult const program_result = static_cast<ProgramResult>(ps.top_state().phase); | 636 | ProgramResult const program_result = ps.top_state().phase; |
778 | 626 | 637 | ||
780 | 627 | if (program_result == None) { // The program has not yet been called. | 638 | if (program_result == ProgramResult::kNone) { // The program has not yet been called. |
781 | 628 | return ps.program_start(game, program_->name()); | 639 | return ps.program_start(game, program_->name()); |
782 | 629 | } | 640 | } |
783 | 630 | 641 | ||
790 | 631 | switch (handling_methods_[program_result - 1]) { | 642 | switch (handling_methods_[program_result_index(program_result)]) { |
791 | 632 | case Fail: | 643 | case ProgramResultHandlingMethod::kFail: |
792 | 633 | case Complete: | 644 | case ProgramResultHandlingMethod::kComplete: |
793 | 634 | case Skip: | 645 | case ProgramResultHandlingMethod::kSkip: |
794 | 635 | return ps.program_end(game, None); | 646 | return ps.program_end(game, ProgramResult::kNone); |
795 | 636 | case Continue: | 647 | case ProgramResultHandlingMethod::kContinue: |
796 | 637 | return ps.program_step(game); | 648 | return ps.program_step(game); |
799 | 638 | case Repeat: | 649 | case ProgramResultHandlingMethod::kRepeat: |
800 | 639 | ps.top_state().phase = None; | 650 | ps.top_state().phase = ProgramResult::kNone; |
801 | 640 | ps.program_timer_ = true; | 651 | ps.program_timer_ = true; |
802 | 641 | ps.program_time_ = ps.schedule_act(game, 10); | 652 | ps.program_time_ = ps.schedule_act(game, 10); |
803 | 642 | break; | 653 | break; |
804 | @@ -687,9 +698,9 @@ | |||
805 | 687 | ProductionSite& psite, | 698 | ProductionSite& psite, |
806 | 688 | Worker& worker) const { | 699 | Worker& worker) const { |
807 | 689 | ProductionSite::State& state = psite.top_state(); | 700 | ProductionSite::State& state = psite.top_state(); |
809 | 690 | if (state.phase == 0) { | 701 | if (state.phase == ProgramResult::kNone) { |
810 | 691 | worker.start_task_program(game, program()); | 702 | worker.start_task_program(game, program()); |
812 | 692 | ++state.phase; | 703 | state.phase = ProgramResult::kFailed; |
813 | 693 | return true; | 704 | return true; |
814 | 694 | } else { | 705 | } else { |
815 | 695 | psite.program_step(game); | 706 | psite.program_step(game); |
816 | @@ -700,7 +711,7 @@ | |||
817 | 700 | void ProductionProgram::ActCallWorker::building_work_failed(Game& game, | 711 | void ProductionProgram::ActCallWorker::building_work_failed(Game& game, |
818 | 701 | ProductionSite& psite, | 712 | ProductionSite& psite, |
819 | 702 | Worker&) const { | 713 | Worker&) const { |
821 | 703 | psite.program_end(game, Failed); | 714 | psite.program_end(game, ProgramResult::kFailed); |
822 | 704 | } | 715 | } |
823 | 705 | 716 | ||
824 | 706 | ProductionProgram::ActSleep::ActSleep(char* parameters) { | 717 | ProductionProgram::ActSleep::ActSleep(char* parameters) { |
825 | @@ -719,7 +730,7 @@ | |||
826 | 719 | } | 730 | } |
827 | 720 | 731 | ||
828 | 721 | void ProductionProgram::ActSleep::execute(Game& game, ProductionSite& ps) const { | 732 | void ProductionProgram::ActSleep::execute(Game& game, ProductionSite& ps) const { |
830 | 722 | return ps.program_step(game, duration_ ? duration_ : ps.top_state().phase); | 733 | return ps.program_step(game, duration_ ? duration_ : 0, ps.top_state().phase); |
831 | 723 | } | 734 | } |
832 | 724 | 735 | ||
833 | 725 | ProductionProgram::ActCheckMap::ActCheckMap(char* parameters) { | 736 | ProductionProgram::ActCheckMap::ActCheckMap(char* parameters) { |
834 | @@ -743,7 +754,7 @@ | |||
835 | 743 | return ps.program_step(game, 0); | 754 | return ps.program_step(game, 0); |
836 | 744 | } else { | 755 | } else { |
837 | 745 | ps.set_production_result(_("No use for ships on this map!")); | 756 | ps.set_production_result(_("No use for ships on this map!")); |
839 | 746 | return ps.program_end(game, Failed); | 757 | return ps.program_end(game, ProgramResult::kFailed); |
840 | 747 | } | 758 | } |
841 | 748 | } | 759 | } |
842 | 749 | default: | 760 | default: |
843 | @@ -777,7 +788,7 @@ | |||
844 | 777 | 788 | ||
845 | 778 | void ProductionProgram::ActAnimate::execute(Game& game, ProductionSite& ps) const { | 789 | void ProductionProgram::ActAnimate::execute(Game& game, ProductionSite& ps) const { |
846 | 779 | ps.start_animation(game, id_); | 790 | ps.start_animation(game, id_); |
848 | 780 | return ps.program_step(game, duration_ ? duration_ : ps.top_state().phase); | 791 | return ps.program_step(game, duration_ ? duration_ : 0, ps.top_state().phase); |
849 | 781 | } | 792 | } |
850 | 782 | 793 | ||
851 | 783 | ProductionProgram::ActConsume::ActConsume(char* parameters, | 794 | ProductionProgram::ActConsume::ActConsume(char* parameters, |
852 | @@ -900,7 +911,7 @@ | |||
853 | 900 | .str(); | 911 | .str(); |
854 | 901 | 912 | ||
855 | 902 | ps.set_production_result(result_string); | 913 | ps.set_production_result(result_string); |
857 | 903 | return ps.program_end(game, Failed); | 914 | return ps.program_end(game, ProgramResult::kFailed); |
858 | 904 | } else { // we fulfilled all consumption requirements | 915 | } else { // we fulfilled all consumption requirements |
859 | 905 | for (size_t i = 0; i < inputqueues.size(); ++i) { | 916 | for (size_t i = 0; i < inputqueues.size(); ++i) { |
860 | 906 | if (uint8_t const q = consumption_quantities[i]) { | 917 | if (uint8_t const q = consumption_quantities[i]) { |
861 | @@ -1182,7 +1193,7 @@ | |||
862 | 1182 | if (digged_percentage < max_) { | 1193 | if (digged_percentage < max_) { |
863 | 1183 | // mine can produce normally | 1194 | // mine can produce normally |
864 | 1184 | if (totalres == 0) | 1195 | if (totalres == 0) |
866 | 1185 | return ps.program_end(game, Failed); | 1196 | return ps.program_end(game, ProgramResult::kFailed); |
867 | 1186 | 1197 | ||
868 | 1187 | // second pass through nodes | 1198 | // second pass through nodes |
869 | 1188 | assert(totalchance); | 1199 | assert(totalchance); |
870 | @@ -1210,7 +1221,7 @@ | |||
871 | 1210 | } | 1221 | } |
872 | 1211 | 1222 | ||
873 | 1212 | if (pick >= 0) { | 1223 | if (pick >= 0) { |
875 | 1213 | return ps.program_end(game, Failed); | 1224 | return ps.program_end(game, ProgramResult::kFailed); |
876 | 1214 | } | 1225 | } |
877 | 1215 | 1226 | ||
878 | 1216 | } else { | 1227 | } else { |
879 | @@ -1233,7 +1244,7 @@ | |||
880 | 1233 | if (training_ >= game.logic_rand() % 100) { | 1244 | if (training_ >= game.logic_rand() % 100) { |
881 | 1234 | ps.train_workers(game); | 1245 | ps.train_workers(game); |
882 | 1235 | } | 1246 | } |
884 | 1236 | return ps.program_end(game, Failed); | 1247 | return ps.program_end(game, ProgramResult::kFailed); |
885 | 1237 | } | 1248 | } |
886 | 1238 | } | 1249 | } |
887 | 1239 | 1250 | ||
888 | @@ -1278,7 +1289,7 @@ | |||
889 | 1278 | const std::vector<Soldier*> soldiers = ctrl->present_soldiers(); | 1289 | const std::vector<Soldier*> soldiers = ctrl->present_soldiers(); |
890 | 1279 | if (soldiers.empty()) { | 1290 | if (soldiers.empty()) { |
891 | 1280 | ps.set_production_result(_("No soldier to train!")); | 1291 | ps.set_production_result(_("No soldier to train!")); |
893 | 1281 | return ps.program_end(game, Skipped); | 1292 | return ps.program_end(game, ProgramResult::kSkipped); |
894 | 1282 | } | 1293 | } |
895 | 1283 | ps.molog(" Checking soldier (%u) level %d)\n", static_cast<unsigned int>(attribute), | 1294 | ps.molog(" Checking soldier (%u) level %d)\n", static_cast<unsigned int>(attribute), |
896 | 1284 | static_cast<unsigned int>(level)); | 1295 | static_cast<unsigned int>(level)); |
897 | @@ -1287,7 +1298,7 @@ | |||
898 | 1287 | for (std::vector<Soldier*>::const_iterator it = soldiers.begin();; ++it) { | 1298 | for (std::vector<Soldier*>::const_iterator it = soldiers.begin();; ++it) { |
899 | 1288 | if (it == soldiers_end) { | 1299 | if (it == soldiers_end) { |
900 | 1289 | ps.set_production_result(_("No soldier found for this training level!")); | 1300 | ps.set_production_result(_("No soldier found for this training level!")); |
902 | 1290 | return ps.program_end(game, Skipped); | 1301 | return ps.program_end(game, ProgramResult::kSkipped); |
903 | 1291 | } | 1302 | } |
904 | 1292 | if (attribute == TrainingAttribute::kHealth) { | 1303 | if (attribute == TrainingAttribute::kHealth) { |
905 | 1293 | if ((*it)->get_health_level() == level) | 1304 | if ((*it)->get_health_level() == level) |
906 | @@ -1354,7 +1365,6 @@ | |||
907 | 1354 | 1365 | ||
908 | 1355 | void ProductionProgram::ActTrain::execute(Game& game, ProductionSite& ps) const { | 1366 | void ProductionProgram::ActTrain::execute(Game& game, ProductionSite& ps) const { |
909 | 1356 | const SoldierControl* ctrl = ps.soldier_control(); | 1367 | const SoldierControl* ctrl = ps.soldier_control(); |
910 | 1357 | ; | ||
911 | 1358 | const std::vector<Soldier*> soldiers = ctrl->present_soldiers(); | 1368 | const std::vector<Soldier*> soldiers = ctrl->present_soldiers(); |
912 | 1359 | const std::vector<Soldier*>::const_iterator soldiers_end = soldiers.end(); | 1369 | const std::vector<Soldier*>::const_iterator soldiers_end = soldiers.end(); |
913 | 1360 | std::vector<Soldier*>::const_iterator it = soldiers.begin(); | 1370 | std::vector<Soldier*>::const_iterator it = soldiers.begin(); |
914 | @@ -1365,7 +1375,7 @@ | |||
915 | 1365 | for (;; ++it) { | 1375 | for (;; ++it) { |
916 | 1366 | if (it == soldiers_end) { | 1376 | if (it == soldiers_end) { |
917 | 1367 | ps.set_production_result(_("No soldier found for this training level!")); | 1377 | ps.set_production_result(_("No soldier found for this training level!")); |
919 | 1368 | return ps.program_end(game, Skipped); | 1378 | return ps.program_end(game, ProgramResult::kSkipped); |
920 | 1369 | } | 1379 | } |
921 | 1370 | if (attribute == TrainingAttribute::kHealth) { | 1380 | if (attribute == TrainingAttribute::kHealth) { |
922 | 1371 | if ((*it)->get_health_level() == level) | 1381 | if ((*it)->get_health_level() == level) |
923 | @@ -1481,7 +1491,7 @@ | |||
924 | 1481 | } | 1491 | } |
925 | 1482 | 1492 | ||
926 | 1483 | if (available_resource == INVALID_INDEX) { | 1493 | if (available_resource == INVALID_INDEX) { |
928 | 1484 | psite.program_end(game, Failed); | 1494 | psite.program_end(game, ProgramResult::kFailed); |
929 | 1485 | return; | 1495 | return; |
930 | 1486 | } | 1496 | } |
931 | 1487 | 1497 | ||
932 | @@ -1534,14 +1544,14 @@ | |||
933 | 1534 | } | 1544 | } |
934 | 1535 | 1545 | ||
935 | 1536 | psite.molog("construct: no object or buildable field\n"); | 1546 | psite.molog("construct: no object or buildable field\n"); |
937 | 1537 | psite.program_end(game, Failed); | 1547 | psite.program_end(game, ProgramResult::kFailed); |
938 | 1538 | } | 1548 | } |
939 | 1539 | 1549 | ||
940 | 1540 | bool ProductionProgram::ActConstruct::get_building_work(Game& game, | 1550 | bool ProductionProgram::ActConstruct::get_building_work(Game& game, |
941 | 1541 | ProductionSite& psite, | 1551 | ProductionSite& psite, |
942 | 1542 | Worker& worker) const { | 1552 | Worker& worker) const { |
943 | 1543 | ProductionSite::State& state = psite.top_state(); | 1553 | ProductionSite::State& state = psite.top_state(); |
945 | 1544 | if (state.phase >= 1) { | 1554 | if (state.phase > ProgramResult::kNone) { |
946 | 1545 | psite.program_step(game); | 1555 | psite.program_step(game); |
947 | 1546 | return false; | 1556 | return false; |
948 | 1547 | } | 1557 | } |
949 | @@ -1554,7 +1564,7 @@ | |||
950 | 1554 | if (construction) { | 1564 | if (construction) { |
951 | 1555 | if (!construction->construct_remaining_buildcost(game, &remaining)) { | 1565 | if (!construction->construct_remaining_buildcost(game, &remaining)) { |
952 | 1556 | psite.molog("construct: immovable %u not under construction", construction->serial()); | 1566 | psite.molog("construct: immovable %u not under construction", construction->serial()); |
954 | 1557 | psite.program_end(game, Failed); | 1567 | psite.program_end(game, ProgramResult::kFailed); |
955 | 1558 | return false; | 1568 | return false; |
956 | 1559 | } | 1569 | } |
957 | 1560 | } else { | 1570 | } else { |
958 | @@ -1571,7 +1581,7 @@ | |||
959 | 1571 | } | 1581 | } |
960 | 1572 | 1582 | ||
961 | 1573 | if (!wq) { | 1583 | if (!wq) { |
963 | 1574 | psite.program_end(game, Failed); | 1584 | psite.program_end(game, ProgramResult::kFailed); |
964 | 1575 | return false; | 1585 | return false; |
965 | 1576 | } | 1586 | } |
966 | 1577 | 1587 | ||
967 | @@ -1587,14 +1597,14 @@ | |||
968 | 1587 | worker.top_state().objvar1 = construction; | 1597 | worker.top_state().objvar1 = construction; |
969 | 1588 | worker.top_state().coords = state.coord; | 1598 | worker.top_state().coords = state.coord; |
970 | 1589 | 1599 | ||
972 | 1590 | state.phase = 1; | 1600 | state.phase = ProgramResult::kFailed; |
973 | 1591 | return true; | 1601 | return true; |
974 | 1592 | } | 1602 | } |
975 | 1593 | 1603 | ||
976 | 1594 | void ProductionProgram::ActConstruct::building_work_failed(Game& game, | 1604 | void ProductionProgram::ActConstruct::building_work_failed(Game& game, |
977 | 1595 | ProductionSite& psite, | 1605 | ProductionSite& psite, |
978 | 1596 | Worker&) const { | 1606 | Worker&) const { |
980 | 1597 | psite.program_end(game, Failed); | 1607 | psite.program_end(game, ProgramResult::kFailed); |
981 | 1598 | } | 1608 | } |
982 | 1599 | 1609 | ||
983 | 1600 | ProductionProgram::ProductionProgram(const std::string& init_name, | 1610 | ProductionProgram::ProductionProgram(const std::string& init_name, |
984 | 1601 | 1611 | ||
985 | === modified file 'src/logic/map_objects/tribes/productionsite.cc' | |||
986 | --- src/logic/map_objects/tribes/productionsite.cc 2019-02-23 11:00:49 +0000 | |||
987 | +++ src/logic/map_objects/tribes/productionsite.cc 2019-04-10 16:40:56 +0000 | |||
988 | @@ -682,7 +682,7 @@ | |||
989 | 682 | 682 | ||
990 | 683 | if (!can_start_working()) { | 683 | if (!can_start_working()) { |
991 | 684 | while (!stack_.empty()) | 684 | while (!stack_.empty()) |
993 | 685 | program_end(game, Failed); | 685 | program_end(game, ProgramResult::kFailed); |
994 | 686 | } else { | 686 | } else { |
995 | 687 | if (stack_.empty()) { | 687 | if (stack_.empty()) { |
996 | 688 | working_positions_[0].worker->update_task_buildingwork(game); | 688 | working_positions_[0].worker->update_task_buildingwork(game); |
997 | @@ -691,7 +691,7 @@ | |||
998 | 691 | 691 | ||
999 | 692 | State& state = top_state(); | 692 | State& state = top_state(); |
1000 | 693 | if (state.program->size() <= state.ip) | 693 | if (state.program->size() <= state.ip) |
1002 | 694 | return program_end(game, Completed); | 694 | return program_end(game, ProgramResult::kCompleted); |
1003 | 695 | 695 | ||
1004 | 696 | if (anim_ != descr().get_animation(default_anim_)) { | 696 | if (anim_ != descr().get_animation(default_anim_)) { |
1005 | 697 | // Restart idle animation, which is the default | 697 | // Restart idle animation, which is the default |
1006 | @@ -720,7 +720,7 @@ | |||
1007 | 720 | // new productions cycle. Otherwise it can lead to consumption | 720 | // new productions cycle. Otherwise it can lead to consumption |
1008 | 721 | // of input wares without producing anything | 721 | // of input wares without producing anything |
1009 | 722 | if (is_stopped_ && state.ip == 0) { | 722 | if (is_stopped_ && state.ip == 0) { |
1011 | 723 | program_end(game, Failed); | 723 | program_end(game, ProgramResult::kFailed); |
1012 | 724 | program_timer_ = true; | 724 | program_timer_ = true; |
1013 | 725 | program_time_ = schedule_act(game, 20000); | 725 | program_time_ = schedule_act(game, 20000); |
1014 | 726 | } else | 726 | } else |
1015 | @@ -874,7 +874,7 @@ | |||
1016 | 874 | /** | 874 | /** |
1017 | 875 | * Advance the program to the next step. | 875 | * Advance the program to the next step. |
1018 | 876 | */ | 876 | */ |
1020 | 877 | void ProductionSite::program_step(Game& game, uint32_t const delay, uint32_t const phase) { | 877 | void ProductionSite::program_step(Game& game, uint32_t const delay, ProgramResult const phase) { |
1021 | 878 | State& state = top_state(); | 878 | State& state = top_state(); |
1022 | 879 | ++state.ip; | 879 | ++state.ip; |
1023 | 880 | state.phase = phase; | 880 | state.phase = phase; |
1024 | @@ -890,7 +890,7 @@ | |||
1025 | 890 | 890 | ||
1026 | 891 | state.program = descr().get_program(program_name); | 891 | state.program = descr().get_program(program_name); |
1027 | 892 | state.ip = 0; | 892 | state.ip = 0; |
1029 | 893 | state.phase = 0; | 893 | state.phase = ProgramResult::kNone; |
1030 | 894 | 894 | ||
1031 | 895 | stack_.push_back(state); | 895 | stack_.push_back(state); |
1032 | 896 | 896 | ||
1033 | @@ -918,17 +918,18 @@ | |||
1034 | 918 | const std::string& program_name = top_state().program->name(); | 918 | const std::string& program_name = top_state().program->name(); |
1035 | 919 | 919 | ||
1036 | 920 | stack_.pop_back(); | 920 | stack_.pop_back(); |
1038 | 921 | if (!stack_.empty()) | 921 | if (!stack_.empty()) { |
1039 | 922 | top_state().phase = result; | 922 | top_state().phase = result; |
1040 | 923 | } | ||
1041 | 923 | 924 | ||
1042 | 924 | switch (result) { | 925 | switch (result) { |
1044 | 925 | case Failed: | 926 | case ProgramResult::kFailed: |
1045 | 926 | statistics_.erase(statistics_.begin(), statistics_.begin() + 1); | 927 | statistics_.erase(statistics_.begin(), statistics_.begin() + 1); |
1046 | 927 | statistics_.push_back(false); | 928 | statistics_.push_back(false); |
1047 | 928 | calc_statistics(); | 929 | calc_statistics(); |
1048 | 929 | crude_percent_ = crude_percent_ * 8 / 10; | 930 | crude_percent_ = crude_percent_ * 8 / 10; |
1049 | 930 | break; | 931 | break; |
1051 | 931 | case Completed: | 932 | case ProgramResult::kCompleted: |
1052 | 932 | skipped_programs_.erase(program_name); | 933 | skipped_programs_.erase(program_name); |
1053 | 933 | statistics_.erase(statistics_.begin(), statistics_.begin() + 1); | 934 | statistics_.erase(statistics_.begin(), statistics_.begin() + 1); |
1054 | 934 | statistics_.push_back(true); | 935 | statistics_.push_back(true); |
1055 | @@ -936,11 +937,11 @@ | |||
1056 | 936 | crude_percent_ = crude_percent_ * 8 / 10 + 1000000 * 2 / 10; | 937 | crude_percent_ = crude_percent_ * 8 / 10 + 1000000 * 2 / 10; |
1057 | 937 | calc_statistics(); | 938 | calc_statistics(); |
1058 | 938 | break; | 939 | break; |
1060 | 939 | case Skipped: | 940 | case ProgramResult::kSkipped: |
1061 | 940 | skipped_programs_[program_name] = game.get_gametime(); | 941 | skipped_programs_[program_name] = game.get_gametime(); |
1062 | 941 | crude_percent_ = crude_percent_ * 98 / 100; | 942 | crude_percent_ = crude_percent_ * 98 / 100; |
1063 | 942 | break; | 943 | break; |
1065 | 943 | case None: | 944 | case ProgramResult::kNone: |
1066 | 944 | skipped_programs_.erase(program_name); | 945 | skipped_programs_.erase(program_name); |
1067 | 945 | break; | 946 | break; |
1068 | 946 | } | 947 | } |
1069 | 947 | 948 | ||
1070 | === modified file 'src/logic/map_objects/tribes/productionsite.h' | |||
1071 | --- src/logic/map_objects/tribes/productionsite.h 2019-02-23 11:00:49 +0000 | |||
1072 | +++ src/logic/map_objects/tribes/productionsite.h 2019-04-10 16:40:56 +0000 | |||
1073 | @@ -243,7 +243,7 @@ | |||
1074 | 243 | struct State { | 243 | struct State { |
1075 | 244 | const ProductionProgram* program; ///< currently running program | 244 | const ProductionProgram* program; ///< currently running program |
1076 | 245 | size_t ip; ///< instruction pointer | 245 | size_t ip; ///< instruction pointer |
1078 | 246 | uint32_t phase; ///< micro-step index (instruction dependent) | 246 | ProgramResult phase; ///< micro-step index (instruction dependent) |
1079 | 247 | uint32_t flags; ///< pfXXX flags | 247 | uint32_t flags; ///< pfXXX flags |
1080 | 248 | 248 | ||
1081 | 249 | /** | 249 | /** |
1082 | @@ -254,7 +254,7 @@ | |||
1083 | 254 | Coords coord; | 254 | Coords coord; |
1084 | 255 | /*@}*/ | 255 | /*@}*/ |
1085 | 256 | 256 | ||
1087 | 257 | State() : program(nullptr), ip(0), phase(0), flags(0), coord(Coords::null()) { | 257 | State() : program(nullptr), ip(0), phase(ProgramResult::kNone), flags(0), coord(Coords::null()) { |
1088 | 258 | } | 258 | } |
1089 | 259 | }; | 259 | }; |
1090 | 260 | 260 | ||
1091 | @@ -282,7 +282,7 @@ | |||
1092 | 282 | /// how long it should take to mine, given the particular circumstances, | 282 | /// how long it should take to mine, given the particular circumstances, |
1093 | 283 | /// and pass the result to the following animation command, to set the | 283 | /// and pass the result to the following animation command, to set the |
1094 | 284 | /// duration. | 284 | /// duration. |
1096 | 285 | void program_step(Game&, uint32_t delay = 10, uint32_t phase = 0); | 285 | void program_step(Game&, uint32_t delay = 10, ProgramResult phase = ProgramResult::kNone); |
1097 | 286 | 286 | ||
1098 | 287 | void program_start(Game&, const std::string& program_name); | 287 | void program_start(Game&, const std::string& program_name); |
1099 | 288 | virtual void program_end(Game&, ProgramResult); | 288 | virtual void program_end(Game&, ProgramResult); |
1100 | 289 | 289 | ||
1101 | === modified file 'src/logic/map_objects/tribes/program_result.h' | |||
1102 | --- src/logic/map_objects/tribes/program_result.h 2019-02-23 11:00:49 +0000 | |||
1103 | +++ src/logic/map_objects/tribes/program_result.h 2019-04-10 16:40:56 +0000 | |||
1104 | @@ -20,10 +20,26 @@ | |||
1105 | 20 | #ifndef WL_LOGIC_MAP_OBJECTS_TRIBES_PROGRAM_RESULT_H | 20 | #ifndef WL_LOGIC_MAP_OBJECTS_TRIBES_PROGRAM_RESULT_H |
1106 | 21 | #define WL_LOGIC_MAP_OBJECTS_TRIBES_PROGRAM_RESULT_H | 21 | #define WL_LOGIC_MAP_OBJECTS_TRIBES_PROGRAM_RESULT_H |
1107 | 22 | 22 | ||
1108 | 23 | #include "base/macros.h" | ||
1109 | 24 | |||
1110 | 23 | namespace Widelands { | 25 | namespace Widelands { |
1114 | 24 | // Don't change this values, they are used as hardcoded array indices | 26 | // Don't change these values, they are used as hardcoded array indices |
1115 | 25 | enum ProgramResult { None = 0, Failed = 1, Completed = 2, Skipped = 3 }; | 27 | enum class ProgramResult { kNone = 0, kFailed = 1, kCompleted = 2, kSkipped = 3 }; |
1116 | 26 | enum ProgramResultHandlingMethod { Fail, Complete, Skip, Continue, Repeat }; | 28 | inline int program_result_index(ProgramResult result) { |
1117 | 29 | switch (result) { | ||
1118 | 30 | case ProgramResult::kFailed: | ||
1119 | 31 | return 0; | ||
1120 | 32 | case ProgramResult::kCompleted: | ||
1121 | 33 | return 1; | ||
1122 | 34 | case ProgramResult::kSkipped: | ||
1123 | 35 | return 2; | ||
1124 | 36 | case ProgramResult::kNone: | ||
1125 | 37 | NEVER_HERE(); | ||
1126 | 38 | } | ||
1127 | 39 | return 0; | ||
1128 | 40 | } | ||
1129 | 41 | |||
1130 | 42 | enum class ProgramResultHandlingMethod { kFail, kComplete, kSkip, kContinue, kRepeat }; | ||
1131 | 27 | } // namespace Widelands | 43 | } // namespace Widelands |
1132 | 28 | 44 | ||
1133 | 29 | #endif // end of include guard: WL_LOGIC_MAP_OBJECTS_TRIBES_PROGRAM_RESULT_H | 45 | #endif // end of include guard: WL_LOGIC_MAP_OBJECTS_TRIBES_PROGRAM_RESULT_H |
1134 | 30 | 46 | ||
1135 | === modified file 'src/logic/map_objects/tribes/trainingsite.cc' | |||
1136 | --- src/logic/map_objects/tribes/trainingsite.cc 2019-02-23 11:00:49 +0000 | |||
1137 | +++ src/logic/map_objects/tribes/trainingsite.cc 2019-04-10 16:40:56 +0000 | |||
1138 | @@ -270,7 +270,7 @@ | |||
1139 | 270 | soldier_request_(nullptr), | 270 | soldier_request_(nullptr), |
1140 | 271 | capacity_(descr().get_max_number_of_soldiers()), | 271 | capacity_(descr().get_max_number_of_soldiers()), |
1141 | 272 | build_heroes_(false), | 272 | build_heroes_(false), |
1143 | 273 | result_(Failed) { | 273 | result_(ProgramResult::kFailed) { |
1144 | 274 | set_soldier_control(&soldier_control_); | 274 | set_soldier_control(&soldier_control_); |
1145 | 275 | 275 | ||
1146 | 276 | // Initialize this in the constructor so that loading code may | 276 | // Initialize this in the constructor so that loading code may |
1147 | @@ -543,7 +543,7 @@ | |||
1148 | 543 | bool leftover_soldiers_check = true; | 543 | bool leftover_soldiers_check = true; |
1149 | 544 | 544 | ||
1150 | 545 | if (current_upgrade_) { | 545 | if (current_upgrade_) { |
1152 | 546 | if (result_ == Completed) { | 546 | if (result_ == ProgramResult::kCompleted) { |
1153 | 547 | drop_unupgradable_soldiers(game); | 547 | drop_unupgradable_soldiers(game); |
1154 | 548 | leftover_soldiers_check = false; | 548 | leftover_soldiers_check = false; |
1155 | 549 | current_upgrade_->lastsuccess = true; | 549 | current_upgrade_->lastsuccess = true; |
1156 | 550 | 550 | ||
1157 | === modified file 'src/logic/map_objects/tribes/tribe_descr.cc' | |||
1158 | --- src/logic/map_objects/tribes/tribe_descr.cc 2019-03-24 12:06:43 +0000 | |||
1159 | +++ src/logic/map_objects/tribes/tribe_descr.cc 2019-04-10 16:40:56 +0000 | |||
1160 | @@ -174,7 +174,7 @@ | |||
1161 | 174 | throw GameDataError("Tribe has no indicators for resource %s.", resource.c_str()); | 174 | throw GameDataError("Tribe has no indicators for resource %s.", resource.c_str()); |
1162 | 175 | } | 175 | } |
1163 | 176 | resource_indicators_[resource] = resis; | 176 | resource_indicators_[resource] = resis; |
1165 | 177 | }; | 177 | } |
1166 | 178 | 178 | ||
1167 | 179 | ship_names_ = table.get_table("ship_names")->array_entries<std::string>(); | 179 | ship_names_ = table.get_table("ship_names")->array_entries<std::string>(); |
1168 | 180 | 180 | ||
1169 | 181 | 181 | ||
1170 | === modified file 'src/logic/map_objects/tribes/worker.cc' | |||
1171 | --- src/logic/map_objects/tribes/worker.cc 2019-03-17 10:30:24 +0000 | |||
1172 | +++ src/logic/map_objects/tribes/worker.cc 2019-04-10 16:40:56 +0000 | |||
1173 | @@ -1060,34 +1060,34 @@ | |||
1174 | 1060 | Bob::log_general_info(egbase); | 1060 | Bob::log_general_info(egbase); |
1175 | 1061 | 1061 | ||
1176 | 1062 | if (upcast(PlayerImmovable, loc, location_.get(egbase))) { | 1062 | if (upcast(PlayerImmovable, loc, location_.get(egbase))) { |
1178 | 1063 | FORMAT_WARNINGS_OFF; | 1063 | FORMAT_WARNINGS_OFF |
1179 | 1064 | molog("* Owner: (%p)\n", &loc->owner()); | 1064 | molog("* Owner: (%p)\n", &loc->owner()); |
1181 | 1065 | FORMAT_WARNINGS_ON; | 1065 | FORMAT_WARNINGS_ON |
1182 | 1066 | molog("** Owner (plrnr): %i\n", loc->owner().player_number()); | 1066 | molog("** Owner (plrnr): %i\n", loc->owner().player_number()); |
1184 | 1067 | FORMAT_WARNINGS_OFF; | 1067 | FORMAT_WARNINGS_OFF |
1185 | 1068 | molog("* Economy: %p\n", loc->get_economy()); | 1068 | molog("* Economy: %p\n", loc->get_economy()); |
1187 | 1069 | FORMAT_WARNINGS_ON; | 1069 | FORMAT_WARNINGS_ON |
1188 | 1070 | } | 1070 | } |
1189 | 1071 | 1071 | ||
1190 | 1072 | PlayerImmovable* imm = location_.get(egbase); | 1072 | PlayerImmovable* imm = location_.get(egbase); |
1191 | 1073 | molog("location: %u\n", imm ? imm->serial() : 0); | 1073 | molog("location: %u\n", imm ? imm->serial() : 0); |
1193 | 1074 | FORMAT_WARNINGS_OFF; | 1074 | FORMAT_WARNINGS_OFF |
1194 | 1075 | molog("Economy: %p\n", economy_); | 1075 | molog("Economy: %p\n", economy_); |
1195 | 1076 | molog("transfer: %p\n", transfer_); | 1076 | molog("transfer: %p\n", transfer_); |
1197 | 1077 | FORMAT_WARNINGS_ON; | 1077 | FORMAT_WARNINGS_ON |
1198 | 1078 | 1078 | ||
1199 | 1079 | if (upcast(WareInstance, ware, carried_ware_.get(egbase))) { | 1079 | if (upcast(WareInstance, ware, carried_ware_.get(egbase))) { |
1200 | 1080 | molog("* carried_ware->get_ware() (id): %i\n", ware->descr_index()); | 1080 | molog("* carried_ware->get_ware() (id): %i\n", ware->descr_index()); |
1202 | 1081 | FORMAT_WARNINGS_OFF; | 1081 | FORMAT_WARNINGS_OFF |
1203 | 1082 | molog("* carried_ware->get_economy() (): %p\n", ware->get_economy()); | 1082 | molog("* carried_ware->get_economy() (): %p\n", ware->get_economy()); |
1205 | 1083 | FORMAT_WARNINGS_ON; | 1083 | FORMAT_WARNINGS_ON |
1206 | 1084 | } | 1084 | } |
1207 | 1085 | 1085 | ||
1208 | 1086 | molog("current_exp: %i / %i\n", current_exp_, descr().get_needed_experience()); | 1086 | molog("current_exp: %i / %i\n", current_exp_, descr().get_needed_experience()); |
1209 | 1087 | 1087 | ||
1211 | 1088 | FORMAT_WARNINGS_OFF; | 1088 | FORMAT_WARNINGS_OFF |
1212 | 1089 | molog("supply: %p\n", supply_); | 1089 | molog("supply: %p\n", supply_); |
1214 | 1090 | FORMAT_WARNINGS_ON; | 1090 | FORMAT_WARNINGS_ON |
1215 | 1091 | } | 1091 | } |
1216 | 1092 | 1092 | ||
1217 | 1093 | /** | 1093 | /** |
1218 | 1094 | 1094 | ||
1219 | === modified file 'src/logic/map_objects/world/terrain_description.h' | |||
1220 | --- src/logic/map_objects/world/terrain_description.h 2019-02-23 11:00:49 +0000 | |||
1221 | +++ src/logic/map_objects/world/terrain_description.h 2019-04-10 16:40:56 +0000 | |||
1222 | @@ -43,7 +43,7 @@ | |||
1223 | 43 | 43 | ||
1224 | 44 | class TerrainDescription { | 44 | class TerrainDescription { |
1225 | 45 | public: | 45 | public: |
1227 | 46 | enum Is { | 46 | enum class Is { |
1228 | 47 | kArable = 0, | 47 | kArable = 0, |
1229 | 48 | kWalkable = 1, | 48 | kWalkable = 1, |
1230 | 49 | kWater = 2, | 49 | kWater = 2, |
1231 | @@ -149,6 +149,14 @@ | |||
1232 | 149 | DISALLOW_COPY_AND_ASSIGN(TerrainDescription); | 149 | DISALLOW_COPY_AND_ASSIGN(TerrainDescription); |
1233 | 150 | }; | 150 | }; |
1234 | 151 | 151 | ||
1235 | 152 | inline TerrainDescription::Is operator|(TerrainDescription::Is left, TerrainDescription::Is right) { | ||
1236 | 153 | return TerrainDescription::Is(static_cast<int>(left) | static_cast<int>(right)); | ||
1237 | 154 | } | ||
1238 | 155 | inline int operator&(TerrainDescription::Is left, TerrainDescription::Is right) { | ||
1239 | 156 | return static_cast<int>(left) & static_cast<int>(right); | ||
1240 | 157 | } | ||
1241 | 158 | |||
1242 | 159 | |||
1243 | 152 | } // namespace Widelands | 160 | } // namespace Widelands |
1244 | 153 | 161 | ||
1245 | 154 | #endif // end of include guard: WL_LOGIC_MAP_OBJECTS_WORLD_TERRAIN_DESCRIPTION_H | 162 | #endif // end of include guard: WL_LOGIC_MAP_OBJECTS_WORLD_TERRAIN_DESCRIPTION_H |
1246 | 155 | 163 | ||
1247 | === modified file 'src/logic/mapdifferenceregion.h' | |||
1248 | --- src/logic/mapdifferenceregion.h 2019-02-23 11:00:49 +0000 | |||
1249 | +++ src/logic/mapdifferenceregion.h 2019-04-10 16:40:56 +0000 | |||
1250 | @@ -48,12 +48,12 @@ | |||
1251 | 48 | map.neighbour_function(area_, &area_); \ | 48 | map.neighbour_function(area_, &area_); \ |
1252 | 49 | break; | 49 | break; |
1253 | 50 | 50 | ||
1260 | 51 | DIRECTION_CASE(WALK_NW, get_tln); | 51 | DIRECTION_CASE(WALK_NW, get_tln) |
1261 | 52 | DIRECTION_CASE(WALK_NE, get_trn); | 52 | DIRECTION_CASE(WALK_NE, get_trn) |
1262 | 53 | DIRECTION_CASE(WALK_E, get_rn); | 53 | DIRECTION_CASE(WALK_E, get_rn) |
1263 | 54 | DIRECTION_CASE(WALK_SE, get_brn); | 54 | DIRECTION_CASE(WALK_SE, get_brn) |
1264 | 55 | DIRECTION_CASE(WALK_SW, get_bln); | 55 | DIRECTION_CASE(WALK_SW, get_bln) |
1265 | 56 | DIRECTION_CASE(WALK_W, get_ln); | 56 | DIRECTION_CASE(WALK_W, get_ln) |
1266 | 57 | #undef DIRECTION_CASE | 57 | #undef DIRECTION_CASE |
1267 | 58 | } | 58 | } |
1268 | 59 | --direction; | 59 | --direction; |
1269 | 60 | 60 | ||
1270 | === modified file 'src/logic/maphollowregion.cc' | |||
1271 | --- src/logic/maphollowregion.cc 2019-02-23 11:00:49 +0000 | |||
1272 | +++ src/logic/maphollowregion.cc 2019-04-10 16:40:56 +0000 | |||
1273 | @@ -24,7 +24,7 @@ | |||
1274 | 24 | template <> | 24 | template <> |
1275 | 25 | MapHollowRegion<Area<>>::MapHollowRegion(const Map& map, const HollowArea<Area<>>& hollow_area) | 25 | MapHollowRegion<Area<>>::MapHollowRegion(const Map& map, const HollowArea<Area<>>& hollow_area) |
1276 | 26 | : hollow_area_(hollow_area), | 26 | : hollow_area_(hollow_area), |
1278 | 27 | phase_(Top), | 27 | phase_(Phase::kTop), |
1279 | 28 | delta_radius_(hollow_area.radius - hollow_area.hole_radius), | 28 | delta_radius_(hollow_area.radius - hollow_area.hole_radius), |
1280 | 29 | row_(0), | 29 | row_(0), |
1281 | 30 | rowwidth_(hollow_area.radius + 1), | 30 | rowwidth_(hollow_area.radius + 1), |
1282 | @@ -37,12 +37,13 @@ | |||
1283 | 37 | } | 37 | } |
1284 | 38 | 38 | ||
1285 | 39 | template <> bool MapHollowRegion<Area<>>::advance(const Map& map) { | 39 | template <> bool MapHollowRegion<Area<>>::advance(const Map& map) { |
1287 | 40 | if (phase_ == None) | 40 | if (phase_ == Phase::kNone) { |
1288 | 41 | return false; | 41 | return false; |
1289 | 42 | } | ||
1290 | 42 | ++rowpos_; | 43 | ++rowpos_; |
1291 | 43 | if (rowpos_ < rowwidth_) { | 44 | if (rowpos_ < rowwidth_) { |
1292 | 44 | map.get_rn(hollow_area_, &hollow_area_); | 45 | map.get_rn(hollow_area_, &hollow_area_); |
1294 | 45 | if ((phase_ & (Upper | Lower)) && rowpos_ == delta_radius_) { | 46 | if ((phase_ & (Phase::kUpper | Phase::kLower)) && rowpos_ == delta_radius_) { |
1295 | 46 | // Jump over the hole. | 47 | // Jump over the hole. |
1296 | 47 | const uint32_t holewidth = rowwidth_ - 2 * delta_radius_; | 48 | const uint32_t holewidth = rowwidth_ - 2 * delta_radius_; |
1297 | 48 | for (uint32_t i = 0; i < holewidth; ++i) | 49 | for (uint32_t i = 0; i < holewidth; ++i) |
1298 | @@ -51,27 +52,29 @@ | |||
1299 | 51 | } | 52 | } |
1300 | 52 | } else { | 53 | } else { |
1301 | 53 | ++row_; | 54 | ++row_; |
1304 | 54 | if (phase_ == Top && row_ == delta_radius_) | 55 | if (phase_ == Phase::kTop && row_ == delta_radius_) { |
1305 | 55 | phase_ = Upper; | 56 | phase_ = Phase::kUpper; |
1306 | 57 | } | ||
1307 | 56 | 58 | ||
1308 | 57 | // If we completed the widest, center line, switch into lower mode | 59 | // If we completed the widest, center line, switch into lower mode |
1309 | 58 | // There are radius_+1 lines in the upper "half", because the upper | 60 | // There are radius_+1 lines in the upper "half", because the upper |
1310 | 59 | // half includes the center line. | 61 | // half includes the center line. |
1312 | 60 | else if (phase_ == Upper && row_ > hollow_area_.radius) { | 62 | else if (phase_ == Phase::kUpper && row_ > hollow_area_.radius) { |
1313 | 61 | row_ = 1; | 63 | row_ = 1; |
1315 | 62 | phase_ = Lower; | 64 | phase_ = Phase::kLower; |
1316 | 63 | } | 65 | } |
1317 | 64 | 66 | ||
1319 | 65 | if (phase_ & (Top | Upper)) { | 67 | if (phase_ & (Phase::kTop | Phase::kUpper)) { |
1320 | 66 | map.get_bln(left_, &hollow_area_); | 68 | map.get_bln(left_, &hollow_area_); |
1321 | 67 | ++rowwidth_; | 69 | ++rowwidth_; |
1322 | 68 | } else { | 70 | } else { |
1323 | 69 | 71 | ||
1324 | 70 | if (row_ > hollow_area_.radius) { | 72 | if (row_ > hollow_area_.radius) { |
1326 | 71 | phase_ = None; | 73 | phase_ = Phase::kNone; |
1327 | 72 | return true; // early out | 74 | return true; // early out |
1330 | 73 | } else if (phase_ == Lower && row_ > hollow_area_.hole_radius) | 75 | } else if (phase_ == Phase::kLower && row_ > hollow_area_.hole_radius) { |
1331 | 74 | phase_ = Bottom; | 76 | phase_ = Phase::kBottom; |
1332 | 77 | } | ||
1333 | 75 | 78 | ||
1334 | 76 | map.get_brn(left_, &hollow_area_); | 79 | map.get_brn(left_, &hollow_area_); |
1335 | 77 | --rowwidth_; | 80 | --rowwidth_; |
1336 | 78 | 81 | ||
1337 | === modified file 'src/logic/maphollowregion.h' | |||
1338 | --- src/logic/maphollowregion.h 2019-02-23 11:00:49 +0000 | |||
1339 | +++ src/logic/maphollowregion.h 2019-04-10 16:40:56 +0000 | |||
1340 | @@ -55,15 +55,15 @@ | |||
1341 | 55 | */ | 55 | */ |
1342 | 56 | bool advance(const Map&); | 56 | bool advance(const Map&); |
1343 | 57 | 57 | ||
1344 | 58 | enum class Phase { | ||
1345 | 59 | kNone = 0, // not initialized or completed | ||
1346 | 60 | kTop = 1, // above the hole | ||
1347 | 61 | kUpper = 2, // upper half | ||
1348 | 62 | kLower = 4, // lower half | ||
1349 | 63 | kBottom = 8, // below the hole | ||
1350 | 64 | }; | ||
1351 | 65 | |||
1352 | 58 | private: | 66 | private: |
1353 | 59 | enum Phase { | ||
1354 | 60 | None = 0, // not initialized or completed | ||
1355 | 61 | Top = 1, // above the hole | ||
1356 | 62 | Upper = 2, // upper half | ||
1357 | 63 | Lower = 4, // lower half | ||
1358 | 64 | Bottom = 8, // below the hole | ||
1359 | 65 | }; | ||
1360 | 66 | |||
1361 | 67 | HollowArea<AreaType> hollow_area_; | 67 | HollowArea<AreaType> hollow_area_; |
1362 | 68 | Phase phase_; | 68 | Phase phase_; |
1363 | 69 | const uint32_t delta_radius_; | 69 | const uint32_t delta_radius_; |
1364 | @@ -77,6 +77,14 @@ | |||
1365 | 77 | template <> | 77 | template <> |
1366 | 78 | MapHollowRegion<Area<>>::MapHollowRegion(const Map& map, const HollowArea<Area<>>& hollow_area); | 78 | MapHollowRegion<Area<>>::MapHollowRegion(const Map& map, const HollowArea<Area<>>& hollow_area); |
1367 | 79 | template <> bool MapHollowRegion<Area<>>::advance(const Map& map); | 79 | template <> bool MapHollowRegion<Area<>>::advance(const Map& map); |
1368 | 80 | |||
1369 | 81 | // A bunch of operators that turn MapHollowRegion<Area<>>::Phase into a bitwise combinable class. | ||
1370 | 82 | inline MapHollowRegion<Area<>>::Phase operator|(MapHollowRegion<Area<>>::Phase left, MapHollowRegion<Area<>>::Phase right) { | ||
1371 | 83 | return MapHollowRegion<Area<>>::Phase(static_cast<int>(left) | static_cast<int>(right)); | ||
1372 | 84 | } | ||
1373 | 85 | inline int operator&(MapHollowRegion<Area<>>::Phase left, MapHollowRegion<Area<>>::Phase right) { | ||
1374 | 86 | return static_cast<int>(left) & static_cast<int>(right); | ||
1375 | 87 | } | ||
1376 | 80 | } // namespace Widelands | 88 | } // namespace Widelands |
1377 | 81 | 89 | ||
1378 | 82 | #endif // end of include guard: WL_LOGIC_MAPHOLLOWREGION_H | 90 | #endif // end of include guard: WL_LOGIC_MAPHOLLOWREGION_H |
1379 | 83 | 91 | ||
1380 | === modified file 'src/logic/maptriangleregion.cc' | |||
1381 | --- src/logic/maptriangleregion.cc 2019-02-23 11:00:49 +0000 | |||
1382 | +++ src/logic/maptriangleregion.cc 2019-04-10 16:40:56 +0000 | |||
1383 | @@ -36,18 +36,18 @@ | |||
1384 | 36 | remaining_rows_in_lower_phase_ = (area.radius - 1) / 2; | 36 | remaining_rows_in_lower_phase_ = (area.radius - 1) / 2; |
1385 | 37 | if (radius_is_odd_) { | 37 | if (radius_is_odd_) { |
1386 | 38 | map.get_trn(area.node, &area.node); | 38 | map.get_trn(area.node, &area.node); |
1388 | 39 | phase_ = Top; | 39 | phase_ = Phase::kTop; |
1389 | 40 | row_length_ = area.radius + 2; | 40 | row_length_ = area.radius + 2; |
1390 | 41 | remaining_in_row_ = radius_plus_1 / 2; | 41 | remaining_in_row_ = radius_plus_1 / 2; |
1391 | 42 | area.t = TriangleIndex::D; | 42 | area.t = TriangleIndex::D; |
1392 | 43 | } else { | 43 | } else { |
1394 | 44 | phase_ = Upper; | 44 | phase_ = Phase::kUpper; |
1395 | 45 | remaining_in_row_ = row_length_ = radius_plus_1; | 45 | remaining_in_row_ = row_length_ = radius_plus_1; |
1396 | 46 | area.t = TriangleIndex::R; | 46 | area.t = TriangleIndex::R; |
1397 | 47 | } | 47 | } |
1398 | 48 | } else { | 48 | } else { |
1399 | 49 | assert(area.radius == 0); | 49 | assert(area.radius == 0); |
1401 | 50 | phase_ = Bottom; | 50 | phase_ = Phase::kBottom; |
1402 | 51 | remaining_in_row_ = 0; | 51 | remaining_in_row_ = 0; |
1403 | 52 | area.t = TriangleIndex::R; | 52 | area.t = TriangleIndex::R; |
1404 | 53 | } | 53 | } |
1405 | @@ -57,12 +57,12 @@ | |||
1406 | 57 | if (radius_is_odd_) { | 57 | if (radius_is_odd_) { |
1407 | 58 | map.get_ln(area.node, &area.node); | 58 | map.get_ln(area.node, &area.node); |
1408 | 59 | left_ = area.node; | 59 | left_ = area.node; |
1410 | 60 | phase_ = Upper; | 60 | phase_ = Phase::kUpper; |
1411 | 61 | remaining_in_row_ = row_length_ = area.radius + 2; | 61 | remaining_in_row_ = row_length_ = area.radius + 2; |
1412 | 62 | area.t = TriangleIndex::R; | 62 | area.t = TriangleIndex::R; |
1413 | 63 | } else { | 63 | } else { |
1414 | 64 | map.get_bln(area.node, &left_); | 64 | map.get_bln(area.node, &left_); |
1416 | 65 | phase_ = Top; | 65 | phase_ = Phase::kTop; |
1417 | 66 | row_length_ = area.radius + 3; | 66 | row_length_ = area.radius + 3; |
1418 | 67 | remaining_in_row_ = half_radius_rounded_down + (0 < area.radius); | 67 | remaining_in_row_ = half_radius_rounded_down + (0 < area.radius); |
1419 | 68 | area.t = TriangleIndex::D; | 68 | area.t = TriangleIndex::D; |
1420 | @@ -77,17 +77,17 @@ | |||
1421 | 77 | return false; | 77 | return false; |
1422 | 78 | --remaining_in_row_; | 78 | --remaining_in_row_; |
1423 | 79 | switch (phase_) { | 79 | switch (phase_) { |
1425 | 80 | case Top: | 80 | case Phase::kTop: |
1426 | 81 | if (remaining_in_row_) | 81 | if (remaining_in_row_) |
1427 | 82 | map.get_rn(location_.node, &location_.node); | 82 | map.get_rn(location_.node, &location_.node); |
1428 | 83 | else if (remaining_rows_in_upper_phase_) { | 83 | else if (remaining_rows_in_upper_phase_) { |
1430 | 84 | phase_ = Upper; | 84 | phase_ = Phase::kUpper; |
1431 | 85 | remaining_in_row_ = row_length_; | 85 | remaining_in_row_ = row_length_; |
1432 | 86 | assert(remaining_in_row_); | 86 | assert(remaining_in_row_); |
1433 | 87 | location_ = TCoords<>(left_, location_.t); | 87 | location_ = TCoords<>(left_, location_.t); |
1434 | 88 | } | 88 | } |
1435 | 89 | break; | 89 | break; |
1437 | 90 | case Upper: | 90 | case Phase::kUpper: |
1438 | 91 | if (remaining_in_row_) { | 91 | if (remaining_in_row_) { |
1439 | 92 | if (location_.t == TriangleIndex::D) | 92 | if (location_.t == TriangleIndex::D) |
1440 | 93 | location_.t = TriangleIndex::R; | 93 | location_.t = TriangleIndex::R; |
1441 | @@ -99,11 +99,11 @@ | |||
1442 | 99 | left_ = map.bl_n(left_); | 99 | left_ = map.bl_n(left_); |
1443 | 100 | } else { | 100 | } else { |
1444 | 101 | if (remaining_rows_in_lower_phase_) { | 101 | if (remaining_rows_in_lower_phase_) { |
1446 | 102 | phase_ = Lower; | 102 | phase_ = Phase::kLower; |
1447 | 103 | assert(row_length_ >= 2); | 103 | assert(row_length_ >= 2); |
1448 | 104 | row_length_ -= 2; | 104 | row_length_ -= 2; |
1449 | 105 | } else if (location_.t == TriangleIndex::R) { | 105 | } else if (location_.t == TriangleIndex::R) { |
1451 | 106 | phase_ = Bottom; | 106 | phase_ = Phase::kBottom; |
1452 | 107 | row_length_ /= 2; | 107 | row_length_ /= 2; |
1453 | 108 | } else | 108 | } else |
1454 | 109 | return false; | 109 | return false; |
1455 | @@ -113,7 +113,7 @@ | |||
1456 | 113 | location_ = TCoords<>(left_, location_.t); | 113 | location_ = TCoords<>(left_, location_.t); |
1457 | 114 | } | 114 | } |
1458 | 115 | break; | 115 | break; |
1460 | 116 | case Lower: | 116 | case Phase::kLower: |
1461 | 117 | if (remaining_in_row_) { | 117 | if (remaining_in_row_) { |
1462 | 118 | if (location_.t == TriangleIndex::D) | 118 | if (location_.t == TriangleIndex::D) |
1463 | 119 | location_.t = TriangleIndex::R; | 119 | location_.t = TriangleIndex::R; |
1464 | @@ -125,14 +125,14 @@ | |||
1465 | 125 | remaining_in_row_ = row_length_ -= 2; | 125 | remaining_in_row_ = row_length_ -= 2; |
1466 | 126 | left_ = map.br_n(left_); | 126 | left_ = map.br_n(left_); |
1467 | 127 | } else if (location_.t == TriangleIndex::R) { | 127 | } else if (location_.t == TriangleIndex::R) { |
1469 | 128 | phase_ = Bottom; | 128 | phase_ = Phase::kBottom; |
1470 | 129 | remaining_in_row_ = row_length_ / 2; | 129 | remaining_in_row_ = row_length_ / 2; |
1471 | 130 | left_ = map.br_n(left_); | 130 | left_ = map.br_n(left_); |
1472 | 131 | } | 131 | } |
1473 | 132 | location_ = TCoords<>(left_, location_.t); | 132 | location_ = TCoords<>(left_, location_.t); |
1474 | 133 | } | 133 | } |
1475 | 134 | break; | 134 | break; |
1477 | 135 | case Bottom: | 135 | case Phase::kBottom: |
1478 | 136 | if (remaining_in_row_) | 136 | if (remaining_in_row_) |
1479 | 137 | map.get_rn(location_.node, &location_.node); | 137 | map.get_rn(location_.node, &location_.node); |
1480 | 138 | break; | 138 | break; |
1481 | @@ -156,17 +156,17 @@ | |||
1482 | 156 | remaining_rows_in_lower_phase_ = (area.radius - 1) / 2; | 156 | remaining_rows_in_lower_phase_ = (area.radius - 1) / 2; |
1483 | 157 | if (radius_is_odd_) { | 157 | if (radius_is_odd_) { |
1484 | 158 | map.get_trn(area.node, &area.node); | 158 | map.get_trn(area.node, &area.node); |
1486 | 159 | phase_ = Top; | 159 | phase_ = Phase::kTop; |
1487 | 160 | row_length_ = area.radius + 2; | 160 | row_length_ = area.radius + 2; |
1488 | 161 | remaining_in_row_ = radius_plus_1 / 2; | 161 | remaining_in_row_ = radius_plus_1 / 2; |
1489 | 162 | area.t = TriangleIndex::D; | 162 | area.t = TriangleIndex::D; |
1490 | 163 | } else { | 163 | } else { |
1492 | 164 | phase_ = Upper; | 164 | phase_ = Phase::kUpper; |
1493 | 165 | remaining_in_row_ = row_length_ = radius_plus_1; | 165 | remaining_in_row_ = row_length_ = radius_plus_1; |
1494 | 166 | area.t = TriangleIndex::R; | 166 | area.t = TriangleIndex::R; |
1495 | 167 | } | 167 | } |
1496 | 168 | } else { | 168 | } else { |
1498 | 169 | phase_ = Bottom; | 169 | phase_ = Phase::kBottom; |
1499 | 170 | remaining_in_row_ = 0; | 170 | remaining_in_row_ = 0; |
1500 | 171 | area.t = TriangleIndex::R; | 171 | area.t = TriangleIndex::R; |
1501 | 172 | } | 172 | } |
1502 | @@ -176,12 +176,12 @@ | |||
1503 | 176 | if (radius_is_odd_) { | 176 | if (radius_is_odd_) { |
1504 | 177 | map.get_ln(area.node, &area.node); | 177 | map.get_ln(area.node, &area.node); |
1505 | 178 | left_ = area.node; | 178 | left_ = area.node; |
1507 | 179 | phase_ = Upper; | 179 | phase_ = Phase::kUpper; |
1508 | 180 | remaining_in_row_ = row_length_ = area.radius + 2; | 180 | remaining_in_row_ = row_length_ = area.radius + 2; |
1509 | 181 | area.t = TriangleIndex::R; | 181 | area.t = TriangleIndex::R; |
1510 | 182 | } else { | 182 | } else { |
1511 | 183 | map.get_bln(area.node, &left_); | 183 | map.get_bln(area.node, &left_); |
1513 | 184 | phase_ = Top; | 184 | phase_ = Phase::kTop; |
1514 | 185 | row_length_ = area.radius + 3; | 185 | row_length_ = area.radius + 3; |
1515 | 186 | remaining_in_row_ = half_radius_rounded_down + (0 < area.radius); | 186 | remaining_in_row_ = half_radius_rounded_down + (0 < area.radius); |
1516 | 187 | area.t = TriangleIndex::D; | 187 | area.t = TriangleIndex::D; |
1517 | @@ -197,17 +197,17 @@ | |||
1518 | 197 | return false; | 197 | return false; |
1519 | 198 | --remaining_in_row_; | 198 | --remaining_in_row_; |
1520 | 199 | switch (phase_) { | 199 | switch (phase_) { |
1522 | 200 | case Top: | 200 | case Phase::kTop: |
1523 | 201 | if (remaining_in_row_) | 201 | if (remaining_in_row_) |
1524 | 202 | map.get_rn(location_.node, &location_.node); | 202 | map.get_rn(location_.node, &location_.node); |
1525 | 203 | else if (remaining_rows_in_upper_phase_) { | 203 | else if (remaining_rows_in_upper_phase_) { |
1527 | 204 | phase_ = Upper; | 204 | phase_ = Phase::kUpper; |
1528 | 205 | remaining_in_row_ = row_length_; | 205 | remaining_in_row_ = row_length_; |
1529 | 206 | assert(remaining_in_row_); | 206 | assert(remaining_in_row_); |
1530 | 207 | location_ = TCoords<FCoords>(left_, location_.t); | 207 | location_ = TCoords<FCoords>(left_, location_.t); |
1531 | 208 | } | 208 | } |
1532 | 209 | break; | 209 | break; |
1534 | 210 | case Upper: | 210 | case Phase::kUpper: |
1535 | 211 | if (remaining_in_row_) { | 211 | if (remaining_in_row_) { |
1536 | 212 | if (location_.t == TriangleIndex::D) | 212 | if (location_.t == TriangleIndex::D) |
1537 | 213 | location_.t = TriangleIndex::R; | 213 | location_.t = TriangleIndex::R; |
1538 | @@ -219,11 +219,11 @@ | |||
1539 | 219 | left_ = map.bl_n(left_); | 219 | left_ = map.bl_n(left_); |
1540 | 220 | } else { | 220 | } else { |
1541 | 221 | if (remaining_rows_in_lower_phase_) { | 221 | if (remaining_rows_in_lower_phase_) { |
1543 | 222 | phase_ = Lower; | 222 | phase_ = Phase::kLower; |
1544 | 223 | assert(row_length_ >= 2); | 223 | assert(row_length_ >= 2); |
1545 | 224 | row_length_ -= 2; | 224 | row_length_ -= 2; |
1546 | 225 | } else if (location_.t == TriangleIndex::R) { | 225 | } else if (location_.t == TriangleIndex::R) { |
1548 | 226 | phase_ = Bottom; | 226 | phase_ = Phase::kBottom; |
1549 | 227 | row_length_ /= 2; | 227 | row_length_ /= 2; |
1550 | 228 | } else | 228 | } else |
1551 | 229 | return false; | 229 | return false; |
1552 | @@ -233,7 +233,7 @@ | |||
1553 | 233 | location_ = TCoords<FCoords>(left_, location_.t); | 233 | location_ = TCoords<FCoords>(left_, location_.t); |
1554 | 234 | } | 234 | } |
1555 | 235 | break; | 235 | break; |
1557 | 236 | case Lower: | 236 | case Phase::kLower: |
1558 | 237 | if (remaining_in_row_) { | 237 | if (remaining_in_row_) { |
1559 | 238 | if (location_.t == TriangleIndex::D) | 238 | if (location_.t == TriangleIndex::D) |
1560 | 239 | location_.t = TriangleIndex::R; | 239 | location_.t = TriangleIndex::R; |
1561 | @@ -245,14 +245,14 @@ | |||
1562 | 245 | remaining_in_row_ = row_length_ -= 2; | 245 | remaining_in_row_ = row_length_ -= 2; |
1563 | 246 | left_ = map.br_n(left_); | 246 | left_ = map.br_n(left_); |
1564 | 247 | } else if (location_.t == TriangleIndex::R) { | 247 | } else if (location_.t == TriangleIndex::R) { |
1566 | 248 | phase_ = Bottom; | 248 | phase_ = Phase::kBottom; |
1567 | 249 | remaining_in_row_ = row_length_ / 2; | 249 | remaining_in_row_ = row_length_ / 2; |
1568 | 250 | left_ = map.br_n(left_); | 250 | left_ = map.br_n(left_); |
1569 | 251 | } | 251 | } |
1570 | 252 | location_ = TCoords<FCoords>(left_, location_.t); | 252 | location_ = TCoords<FCoords>(left_, location_.t); |
1571 | 253 | } | 253 | } |
1572 | 254 | break; | 254 | break; |
1574 | 255 | case Bottom: | 255 | case Phase::kBottom: |
1575 | 256 | if (remaining_in_row_) | 256 | if (remaining_in_row_) |
1576 | 257 | map.get_rn(location_.node, &location_.node); | 257 | map.get_rn(location_.node, &location_.node); |
1577 | 258 | break; | 258 | break; |
1578 | 259 | 259 | ||
1579 | === modified file 'src/logic/maptriangleregion.h' | |||
1580 | --- src/logic/maptriangleregion.h 2019-02-23 11:00:49 +0000 | |||
1581 | +++ src/logic/maptriangleregion.h 2019-04-10 16:40:56 +0000 | |||
1582 | @@ -114,7 +114,7 @@ | |||
1583 | 114 | 114 | ||
1584 | 115 | private: | 115 | private: |
1585 | 116 | const bool radius_is_odd_ = false; | 116 | const bool radius_is_odd_ = false; |
1587 | 117 | enum { Top, Upper, Lower, Bottom } phase_ = Top; | 117 | enum class Phase { kTop, kUpper, kLower, kBottom } phase_ = Phase::kTop; |
1588 | 118 | uint16_t remaining_rows_in_upper_phase_ = 0U; | 118 | uint16_t remaining_rows_in_upper_phase_ = 0U; |
1589 | 119 | uint16_t remaining_rows_in_lower_phase_ = 0U; | 119 | uint16_t remaining_rows_in_lower_phase_ = 0U; |
1590 | 120 | uint16_t row_length_, remaining_in_row_ = 0U; | 120 | uint16_t row_length_, remaining_in_row_ = 0U; |
1591 | 121 | 121 | ||
1592 | === modified file 'src/logic/player.cc' | |||
1593 | --- src/logic/player.cc 2019-03-09 08:58:52 +0000 | |||
1594 | +++ src/logic/player.cc 2019-04-10 16:40:56 +0000 | |||
1595 | @@ -329,8 +329,8 @@ | |||
1596 | 329 | } | 329 | } |
1597 | 330 | 330 | ||
1598 | 331 | if (g_options.pull_section("global").get_bool("sound_at_message", true)) { | 331 | if (g_options.pull_section("global").get_bool("sound_at_message", true)) { |
1601 | 332 | MAYBE_PLAY(Message::Type::kEconomySiteOccupied, "military/site_occupied"); | 332 | MAYBE_PLAY(Message::Type::kEconomySiteOccupied, "military/site_occupied") |
1602 | 333 | MAYBE_PLAY(Message::Type::kWarfareUnderAttack, "military/under_attack"); | 333 | MAYBE_PLAY(Message::Type::kWarfareUnderAttack, "military/under_attack") |
1603 | 334 | Notifications::publish(NoteSound("message", 200, PRIO_ALWAYS_PLAY)); | 334 | Notifications::publish(NoteSound("message", 200, PRIO_ALWAYS_PLAY)); |
1604 | 335 | } | 335 | } |
1605 | 336 | } | 336 | } |
1606 | 337 | 337 | ||
1607 | === modified file 'src/map_io/map_buildingdata_packet.cc' | |||
1608 | --- src/map_io/map_buildingdata_packet.cc 2019-02-23 11:00:49 +0000 | |||
1609 | +++ src/map_io/map_buildingdata_packet.cc 2019-04-10 16:40:56 +0000 | |||
1610 | @@ -666,7 +666,7 @@ | |||
1611 | 666 | 666 | ||
1612 | 667 | productionsite.stack_[i].program = productionsite.descr().get_program(program_name); | 667 | productionsite.stack_[i].program = productionsite.descr().get_program(program_name); |
1613 | 668 | productionsite.stack_[i].ip = fr.signed_32(); | 668 | productionsite.stack_[i].ip = fr.signed_32(); |
1615 | 669 | productionsite.stack_[i].phase = fr.signed_32(); | 669 | productionsite.stack_[i].phase = static_cast<ProgramResult>(fr.signed_32()); |
1616 | 670 | productionsite.stack_[i].flags = fr.unsigned_32(); | 670 | productionsite.stack_[i].flags = fr.unsigned_32(); |
1617 | 671 | 671 | ||
1618 | 672 | uint32_t serial = fr.unsigned_32(); | 672 | uint32_t serial = fr.unsigned_32(); |
1619 | @@ -1135,7 +1135,8 @@ | |||
1620 | 1135 | for (uint16_t i = 0; i < program_size; ++i) { | 1135 | for (uint16_t i = 0; i < program_size; ++i) { |
1621 | 1136 | fw.string(productionsite.stack_[i].program->name()); | 1136 | fw.string(productionsite.stack_[i].program->name()); |
1622 | 1137 | fw.signed_32(productionsite.stack_[i].ip); | 1137 | fw.signed_32(productionsite.stack_[i].ip); |
1624 | 1138 | fw.signed_32(productionsite.stack_[i].phase); | 1138 | // TODO(GunChleoc): If we ever change this packet, we can have an uint8 here. |
1625 | 1139 | fw.signed_32(static_cast<int>(productionsite.stack_[i].phase)); | ||
1626 | 1139 | fw.unsigned_32(productionsite.stack_[i].flags); | 1140 | fw.unsigned_32(productionsite.stack_[i].flags); |
1627 | 1140 | fw.unsigned_32(mos.get_object_file_index_or_zero(productionsite.stack_[i].objvar.get(game))); | 1141 | fw.unsigned_32(mos.get_object_file_index_or_zero(productionsite.stack_[i].objvar.get(game))); |
1628 | 1141 | write_coords_32(&fw, productionsite.stack_[i].coord); | 1142 | write_coords_32(&fw, productionsite.stack_[i].coord); |
1629 | 1142 | 1143 | ||
1630 | === modified file 'src/map_io/map_players_view_packet.cc' | |||
1631 | --- src/map_io/map_players_view_packet.cc 2019-02-23 11:00:49 +0000 | |||
1632 | +++ src/map_io/map_players_view_packet.cc 2019-04-10 16:40:56 +0000 | |||
1633 | @@ -434,47 +434,47 @@ | |||
1634 | 434 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, node_immovable_kinds_file, | 434 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, node_immovable_kinds_file, |
1635 | 435 | node_immovable_kinds_filename, node_immovable_kinds_file_version, | 435 | node_immovable_kinds_filename, node_immovable_kinds_file_version, |
1636 | 436 | NODE_IMMOVABLE_KINDS_FILENAME_TEMPLATE, | 436 | NODE_IMMOVABLE_KINDS_FILENAME_TEMPLATE, |
1638 | 437 | kCurrentPacketVersionImmovableKinds); | 437 | kCurrentPacketVersionImmovableKinds) |
1639 | 438 | 438 | ||
1640 | 439 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, node_immovables_file, node_immovables_filename, | 439 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, node_immovables_file, node_immovables_filename, |
1641 | 440 | node_immovables_file_version, NODE_IMMOVABLES_FILENAME_TEMPLATE, | 440 | node_immovables_file_version, NODE_IMMOVABLES_FILENAME_TEMPLATE, |
1643 | 441 | kCurrentPacketVersionImmovables); | 441 | kCurrentPacketVersionImmovables) |
1644 | 442 | 442 | ||
1645 | 443 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, roads_file, roads_filename, road_file_version, | 443 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, roads_file, roads_filename, road_file_version, |
1647 | 444 | ROADS_FILENAME_TEMPLATE, kCurrentPacketVersionRoads); | 444 | ROADS_FILENAME_TEMPLATE, kCurrentPacketVersionRoads) |
1648 | 445 | 445 | ||
1649 | 446 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, terrains_file, terrains_filename, terrains_file_version, | 446 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, terrains_file, terrains_filename, terrains_file_version, |
1651 | 447 | TERRAINS_FILENAME_TEMPLATE, kCurrentPacketVersionTerrains); | 447 | TERRAINS_FILENAME_TEMPLATE, kCurrentPacketVersionTerrains) |
1652 | 448 | 448 | ||
1653 | 449 | OPEN_INPUT_FILE_NEW_VERSION( | 449 | OPEN_INPUT_FILE_NEW_VERSION( |
1654 | 450 | FileRead, triangle_immovable_kinds_file, triangle_immovable_kinds_filename, | 450 | FileRead, triangle_immovable_kinds_file, triangle_immovable_kinds_filename, |
1655 | 451 | triangle_immovable_kinds_file_version, TRIANGLE_IMMOVABLE_KINDS_FILENAME_TEMPLATE, | 451 | triangle_immovable_kinds_file_version, TRIANGLE_IMMOVABLE_KINDS_FILENAME_TEMPLATE, |
1657 | 452 | kCurrentPacketVersionImmovableKinds); | 452 | kCurrentPacketVersionImmovableKinds) |
1658 | 453 | 453 | ||
1659 | 454 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, triangle_immovables_file, triangle_immovables_filename, | 454 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, triangle_immovables_file, triangle_immovables_filename, |
1660 | 455 | triangle_immovables_file_version, | 455 | triangle_immovables_file_version, |
1661 | 456 | TRIANGLE_IMMOVABLES_FILENAME_TEMPLATE, | 456 | TRIANGLE_IMMOVABLES_FILENAME_TEMPLATE, |
1663 | 457 | kCurrentPacketVersionImmovables); | 457 | kCurrentPacketVersionImmovables) |
1664 | 458 | 458 | ||
1665 | 459 | OPEN_INPUT_FILE(FileRead, owners_file, owners_filename, OWNERS_FILENAME_TEMPLATE, | 459 | OPEN_INPUT_FILE(FileRead, owners_file, owners_filename, OWNERS_FILENAME_TEMPLATE, |
1667 | 460 | kCurrentPacketVersionOwners); | 460 | kCurrentPacketVersionOwners) |
1668 | 461 | 461 | ||
1669 | 462 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, surveys_file, surveys_filename, surveys_file_version, | 462 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, surveys_file, surveys_filename, surveys_file_version, |
1671 | 463 | SURVEYS_FILENAME_TEMPLATE, kCurrentPacketVersionSurveys); | 463 | SURVEYS_FILENAME_TEMPLATE, kCurrentPacketVersionSurveys) |
1672 | 464 | 464 | ||
1673 | 465 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, survey_amounts_file, survey_amounts_filename, | 465 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, survey_amounts_file, survey_amounts_filename, |
1674 | 466 | survey_amounts_file_version, SURVEY_AMOUNTS_FILENAME_TEMPLATE, | 466 | survey_amounts_file_version, SURVEY_AMOUNTS_FILENAME_TEMPLATE, |
1676 | 467 | kCurrentPacketVersionSurveyAmounts); | 467 | kCurrentPacketVersionSurveyAmounts) |
1677 | 468 | 468 | ||
1678 | 469 | OPEN_INPUT_FILE(FileRead, survey_times_file, survey_times_filename, | 469 | OPEN_INPUT_FILE(FileRead, survey_times_file, survey_times_filename, |
1680 | 470 | SURVEY_TIMES_FILENAME_TEMPLATE, kCurrentPacketVersionSurveyTimes); | 470 | SURVEY_TIMES_FILENAME_TEMPLATE, kCurrentPacketVersionSurveyTimes) |
1681 | 471 | 471 | ||
1682 | 472 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, border_file, border_filename, border_file_version, | 472 | OPEN_INPUT_FILE_NEW_VERSION(FileRead, border_file, border_filename, border_file_version, |
1684 | 473 | BORDER_FILENAME_TEMPLATE, kCurrentPacketVersionBorder); | 473 | BORDER_FILENAME_TEMPLATE, kCurrentPacketVersionBorder) |
1685 | 474 | 474 | ||
1686 | 475 | OPEN_INPUT_FILE_NEW_VERSION_SILENT(FileRead, hidden_file, hidden_filename, | 475 | OPEN_INPUT_FILE_NEW_VERSION_SILENT(FileRead, hidden_file, hidden_filename, |
1687 | 476 | hidden_file_version, HIDDEN_FILENAME_TEMPLATE, | 476 | hidden_file_version, HIDDEN_FILENAME_TEMPLATE, |
1689 | 477 | kCurrentPacketVersionHidden); | 477 | kCurrentPacketVersionHidden) |
1690 | 478 | 478 | ||
1691 | 479 | for (FCoords first_in_row(Coords(0, 0), &first_field); first_in_row.y < mapheight; | 479 | for (FCoords first_in_row(Coords(0, 0), &first_field); first_in_row.y < mapheight; |
1692 | 480 | ++first_in_row.y, first_in_row.field += mapwidth) { | 480 | ++first_in_row.y, first_in_row.field += mapwidth) { |
1693 | @@ -801,19 +801,19 @@ | |||
1694 | 801 | hidden_file_version, kCurrentPacketVersionHidden); | 801 | hidden_file_version, kCurrentPacketVersionHidden); |
1695 | 802 | } | 802 | } |
1696 | 803 | 803 | ||
1710 | 804 | CHECK_TRAILING_BYTES(unseen_times_file, unseen_times_filename); | 804 | CHECK_TRAILING_BYTES(unseen_times_file, unseen_times_filename) |
1711 | 805 | CHECK_TRAILING_BYTES(node_immovable_kinds_file, node_immovable_kinds_filename); | 805 | CHECK_TRAILING_BYTES(node_immovable_kinds_file, node_immovable_kinds_filename) |
1712 | 806 | CHECK_TRAILING_BYTES(node_immovables_file, node_immovables_filename); | 806 | CHECK_TRAILING_BYTES(node_immovables_file, node_immovables_filename) |
1713 | 807 | CHECK_TRAILING_BYTES(roads_file, roads_filename); | 807 | CHECK_TRAILING_BYTES(roads_file, roads_filename) |
1714 | 808 | CHECK_TRAILING_BYTES(terrains_file, terrains_filename); | 808 | CHECK_TRAILING_BYTES(terrains_file, terrains_filename) |
1715 | 809 | CHECK_TRAILING_BYTES(triangle_immovable_kinds_file, triangle_immovable_kinds_filename); | 809 | CHECK_TRAILING_BYTES(triangle_immovable_kinds_file, triangle_immovable_kinds_filename) |
1716 | 810 | CHECK_TRAILING_BYTES(triangle_immovables_file, triangle_immovables_filename); | 810 | CHECK_TRAILING_BYTES(triangle_immovables_file, triangle_immovables_filename) |
1717 | 811 | CHECK_TRAILING_BYTES(owners_file, owners_filename); | 811 | CHECK_TRAILING_BYTES(owners_file, owners_filename) |
1718 | 812 | CHECK_TRAILING_BYTES(surveys_file, surveys_filename); | 812 | CHECK_TRAILING_BYTES(surveys_file, surveys_filename) |
1719 | 813 | CHECK_TRAILING_BYTES(survey_amounts_file, survey_amounts_filename); | 813 | CHECK_TRAILING_BYTES(survey_amounts_file, survey_amounts_filename) |
1720 | 814 | CHECK_TRAILING_BYTES(survey_times_file, survey_times_filename); | 814 | CHECK_TRAILING_BYTES(survey_times_file, survey_times_filename) |
1721 | 815 | CHECK_TRAILING_BYTES(border_file, border_filename); | 815 | CHECK_TRAILING_BYTES(border_file, border_filename) |
1722 | 816 | CHECK_TRAILING_BYTES(hidden_file, hidden_filename); | 816 | CHECK_TRAILING_BYTES(hidden_file, hidden_filename) |
1723 | 817 | } | 817 | } |
1724 | 818 | } | 818 | } |
1725 | 819 | 819 | ||
1726 | @@ -1011,38 +1011,38 @@ | |||
1727 | 1011 | fs.ensure_directory_exists( | 1011 | fs.ensure_directory_exists( |
1728 | 1012 | (boost::format(DIRNAME_TEMPLATE) % static_cast<unsigned int>(plnum)).str()); | 1012 | (boost::format(DIRNAME_TEMPLATE) % static_cast<unsigned int>(plnum)).str()); |
1729 | 1013 | 1013 | ||
1731 | 1014 | WRITE(unseen_times_file, UNSEEN_TIMES_FILENAME_TEMPLATE, kCurrentPacketVersionUnseenTimes); | 1014 | WRITE(unseen_times_file, UNSEEN_TIMES_FILENAME_TEMPLATE, kCurrentPacketVersionUnseenTimes) |
1732 | 1015 | 1015 | ||
1733 | 1016 | WRITE(node_immovable_kinds_file, NODE_IMMOVABLE_KINDS_FILENAME_TEMPLATE, | 1016 | WRITE(node_immovable_kinds_file, NODE_IMMOVABLE_KINDS_FILENAME_TEMPLATE, |
1735 | 1017 | kCurrentPacketVersionImmovableKinds); | 1017 | kCurrentPacketVersionImmovableKinds) |
1736 | 1018 | 1018 | ||
1737 | 1019 | WRITE( | 1019 | WRITE( |
1743 | 1020 | node_immovables_file, NODE_IMMOVABLES_FILENAME_TEMPLATE, kCurrentPacketVersionImmovables); | 1020 | node_immovables_file, NODE_IMMOVABLES_FILENAME_TEMPLATE, kCurrentPacketVersionImmovables) |
1744 | 1021 | 1021 | ||
1745 | 1022 | WRITE(roads_file, ROADS_FILENAME_TEMPLATE, kCurrentPacketVersionRoads); | 1022 | WRITE(roads_file, ROADS_FILENAME_TEMPLATE, kCurrentPacketVersionRoads) |
1746 | 1023 | 1023 | ||
1747 | 1024 | WRITE(terrains_file, TERRAINS_FILENAME_TEMPLATE, kCurrentPacketVersionTerrains); | 1024 | WRITE(terrains_file, TERRAINS_FILENAME_TEMPLATE, kCurrentPacketVersionTerrains) |
1748 | 1025 | 1025 | ||
1749 | 1026 | WRITE(triangle_immovable_kinds_file, TRIANGLE_IMMOVABLE_KINDS_FILENAME_TEMPLATE, | 1026 | WRITE(triangle_immovable_kinds_file, TRIANGLE_IMMOVABLE_KINDS_FILENAME_TEMPLATE, |
1751 | 1027 | kCurrentPacketVersionImmovableKinds); | 1027 | kCurrentPacketVersionImmovableKinds) |
1752 | 1028 | 1028 | ||
1753 | 1029 | WRITE(triangle_immovables_file, TRIANGLE_IMMOVABLES_FILENAME_TEMPLATE, | 1029 | WRITE(triangle_immovables_file, TRIANGLE_IMMOVABLES_FILENAME_TEMPLATE, |
1759 | 1030 | kCurrentPacketVersionImmovables); | 1030 | kCurrentPacketVersionImmovables) |
1760 | 1031 | 1031 | ||
1761 | 1032 | WRITE(owners_file, OWNERS_FILENAME_TEMPLATE, kCurrentPacketVersionOwners); | 1032 | WRITE(owners_file, OWNERS_FILENAME_TEMPLATE, kCurrentPacketVersionOwners) |
1762 | 1033 | 1033 | ||
1763 | 1034 | WRITE(surveys_file, SURVEYS_FILENAME_TEMPLATE, kCurrentPacketVersionSurveys); | 1034 | WRITE(surveys_file, SURVEYS_FILENAME_TEMPLATE, kCurrentPacketVersionSurveys) |
1764 | 1035 | 1035 | ||
1765 | 1036 | WRITE( | 1036 | WRITE( |
1775 | 1037 | survey_amounts_file, SURVEY_AMOUNTS_FILENAME_TEMPLATE, kCurrentPacketVersionSurveyAmounts); | 1037 | survey_amounts_file, SURVEY_AMOUNTS_FILENAME_TEMPLATE, kCurrentPacketVersionSurveyAmounts) |
1776 | 1038 | 1038 | ||
1777 | 1039 | WRITE(survey_times_file, SURVEY_TIMES_FILENAME_TEMPLATE, kCurrentPacketVersionSurveyTimes); | 1039 | WRITE(survey_times_file, SURVEY_TIMES_FILENAME_TEMPLATE, kCurrentPacketVersionSurveyTimes) |
1778 | 1040 | 1040 | ||
1779 | 1041 | WRITE(hidden_file, HIDDEN_FILENAME_TEMPLATE, kCurrentPacketVersionHidden); | 1041 | WRITE(hidden_file, HIDDEN_FILENAME_TEMPLATE, kCurrentPacketVersionHidden) |
1780 | 1042 | 1042 | ||
1781 | 1043 | WRITE(vision_file, VISION_FILENAME_TEMPLATE, kCurrentPacketVersionVision); | 1043 | WRITE(vision_file, VISION_FILENAME_TEMPLATE, kCurrentPacketVersionVision) |
1782 | 1044 | 1044 | ||
1783 | 1045 | WRITE(border_file, BORDER_FILENAME_TEMPLATE, kCurrentPacketVersionBorder); | 1045 | WRITE(border_file, BORDER_FILENAME_TEMPLATE, kCurrentPacketVersionBorder) |
1784 | 1046 | } | 1046 | } |
1785 | 1047 | } | 1047 | } |
1786 | 1048 | } // namespace Widelands | 1048 | } // namespace Widelands |
1787 | 1049 | 1049 | ||
1788 | === modified file 'src/map_io/s2map.cc' | |||
1789 | --- src/map_io/s2map.cc 2019-02-23 11:00:49 +0000 | |||
1790 | +++ src/map_io/s2map.cc 2019-04-10 16:40:56 +0000 | |||
1791 | @@ -704,7 +704,7 @@ | |||
1792 | 704 | res = ""; | 704 | res = ""; |
1793 | 705 | amount = 0; | 705 | amount = 0; |
1794 | 706 | break; | 706 | break; |
1796 | 707 | }; | 707 | } |
1797 | 708 | 708 | ||
1798 | 709 | Widelands::DescriptionIndex nres = 0; | 709 | Widelands::DescriptionIndex nres = 0; |
1799 | 710 | if (*res) { | 710 | if (*res) { |
1800 | 711 | 711 | ||
1801 | === modified file 'src/scripting/lua_bases.cc' | |||
1802 | --- src/scripting/lua_bases.cc 2019-02-23 11:00:49 +0000 | |||
1803 | +++ src/scripting/lua_bases.cc 2019-04-10 16:40:56 +0000 | |||
1804 | @@ -572,7 +572,7 @@ | |||
1805 | 572 | PERS_UINT32("player", player_number_); | 572 | PERS_UINT32("player", player_number_); |
1806 | 573 | } | 573 | } |
1807 | 574 | void LuaPlayerBase::__unpersist(lua_State* L) { | 574 | void LuaPlayerBase::__unpersist(lua_State* L) { |
1809 | 575 | UNPERS_UINT32("player", player_number_); | 575 | UNPERS_UINT32("player", player_number_) |
1810 | 576 | } | 576 | } |
1811 | 577 | 577 | ||
1812 | 578 | /* | 578 | /* |
1813 | 579 | 579 | ||
1814 | === modified file 'src/scripting/lua_game.cc' | |||
1815 | --- src/scripting/lua_game.cc 2019-03-09 08:58:52 +0000 | |||
1816 | +++ src/scripting/lua_game.cc 2019-04-10 16:40:56 +0000 | |||
1817 | @@ -435,10 +435,10 @@ | |||
1818 | 435 | lua_pop(L, 1); | 435 | lua_pop(L, 1); |
1819 | 436 | 436 | ||
1820 | 437 | if (lua_gettop(L) == 4) { | 437 | if (lua_gettop(L) == 4) { |
1825 | 438 | CHECK_UINT(posx); | 438 | CHECK_UINT(posx) |
1826 | 439 | CHECK_UINT(posy); | 439 | CHECK_UINT(posy) |
1827 | 440 | CHECK_UINT(w); | 440 | CHECK_UINT(w) |
1828 | 441 | CHECK_UINT(h); | 441 | CHECK_UINT(h) |
1829 | 442 | 442 | ||
1830 | 443 | // If a field has been defined, read the coordinates to jump to. | 443 | // If a field has been defined, read the coordinates to jump to. |
1831 | 444 | lua_getfield(L, 4, "field"); | 444 | lua_getfield(L, 4, "field"); |
1832 | @@ -959,7 +959,7 @@ | |||
1833 | 959 | PERS_STRING("name", name_); | 959 | PERS_STRING("name", name_); |
1834 | 960 | } | 960 | } |
1835 | 961 | void LuaObjective::__unpersist(lua_State* L) { | 961 | void LuaObjective::__unpersist(lua_State* L) { |
1837 | 962 | UNPERS_STRING("name", name_); | 962 | UNPERS_STRING("name", name_) |
1838 | 963 | } | 963 | } |
1839 | 964 | 964 | ||
1840 | 965 | /* | 965 | /* |
1841 | @@ -1126,9 +1126,9 @@ | |||
1842 | 1126 | PERS_UINT32("msg_idx", get_mos(L)->message_savers[player_number_ - 1][message_id_].value()); | 1126 | PERS_UINT32("msg_idx", get_mos(L)->message_savers[player_number_ - 1][message_id_].value()); |
1843 | 1127 | } | 1127 | } |
1844 | 1128 | void LuaMessage::__unpersist(lua_State* L) { | 1128 | void LuaMessage::__unpersist(lua_State* L) { |
1846 | 1129 | UNPERS_UINT32("player", player_number_); | 1129 | UNPERS_UINT32("player", player_number_) |
1847 | 1130 | uint32_t midx = 0; | 1130 | uint32_t midx = 0; |
1849 | 1131 | UNPERS_UINT32("msg_idx", midx); | 1131 | UNPERS_UINT32("msg_idx", midx) |
1850 | 1132 | message_id_ = MessageId(midx); | 1132 | message_id_ = MessageId(midx); |
1851 | 1133 | } | 1133 | } |
1852 | 1134 | 1134 | ||
1853 | 1135 | 1135 | ||
1854 | === modified file 'src/scripting/lua_map.cc' | |||
1855 | --- src/scripting/lua_map.cc 2019-04-07 05:46:13 +0000 | |||
1856 | +++ src/scripting/lua_map.cc 2019-04-10 16:40:56 +0000 | |||
1857 | @@ -545,10 +545,10 @@ | |||
1858 | 545 | lua_pushuint32(L, idx); \ | 545 | lua_pushuint32(L, idx); \ |
1859 | 546 | lua_pushuint32(L, i.first.name); \ | 546 | lua_pushuint32(L, i.first.name); \ |
1860 | 547 | lua_rawset(L, -3); | 547 | lua_rawset(L, -3); |
1865 | 548 | PUSHLEVEL(1, health); | 548 | PUSHLEVEL(1, health) |
1866 | 549 | PUSHLEVEL(2, attack); | 549 | PUSHLEVEL(2, attack) |
1867 | 550 | PUSHLEVEL(3, defense); | 550 | PUSHLEVEL(3, defense) |
1868 | 551 | PUSHLEVEL(4, evade); | 551 | PUSHLEVEL(4, evade) |
1869 | 552 | #undef PUSHLEVEL | 552 | #undef PUSHLEVEL |
1870 | 553 | 553 | ||
1871 | 554 | lua_pushuint32(L, i.second); | 554 | lua_pushuint32(L, i.second); |
1872 | @@ -1539,7 +1539,7 @@ | |||
1873 | 1539 | 1539 | ||
1874 | 1540 | void LuaTribeDescription::__unpersist(lua_State* L) { | 1540 | void LuaTribeDescription::__unpersist(lua_State* L) { |
1875 | 1541 | std::string name; | 1541 | std::string name; |
1877 | 1542 | UNPERS_STRING("name", name); | 1542 | UNPERS_STRING("name", name) |
1878 | 1543 | const Tribes& tribes = get_egbase(L).tribes(); | 1543 | const Tribes& tribes = get_egbase(L).tribes(); |
1879 | 1544 | DescriptionIndex idx = tribes.safe_tribe_index(name); | 1544 | DescriptionIndex idx = tribes.safe_tribe_index(name); |
1880 | 1545 | set_description_pointer(tribes.get_tribe_descr(idx)); | 1545 | set_description_pointer(tribes.get_tribe_descr(idx)); |
1881 | @@ -1993,7 +1993,7 @@ | |||
1882 | 1993 | 1993 | ||
1883 | 1994 | void LuaImmovableDescription::__unpersist(lua_State* L) { | 1994 | void LuaImmovableDescription::__unpersist(lua_State* L) { |
1884 | 1995 | std::string name; | 1995 | std::string name; |
1886 | 1996 | UNPERS_STRING("name", name); | 1996 | UNPERS_STRING("name", name) |
1887 | 1997 | const World& world = get_egbase(L).world(); | 1997 | const World& world = get_egbase(L).world(); |
1888 | 1998 | DescriptionIndex idx = world.get_immovable_index(name); | 1998 | DescriptionIndex idx = world.get_immovable_index(name); |
1889 | 1999 | if (idx != INVALID_INDEX) { | 1999 | if (idx != INVALID_INDEX) { |
1890 | @@ -2215,7 +2215,7 @@ | |||
1891 | 2215 | 2215 | ||
1892 | 2216 | void LuaBuildingDescription::__unpersist(lua_State* L) { | 2216 | void LuaBuildingDescription::__unpersist(lua_State* L) { |
1893 | 2217 | std::string name; | 2217 | std::string name; |
1895 | 2218 | UNPERS_STRING("name", name); | 2218 | UNPERS_STRING("name", name) |
1896 | 2219 | const Tribes& tribes = get_egbase(L).tribes(); | 2219 | const Tribes& tribes = get_egbase(L).tribes(); |
1897 | 2220 | DescriptionIndex idx = tribes.safe_building_index(name.c_str()); | 2220 | DescriptionIndex idx = tribes.safe_building_index(name.c_str()); |
1898 | 2221 | set_description_pointer(tribes.get_building_descr(idx)); | 2221 | set_description_pointer(tribes.get_building_descr(idx)); |
1899 | @@ -3070,7 +3070,7 @@ | |||
1900 | 3070 | 3070 | ||
1901 | 3071 | void LuaWareDescription::__unpersist(lua_State* L) { | 3071 | void LuaWareDescription::__unpersist(lua_State* L) { |
1902 | 3072 | std::string name; | 3072 | std::string name; |
1904 | 3073 | UNPERS_STRING("name", name); | 3073 | UNPERS_STRING("name", name) |
1905 | 3074 | const Tribes& tribes = get_egbase(L).tribes(); | 3074 | const Tribes& tribes = get_egbase(L).tribes(); |
1906 | 3075 | DescriptionIndex idx = tribes.safe_ware_index(name.c_str()); | 3075 | DescriptionIndex idx = tribes.safe_ware_index(name.c_str()); |
1907 | 3076 | set_description_pointer(tribes.get_ware_descr(idx)); | 3076 | set_description_pointer(tribes.get_ware_descr(idx)); |
1908 | @@ -3188,7 +3188,7 @@ | |||
1909 | 3188 | 3188 | ||
1910 | 3189 | void LuaWorkerDescription::__unpersist(lua_State* L) { | 3189 | void LuaWorkerDescription::__unpersist(lua_State* L) { |
1911 | 3190 | std::string name; | 3190 | std::string name; |
1913 | 3191 | UNPERS_STRING("name", name); | 3191 | UNPERS_STRING("name", name) |
1914 | 3192 | const Tribes& tribes = get_egbase(L).tribes(); | 3192 | const Tribes& tribes = get_egbase(L).tribes(); |
1915 | 3193 | DescriptionIndex idx = tribes.safe_worker_index(name.c_str()); | 3193 | DescriptionIndex idx = tribes.safe_worker_index(name.c_str()); |
1916 | 3194 | set_description_pointer(tribes.get_worker_descr(idx)); | 3194 | set_description_pointer(tribes.get_worker_descr(idx)); |
1917 | @@ -3469,7 +3469,7 @@ | |||
1918 | 3469 | 3469 | ||
1919 | 3470 | void LuaResourceDescription::__unpersist(lua_State* L) { | 3470 | void LuaResourceDescription::__unpersist(lua_State* L) { |
1920 | 3471 | std::string name; | 3471 | std::string name; |
1922 | 3472 | UNPERS_STRING("name", name); | 3472 | UNPERS_STRING("name", name) |
1923 | 3473 | const World& world = get_egbase(L).world(); | 3473 | const World& world = get_egbase(L).world(); |
1924 | 3474 | const ResourceDescription* descr = world.get_resource(world.safe_resource_index(name.c_str())); | 3474 | const ResourceDescription* descr = world.get_resource(world.safe_resource_index(name.c_str())); |
1925 | 3475 | set_description_pointer(descr); | 3475 | set_description_pointer(descr); |
1926 | @@ -3590,7 +3590,7 @@ | |||
1927 | 3590 | 3590 | ||
1928 | 3591 | void LuaTerrainDescription::__unpersist(lua_State* L) { | 3591 | void LuaTerrainDescription::__unpersist(lua_State* L) { |
1929 | 3592 | std::string name; | 3592 | std::string name; |
1931 | 3593 | UNPERS_STRING("name", name); | 3593 | UNPERS_STRING("name", name) |
1932 | 3594 | set_description_pointer(get_egbase(L).world().terrain_descr(name)); | 3594 | set_description_pointer(get_egbase(L).world().terrain_descr(name)); |
1933 | 3595 | } | 3595 | } |
1934 | 3596 | 3596 | ||
1935 | @@ -3776,8 +3776,8 @@ | |||
1936 | 3776 | void LuaEconomy::__unpersist(lua_State* L) { | 3776 | void LuaEconomy::__unpersist(lua_State* L) { |
1937 | 3777 | Widelands::PlayerNumber player_number; | 3777 | Widelands::PlayerNumber player_number; |
1938 | 3778 | Widelands::Serial economy_serial; | 3778 | Widelands::Serial economy_serial; |
1941 | 3779 | UNPERS_UINT32("player", player_number); | 3779 | UNPERS_UINT32("player", player_number) |
1942 | 3780 | UNPERS_UINT32("economy", economy_serial); | 3780 | UNPERS_UINT32("economy", economy_serial) |
1943 | 3781 | const Widelands::Player& player = get_egbase(L).player(player_number); | 3781 | const Widelands::Player& player = get_egbase(L).player(player_number); |
1944 | 3782 | set_economy_pointer(player.get_economy(economy_serial)); | 3782 | set_economy_pointer(player.get_economy(economy_serial)); |
1945 | 3783 | } | 3783 | } |
1946 | @@ -3929,7 +3929,7 @@ | |||
1947 | 3929 | } | 3929 | } |
1948 | 3930 | void LuaMapObject::__unpersist(lua_State* L) { | 3930 | void LuaMapObject::__unpersist(lua_State* L) { |
1949 | 3931 | uint32_t idx; | 3931 | uint32_t idx; |
1951 | 3932 | UNPERS_UINT32("file_index", idx); | 3932 | UNPERS_UINT32("file_index", idx) |
1952 | 3933 | 3933 | ||
1953 | 3934 | if (!idx) | 3934 | if (!idx) |
1954 | 3935 | ptr_ = nullptr; | 3935 | ptr_ = nullptr; |
1955 | @@ -6179,8 +6179,8 @@ | |||
1956 | 6179 | } | 6179 | } |
1957 | 6180 | 6180 | ||
1958 | 6181 | void LuaField::__unpersist(lua_State* L) { | 6181 | void LuaField::__unpersist(lua_State* L) { |
1961 | 6182 | UNPERS_INT32("x", coords_.x); | 6182 | UNPERS_INT32("x", coords_.x) |
1962 | 6183 | UNPERS_INT32("y", coords_.y); | 6183 | UNPERS_INT32("y", coords_.y) |
1963 | 6184 | } | 6184 | } |
1964 | 6185 | 6185 | ||
1965 | 6186 | /* | 6186 | /* |
1966 | @@ -6727,7 +6727,7 @@ | |||
1967 | 6727 | } | 6727 | } |
1968 | 6728 | 6728 | ||
1969 | 6729 | void LuaPlayerSlot::__unpersist(lua_State* L) { | 6729 | void LuaPlayerSlot::__unpersist(lua_State* L) { |
1971 | 6730 | UNPERS_UINT32("player", player_number_); | 6730 | UNPERS_UINT32("player", player_number_) |
1972 | 6731 | } | 6731 | } |
1973 | 6732 | 6732 | ||
1974 | 6733 | /* | 6733 | /* |
1975 | 6734 | 6734 | ||
1976 | === modified file 'src/sound/sound_handler.cc' | |||
1977 | --- src/sound/sound_handler.cc 2019-02-23 11:00:49 +0000 | |||
1978 | +++ src/sound/sound_handler.cc 2019-04-10 16:40:56 +0000 | |||
1979 | @@ -112,7 +112,7 @@ | |||
1980 | 112 | nosound_ = true; | 112 | nosound_ = true; |
1981 | 113 | } | 113 | } |
1982 | 114 | 114 | ||
1984 | 115 | SDL_MIXER_VERSION(&sdl_version); | 115 | SDL_MIXER_VERSION(&sdl_version) |
1985 | 116 | log("SDL_mixer version: %d.%d.%d\n", static_cast<unsigned int>(sdl_version.major), | 116 | log("SDL_mixer version: %d.%d.%d\n", static_cast<unsigned int>(sdl_version.major), |
1986 | 117 | static_cast<unsigned int>(sdl_version.minor), static_cast<unsigned int>(sdl_version.patch)); | 117 | static_cast<unsigned int>(sdl_version.minor), static_cast<unsigned int>(sdl_version.patch)); |
1987 | 118 | 118 | ||
1988 | 119 | 119 | ||
1989 | === modified file 'src/ui_basic/box.cc' | |||
1990 | --- src/ui_basic/box.cc 2019-02-23 11:00:49 +0000 | |||
1991 | +++ src/ui_basic/box.cc 2019-04-10 16:40:56 +0000 | |||
1992 | @@ -423,6 +423,6 @@ | |||
1993 | 423 | 423 | ||
1994 | 424 | case Item::ItemSpace: | 424 | case Item::ItemSpace: |
1995 | 425 | break; // no need to do anything | 425 | break; // no need to do anything |
1997 | 426 | }; | 426 | } |
1998 | 427 | } | 427 | } |
1999 | 428 | } // namespace UI | 428 | } // namespace UI |
2000 | 429 | 429 | ||
2001 | === modified file 'src/ui_basic/editbox.cc' | |||
2002 | --- src/ui_basic/editbox.cc 2019-02-23 11:00:49 +0000 | |||
2003 | +++ src/ui_basic/editbox.cc 2019-04-10 16:40:56 +0000 | |||
2004 | @@ -208,7 +208,7 @@ | |||
2005 | 208 | case SDLK_DELETE: | 208 | case SDLK_DELETE: |
2006 | 209 | if (m_->caret < m_->text.size()) { | 209 | if (m_->caret < m_->text.size()) { |
2007 | 210 | while ((m_->text[++m_->caret] & 0xc0) == 0x80) { | 210 | while ((m_->text[++m_->caret] & 0xc0) == 0x80) { |
2009 | 211 | }; | 211 | } |
2010 | 212 | // Now fallthrough to handle it like Backspace | 212 | // Now fallthrough to handle it like Backspace |
2011 | 213 | } else { | 213 | } else { |
2012 | 214 | return true; | 214 | return true; |
2013 | @@ -232,7 +232,7 @@ | |||
2014 | 232 | case SDLK_LEFT: | 232 | case SDLK_LEFT: |
2015 | 233 | if (m_->caret > 0) { | 233 | if (m_->caret > 0) { |
2016 | 234 | while ((m_->text[--m_->caret] & 0xc0) == 0x80) { | 234 | while ((m_->text[--m_->caret] & 0xc0) == 0x80) { |
2018 | 235 | }; | 235 | } |
2019 | 236 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) | 236 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) |
2020 | 237 | for (uint32_t new_caret = m_->caret;; m_->caret = new_caret) | 237 | for (uint32_t new_caret = m_->caret;; m_->caret = new_caret) |
2021 | 238 | if (0 == new_caret || isspace(m_->text[--new_caret])) | 238 | if (0 == new_caret || isspace(m_->text[--new_caret])) |
2022 | @@ -250,7 +250,8 @@ | |||
2023 | 250 | case SDLK_RIGHT: | 250 | case SDLK_RIGHT: |
2024 | 251 | if (m_->caret < m_->text.size()) { | 251 | if (m_->caret < m_->text.size()) { |
2025 | 252 | while ((m_->text[++m_->caret] & 0xc0) == 0x80) { | 252 | while ((m_->text[++m_->caret] & 0xc0) == 0x80) { |
2027 | 253 | }; | 253 | // We're just advancing the caret |
2028 | 254 | } | ||
2029 | 254 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) | 255 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) |
2030 | 255 | for (uint32_t new_caret = m_->caret;; ++new_caret) | 256 | for (uint32_t new_caret = m_->caret;; ++new_caret) |
2031 | 256 | if (new_caret == m_->text.size() || isspace(m_->text[new_caret - 1])) { | 257 | if (new_caret == m_->text.size() || isspace(m_->text[new_caret - 1])) { |
2032 | 257 | 258 | ||
2033 | === modified file 'src/ui_basic/unique_window.h' | |||
2034 | --- src/ui_basic/unique_window.h 2019-02-23 11:00:49 +0000 | |||
2035 | +++ src/ui_basic/unique_window.h 2019-04-10 16:40:56 +0000 | |||
2036 | @@ -55,9 +55,6 @@ | |||
2037 | 55 | int32_t x, y; | 55 | int32_t x, y; |
2038 | 56 | bool valid_pos; | 56 | bool valid_pos; |
2039 | 57 | 57 | ||
2040 | 58 | Registry(const Registry&) = default; | ||
2041 | 59 | Registry& operator=(const Registry&) = default; | ||
2042 | 60 | |||
2043 | 61 | Registry() : window(nullptr), x(0), y(0), valid_pos(false) { | 58 | Registry() : window(nullptr), x(0), y(0), valid_pos(false) { |
2044 | 62 | } | 59 | } |
2045 | 63 | ~Registry(); | 60 | ~Registry(); |
2046 | 64 | 61 | ||
2047 | === modified file 'src/ui_fsmenu/main.cc' | |||
2048 | --- src/ui_fsmenu/main.cc 2019-02-23 11:00:49 +0000 | |||
2049 | +++ src/ui_fsmenu/main.cc 2019-04-10 16:40:56 +0000 | |||
2050 | @@ -114,7 +114,7 @@ | |||
2051 | 114 | } | 114 | } |
2052 | 115 | 115 | ||
2053 | 116 | void FullscreenMenuMain::clicked_ok() { | 116 | void FullscreenMenuMain::clicked_ok() { |
2055 | 117 | ; // do nothing | 117 | // do nothing |
2056 | 118 | } | 118 | } |
2057 | 119 | 119 | ||
2058 | 120 | void FullscreenMenuMain::layout() { | 120 | void FullscreenMenuMain::layout() { |
2059 | 121 | 121 | ||
2060 | === modified file 'src/ui_fsmenu/netsetup_lan.cc' | |||
2061 | --- src/ui_fsmenu/netsetup_lan.cc 2019-02-23 11:00:49 +0000 | |||
2062 | +++ src/ui_fsmenu/netsetup_lan.cc 2019-04-10 16:40:56 +0000 | |||
2063 | @@ -207,7 +207,7 @@ | |||
2064 | 207 | /** TRANSLATORS: The state of a LAN game can be open, closed or unknown */ | 207 | /** TRANSLATORS: The state of a LAN game can be open, closed or unknown */ |
2065 | 208 | er.set_string(2, pgettext("game_state", "Unknown")); | 208 | er.set_string(2, pgettext("game_state", "Unknown")); |
2066 | 209 | break; | 209 | break; |
2068 | 210 | }; | 210 | } |
2069 | 211 | } | 211 | } |
2070 | 212 | 212 | ||
2071 | 213 | void FullscreenMenuNetSetupLAN::game_opened(const NetOpenGame* game) { | 213 | void FullscreenMenuNetSetupLAN::game_opened(const NetOpenGame* game) { |
2072 | 214 | 214 | ||
2073 | === modified file 'src/wui/interactive_player.cc' | |||
2074 | --- src/wui/interactive_player.cc 2019-03-01 04:29:12 +0000 | |||
2075 | +++ src/wui/interactive_player.cc 2019-04-10 16:40:56 +0000 | |||
2076 | @@ -68,7 +68,7 @@ | |||
2077 | 68 | const Widelands::Player::Field& pf) { | 68 | const Widelands::Player::Field& pf) { |
2078 | 69 | if (pf.vision == 0) { | 69 | if (pf.vision == 0) { |
2079 | 70 | return 0.; | 70 | return 0.; |
2081 | 71 | }; | 71 | } |
2082 | 72 | 72 | ||
2083 | 73 | uint32_t brightness = 144 + fcoords.field->get_brightness(); | 73 | uint32_t brightness = 144 + fcoords.field->get_brightness(); |
2084 | 74 | brightness = std::min<uint32_t>(255, (brightness * 255) / 160); | 74 | brightness = std::min<uint32_t>(255, (brightness * 255) / 160); |
Continuous integration builds have changed state:
Travis build 4702. State: passed. Details: https:/ /travis- ci.org/ widelands/ widelands/ builds/ 517666765. /ci.appveyor. com/project/ widelands- dev/widelands/ build/_ widelands_ dev_widelands_ bug_1823612_ llvm8_build_ errors- 4488.
Appveyor build 4488. State: success. Details: https:/