Merge lp:~widelands-dev/widelands/tribe_basic_info into lp:widelands
- tribe_basic_info
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 8538 |
Proposed branch: | lp:~widelands-dev/widelands/tribe_basic_info |
Merge into: | lp:widelands |
Diff against target: |
1242 lines (+333/-162) 36 files modified
src/CMakeLists.txt (+7/-1) src/economy/CMakeLists.txt (+1/-0) src/editor/CMakeLists.txt (+2/-1) src/editor/ui_menus/player_menu.cc (+1/-2) src/game_io/CMakeLists.txt (+2/-1) src/logic/CMakeLists.txt (+26/-6) src/logic/game_settings.h (+1/-1) src/logic/map.cc (+1/-1) src/logic/map.h (+1/-3) src/logic/map_objects/tribes/tribe_basic_info.cc (+46/-0) src/logic/map_objects/tribes/tribe_basic_info.h (+16/-0) src/logic/map_objects/tribes/tribe_descr.cc (+1/-1) src/logic/map_objects/tribes/tribe_descr.h (+3/-3) src/logic/map_objects/tribes/tribes.cc (+1/-43) src/logic/map_objects/tribes/tribes.h (+0/-12) src/logic/player.cc (+2/-2) src/logic/single_player_game_settings_provider.cc (+4/-3) src/logic/widelands.h (+6/-0) src/map_io/CMakeLists.txt (+1/-0) src/map_io/map_elemental_packet.cc (+4/-4) src/network/CMakeLists.txt (+2/-1) src/network/gameclient.cc (+3/-3) src/network/gamehost.cc (+5/-5) src/scripting/CMakeLists.txt (+1/-0) src/scripting/lua_map.cc (+1/-0) src/ui_fsmenu/CMakeLists.txt (+133/-37) src/ui_fsmenu/launch_mpg.cc (+2/-1) src/website/CMakeLists.txt (+1/-0) src/website/map_object_info.cc (+4/-3) src/wui/CMakeLists.txt (+38/-11) src/wui/load_or_save_game.cc (+0/-1) src/wui/mapdata.h (+2/-1) src/wui/multiplayersetupgroup.cc (+4/-5) src/wui/playerdescrgroup.cc (+4/-4) src/wui/suggested_teams_box.cc (+4/-3) src/wui/suggested_teams_box.h (+3/-3) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/tribe_basic_info |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Widelands Developers | Pending | ||
Review via email: mp+333974@code.launchpad.net |
Commit message
Reduce dependencies on liblogic
- Shifted stand-alone tribe functions to tribe_basic_info.h
- Moved type definitions for suggected teams to widelands.h
- New CMake library logic_exceptions
- Refactored CMake libraries for ui_fsmenu and wui_common
Description of the change
This should speed up compile time when some logic headers change.
No code changes except for moving stuff around.
GunChleoc (gunchleoc) wrote : | # |
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 2820. State: errored. Details: https:/
Appveyor build 2630. State: success. Details: https:/
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 2921. State: passed. Details: https:/
Appveyor build 2730. State: failed. Details: https:/
Notabilis (notabilis27) wrote : | # |
Actually I am not sure what kind of review makes sense here. Bunnybot does not complain, so I guess everything compiles just fine. I also haven't spotted any errors on a quick glance through.
Breaking up the big libraries is probably a good thing, so as far as I am concerned this can go in. Just out of curiosity: Have you done the comparison of the release build file sizes? Why do you think it should change?
If you have any suggestions what should be done as a review, please say so.
GunChleoc (gunchleoc) wrote : | # |
It doesn't do anything for the release build file sizes. The benefit I did get a few branches further down in this series was that logic includes network.h for no reason whatsoever.
I'm generally trying to improve the compiling and linking speed, but it's very slow going...
A quick glance at the code should be sufficient here, since there are no functionality changes. Thanks for the review!
@bunnybot merge
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 2985. State: passed. Details: https:/
Appveyor build 2794. State: success. Details: https:/
Preview Diff
1 | === modified file 'src/CMakeLists.txt' |
2 | --- src/CMakeLists.txt 2017-11-25 20:29:26 +0000 |
3 | +++ src/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
4 | @@ -114,6 +114,7 @@ |
5 | helper |
6 | io_filesystem |
7 | logic |
8 | + logic_exceptions |
9 | logic_filesystem_constants |
10 | logic_game_controller |
11 | logic_game_settings |
12 | @@ -124,7 +125,12 @@ |
13 | random |
14 | sound |
15 | ui_basic |
16 | - ui_fsmenu |
17 | + ui_fsmenu_gameloading |
18 | + ui_fsmenu_loading_common |
19 | + ui_fsmenu_main |
20 | + ui_fsmenu_maploading |
21 | + ui_fsmenu_misc |
22 | + ui_fsmenu_network |
23 | ui_fsmenu_options |
24 | wui |
25 | ) |
26 | |
27 | === modified file 'src/economy/CMakeLists.txt' |
28 | --- src/economy/CMakeLists.txt 2017-03-02 12:21:57 +0000 |
29 | +++ src/economy/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
30 | @@ -53,6 +53,7 @@ |
31 | io_fileread |
32 | logic |
33 | logic_constants |
34 | + logic_exceptions |
35 | logic_widelands_geometry |
36 | map_io |
37 | notifications |
38 | |
39 | === modified file 'src/editor/CMakeLists.txt' |
40 | --- src/editor/CMakeLists.txt 2017-11-05 20:06:36 +0000 |
41 | +++ src/editor/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
42 | @@ -98,6 +98,7 @@ |
43 | logic |
44 | logic_constants |
45 | logic_filesystem_constants |
46 | + logic_tribe_basic_info |
47 | logic_widelands_geometry |
48 | map_io |
49 | map_io_map_loader |
50 | @@ -108,6 +109,6 @@ |
51 | scripting_lua_table |
52 | ui_basic |
53 | wui |
54 | - wui_common |
55 | + wui_common_mapdetails |
56 | wui_mapview_pixelfunctions |
57 | ) |
58 | |
59 | === modified file 'src/editor/ui_menus/player_menu.cc' |
60 | --- src/editor/ui_menus/player_menu.cc 2017-11-24 21:34:17 +0000 |
61 | +++ src/editor/ui_menus/player_menu.cc 2017-12-18 10:43:22 +0000 |
62 | @@ -27,8 +27,7 @@ |
63 | #include "editor/tools/set_starting_pos_tool.h" |
64 | #include "graphic/graphic.h" |
65 | #include "logic/map.h" |
66 | -#include "logic/map_objects/tribes/tribes.h" |
67 | -#include "logic/map_objects/tribes/warehouse.h" |
68 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
69 | #include "logic/player.h" |
70 | #include "ui_basic/editbox.h" |
71 | #include "ui_basic/messagebox.h" |
72 | |
73 | === modified file 'src/game_io/CMakeLists.txt' |
74 | --- src/game_io/CMakeLists.txt 2016-10-22 18:19:22 +0000 |
75 | +++ src/game_io/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
76 | @@ -8,7 +8,7 @@ |
77 | game_interactive_player_packet.cc |
78 | game_interactive_player_packet.h |
79 | game_player_ai_persistent_packet.cc |
80 | - game_player_ai_persistent_packet.h |
81 | + game_player_ai_persistent_packet.h |
82 | game_loader.cc |
83 | game_loader.h |
84 | game_map_packet.cc |
85 | @@ -35,6 +35,7 @@ |
86 | io_fileread |
87 | io_filesystem |
88 | logic |
89 | + logic_exceptions |
90 | logic_game_controller |
91 | map_io |
92 | map_io_map_loader |
93 | |
94 | === modified file 'src/logic/CMakeLists.txt' |
95 | --- src/logic/CMakeLists.txt 2017-11-06 09:27:20 +0000 |
96 | +++ src/logic/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
97 | @@ -1,3 +1,13 @@ |
98 | +wl_library(logic_exceptions |
99 | + SRCS |
100 | + game_data_error.cc |
101 | + game_data_error.h |
102 | + DEPENDS |
103 | + base_exceptions |
104 | + base_i18n |
105 | +) |
106 | + |
107 | + |
108 | wl_library(logic_widelands_geometry |
109 | SRCS |
110 | widelands_geometry.cc |
111 | @@ -11,8 +21,8 @@ |
112 | player_end_result.h |
113 | DEPENDS |
114 | io_filesystem |
115 | - logic |
116 | logic_constants |
117 | + logic_tribe_basic_info |
118 | notifications |
119 | scripting_lua_interface |
120 | scripting_lua_table |
121 | @@ -25,8 +35,9 @@ |
122 | DEPENDS |
123 | ai |
124 | base_exceptions |
125 | - logic |
126 | + base_i18n |
127 | logic_game_settings |
128 | + logic_tribe_basic_info |
129 | ) |
130 | |
131 | wl_library(logic_game_controller |
132 | @@ -70,6 +81,17 @@ |
133 | filesystem_constants.h |
134 | filesystem_constants.cc |
135 | ) |
136 | +wl_library(logic_tribe_basic_info |
137 | + SRCS |
138 | + map_objects/tribes/tribe_basic_info.cc |
139 | + map_objects/tribes/tribe_basic_info.h |
140 | + DEPENDS |
141 | + base_i18n |
142 | + logic_exceptions |
143 | + scripting_lua_table |
144 | + scripting_lua_interface |
145 | + |
146 | +) |
147 | |
148 | wl_library(logic |
149 | SRCS |
150 | @@ -103,8 +125,6 @@ |
151 | findnode.h |
152 | game.cc |
153 | game.h |
154 | - game_data_error.cc |
155 | - game_data_error.h |
156 | map.cc |
157 | map.h |
158 | map_revision.cc |
159 | @@ -196,8 +216,6 @@ |
160 | map_objects/tribes/training_attribute.h |
161 | map_objects/tribes/trainingsite.cc |
162 | map_objects/tribes/trainingsite.h |
163 | - map_objects/tribes/tribe_basic_info.cc |
164 | - map_objects/tribes/tribe_basic_info.h |
165 | map_objects/tribes/tribe_descr.cc |
166 | map_objects/tribes/tribe_descr.h |
167 | map_objects/tribes/tribes.cc |
168 | @@ -261,9 +279,11 @@ |
169 | io_filesystem |
170 | io_stream |
171 | logic_constants |
172 | + logic_exceptions |
173 | logic_filesystem_constants |
174 | logic_game_controller |
175 | logic_game_settings |
176 | + logic_tribe_basic_info |
177 | logic_widelands_geometry |
178 | map_io |
179 | map_io_map_loader |
180 | |
181 | === modified file 'src/logic/game_settings.h' |
182 | --- src/logic/game_settings.h 2017-08-18 10:23:45 +0000 |
183 | +++ src/logic/game_settings.h 2017-12-18 10:43:22 +0000 |
184 | @@ -157,7 +157,7 @@ |
185 | bool savegame; |
186 | |
187 | /// List of tribes that players are allowed to choose |
188 | - std::vector<TribeBasicInfo> tribes; |
189 | + std::vector<Widelands::TribeBasicInfo> tribes; |
190 | |
191 | /// Player configuration, with 0-based indices for players |
192 | std::vector<PlayerSettings> players; |
193 | |
194 | === modified file 'src/logic/map.cc' |
195 | --- src/logic/map.cc 2017-12-11 17:09:48 +0000 |
196 | +++ src/logic/map.cc 2017-12-18 10:43:22 +0000 |
197 | @@ -39,7 +39,7 @@ |
198 | #include "logic/findnode.h" |
199 | #include "logic/map_objects/checkstep.h" |
200 | #include "logic/map_objects/tribes/soldier.h" |
201 | -#include "logic/map_objects/tribes/tribe_descr.h" |
202 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
203 | #include "logic/map_objects/world/terrain_description.h" |
204 | #include "logic/map_objects/world/world.h" |
205 | #include "logic/mapfringeregion.h" |
206 | |
207 | === modified file 'src/logic/map.h' |
208 | --- src/logic/map.h 2017-12-11 17:09:48 +0000 |
209 | +++ src/logic/map.h 2017-12-18 10:43:22 +0000 |
210 | @@ -36,6 +36,7 @@ |
211 | #include "logic/map_revision.h" |
212 | #include "logic/objective.h" |
213 | #include "logic/widelands_geometry.h" |
214 | +#include "logic/widelands.h" |
215 | #include "notifications/note_ids.h" |
216 | #include "notifications/notifications.h" |
217 | #include "random/random.h" |
218 | @@ -132,9 +133,6 @@ |
219 | |
220 | using PortSpacesSet = std::set<Coords>; |
221 | using Objectives = std::map<std::string, std::unique_ptr<Objective>>; |
222 | - using SuggestedTeam = std::vector<PlayerNumber>; // Players in a team |
223 | - using SuggestedTeamLineup = |
224 | - std::vector<SuggestedTeam>; // Recommended teams to play against each other |
225 | |
226 | enum { // flags for findpath() |
227 | |
228 | |
229 | === modified file 'src/logic/map_objects/tribes/tribe_basic_info.cc' |
230 | --- src/logic/map_objects/tribes/tribe_basic_info.cc 2017-01-25 18:55:59 +0000 |
231 | +++ src/logic/map_objects/tribes/tribe_basic_info.cc 2017-12-18 10:43:22 +0000 |
232 | @@ -25,6 +25,8 @@ |
233 | #include "logic/game_data_error.h" |
234 | #include "scripting/lua_interface.h" |
235 | |
236 | +namespace Widelands { |
237 | + |
238 | TribeBasicInfo::TribeBasicInfo(std::unique_ptr<LuaTable> table) { |
239 | try { |
240 | i18n::Textdomain td("tribes"); |
241 | @@ -47,3 +49,47 @@ |
242 | "reading basic info for tribe \"%s\": %s", name.c_str(), e.what()); |
243 | } |
244 | } |
245 | + |
246 | +std::vector<std::string> get_all_tribenames() { |
247 | + std::vector<std::string> tribenames; |
248 | + LuaInterface lua; |
249 | + std::unique_ptr<LuaTable> table(lua.run_script("tribes/preload.lua")); |
250 | + for (const int key : table->keys<int>()) { |
251 | + std::unique_ptr<LuaTable> info = table->get_table(key); |
252 | + info->do_not_warn_about_unaccessed_keys(); |
253 | + tribenames.push_back(info->get_string("name")); |
254 | + } |
255 | + return tribenames; |
256 | +} |
257 | + |
258 | +std::vector<TribeBasicInfo> get_all_tribeinfos() { |
259 | + std::vector<TribeBasicInfo> tribeinfos; |
260 | + LuaInterface lua; |
261 | + std::unique_ptr<LuaTable> table(lua.run_script("tribes/preload.lua")); |
262 | + for (const int key : table->keys<int>()) { |
263 | + tribeinfos.push_back(TribeBasicInfo(table->get_table(key))); |
264 | + } |
265 | + return tribeinfos; |
266 | +} |
267 | + |
268 | +TribeBasicInfo get_tribeinfo(const std::string& tribename) { |
269 | + if (Widelands::tribe_exists(tribename)) { |
270 | + for (const TribeBasicInfo& info : Widelands::get_all_tribeinfos()) { |
271 | + if (info.name == tribename) { |
272 | + return info; |
273 | + } |
274 | + } |
275 | + } |
276 | + throw GameDataError("The tribe '%s'' does not exist.", tribename.c_str()); |
277 | +} |
278 | + |
279 | +bool tribe_exists(const std::string& tribename) { |
280 | + for (const std::string& name : get_all_tribenames()) { |
281 | + if (name == tribename) { |
282 | + return true; |
283 | + } |
284 | + } |
285 | + return false; |
286 | +} |
287 | + |
288 | +} // namespace Widelands |
289 | |
290 | === modified file 'src/logic/map_objects/tribes/tribe_basic_info.h' |
291 | --- src/logic/map_objects/tribes/tribe_basic_info.h 2017-06-26 11:27:27 +0000 |
292 | +++ src/logic/map_objects/tribes/tribe_basic_info.h 2017-12-18 10:43:22 +0000 |
293 | @@ -28,6 +28,8 @@ |
294 | |
295 | #include "scripting/lua_table.h" |
296 | |
297 | +namespace Widelands { |
298 | + |
299 | /// Basic information about the tribe that is determined only from the conf |
300 | /// file and needed before the actual game. |
301 | struct TribeBasicInfo { |
302 | @@ -60,4 +62,18 @@ |
303 | std::vector<Initialization> initializations; |
304 | }; |
305 | |
306 | +/// Returns a string vector with the names of all tribes. |
307 | +std::vector<std::string> get_all_tribenames(); |
308 | + |
309 | +/// Returns a vector with the basic info for all tribes. |
310 | +std::vector<TribeBasicInfo> get_all_tribeinfos(); |
311 | + |
312 | +/// Returns the basic preload info for a tribe. |
313 | +TribeBasicInfo get_tribeinfo(const std::string& tribename); |
314 | + |
315 | +/// Returns whether this tribe is listed in tribes/preload.lua. |
316 | +bool tribe_exists(const std::string& tribename); |
317 | + |
318 | +} // namespace Widelands |
319 | + |
320 | #endif // end of include guard: WL_LOGIC_MAP_OBJECTS_TRIBES_TRIBE_BASIC_INFO_H |
321 | |
322 | === modified file 'src/logic/map_objects/tribes/tribe_descr.cc' |
323 | --- src/logic/map_objects/tribes/tribe_descr.cc 2017-11-28 17:29:49 +0000 |
324 | +++ src/logic/map_objects/tribes/tribe_descr.cc 2017-12-18 10:43:22 +0000 |
325 | @@ -55,7 +55,7 @@ |
326 | * The contents of 'table' are documented in |
327 | * /data/tribes/atlanteans.lua |
328 | */ |
329 | -TribeDescr::TribeDescr(const LuaTable& table, const TribeBasicInfo& info, const Tribes& init_tribes) |
330 | +TribeDescr::TribeDescr(const LuaTable& table, const Widelands::TribeBasicInfo& info, const Tribes& init_tribes) |
331 | : name_(table.get_string("name")), descname_(info.descname), tribes_(init_tribes) { |
332 | |
333 | try { |
334 | |
335 | === modified file 'src/logic/map_objects/tribes/tribe_descr.h' |
336 | --- src/logic/map_objects/tribes/tribe_descr.h 2017-11-24 07:33:46 +0000 |
337 | +++ src/logic/map_objects/tribes/tribe_descr.h 2017-12-18 10:43:22 +0000 |
338 | @@ -58,7 +58,7 @@ |
339 | */ |
340 | class TribeDescr { |
341 | public: |
342 | - TribeDescr(const LuaTable& table, const TribeBasicInfo& info, const Tribes& init_tribes); |
343 | + TribeDescr(const LuaTable& table, const Widelands::TribeBasicInfo& info, const Tribes& init_tribes); |
344 | |
345 | const std::string& name() const; |
346 | const std::string& descname() const; |
347 | @@ -130,7 +130,7 @@ |
348 | const ResourceAmount amount) const; |
349 | |
350 | // Returns the initalization at 'index' (which must not be out of bounds). |
351 | - const TribeBasicInfo::Initialization& initialization(const uint8_t index) const { |
352 | + const Widelands::TribeBasicInfo::Initialization& initialization(const uint8_t index) const { |
353 | return initializations_.at(index); |
354 | } |
355 | |
356 | @@ -204,7 +204,7 @@ |
357 | WaresOrder workers_order_; |
358 | WaresOrderCoords workers_order_coords_; |
359 | |
360 | - std::vector<TribeBasicInfo::Initialization> initializations_; |
361 | + std::vector<Widelands::TribeBasicInfo::Initialization> initializations_; |
362 | |
363 | DISALLOW_COPY_AND_ASSIGN(TribeDescr); |
364 | }; |
365 | |
366 | === modified file 'src/logic/map_objects/tribes/tribes.cc' |
367 | --- src/logic/map_objects/tribes/tribes.cc 2017-12-02 11:52:05 +0000 |
368 | +++ src/logic/map_objects/tribes/tribes.cc 2017-12-18 10:43:22 +0000 |
369 | @@ -25,51 +25,9 @@ |
370 | #include "graphic/graphic.h" |
371 | #include "logic/game_data_error.h" |
372 | #include "logic/map_objects/tribes/market.h" |
373 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
374 | |
375 | namespace Widelands { |
376 | - |
377 | -std::vector<std::string> get_all_tribenames() { |
378 | - std::vector<std::string> tribenames; |
379 | - LuaInterface lua; |
380 | - std::unique_ptr<LuaTable> table(lua.run_script("tribes/preload.lua")); |
381 | - for (const int key : table->keys<int>()) { |
382 | - std::unique_ptr<LuaTable> info = table->get_table(key); |
383 | - info->do_not_warn_about_unaccessed_keys(); |
384 | - tribenames.push_back(info->get_string("name")); |
385 | - } |
386 | - return tribenames; |
387 | -} |
388 | - |
389 | -std::vector<TribeBasicInfo> get_all_tribeinfos() { |
390 | - std::vector<TribeBasicInfo> tribeinfos; |
391 | - LuaInterface lua; |
392 | - std::unique_ptr<LuaTable> table(lua.run_script("tribes/preload.lua")); |
393 | - for (const int key : table->keys<int>()) { |
394 | - tribeinfos.push_back(TribeBasicInfo(table->get_table(key))); |
395 | - } |
396 | - return tribeinfos; |
397 | -} |
398 | - |
399 | -TribeBasicInfo get_tribeinfo(const std::string& tribename) { |
400 | - if (Widelands::tribe_exists(tribename)) { |
401 | - for (const TribeBasicInfo& info : Widelands::get_all_tribeinfos()) { |
402 | - if (info.name == tribename) { |
403 | - return info; |
404 | - } |
405 | - } |
406 | - } |
407 | - throw GameDataError("The tribe '%s'' does not exist.", tribename.c_str()); |
408 | -} |
409 | - |
410 | -bool tribe_exists(const std::string& tribename) { |
411 | - for (const std::string& name : get_all_tribenames()) { |
412 | - if (name == tribename) { |
413 | - return true; |
414 | - } |
415 | - } |
416 | - return false; |
417 | -} |
418 | - |
419 | Tribes::Tribes() |
420 | : buildings_(new DescriptionMaintainer<BuildingDescr>()), |
421 | immovables_(new DescriptionMaintainer<ImmovableDescr>()), |
422 | |
423 | === modified file 'src/logic/map_objects/tribes/tribes.h' |
424 | --- src/logic/map_objects/tribes/tribes.h 2017-11-21 17:05:45 +0000 |
425 | +++ src/logic/map_objects/tribes/tribes.h 2017-12-18 10:43:22 +0000 |
426 | @@ -46,18 +46,6 @@ |
427 | class WareDescr; |
428 | class WorkerDescr; |
429 | |
430 | -/// Returns a string vector with the names of all tribes. |
431 | -std::vector<std::string> get_all_tribenames(); |
432 | - |
433 | -/// Returns a vector with the basic info for all tribes. |
434 | -std::vector<TribeBasicInfo> get_all_tribeinfos(); |
435 | - |
436 | -/// Returns the basic preload info for a tribe. |
437 | -TribeBasicInfo get_tribeinfo(const std::string& tribename); |
438 | - |
439 | -/// Returns whether this tribe is listed in tribes/preload.lua. |
440 | -bool tribe_exists(const std::string& tribename); |
441 | - |
442 | class Tribes { |
443 | public: |
444 | Tribes(); |
445 | |
446 | === modified file 'src/logic/player.cc' |
447 | --- src/logic/player.cc 2017-11-18 10:11:54 +0000 |
448 | +++ src/logic/player.cc 2017-12-18 10:43:22 +0000 |
449 | @@ -47,7 +47,7 @@ |
450 | #include "logic/map_objects/tribes/soldier.h" |
451 | #include "logic/map_objects/tribes/soldiercontrol.h" |
452 | #include "logic/map_objects/tribes/trainingsite.h" |
453 | -#include "logic/map_objects/tribes/tribe_descr.h" |
454 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
455 | #include "logic/map_objects/tribes/warehouse.h" |
456 | #include "logic/playercommand.h" |
457 | #include "scripting/lua_table.h" |
458 | @@ -190,7 +190,7 @@ |
459 | void Player::create_default_infrastructure() { |
460 | const Map& map = egbase().map(); |
461 | if (map.get_starting_pos(player_number_)) { |
462 | - const TribeBasicInfo::Initialization& initialization = |
463 | + const Widelands::TribeBasicInfo::Initialization& initialization = |
464 | tribe().initialization(initialization_index_); |
465 | |
466 | Game& game = dynamic_cast<Game&>(egbase()); |
467 | |
468 | === modified file 'src/logic/single_player_game_settings_provider.cc' |
469 | --- src/logic/single_player_game_settings_provider.cc 2017-08-18 10:23:45 +0000 |
470 | +++ src/logic/single_player_game_settings_provider.cc 2017-12-18 10:43:22 +0000 |
471 | @@ -22,8 +22,9 @@ |
472 | #include <boost/format.hpp> |
473 | |
474 | #include "ai/computer_player.h" |
475 | +#include "base/i18n.h" |
476 | #include "base/wexception.h" |
477 | -#include "logic/map_objects/tribes/tribes.h" |
478 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
479 | |
480 | SinglePlayerGameSettingsProvider::SinglePlayerGameSettingsProvider() { |
481 | s.tribes = Widelands::get_all_tribeinfos(); |
482 | @@ -167,7 +168,7 @@ |
483 | actual_tribe = s.tribes.at(random).name; |
484 | } |
485 | |
486 | - for (const TribeBasicInfo& tmp_tribe : s.tribes) { |
487 | + for (const Widelands::TribeBasicInfo& tmp_tribe : s.tribes) { |
488 | if (tmp_tribe.name == player.tribe) { |
489 | s.players[number].tribe = actual_tribe; |
490 | if (tmp_tribe.initializations.size() <= player.initialization_index) { |
491 | @@ -181,7 +182,7 @@ |
492 | if (number >= s.players.size()) |
493 | return; |
494 | |
495 | - for (const TribeBasicInfo& tmp_tribe : s.tribes) { |
496 | + for (const Widelands::TribeBasicInfo& tmp_tribe : s.tribes) { |
497 | if (tmp_tribe.name == s.players[number].tribe) { |
498 | if (index < tmp_tribe.initializations.size()) |
499 | s.players[number].initialization_index = index; |
500 | |
501 | === modified file 'src/logic/widelands.h' |
502 | --- src/logic/widelands.h 2017-01-25 18:55:59 +0000 |
503 | +++ src/logic/widelands.h 2017-12-18 10:43:22 +0000 |
504 | @@ -23,6 +23,7 @@ |
505 | #include <cassert> |
506 | #include <cstddef> |
507 | #include <limits> |
508 | +#include <vector> |
509 | |
510 | #include <stdint.h> |
511 | |
512 | @@ -101,6 +102,11 @@ |
513 | } |
514 | }; |
515 | |
516 | +// For suggested teams info during map preload |
517 | +using SuggestedTeam = std::vector<PlayerNumber>; // Players in a team |
518 | +// Recommended teams to play against each other |
519 | +using SuggestedTeamLineup = std::vector<SuggestedTeam>; |
520 | + |
521 | } // namespace Widelands |
522 | |
523 | #endif // end of include guard: WL_LOGIC_WIDELANDS_H |
524 | |
525 | === modified file 'src/map_io/CMakeLists.txt' |
526 | --- src/map_io/CMakeLists.txt 2017-11-05 20:06:36 +0000 |
527 | +++ src/map_io/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
528 | @@ -104,6 +104,7 @@ |
529 | io_filesystem |
530 | logic |
531 | logic_constants |
532 | + logic_exceptions |
533 | logic_widelands_geometry |
534 | profile |
535 | scripting_logic |
536 | |
537 | === modified file 'src/map_io/map_elemental_packet.cc' |
538 | --- src/map_io/map_elemental_packet.cc 2017-08-19 22:22:20 +0000 |
539 | +++ src/map_io/map_elemental_packet.cc 2017-12-18 10:43:22 +0000 |
540 | @@ -73,14 +73,14 @@ |
541 | while (Section* teamsection = prof.get_section(teamsection_key.c_str())) { |
542 | |
543 | // A lineup is made up of teams |
544 | - Map::SuggestedTeamLineup lineup; |
545 | + SuggestedTeamLineup lineup; |
546 | |
547 | uint16_t team_number = 1; |
548 | std::string team_key = (boost::format("team%i") % team_number).str().c_str(); |
549 | std::string team_string = teamsection->get_string(team_key.c_str(), ""); |
550 | while (!team_string.empty()) { |
551 | // A team is made up of players |
552 | - Map::SuggestedTeam team; |
553 | + SuggestedTeam team; |
554 | |
555 | std::vector<std::string> players_string; |
556 | boost::split(players_string, team_string, boost::is_any_of(",")); |
557 | @@ -142,11 +142,11 @@ |
558 | global_section.set_string("tags", boost::algorithm::join(map.get_tags(), ",")); |
559 | |
560 | int counter = 0; |
561 | - for (Widelands::Map::SuggestedTeamLineup lineup : map.get_suggested_teams()) { |
562 | + for (Widelands::SuggestedTeamLineup lineup : map.get_suggested_teams()) { |
563 | Section& teams_section = |
564 | prof.create_section((boost::format("teams%02d") % counter++).str().c_str()); |
565 | int lineup_counter = 0; |
566 | - for (Widelands::Map::SuggestedTeam team : lineup) { |
567 | + for (Widelands::SuggestedTeam team : lineup) { |
568 | std::string section_contents; |
569 | for (std::vector<PlayerNumber>::const_iterator it = team.begin(); it != team.end(); ++it) { |
570 | if (it == team.begin()) { |
571 | |
572 | === modified file 'src/network/CMakeLists.txt' |
573 | --- src/network/CMakeLists.txt 2017-11-28 20:39:35 +0000 |
574 | +++ src/network/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
575 | @@ -53,13 +53,14 @@ |
576 | logic_filesystem_constants |
577 | logic_game_controller |
578 | logic_game_settings |
579 | + logic_tribe_basic_info |
580 | map_io_map_loader |
581 | profile |
582 | random |
583 | scripting_lua_interface |
584 | scripting_lua_table |
585 | ui_basic |
586 | - ui_fsmenu |
587 | + ui_fsmenu_gameloading |
588 | widelands_ball_of_mud |
589 | wui |
590 | ) |
591 | |
592 | === modified file 'src/network/gameclient.cc' |
593 | --- src/network/gameclient.cc 2017-12-17 14:45:23 +0000 |
594 | +++ src/network/gameclient.cc 2017-12-18 10:43:22 +0000 |
595 | @@ -35,7 +35,7 @@ |
596 | #include "io/filewrite.h" |
597 | #include "logic/filesystem_constants.h" |
598 | #include "logic/game.h" |
599 | -#include "logic/map_objects/tribes/tribes.h" |
600 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
601 | #include "logic/player.h" |
602 | #include "logic/playercommand.h" |
603 | #include "logic/playersmanager.h" |
604 | @@ -744,7 +744,7 @@ |
605 | case NETCMD_SETTING_TRIBES: { |
606 | d->settings.tribes.clear(); |
607 | for (uint8_t i = packet.unsigned_8(); i; --i) { |
608 | - TribeBasicInfo info = Widelands::get_tribeinfo(packet.string()); |
609 | + Widelands::TribeBasicInfo info = Widelands::get_tribeinfo(packet.string()); |
610 | |
611 | // Get initializations (we have to do this locally, for translations) |
612 | LuaInterface lua; |
613 | @@ -753,7 +753,7 @@ |
614 | std::string const initialization_script = packet.string(); |
615 | std::unique_ptr<LuaTable> t = lua.run_script(initialization_script); |
616 | t->do_not_warn_about_unaccessed_keys(); |
617 | - info.initializations.push_back(TribeBasicInfo::Initialization( |
618 | + info.initializations.push_back(Widelands::TribeBasicInfo::Initialization( |
619 | initialization_script, t->get_string("descname"), t->get_string("tooltip"))); |
620 | } |
621 | d->settings.tribes.push_back(info); |
622 | |
623 | === modified file 'src/network/gamehost.cc' |
624 | --- src/network/gamehost.cc 2017-12-17 14:45:23 +0000 |
625 | +++ src/network/gamehost.cc 2017-12-18 10:43:22 +0000 |
626 | @@ -44,7 +44,7 @@ |
627 | #include "io/filesystem/layered_filesystem.h" |
628 | #include "logic/filesystem_constants.h" |
629 | #include "logic/game.h" |
630 | -#include "logic/map_objects/tribes/tribes.h" |
631 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
632 | #include "logic/player.h" |
633 | #include "logic/playercommand.h" |
634 | #include "logic/playersmanager.h" |
635 | @@ -1188,7 +1188,7 @@ |
636 | actual_tribe = d->settings.tribes.at(random).name; |
637 | } |
638 | |
639 | - for (const TribeBasicInfo& temp_tribeinfo : d->settings.tribes) { |
640 | + for (const Widelands::TribeBasicInfo& temp_tribeinfo : d->settings.tribes) { |
641 | if (temp_tribeinfo.name == player.tribe) { |
642 | player.tribe = actual_tribe; |
643 | if (temp_tribeinfo.initializations.size() <= player.initialization_index) |
644 | @@ -1215,7 +1215,7 @@ |
645 | if (player.initialization_index == index) |
646 | return; |
647 | |
648 | - for (const TribeBasicInfo& temp_tribeinfo : d->settings.tribes) { |
649 | + for (const Widelands::TribeBasicInfo& temp_tribeinfo : d->settings.tribes) { |
650 | if (temp_tribeinfo.name == player.tribe) { |
651 | if (index < temp_tribeinfo.initializations.size()) { |
652 | player.initialization_index = index; |
653 | @@ -1622,11 +1622,11 @@ |
654 | packet.reset(); |
655 | packet.unsigned_8(NETCMD_SETTING_TRIBES); |
656 | packet.unsigned_8(d->settings.tribes.size()); |
657 | - for (const TribeBasicInfo& tribe : d->settings.tribes) { |
658 | + for (const Widelands::TribeBasicInfo& tribe : d->settings.tribes) { |
659 | packet.string(tribe.name); |
660 | size_t const nr_initializations = tribe.initializations.size(); |
661 | packet.unsigned_8(nr_initializations); |
662 | - for (const TribeBasicInfo::Initialization& init : tribe.initializations) |
663 | + for (const Widelands::TribeBasicInfo::Initialization& init : tribe.initializations) |
664 | packet.string(init.script); |
665 | } |
666 | d->net->send(client.sock_id, packet); |
667 | |
668 | === modified file 'src/scripting/CMakeLists.txt' |
669 | --- src/scripting/CMakeLists.txt 2017-06-05 07:48:28 +0000 |
670 | +++ src/scripting/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
671 | @@ -112,6 +112,7 @@ |
672 | logic_constants |
673 | logic_game_controller |
674 | logic_game_settings |
675 | + logic_tribe_basic_info |
676 | logic_widelands_geometry |
677 | map_io |
678 | scripting_base |
679 | |
680 | === modified file 'src/scripting/lua_map.cc' |
681 | --- src/scripting/lua_map.cc 2017-12-11 17:09:48 +0000 |
682 | +++ src/scripting/lua_map.cc 2017-12-18 10:43:22 +0000 |
683 | @@ -36,6 +36,7 @@ |
684 | #include "logic/map_objects/tribes/market.h" |
685 | #include "logic/map_objects/tribes/ship.h" |
686 | #include "logic/map_objects/tribes/soldier.h" |
687 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
688 | #include "logic/map_objects/tribes/tribes.h" |
689 | #include "logic/map_objects/tribes/warelist.h" |
690 | #include "logic/map_objects/world/editor_category.h" |
691 | |
692 | === modified file 'src/ui_fsmenu/CMakeLists.txt' |
693 | --- src/ui_fsmenu/CMakeLists.txt 2017-11-26 10:34:04 +0000 |
694 | +++ src/ui_fsmenu/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
695 | @@ -17,26 +17,80 @@ |
696 | scripting_lua_interface |
697 | scripting_lua_table |
698 | ui_basic |
699 | - ui_fsmenu |
700 | + ui_fsmenu_base |
701 | profile |
702 | sound |
703 | widelands_ball_of_mud |
704 | ) |
705 | |
706 | -wl_library(ui_fsmenu |
707 | +wl_library(ui_fsmenu_base |
708 | SRCS |
709 | - about.cc |
710 | - about.h |
711 | base.cc |
712 | base.h |
713 | - campaign_select.cc |
714 | - campaign_select.h |
715 | + DEPENDS |
716 | + ui_basic |
717 | +) |
718 | + |
719 | +wl_library(ui_fsmenu_helpwindow |
720 | + SRCS |
721 | helpwindow.cc |
722 | helpwindow.h |
723 | - internet_lobby.cc |
724 | - internet_lobby.h |
725 | - intro.cc |
726 | - intro.h |
727 | + DEPENDS |
728 | + base_i18n |
729 | + graphic |
730 | + scripting_coroutine |
731 | + scripting_lua_table |
732 | + scripting_lua_interface |
733 | + ui_basic |
734 | +) |
735 | + |
736 | + |
737 | +wl_library(ui_fsmenu_main |
738 | + SRCS |
739 | + main.cc |
740 | + main.h |
741 | + DEPENDS |
742 | + base_i18n |
743 | + build_info |
744 | + graphic |
745 | + ui_basic |
746 | + ui_fsmenu_main_menu |
747 | +) |
748 | + |
749 | +wl_library(ui_fsmenu_main_menu |
750 | + SRCS |
751 | + main_menu.cc |
752 | + main_menu.h |
753 | + DEPENDS |
754 | + ui_basic |
755 | + ui_fsmenu_base |
756 | +) |
757 | + |
758 | +wl_library(ui_fsmenu_loading_common |
759 | + SRCS |
760 | + load_map_or_game.cc |
761 | + load_map_or_game.h |
762 | + multiplayer.cc |
763 | + multiplayer.h |
764 | + singleplayer.cc |
765 | + singleplayer.h |
766 | + DEPENDS |
767 | + base_i18n |
768 | + graphic |
769 | + graphic_text_constants |
770 | + io_filesystem |
771 | + profile |
772 | + network |
773 | + random |
774 | + ui_basic |
775 | + ui_fsmenu_base |
776 | + ui_fsmenu_main_menu |
777 | + wui_common_mapdetails |
778 | + wui |
779 | +) |
780 | + |
781 | +wl_library(ui_fsmenu_gameloading |
782 | + SRCS |
783 | launch_game.cc |
784 | launch_game.h |
785 | launch_mpg.cc |
786 | @@ -45,46 +99,88 @@ |
787 | launch_spg.h |
788 | loadgame.cc |
789 | loadgame.h |
790 | - load_map_or_game.cc |
791 | - load_map_or_game.h |
792 | - main.cc |
793 | - main.h |
794 | - main_menu.cc |
795 | - main_menu.h |
796 | + DEPENDS |
797 | + base_exceptions |
798 | + base_i18n |
799 | + graphic |
800 | + graphic_playercolor |
801 | + graphic_text_constants |
802 | + helper |
803 | + io_filesystem |
804 | + logic |
805 | + logic_game_controller |
806 | + logic_game_settings |
807 | + logic_tribe_basic_info |
808 | + map_io_map_loader |
809 | + profile |
810 | + scripting_lua_interface |
811 | + scripting_lua_table |
812 | + ui_basic |
813 | + ui_fsmenu_base |
814 | + ui_fsmenu_helpwindow |
815 | + ui_fsmenu_loading_common |
816 | + ui_fsmenu_maploading |
817 | + wui |
818 | + wui_chat_ui |
819 | + wui_common_gamedetails |
820 | + wui_common_suggested_teams |
821 | +) |
822 | + |
823 | +wl_library(ui_fsmenu_maploading |
824 | + SRCS |
825 | + campaign_select.cc |
826 | + campaign_select.h |
827 | mapselect.cc |
828 | mapselect.h |
829 | - multiplayer.cc |
830 | - multiplayer.h |
831 | + DEPENDS |
832 | + base_exceptions |
833 | + base_i18n |
834 | + base_log |
835 | + graphic |
836 | + graphic_fonthandler |
837 | + graphic_text_constants |
838 | + io_filesystem |
839 | + logic_campaign_visibility |
840 | + logic_filesystem_constants |
841 | + logic_game_controller |
842 | + logic_game_settings |
843 | + map_io_map_loader |
844 | + profile |
845 | + ui_basic |
846 | + ui_fsmenu_base |
847 | + ui_fsmenu_loading_common |
848 | + wui_common_mapdetails |
849 | +) |
850 | + |
851 | +wl_library(ui_fsmenu_network |
852 | + SRCS |
853 | + internet_lobby.cc |
854 | + internet_lobby.h |
855 | netsetup_lan.cc |
856 | netsetup_lan.h |
857 | - singleplayer.cc |
858 | - singleplayer.h |
859 | DEPENDS |
860 | - base_exceptions |
861 | base_i18n |
862 | base_log |
863 | base_macros |
864 | - build_info |
865 | graphic |
866 | - graphic_fonthandler |
867 | - graphic_playercolor |
868 | graphic_text_constants |
869 | - helper |
870 | - io_filesystem |
871 | - logic |
872 | - logic_campaign_visibility |
873 | - logic_filesystem_constants |
874 | - logic_game_controller |
875 | - logic_game_settings |
876 | - map_io_map_loader |
877 | network |
878 | profile |
879 | random |
880 | - scripting_coroutine |
881 | - scripting_lua_interface |
882 | - scripting_lua_table |
883 | ui_basic |
884 | - wui |
885 | + ui_fsmenu_base |
886 | wui_chat_ui |
887 | - wui_common |
888 | +) |
889 | + |
890 | +wl_library(ui_fsmenu_misc |
891 | + SRCS |
892 | + about.cc |
893 | + about.h |
894 | + intro.cc |
895 | + intro.h |
896 | + DEPENDS |
897 | + base_i18n |
898 | + graphic |
899 | + ui_basic |
900 | + ui_fsmenu_base |
901 | ) |
902 | |
903 | === modified file 'src/ui_fsmenu/launch_mpg.cc' |
904 | --- src/ui_fsmenu/launch_mpg.cc 2017-11-24 09:19:52 +0000 |
905 | +++ src/ui_fsmenu/launch_mpg.cc 2017-12-18 10:43:22 +0000 |
906 | @@ -34,6 +34,7 @@ |
907 | #include "logic/game_settings.h" |
908 | #include "logic/map.h" |
909 | #include "logic/map_objects/map_object.h" |
910 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
911 | #include "logic/player.h" |
912 | #include "map_io/map_loader.h" |
913 | #include "profile/profile.h" |
914 | @@ -515,7 +516,7 @@ |
915 | settings_->set_player_tribe(i - 1, player_save_tribe[i - 1]); |
916 | |
917 | // get translated tribename |
918 | - for (const TribeBasicInfo& tribeinfo : settings_->settings().tribes) { |
919 | + for (const Widelands::TribeBasicInfo& tribeinfo : settings_->settings().tribes) { |
920 | if (tribeinfo.name == player_save_tribe[i - 1]) { |
921 | i18n::Textdomain td("tribes"); // for translated initialisation |
922 | player_save_tribe[i - 1] = _(tribeinfo.descname); |
923 | |
924 | === modified file 'src/website/CMakeLists.txt' |
925 | --- src/website/CMakeLists.txt 2016-05-14 07:35:39 +0000 |
926 | +++ src/website/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
927 | @@ -26,5 +26,6 @@ |
928 | io_fileread |
929 | io_filesystem |
930 | logic |
931 | + logic_tribe_basic_info |
932 | sound |
933 | ) |
934 | |
935 | === modified file 'src/website/map_object_info.cc' |
936 | --- src/website/map_object_info.cc 2017-09-15 12:33:58 +0000 |
937 | +++ src/website/map_object_info.cc 2017-12-18 10:43:22 +0000 |
938 | @@ -33,6 +33,7 @@ |
939 | #include "io/filesystem/layered_filesystem.h" |
940 | #include "io/filewrite.h" |
941 | #include "logic/editor_game_base.h" |
942 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
943 | #include "logic/map_objects/tribes/tribes.h" |
944 | #include "logic/map_objects/world/world.h" |
945 | #include "sound/sound_handler.h" |
946 | @@ -461,7 +462,7 @@ |
947 | ========================================================== |
948 | */ |
949 | |
950 | -void add_tribe_info(const TribeBasicInfo& tribe_info, JSONFileWrite* fw) { |
951 | +void add_tribe_info(const Widelands::TribeBasicInfo& tribe_info, JSONFileWrite* fw) { |
952 | fw->write_key_value_string("name", tribe_info.name); |
953 | fw->close_element(); |
954 | fw->write_key_value_string("descname", tribe_info.descname); |
955 | @@ -482,9 +483,9 @@ |
956 | egbase.mutable_tribes()->postload(); // Make sure that all values have been set. |
957 | const Tribes& tribes = egbase.tribes(); |
958 | |
959 | - std::vector<TribeBasicInfo> tribeinfos = Widelands::get_all_tribeinfos(); |
960 | + std::vector<Widelands::TribeBasicInfo> tribeinfos = Widelands::get_all_tribeinfos(); |
961 | for (size_t tribe_index = 0; tribe_index < tribeinfos.size(); ++tribe_index) { |
962 | - const TribeBasicInfo& tribe_info = tribeinfos[tribe_index]; |
963 | + const Widelands::TribeBasicInfo& tribe_info = tribeinfos[tribe_index]; |
964 | log("\n\n=========================\nWriting tribe: %s\n=========================\n", |
965 | tribe_info.name.c_str()); |
966 | |
967 | |
968 | === modified file 'src/wui/CMakeLists.txt' |
969 | --- src/wui/CMakeLists.txt 2017-11-05 20:06:36 +0000 |
970 | +++ src/wui/CMakeLists.txt 2017-12-18 10:43:22 +0000 |
971 | @@ -49,12 +49,45 @@ |
972 | logic_widelands_geometry |
973 | ) |
974 | |
975 | -wl_library(wui_common |
976 | +wl_library(wui_common_suggested_teams |
977 | + SRCS |
978 | + suggested_teams_box.cc |
979 | + suggested_teams_box.h |
980 | + DEPENDS |
981 | + base_i18n |
982 | + graphic |
983 | + graphic_playercolor |
984 | + logic_constants |
985 | + ui_basic |
986 | +) |
987 | + |
988 | +wl_library(wui_common_gamedetails |
989 | SRCS |
990 | gamedetails.cc |
991 | gamedetails.h |
992 | load_or_save_game.cc |
993 | load_or_save_game.h |
994 | + DEPENDS |
995 | + base_i18n |
996 | + base_log |
997 | + base_time_string |
998 | + helper |
999 | + game_io |
1000 | + graphic |
1001 | + graphic_fonthandler |
1002 | + graphic_image_io |
1003 | + graphic_surface |
1004 | + graphic_text_constants |
1005 | + io_filesystem |
1006 | + logic |
1007 | + logic_filesystem_constants |
1008 | + logic_game_controller |
1009 | + logic_game_settings |
1010 | + ui_basic |
1011 | +) |
1012 | + |
1013 | +wl_library(wui_common_mapdetails |
1014 | + SRCS |
1015 | mapdetails.cc |
1016 | mapdetails.h |
1017 | mapdata.cc |
1018 | @@ -63,28 +96,21 @@ |
1019 | maptable.h |
1020 | map_tags.cc |
1021 | map_tags.h |
1022 | - suggested_teams_box.cc |
1023 | - suggested_teams_box.h |
1024 | DEPENDS |
1025 | base_exceptions |
1026 | base_i18n |
1027 | base_log |
1028 | - base_time_string |
1029 | - helper |
1030 | - game_io |
1031 | graphic |
1032 | graphic_fonthandler |
1033 | - graphic_image_io |
1034 | - graphic_playercolor |
1035 | - graphic_surface |
1036 | graphic_text_constants |
1037 | io_filesystem |
1038 | logic |
1039 | - logic_filesystem_constants |
1040 | + logic_constants |
1041 | logic_game_controller |
1042 | logic_game_settings |
1043 | map_io_map_loader |
1044 | ui_basic |
1045 | + wui_common_suggested_teams |
1046 | ) |
1047 | |
1048 | wl_library(wui_quicknavigation |
1049 | @@ -253,6 +279,7 @@ |
1050 | logic_filesystem_constants |
1051 | logic_game_controller |
1052 | logic_game_settings |
1053 | + logic_tribe_basic_info |
1054 | logic_widelands_geometry |
1055 | network |
1056 | note_sound |
1057 | @@ -264,7 +291,7 @@ |
1058 | sound |
1059 | ui_basic |
1060 | wui_chat_ui |
1061 | - wui_common |
1062 | + wui_common_gamedetails |
1063 | wui_economy_options |
1064 | wui_mapview |
1065 | wui_mapview_pixelfunctions |
1066 | |
1067 | === modified file 'src/wui/load_or_save_game.cc' |
1068 | --- src/wui/load_or_save_game.cc 2017-11-27 21:21:45 +0000 |
1069 | +++ src/wui/load_or_save_game.cc 2017-12-18 10:43:22 +0000 |
1070 | @@ -34,7 +34,6 @@ |
1071 | #include "helper.h" |
1072 | #include "io/filesystem/layered_filesystem.h" |
1073 | #include "logic/filesystem_constants.h" |
1074 | -#include "logic/game.h" |
1075 | #include "logic/game_controller.h" |
1076 | #include "logic/game_settings.h" |
1077 | #include "logic/replay.h" |
1078 | |
1079 | === modified file 'src/wui/mapdata.h' |
1080 | --- src/wui/mapdata.h 2017-01-25 18:55:59 +0000 |
1081 | +++ src/wui/mapdata.h 2017-12-18 10:43:22 +0000 |
1082 | @@ -30,6 +30,7 @@ |
1083 | #include "base/i18n.h" |
1084 | #include "io/filesystem/filesystem.h" |
1085 | #include "logic/map.h" |
1086 | +#include "logic/widelands.h" |
1087 | |
1088 | /** |
1089 | * Author data for a map or scenario. |
1090 | @@ -109,7 +110,7 @@ |
1091 | uint32_t nrplayers; |
1092 | uint32_t width; |
1093 | uint32_t height; |
1094 | - std::vector<Widelands::Map::SuggestedTeamLineup> suggested_teams; |
1095 | + std::vector<Widelands::SuggestedTeamLineup> suggested_teams; |
1096 | std::set<std::string> tags; |
1097 | MapData::MapType maptype; |
1098 | MapData::DisplayType displaytype; |
1099 | |
1100 | === modified file 'src/wui/multiplayersetupgroup.cc' |
1101 | --- src/wui/multiplayersetupgroup.cc 2017-11-27 16:59:23 +0000 |
1102 | +++ src/wui/multiplayersetupgroup.cc 2017-12-18 10:43:22 +0000 |
1103 | @@ -35,8 +35,7 @@ |
1104 | #include "graphic/text_constants.h" |
1105 | #include "logic/game.h" |
1106 | #include "logic/game_settings.h" |
1107 | -#include "logic/map_objects/tribes/tribe_descr.h" |
1108 | -#include "logic/map_objects/tribes/tribes.h" |
1109 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
1110 | #include "logic/player.h" |
1111 | #include "logic/widelands.h" |
1112 | #include "ui_basic/button.h" |
1113 | @@ -422,7 +421,7 @@ |
1114 | } else { |
1115 | { |
1116 | i18n::Textdomain td("tribes"); |
1117 | - for (const TribeBasicInfo& tribeinfo : Widelands::get_all_tribeinfos()) { |
1118 | + for (const Widelands::TribeBasicInfo& tribeinfo : Widelands::get_all_tribeinfos()) { |
1119 | tribes_dropdown_.add(_(tribeinfo.descname), tribeinfo.name, |
1120 | g_gr->images().get(tribeinfo.icon), false, tribeinfo.tooltip); |
1121 | } |
1122 | @@ -479,9 +478,9 @@ |
1123 | } else { |
1124 | init_dropdown_.set_label(""); |
1125 | i18n::Textdomain td("tribes"); // for translated initialisation |
1126 | - const TribeBasicInfo tribeinfo = Widelands::get_tribeinfo(player_setting.tribe); |
1127 | + const Widelands::TribeBasicInfo tribeinfo = Widelands::get_tribeinfo(player_setting.tribe); |
1128 | for (size_t i = 0; i < tribeinfo.initializations.size(); ++i) { |
1129 | - const TribeBasicInfo::Initialization& addme = tribeinfo.initializations[i]; |
1130 | + const Widelands::TribeBasicInfo::Initialization& addme = tribeinfo.initializations[i]; |
1131 | init_dropdown_.add(_(addme.descname), i, nullptr, |
1132 | i == player_setting.initialization_index, _(addme.tooltip)); |
1133 | } |
1134 | |
1135 | === modified file 'src/wui/playerdescrgroup.cc' |
1136 | --- src/wui/playerdescrgroup.cc 2017-06-15 05:48:10 +0000 |
1137 | +++ src/wui/playerdescrgroup.cc 2017-12-18 10:43:22 +0000 |
1138 | @@ -29,7 +29,7 @@ |
1139 | #include "graphic/graphic.h" |
1140 | #include "graphic/text_constants.h" |
1141 | #include "logic/game_settings.h" |
1142 | -#include "logic/map_objects/tribes/tribe_descr.h" |
1143 | +#include "logic/map_objects/tribes/tribe_basic_info.h" |
1144 | #include "logic/player.h" |
1145 | #include "ui_basic/button.h" |
1146 | #include "ui_basic/checkbox.h" |
1147 | @@ -161,7 +161,7 @@ |
1148 | } |
1149 | d->btnPlayerType->set_title(title); |
1150 | |
1151 | - TribeBasicInfo info = Widelands::get_tribeinfo(player.tribe); |
1152 | + Widelands::TribeBasicInfo info = Widelands::get_tribeinfo(player.tribe); |
1153 | if (!tribenames_[player.tribe].size()) { |
1154 | // Tribe's localized name |
1155 | tribenames_[player.tribe] = info.descname; |
1156 | @@ -177,7 +177,7 @@ |
1157 | |
1158 | { |
1159 | i18n::Textdomain td("tribes"); // for translated initialisation |
1160 | - for (const TribeBasicInfo& tribeinfo : settings.tribes) { |
1161 | + for (const Widelands::TribeBasicInfo& tribeinfo : settings.tribes) { |
1162 | if (tribeinfo.name == player.tribe) { |
1163 | d->btnPlayerInit->set_title( |
1164 | _(tribeinfo.initializations.at(player.initialization_index).descname)); |
1165 | @@ -293,7 +293,7 @@ |
1166 | |
1167 | const PlayerSettings& player = settings.players[d->plnum]; |
1168 | |
1169 | - for (const TribeBasicInfo& tribeinfo : settings.tribes) { |
1170 | + for (const Widelands::TribeBasicInfo& tribeinfo : settings.tribes) { |
1171 | if (tribeinfo.name == player.tribe) { |
1172 | return d->settings->set_player_init( |
1173 | d->plnum, (player.initialization_index + 1) % tribeinfo.initializations.size()); |
1174 | |
1175 | === modified file 'src/wui/suggested_teams_box.cc' |
1176 | --- src/wui/suggested_teams_box.cc 2017-08-19 23:24:28 +0000 |
1177 | +++ src/wui/suggested_teams_box.cc 2017-12-18 10:43:22 +0000 |
1178 | @@ -22,6 +22,7 @@ |
1179 | #include <set> |
1180 | #include <string> |
1181 | |
1182 | +#include "base/i18n.h" |
1183 | #include "graphic/graphic.h" |
1184 | #include "graphic/playercolor.h" |
1185 | |
1186 | @@ -76,7 +77,7 @@ |
1187 | } |
1188 | |
1189 | void SuggestedTeamsBox::show( |
1190 | - const std::vector<Widelands::Map::SuggestedTeamLineup>& suggested_teams) { |
1191 | + const std::vector<Widelands::SuggestedTeamLineup>& suggested_teams) { |
1192 | hide(); |
1193 | suggested_teams_ = suggested_teams; |
1194 | |
1195 | @@ -94,7 +95,7 @@ |
1196 | // Parse suggested teams |
1197 | UI::Icon* player_icon; |
1198 | UI::Textarea* vs_label; |
1199 | - for (const Widelands::Map::SuggestedTeamLineup& lineup : suggested_teams_) { |
1200 | + for (const Widelands::SuggestedTeamLineup& lineup : suggested_teams_) { |
1201 | |
1202 | lineup_box_ = |
1203 | new UI::Box(this, indent_, teamlist_offset + lineup_counter * (label_height_), |
1204 | @@ -103,7 +104,7 @@ |
1205 | lineup_box_->set_size(get_w(), label_height_); |
1206 | |
1207 | bool is_first = true; |
1208 | - for (const Widelands::Map::SuggestedTeam& team : lineup) { |
1209 | + for (const Widelands::SuggestedTeam& team : lineup) { |
1210 | |
1211 | if (!is_first) { |
1212 | lineup_box_->add_space(padding_); |
1213 | |
1214 | === modified file 'src/wui/suggested_teams_box.h' |
1215 | --- src/wui/suggested_teams_box.h 2017-01-25 18:55:59 +0000 |
1216 | +++ src/wui/suggested_teams_box.h 2017-12-18 10:43:22 +0000 |
1217 | @@ -23,7 +23,7 @@ |
1218 | #include <set> |
1219 | #include <string> |
1220 | |
1221 | -#include "logic/map.h" |
1222 | +#include "logic/widelands.h" |
1223 | #include "ui_basic/box.h" |
1224 | #include "ui_basic/icon.h" |
1225 | #include "ui_basic/textarea.h" |
1226 | @@ -43,7 +43,7 @@ |
1227 | ~SuggestedTeamsBox(); |
1228 | |
1229 | void hide(); |
1230 | - void show(const std::vector<Widelands::Map::SuggestedTeamLineup>& suggested_teams); |
1231 | + void show(const std::vector<Widelands::SuggestedTeamLineup>& suggested_teams); |
1232 | |
1233 | private: |
1234 | int32_t const padding_; |
1235 | @@ -53,7 +53,7 @@ |
1236 | UI::Box* lineup_box_; |
1237 | std::vector<UI::Icon*> player_icons_; |
1238 | std::vector<UI::Textarea*> vs_labels_; |
1239 | - std::vector<Widelands::Map::SuggestedTeamLineup> suggested_teams_; |
1240 | + std::vector<Widelands::SuggestedTeamLineup> suggested_teams_; |
1241 | }; |
1242 | } |
1243 |
I tested this by changing map_object.h - the only gain is that suggested_teams_box doesn't get recompiled. I still think it's worth it though when we hopefully get to break up the logic monolith a bit. Will do 2 release builds to have a look at the file sizes of the executables.