Merge lp:~widelands-dev/widelands/compiler-warnings-201908-2 into lp:widelands
- compiler-warnings-201908-2
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 9199 |
Proposed branch: | lp:~widelands-dev/widelands/compiler-warnings-201908-2 |
Merge into: | lp:widelands |
Diff against target: |
519 lines (+79/-71) 24 files modified
src/CMakeLists.txt (+16/-3) src/ai/defaultai.cc (+0/-1) src/ai/test/test_ai.cc (+1/-0) src/economy/test/test_road.cc (+1/-0) src/economy/test/test_routing.cc (+1/-0) src/editor/CMakeLists.txt (+1/-1) src/graphic/styles/font_style.h (+0/-1) src/graphic/styles/text_panel_style.h (+0/-1) src/io/filesystem/test/test_filesystem.cc (+1/-0) src/logic/CMakeLists.txt (+2/-2) src/logic/map_objects/tribes/productionsite.cc (+1/-1) src/network/CMakeLists.txt (+1/-0) src/notifications/test/notifications_test.cc (+1/-0) src/scripting/CMakeLists.txt (+1/-1) src/scripting/test/test_luna.cc (+1/-0) src/sound/CMakeLists.txt (+1/-1) src/ui_basic/CMakeLists.txt (+1/-0) src/ui_fsmenu/CMakeLists.txt (+4/-3) src/ui_fsmenu/options.cc (+1/-1) src/wlapplication.cc (+12/-4) src/wlapplication.h (+0/-7) src/wlapplication_options.cc (+20/-21) src/wlapplication_options.h (+9/-21) src/wui/CMakeLists.txt (+3/-2) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/compiler-warnings-201908-2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Klaus Halfmann | Approve | ||
GunChleoc | Needs Resubmitting | ||
Review via email: mp+372111@code.launchpad.net |
Commit message
Fix compiler warnings and refactor config dir.
Description of the change
Do not send the merge command yet, I want to check the Travis/AppVeyor logs first.
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 5378. State: failed. Details: https:/
Appveyor build 5148. State: success. Details: https:/
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 5378. State: passed. Details: https:/
Appveyor build 5148. State: success. Details: https:/
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 5399. State: failed. Details: https:/
Appveyor build 5169. State: success. Details: https:/
Klaus Halfmann (klaus-halfmann) wrote : | # |
* Replaced:
- widelands_
+ widelands_options
-> fine
* Codestyle: using this for a member function makes no sense.
* Smuggeled in some USE_XDG handling :-)
Will compile and start this, not doing much testing.
Please: review my refactor_gamehost before merging it becomes to much pain.
GunChleoc (gunchleoc) wrote : | # |
Thanks for the review!
I already did a code review on your branch, I guess you overlooked it.
@bunnybot merge
bunnybot (widelandsofficial) wrote : | # |
Refusing to merge, since Travis is not green. Use @bunnybot merge force for merging anyways.
Travis build 5399. State: failed. Details: https:/
Klaus Halfmann (klaus-halfmann) wrote : | # |
Locally commpiles without issues. Start upto Lobby was fine.
Klaus Halfmann (klaus-halfmann) wrote : | # |
Mhh,one test in travis fails
test/maps/
Running Widelands ... FAIL
But only for GCC_VERSION="4.9" BUILD_TYPE="Debug" ?
will run the test loocally, too
GunChleoc (gunchleoc) wrote : | # |
The UI test sometimes fails because it takes too long for the game to close. I have implemented a fix in one of my other branches. Will rerun the Travis job.
Klaus Halfmann (klaus-halfmann) wrote : | # |
local tests ok
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 5399. State: passed. Details: https:/
Appveyor build 5169. State: success. Details: https:/
GunChleoc (gunchleoc) wrote : | # |
Thanks again!
@bunnybot merge
Preview Diff
1 | === modified file 'src/CMakeLists.txt' | |||
2 | --- src/CMakeLists.txt 2019-07-20 14:32:57 +0000 | |||
3 | +++ src/CMakeLists.txt 2019-09-06 14:10:07 +0000 | |||
4 | @@ -92,8 +92,6 @@ | |||
5 | 92 | wlapplication.h | 92 | wlapplication.h |
6 | 93 | wlapplication_messages.cc | 93 | wlapplication_messages.cc |
7 | 94 | wlapplication_messages.h | 94 | wlapplication_messages.h |
8 | 95 | wlapplication_options.cc | ||
9 | 96 | wlapplication_options.h | ||
10 | 97 | USES_SDL2 | 95 | USES_SDL2 |
11 | 98 | USES_SDL2_IMAGE | 96 | USES_SDL2_IMAGE |
12 | 99 | USES_SDL2_TTF | 97 | USES_SDL2_TTF |
13 | @@ -109,7 +107,6 @@ | |||
14 | 109 | graphic_fonthandler | 107 | graphic_fonthandler |
15 | 110 | graphic_text | 108 | graphic_text |
16 | 111 | io_filesystem | 109 | io_filesystem |
17 | 112 | io_profile | ||
18 | 113 | logic | 110 | logic |
19 | 114 | logic_exceptions | 111 | logic_exceptions |
20 | 115 | logic_filesystem_constants | 112 | logic_filesystem_constants |
21 | @@ -129,9 +126,25 @@ | |||
22 | 129 | ui_fsmenu_misc | 126 | ui_fsmenu_misc |
23 | 130 | ui_fsmenu_network | 127 | ui_fsmenu_network |
24 | 131 | ui_fsmenu_options | 128 | ui_fsmenu_options |
25 | 129 | widelands_options | ||
26 | 132 | wui | 130 | wui |
27 | 133 | ) | 131 | ) |
28 | 134 | 132 | ||
29 | 133 | wl_library(widelands_options | ||
30 | 134 | SRCS | ||
31 | 135 | wlapplication_options.cc | ||
32 | 136 | wlapplication_options.h | ||
33 | 137 | USES_SDL2 | ||
34 | 138 | USES_SDL2_IMAGE | ||
35 | 139 | USES_SDL2_TTF | ||
36 | 140 | DEPENDS | ||
37 | 141 | base_log | ||
38 | 142 | io_filesystem | ||
39 | 143 | io_profile | ||
40 | 144 | logic_filesystem_constants | ||
41 | 145 | ) | ||
42 | 146 | |||
43 | 147 | |||
44 | 135 | # TODO(sirver): Split into libs with useful names. | 148 | # TODO(sirver): Split into libs with useful names. |
45 | 136 | wl_library(helper | 149 | wl_library(helper |
46 | 137 | SRCS | 150 | SRCS |
47 | 138 | 151 | ||
48 | === modified file 'src/ai/defaultai.cc' | |||
49 | --- src/ai/defaultai.cc 2019-09-05 19:57:55 +0000 | |||
50 | +++ src/ai/defaultai.cc 2019-09-06 14:10:07 +0000 | |||
51 | @@ -5601,7 +5601,6 @@ | |||
52 | 5601 | inputs[16] = 0; | 5601 | inputs[16] = 0; |
53 | 5602 | inputs[17] = (inputs_on_stock) ? 0 : -2; | 5602 | inputs[17] = (inputs_on_stock) ? 0 : -2; |
54 | 5603 | inputs[18] = (suppliers_exist) ? 0 : -3; | 5603 | inputs[18] = (suppliers_exist) ? 0 : -3; |
55 | 5604 | ; | ||
56 | 5605 | inputs[19] = (inputs_on_stock) ? 0 : -4; | 5604 | inputs[19] = (inputs_on_stock) ? 0 : -4; |
57 | 5606 | inputs[20] = | 5605 | inputs[20] = |
58 | 5607 | (mines_per_type[bo.mines].in_construction + mines_per_type[bo.mines].finished == 1) ? | 5606 | (mines_per_type[bo.mines].in_construction + mines_per_type[bo.mines].finished == 1) ? |
59 | 5608 | 5607 | ||
60 | === modified file 'src/ai/test/test_ai.cc' | |||
61 | --- src/ai/test/test_ai.cc 2019-08-31 20:12:56 +0000 | |||
62 | +++ src/ai/test/test_ai.cc 2019-09-06 14:10:07 +0000 | |||
63 | @@ -29,6 +29,7 @@ | |||
64 | 29 | 29 | ||
65 | 30 | // Triggered by BOOST_AUTO_TEST_CASE | 30 | // Triggered by BOOST_AUTO_TEST_CASE |
66 | 31 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") | 31 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") |
67 | 32 | CLANG_DIAG_OFF("-Wused-but-marked-unused") | ||
68 | 32 | 33 | ||
69 | 33 | using namespace Widelands; | 34 | using namespace Widelands; |
70 | 34 | 35 | ||
71 | 35 | 36 | ||
72 | === modified file 'src/economy/test/test_road.cc' | |||
73 | --- src/economy/test/test_road.cc 2019-02-23 11:00:49 +0000 | |||
74 | +++ src/economy/test/test_road.cc 2019-09-06 14:10:07 +0000 | |||
75 | @@ -33,6 +33,7 @@ | |||
76 | 33 | 33 | ||
77 | 34 | // Triggered by BOOST_AUTO_TEST_CASE | 34 | // Triggered by BOOST_AUTO_TEST_CASE |
78 | 35 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") | 35 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") |
79 | 36 | CLANG_DIAG_OFF("-Wused-but-marked-unused") | ||
80 | 36 | 37 | ||
81 | 37 | namespace Widelands { | 38 | namespace Widelands { |
82 | 38 | class World; | 39 | class World; |
83 | 39 | 40 | ||
84 | === modified file 'src/economy/test/test_routing.cc' | |||
85 | --- src/economy/test/test_routing.cc 2019-02-23 11:00:49 +0000 | |||
86 | +++ src/economy/test/test_routing.cc 2019-09-06 14:10:07 +0000 | |||
87 | @@ -33,6 +33,7 @@ | |||
88 | 33 | 33 | ||
89 | 34 | // Triggered by BOOST_AUTO_TEST_CASE | 34 | // Triggered by BOOST_AUTO_TEST_CASE |
90 | 35 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") | 35 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") |
91 | 36 | CLANG_DIAG_OFF("-Wused-but-marked-unused") | ||
92 | 36 | 37 | ||
93 | 37 | using namespace Widelands; | 38 | using namespace Widelands; |
94 | 38 | 39 | ||
95 | 39 | 40 | ||
96 | === modified file 'src/editor/CMakeLists.txt' | |||
97 | --- src/editor/CMakeLists.txt 2019-08-27 19:00:30 +0000 | |||
98 | +++ src/editor/CMakeLists.txt 2019-09-06 14:10:07 +0000 | |||
99 | @@ -115,7 +115,7 @@ | |||
100 | 115 | scripting_lua_interface | 115 | scripting_lua_interface |
101 | 116 | scripting_lua_table | 116 | scripting_lua_table |
102 | 117 | ui_basic | 117 | ui_basic |
104 | 118 | widelands_ball_of_mud | 118 | widelands_options |
105 | 119 | wui | 119 | wui |
106 | 120 | wui_common_mapdetails | 120 | wui_common_mapdetails |
107 | 121 | wui_mapview_pixelfunctions | 121 | wui_mapview_pixelfunctions |
108 | 122 | 122 | ||
109 | === modified file 'src/graphic/styles/font_style.h' | |||
110 | --- src/graphic/styles/font_style.h 2019-06-01 14:16:25 +0000 | |||
111 | +++ src/graphic/styles/font_style.h 2019-09-06 14:10:07 +0000 | |||
112 | @@ -67,7 +67,6 @@ | |||
113 | 67 | bool init_underline, | 67 | bool init_underline, |
114 | 68 | bool init_shadow); | 68 | bool init_shadow); |
115 | 69 | explicit FontStyleInfo(const FontStyleInfo& other); | 69 | explicit FontStyleInfo(const FontStyleInfo& other); |
116 | 70 | FontStyleInfo& operator=(const FontStyleInfo& other) = default; | ||
117 | 71 | 70 | ||
118 | 72 | std::string as_font_tag(const std::string& text) const; | 71 | std::string as_font_tag(const std::string& text) const; |
119 | 73 | 72 | ||
120 | 74 | 73 | ||
121 | === modified file 'src/graphic/styles/text_panel_style.h' | |||
122 | --- src/graphic/styles/text_panel_style.h 2019-05-26 17:21:15 +0000 | |||
123 | +++ src/graphic/styles/text_panel_style.h 2019-09-06 14:10:07 +0000 | |||
124 | @@ -38,7 +38,6 @@ | |||
125 | 38 | : background_(new UI::PanelStyleInfo(other.background())), | 38 | : background_(new UI::PanelStyleInfo(other.background())), |
126 | 39 | font_(new UI::FontStyleInfo(other.font())) { | 39 | font_(new UI::FontStyleInfo(other.font())) { |
127 | 40 | } | 40 | } |
128 | 41 | TextPanelStyleInfo& operator=(const TextPanelStyleInfo& other) = default; | ||
129 | 42 | 41 | ||
130 | 43 | const UI::FontStyleInfo& font() const { | 42 | const UI::FontStyleInfo& font() const { |
131 | 44 | return *font_.get(); | 43 | return *font_.get(); |
132 | 45 | 44 | ||
133 | === modified file 'src/io/filesystem/test/test_filesystem.cc' | |||
134 | --- src/io/filesystem/test/test_filesystem.cc 2019-04-09 16:43:49 +0000 | |||
135 | +++ src/io/filesystem/test/test_filesystem.cc 2019-09-06 14:10:07 +0000 | |||
136 | @@ -49,6 +49,7 @@ | |||
137 | 49 | 49 | ||
138 | 50 | // Triggered by BOOST_AUTO_TEST_CASE | 50 | // Triggered by BOOST_AUTO_TEST_CASE |
139 | 51 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") | 51 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") |
140 | 52 | CLANG_DIAG_OFF("-Wused-but-marked-unused") | ||
141 | 52 | 53 | ||
142 | 53 | BOOST_AUTO_TEST_SUITE(FileSystemTests) | 54 | BOOST_AUTO_TEST_SUITE(FileSystemTests) |
143 | 54 | #ifndef _WIN32 | 55 | #ifndef _WIN32 |
144 | 55 | 56 | ||
145 | === modified file 'src/logic/CMakeLists.txt' | |||
146 | --- src/logic/CMakeLists.txt 2019-08-27 19:00:30 +0000 | |||
147 | +++ src/logic/CMakeLists.txt 2019-09-06 14:10:07 +0000 | |||
148 | @@ -63,7 +63,7 @@ | |||
149 | 63 | logic_commands | 63 | logic_commands |
150 | 64 | logic_game_settings | 64 | logic_game_settings |
151 | 65 | ui_basic | 65 | ui_basic |
153 | 66 | widelands_ball_of_mud | 66 | widelands_options |
154 | 67 | wui | 67 | wui |
155 | 68 | ) | 68 | ) |
156 | 69 | 69 | ||
157 | @@ -258,7 +258,7 @@ | |||
158 | 258 | sound | 258 | sound |
159 | 259 | sound_constants | 259 | sound_constants |
160 | 260 | ui_basic | 260 | ui_basic |
162 | 261 | widelands_ball_of_mud | 261 | widelands_options |
163 | 262 | wui # TODO(GunChleoc): Circular dependency | 262 | wui # TODO(GunChleoc): Circular dependency |
164 | 263 | ) | 263 | ) |
165 | 264 | 264 | ||
166 | 265 | 265 | ||
167 | === modified file 'src/logic/map_objects/tribes/productionsite.cc' | |||
168 | --- src/logic/map_objects/tribes/productionsite.cc 2019-08-20 17:35:33 +0000 | |||
169 | +++ src/logic/map_objects/tribes/productionsite.cc 2019-09-06 14:10:07 +0000 | |||
170 | @@ -1090,7 +1090,7 @@ | |||
171 | 1090 | static const uint32_t entire_duration = 10 * 60 * 1000; | 1090 | static const uint32_t entire_duration = 10 * 60 * 1000; |
172 | 1091 | if (duration > duration_cap) { | 1091 | if (duration > duration_cap) { |
173 | 1092 | duration = duration_cap; | 1092 | duration = duration_cap; |
175 | 1093 | }; | 1093 | } |
176 | 1094 | const uint32_t past_duration = entire_duration - duration; | 1094 | const uint32_t past_duration = entire_duration - duration; |
177 | 1095 | crude_percent_ = | 1095 | crude_percent_ = |
178 | 1096 | (crude_percent_ * past_duration + produced * duration * 10000) / entire_duration; | 1096 | (crude_percent_ * past_duration + produced * duration * 10000) / entire_duration; |
179 | 1097 | 1097 | ||
180 | === modified file 'src/network/CMakeLists.txt' | |||
181 | --- src/network/CMakeLists.txt 2019-08-27 19:00:30 +0000 | |||
182 | +++ src/network/CMakeLists.txt 2019-09-06 14:10:07 +0000 | |||
183 | @@ -61,5 +61,6 @@ | |||
184 | 61 | ui_basic | 61 | ui_basic |
185 | 62 | ui_fsmenu_gameloading | 62 | ui_fsmenu_gameloading |
186 | 63 | widelands_ball_of_mud | 63 | widelands_ball_of_mud |
187 | 64 | widelands_options | ||
188 | 64 | wui | 65 | wui |
189 | 65 | ) | 66 | ) |
190 | 66 | 67 | ||
191 | === modified file 'src/notifications/test/notifications_test.cc' | |||
192 | --- src/notifications/test/notifications_test.cc 2019-02-23 11:00:49 +0000 | |||
193 | +++ src/notifications/test/notifications_test.cc 2019-09-06 14:10:07 +0000 | |||
194 | @@ -29,6 +29,7 @@ | |||
195 | 29 | 29 | ||
196 | 30 | // Triggered by BOOST_AUTO_TEST_CASE | 30 | // Triggered by BOOST_AUTO_TEST_CASE |
197 | 31 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") | 31 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") |
198 | 32 | CLANG_DIAG_OFF("-Wused-but-marked-unused") | ||
199 | 32 | 33 | ||
200 | 33 | struct SimpleNote { | 34 | struct SimpleNote { |
201 | 34 | CAN_BE_SENT_AS_NOTE(100) | 35 | CAN_BE_SENT_AS_NOTE(100) |
202 | 35 | 36 | ||
203 | === modified file 'src/scripting/CMakeLists.txt' | |||
204 | --- src/scripting/CMakeLists.txt 2019-08-27 19:00:30 +0000 | |||
205 | +++ src/scripting/CMakeLists.txt 2019-09-06 14:10:07 +0000 | |||
206 | @@ -129,7 +129,7 @@ | |||
207 | 129 | scripting_luna | 129 | scripting_luna |
208 | 130 | third_party_eris | 130 | third_party_eris |
209 | 131 | ui_basic | 131 | ui_basic |
211 | 132 | widelands_ball_of_mud | 132 | widelands_options |
212 | 133 | wui | 133 | wui |
213 | 134 | wui_mapview_pixelfunctions | 134 | wui_mapview_pixelfunctions |
214 | 135 | ) | 135 | ) |
215 | 136 | 136 | ||
216 | === modified file 'src/scripting/test/test_luna.cc' | |||
217 | --- src/scripting/test/test_luna.cc 2019-02-23 11:00:49 +0000 | |||
218 | +++ src/scripting/test/test_luna.cc 2019-09-06 14:10:07 +0000 | |||
219 | @@ -30,6 +30,7 @@ | |||
220 | 30 | 30 | ||
221 | 31 | // Triggered by BOOST_AUTO_TEST_CASE | 31 | // Triggered by BOOST_AUTO_TEST_CASE |
222 | 32 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") | 32 | CLANG_DIAG_OFF("-Wdisabled-macro-expansion") |
223 | 33 | CLANG_DIAG_OFF("-Wused-but-marked-unused") | ||
224 | 33 | 34 | ||
225 | 34 | #ifndef BEGIN_LUNA_PROPERTIES | 35 | #ifndef BEGIN_LUNA_PROPERTIES |
226 | 35 | #define BEGIN_LUNA_PROPERTIES(klass) const PropertyType<klass> klass::Properties[] = { | 36 | #define BEGIN_LUNA_PROPERTIES(klass) const PropertyType<klass> klass::Properties[] = { |
227 | 36 | 37 | ||
228 | === modified file 'src/sound/CMakeLists.txt' | |||
229 | --- src/sound/CMakeLists.txt 2019-08-27 19:00:30 +0000 | |||
230 | +++ src/sound/CMakeLists.txt 2019-09-06 14:10:07 +0000 | |||
231 | @@ -34,5 +34,5 @@ | |||
232 | 34 | logic_exceptions | 34 | logic_exceptions |
233 | 35 | random | 35 | random |
234 | 36 | sound_constants | 36 | sound_constants |
236 | 37 | widelands_ball_of_mud | 37 | widelands_options |
237 | 38 | ) | 38 | ) |
238 | 39 | 39 | ||
239 | === modified file 'src/ui_basic/CMakeLists.txt' | |||
240 | --- src/ui_basic/CMakeLists.txt 2019-08-27 19:00:30 +0000 | |||
241 | +++ src/ui_basic/CMakeLists.txt 2019-09-06 14:10:07 +0000 | |||
242 | @@ -76,4 +76,5 @@ | |||
243 | 76 | sound | 76 | sound |
244 | 77 | sound_constants | 77 | sound_constants |
245 | 78 | widelands_ball_of_mud | 78 | widelands_ball_of_mud |
246 | 79 | widelands_options | ||
247 | 79 | ) | 80 | ) |
248 | 80 | 81 | ||
249 | === modified file 'src/ui_fsmenu/CMakeLists.txt' | |||
250 | --- src/ui_fsmenu/CMakeLists.txt 2019-08-27 19:00:30 +0000 | |||
251 | +++ src/ui_fsmenu/CMakeLists.txt 2019-09-06 14:10:07 +0000 | |||
252 | @@ -19,6 +19,7 @@ | |||
253 | 19 | ui_fsmenu_base | 19 | ui_fsmenu_base |
254 | 20 | sound | 20 | sound |
255 | 21 | widelands_ball_of_mud | 21 | widelands_ball_of_mud |
256 | 22 | widelands_options | ||
257 | 22 | wui_sound_options | 23 | wui_sound_options |
258 | 23 | ) | 24 | ) |
259 | 24 | 25 | ||
260 | @@ -81,7 +82,7 @@ | |||
261 | 81 | ui_basic | 82 | ui_basic |
262 | 82 | ui_fsmenu_base | 83 | ui_fsmenu_base |
263 | 83 | ui_fsmenu_main_menu | 84 | ui_fsmenu_main_menu |
265 | 84 | widelands_ball_of_mud | 85 | widelands_options |
266 | 85 | wui_common_mapdetails | 86 | wui_common_mapdetails |
267 | 86 | wui | 87 | wui |
268 | 87 | ) | 88 | ) |
269 | @@ -118,7 +119,7 @@ | |||
270 | 118 | ui_fsmenu_helpwindow | 119 | ui_fsmenu_helpwindow |
271 | 119 | ui_fsmenu_loading_common | 120 | ui_fsmenu_loading_common |
272 | 120 | ui_fsmenu_maploading | 121 | ui_fsmenu_maploading |
274 | 121 | widelands_ball_of_mud | 122 | widelands_options |
275 | 122 | wui | 123 | wui |
276 | 123 | wui_chat_ui | 124 | wui_chat_ui |
277 | 124 | wui_common_gamedetails | 125 | wui_common_gamedetails |
278 | @@ -177,7 +178,7 @@ | |||
279 | 177 | sound | 178 | sound |
280 | 178 | ui_basic | 179 | ui_basic |
281 | 179 | ui_fsmenu_base | 180 | ui_fsmenu_base |
283 | 180 | widelands_ball_of_mud | 181 | widelands_options |
284 | 181 | wui_chat_ui | 182 | wui_chat_ui |
285 | 182 | ) | 183 | ) |
286 | 183 | 184 | ||
287 | 184 | 185 | ||
288 | === modified file 'src/ui_fsmenu/options.cc' | |||
289 | --- src/ui_fsmenu/options.cc 2019-08-25 14:50:16 +0000 | |||
290 | +++ src/ui_fsmenu/options.cc 2019-09-06 14:10:07 +0000 | |||
291 | @@ -680,5 +680,5 @@ | |||
292 | 680 | g_sh->save_config(); | 680 | g_sh->save_config(); |
293 | 681 | 681 | ||
294 | 682 | // Now write to file | 682 | // Now write to file |
296 | 683 | write_config(WLApplication::get()); | 683 | write_config(); |
297 | 684 | } | 684 | } |
298 | 685 | 685 | ||
299 | === modified file 'src/wlapplication.cc' | |||
300 | --- src/wlapplication.cc 2019-09-05 20:04:47 +0000 | |||
301 | +++ src/wlapplication.cc 2019-09-06 14:10:07 +0000 | |||
302 | @@ -228,6 +228,9 @@ | |||
303 | 228 | 228 | ||
304 | 229 | // Set up the homedir. Exit 1 if the homedir is illegal or the logger couldn't be initialized for | 229 | // Set up the homedir. Exit 1 if the homedir is illegal or the logger couldn't be initialized for |
305 | 230 | // Windows. | 230 | // Windows. |
306 | 231 | // Also sets the config directory. This defaults to $XDG_CONFIG_HOME/widelands/config on Unix. | ||
307 | 232 | // Defaults to homedir/config everywhere else, if homedir is set manually or if | ||
308 | 233 | // built without XDG-support. | ||
309 | 231 | void WLApplication::setup_homedir() { | 234 | void WLApplication::setup_homedir() { |
310 | 232 | // Check if we have a command line override | 235 | // Check if we have a command line override |
311 | 233 | if (commandline_.count("homedir")) { | 236 | if (commandline_.count("homedir")) { |
312 | @@ -274,6 +277,12 @@ | |||
313 | 274 | // Homedir is ready, so we can log normally from now on | 277 | // Homedir is ready, so we can log normally from now on |
314 | 275 | log("Set home directory: %s\n", homedir_.c_str()); | 278 | log("Set home directory: %s\n", homedir_.c_str()); |
315 | 276 | } | 279 | } |
316 | 280 | |||
317 | 281 | #ifdef USE_XDG | ||
318 | 282 | set_config_directory(userconfigdir_); | ||
319 | 283 | #else | ||
320 | 284 | set_config_directory(homedir_); | ||
321 | 285 | #endif | ||
322 | 277 | } | 286 | } |
323 | 278 | 287 | ||
324 | 279 | WLApplication* WLApplication::the_singleton = nullptr; | 288 | WLApplication* WLApplication::the_singleton = nullptr; |
325 | @@ -766,7 +775,7 @@ | |||
326 | 766 | bool WLApplication::init_settings() { | 775 | bool WLApplication::init_settings() { |
327 | 767 | 776 | ||
328 | 768 | // Read in the configuration file | 777 | // Read in the configuration file |
330 | 769 | read_config(this); | 778 | read_config(); |
331 | 770 | 779 | ||
332 | 771 | // Then parse the commandline - overwrites conffile settings | 780 | // Then parse the commandline - overwrites conffile settings |
333 | 772 | handle_commandline_parameters(); | 781 | handle_commandline_parameters(); |
334 | @@ -846,7 +855,7 @@ | |||
335 | 846 | 855 | ||
336 | 847 | // Save configuration now. Otherwise, the UUID is not saved | 856 | // Save configuration now. Otherwise, the UUID is not saved |
337 | 848 | // when the game crashes, losing part of its advantage | 857 | // when the game crashes, losing part of its advantage |
339 | 849 | write_config(this); | 858 | write_config(); |
340 | 850 | 859 | ||
341 | 851 | return true; | 860 | return true; |
342 | 852 | } | 861 | } |
343 | @@ -872,8 +881,7 @@ | |||
344 | 872 | void WLApplication::shutdown_settings() { | 881 | void WLApplication::shutdown_settings() { |
345 | 873 | // To be proper, release our textdomain | 882 | // To be proper, release our textdomain |
346 | 874 | i18n::release_textdomain(); | 883 | i18n::release_textdomain(); |
349 | 875 | 884 | write_config(); | |
348 | 876 | write_config(this); | ||
350 | 877 | } | 885 | } |
351 | 878 | 886 | ||
352 | 879 | void WLApplication::shutdown_hardware() { | 887 | void WLApplication::shutdown_hardware() { |
353 | 880 | 888 | ||
354 | === modified file 'src/wlapplication.h' | |||
355 | --- src/wlapplication.h 2019-07-20 14:32:57 +0000 | |||
356 | +++ src/wlapplication.h 2019-09-06 14:10:07 +0000 | |||
357 | @@ -196,13 +196,6 @@ | |||
358 | 196 | void replay(); | 196 | void replay(); |
359 | 197 | static void emergency_save(Widelands::Game&); | 197 | static void emergency_save(Widelands::Game&); |
360 | 198 | 198 | ||
361 | 199 | #ifdef USE_XDG | ||
362 | 200 | // this is only for src/wlapplication_options.cc | ||
363 | 201 | std::string get_userconfigdir() { | ||
364 | 202 | return userconfigdir_; | ||
365 | 203 | } | ||
366 | 204 | #endif | ||
367 | 205 | |||
368 | 206 | private: | 199 | private: |
369 | 207 | WLApplication(int argc, char const* const* argv); | 200 | WLApplication(int argc, char const* const* argv); |
370 | 208 | 201 | ||
371 | 209 | 202 | ||
372 | === modified file 'src/wlapplication_options.cc' | |||
373 | --- src/wlapplication_options.cc 2019-08-31 03:22:10 +0000 | |||
374 | +++ src/wlapplication_options.cc 2019-09-06 14:10:07 +0000 | |||
375 | @@ -19,14 +19,17 @@ | |||
376 | 19 | 19 | ||
377 | 20 | #include "wlapplication_options.h" | 20 | #include "wlapplication_options.h" |
378 | 21 | 21 | ||
379 | 22 | #include <cassert> | ||
380 | 23 | #include <memory> | ||
381 | 24 | |||
382 | 22 | #include "base/log.h" | 25 | #include "base/log.h" |
383 | 23 | #include "io/filesystem/disk_filesystem.h" | 26 | #include "io/filesystem/disk_filesystem.h" |
384 | 24 | #include "io/profile.h" | ||
385 | 25 | #include "logic/filesystem_constants.h" | 27 | #include "logic/filesystem_constants.h" |
386 | 26 | #include "wlapplication.h" | ||
387 | 27 | 28 | ||
388 | 28 | static Profile g_options(Profile::err_log); | 29 | static Profile g_options(Profile::err_log); |
389 | 29 | 30 | ||
390 | 31 | static std::unique_ptr<FileSystem> config_dir = nullptr; | ||
391 | 32 | |||
392 | 30 | void check_config_used() { | 33 | void check_config_used() { |
393 | 31 | g_options.check_used(); | 34 | g_options.check_used(); |
394 | 32 | } | 35 | } |
395 | @@ -110,26 +113,22 @@ | |||
396 | 110 | g_options.pull_section(section.c_str()).set_string(name.c_str(), value.c_str()); | 113 | g_options.pull_section(section.c_str()).set_string(name.c_str(), value.c_str()); |
397 | 111 | } | 114 | } |
398 | 112 | 115 | ||
412 | 113 | void read_config(WLApplication* wlapplication) { | 116 | |
413 | 114 | #ifdef USE_XDG | 117 | void set_config_directory(const std::string& userconfigdir) { |
414 | 115 | RealFSImpl dir(wlapplication->get_userconfigdir()); | 118 | config_dir.reset(new RealFSImpl(userconfigdir)); |
415 | 116 | dir.ensure_directory_exists("."); | 119 | config_dir->ensure_directory_exists("."); |
416 | 117 | log("Set configuration file: %s/%s\n", wlapplication->get_userconfigdir().c_str(), | 120 | log("Set configuration file: %s/%s\n", userconfigdir.c_str(), kConfigFile.c_str()); |
417 | 118 | kConfigFile.c_str()); | 121 | } |
418 | 119 | g_options.read(kConfigFile.c_str(), "global", dir); | 122 | |
419 | 120 | #else | 123 | void read_config() { |
420 | 121 | g_options.read(kConfigFile.c_str(), "global"); | 124 | assert(config_dir != nullptr); |
421 | 122 | #endif | 125 | g_options.read(kConfigFile.c_str(), "global", *config_dir); |
422 | 123 | } | 126 | } |
423 | 124 | 127 | ||
424 | 125 | void write_config(WLApplication* wlapplication) { | 128 | void write_config() { |
425 | 129 | assert(config_dir != nullptr); | ||
426 | 126 | try { // overwrite the old config file | 130 | try { // overwrite the old config file |
433 | 127 | #ifdef USE_XDG | 131 | g_options.write(kConfigFile.c_str(), true, *config_dir); |
428 | 128 | RealFSImpl dir(wlapplication->get_userconfigdir()); | ||
429 | 129 | g_options.write(kConfigFile.c_str(), true, dir); | ||
430 | 130 | #else | ||
431 | 131 | g_options.write(kConfigFile.c_str(), true); | ||
432 | 132 | #endif | ||
434 | 133 | } catch (const std::exception& e) { | 132 | } catch (const std::exception& e) { |
435 | 134 | log("WARNING: could not save configuration: %s\n", e.what()); | 133 | log("WARNING: could not save configuration: %s\n", e.what()); |
436 | 135 | } catch (...) { | 134 | } catch (...) { |
437 | 136 | 135 | ||
438 | === modified file 'src/wlapplication_options.h' | |||
439 | --- src/wlapplication_options.h 2019-08-28 18:34:58 +0000 | |||
440 | +++ src/wlapplication_options.h 2019-09-06 14:10:07 +0000 | |||
441 | @@ -21,7 +21,6 @@ | |||
442 | 21 | #define WL_WLAPPLICATION_OPTIONS_H | 21 | #define WL_WLAPPLICATION_OPTIONS_H |
443 | 22 | 22 | ||
444 | 23 | #include "io/profile.h" | 23 | #include "io/profile.h" |
445 | 24 | #include "wlapplication.h" | ||
446 | 25 | 24 | ||
447 | 26 | /* | 25 | /* |
448 | 27 | * Further explanations for all functions and its return values | 26 | * Further explanations for all functions and its return values |
449 | @@ -77,31 +76,20 @@ | |||
450 | 77 | const std::string& value); | 76 | const std::string& value); |
451 | 78 | 77 | ||
452 | 79 | /* | 78 | /* |
453 | 79 | * Sets the directory where to read/write kConfigFile. | ||
454 | 80 | */ | ||
455 | 81 | void set_config_directory(const std::string& userconfigdir); | ||
456 | 82 | |||
457 | 83 | /* | ||
458 | 80 | * Reads the configuration from kConfigFile. | 84 | * Reads the configuration from kConfigFile. |
468 | 81 | * Defaults to $XDG_CONFIG_HOME/widelands/config on Unix. | 85 | * Assumes that set_config_directory has been called. |
460 | 82 | * Defaults to homedir/config everywhere else, if homedir is set manually or if | ||
461 | 83 | * built without XDG-support. | ||
462 | 84 | * | ||
463 | 85 | * This function needs access to the WLApplication object to distinguish | ||
464 | 86 | * between multiple possible states. | ||
465 | 87 | * While we could use WLApplication::get() this would get us in an infinite loop | ||
466 | 88 | * because this function will be called in the constructor of said object and | ||
467 | 89 | * WLApplication::get() spawns another object if there isn't one yet. | ||
469 | 90 | */ | 86 | */ |
471 | 91 | void read_config(WLApplication*); | 87 | void read_config(); |
472 | 92 | 88 | ||
473 | 93 | /* | 89 | /* |
474 | 94 | * Writes the configuration to kConfigFile. | 90 | * Writes the configuration to kConfigFile. |
484 | 95 | * Defaults to $XDG_CONFIG_HOME/widelands/config on Unix. | 91 | * * Assumes that set_config_directory has been called. |
476 | 96 | * Defaults to homedir/config everywhere else, if homedir is set manually or if | ||
477 | 97 | * built without XDG-support. | ||
478 | 98 | * | ||
479 | 99 | * This function needs access to the WLApplication object to distinguish | ||
480 | 100 | * between multiple possible states. | ||
481 | 101 | * While we could use WLApplication::get() this would get us in an infinite loop | ||
482 | 102 | * because this function will be called in the constructor of said object and | ||
483 | 103 | * WLApplication::get() spawns another object if there isn't one yet. | ||
485 | 104 | */ | 92 | */ |
487 | 105 | void write_config(WLApplication*); | 93 | void write_config(); |
488 | 106 | 94 | ||
489 | 107 | #endif // end of include guard: WL_WLAPPLICATION_OPTIONS_H | 95 | #endif // end of include guard: WL_WLAPPLICATION_OPTIONS_H |
490 | 108 | 96 | ||
491 | === modified file 'src/wui/CMakeLists.txt' | |||
492 | --- src/wui/CMakeLists.txt 2019-08-27 19:00:30 +0000 | |||
493 | +++ src/wui/CMakeLists.txt 2019-09-06 14:10:07 +0000 | |||
494 | @@ -33,7 +33,7 @@ | |||
495 | 33 | logic | 33 | logic |
496 | 34 | sound | 34 | sound |
497 | 35 | ui_basic | 35 | ui_basic |
499 | 36 | widelands_ball_of_mud | 36 | widelands_options |
500 | 37 | wui | 37 | wui |
501 | 38 | ) | 38 | ) |
502 | 39 | 39 | ||
503 | @@ -154,6 +154,7 @@ | |||
504 | 154 | logic_widelands_geometry | 154 | logic_widelands_geometry |
505 | 155 | ui_basic | 155 | ui_basic |
506 | 156 | widelands_ball_of_mud | 156 | widelands_ball_of_mud |
507 | 157 | widelands_options | ||
508 | 157 | wui_mapview_pixelfunctions | 158 | wui_mapview_pixelfunctions |
509 | 158 | ) | 159 | ) |
510 | 159 | 160 | ||
511 | @@ -314,7 +315,7 @@ | |||
512 | 314 | scripting_lua_table | 315 | scripting_lua_table |
513 | 315 | sound | 316 | sound |
514 | 316 | ui_basic | 317 | ui_basic |
516 | 317 | widelands_ball_of_mud | 318 | widelands_options |
517 | 318 | wui_chat_ui | 319 | wui_chat_ui |
518 | 319 | wui_common_gamedetails | 320 | wui_common_gamedetails |
519 | 320 | wui_economy_options | 321 | wui_economy_options |
I'm done checking the logs, so this is ready for review now.