Merge lp:~klaus-halfmann/widelands/bug-1395278-wui into lp:widelands
- bug-1395278-wui
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 7740 | ||||
Proposed branch: | lp:~klaus-halfmann/widelands/bug-1395278-wui | ||||
Merge into: | lp:widelands | ||||
Diff against target: |
7530 lines (+1659/-1659) 68 files modified
src/ai/computer_player.cc (+2/-2) src/ai/computer_player.h (+4/-4) src/logic/map_objects/tribes/tribe_descr.h (+1/-1) src/logic/player.h (+2/-2) src/wlapplication.cc (+134/-134) src/wlapplication.h (+19/-19) src/wui/buildingwindow.cc (+75/-75) src/wui/buildingwindow.h (+16/-16) src/wui/debugconsole.cc (+3/-3) src/wui/debugconsole.h (+2/-2) src/wui/edge_overlay_manager.cc (+15/-15) src/wui/edge_overlay_manager.h (+2/-2) src/wui/field_overlay_manager.cc (+20/-20) src/wui/field_overlay_manager.h (+7/-7) src/wui/game_chat_menu.cc (+11/-11) src/wui/game_chat_menu.h (+3/-3) src/wui/game_main_menu.cc (+23/-23) src/wui/game_main_menu.h (+3/-3) src/wui/game_main_menu_save_game.cc (+47/-47) src/wui/game_main_menu_save_game.h (+10/-10) src/wui/game_message_menu.cc (+63/-63) src/wui/game_message_menu.h (+10/-10) src/wui/game_summary.cc (+61/-61) src/wui/game_summary.h (+10/-10) src/wui/game_tips.cc (+23/-23) src/wui/game_tips.h (+7/-7) src/wui/gamechatpanel.cc (+4/-4) src/wui/gamechatpanel.h (+2/-2) src/wui/general_statistics_menu.cc (+92/-92) src/wui/general_statistics_menu.h (+8/-8) src/wui/interactive_gamebase.cc (+18/-18) src/wui/interactive_gamebase.h (+17/-17) src/wui/interactive_player.cc (+89/-89) src/wui/interactive_player.h (+22/-22) src/wui/interactive_spectator.cc (+62/-62) src/wui/interactive_spectator.h (+11/-11) src/wui/itemwaresdisplay.cc (+17/-17) src/wui/itemwaresdisplay.h (+8/-8) src/wui/mapdata.h (+7/-7) src/wui/mapview.cc (+19/-19) src/wui/mapview.h (+10/-10) src/wui/minimap.cc (+43/-43) src/wui/minimap.h (+7/-7) src/wui/multiplayersetupgroup.cc (+40/-40) src/wui/multiplayersetupgroup.h (+5/-5) src/wui/playerdescrgroup.cc (+3/-3) src/wui/playerdescrgroup.h (+2/-2) src/wui/plot_area.cc (+77/-77) src/wui/plot_area.h (+18/-18) src/wui/productionsitewindow.cc (+21/-21) src/wui/productionsitewindow.h (+3/-3) src/wui/quicknavigation.cc (+42/-42) src/wui/quicknavigation.h (+12/-12) src/wui/soldierlist.cc (+1/-1) src/wui/stock_menu.cc (+15/-15) src/wui/stock_menu.h (+6/-6) src/wui/story_message_box.h (+1/-1) src/wui/suggested_teams_box.cc (+37/-37) src/wui/suggested_teams_box.h (+9/-9) src/wui/transport_draw.cc (+1/-1) src/wui/transport_ui.cc (+57/-57) src/wui/ware_statistics_menu.cc (+51/-51) src/wui/ware_statistics_menu.h (+7/-7) src/wui/warehousewindow.cc (+26/-26) src/wui/waresdisplay.cc (+90/-90) src/wui/waresdisplay.h (+16/-16) src/wui/waresqueuedisplay.cc (+92/-92) src/wui/waresqueuedisplay.h (+18/-18) |
||||
To merge this branch: | bzr merge lp:~klaus-halfmann/widelands/bug-1395278-wui | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
SirVer | Approve | ||
Review via email: mp+283747@code.launchpad.net |
Commit message
Description of the change
Migration from m_... to ..._ mostly in wui
bunnybot (widelandsofficial) wrote : | # |
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 381. State: failed. Details: https:/
Appveyor build 288. State: failed. Details: https:/
SirVer (sirver) wrote : | # |
Travis fails, because you have to fix one CMakeTarget: /home/travis/
you can get these warnings locally by running 'make codecheck'
otherwise lgtm.
GunChleoc (gunchleoc) wrote : | # |
Another way to run codecheck that works better for me is:
cmake/codecheck
More on CodeCheck and regression tests: https:/
SirVer (sirver) wrote : | # |
What gun posted will only check .cc and .h files though, not the cmake files.
> Am 25.01.2016 um 08:15 schrieb GunChleoc <email address hidden>:
>
> Another way to run codecheck that works better for me is:
>
> cmake/codecheck
>
> More on CodeCheck and regression tests: https:/
> --
> https:/
> You are reviewing the proposed merge of lp:~klaus-halfmann/widelands/bug-1395278-wui into lp:widelands.
SirVer (sirver) wrote : | # |
This bug was actually already in trunk. I fixed it in 7739.
Since release compiled, I think this is save to go in.
@bunnybot merge.
Fingers crossed :)
GunChleoc (gunchleoc) wrote : | # |
The reason I never tun "make codecheck is that I get a screenful of
[ 15%] Built target see_if_
And it's pretty impossible to find the actual codecheck messages among them.
SirVer (sirver) wrote : | # |
ninja is not printing that. You can throttle ninja by using ninja -j1
Preview Diff
1 | === modified file 'src/ai/computer_player.cc' | |||
2 | --- src/ai/computer_player.cc 2015-12-06 12:37:51 +0000 | |||
3 | +++ src/ai/computer_player.cc 2016-01-24 20:25:45 +0000 | |||
4 | @@ -1,5 +1,5 @@ | |||
5 | 1 | /* | 1 | /* |
7 | 2 | * Copyright (C) 2004, 2006-2009 by the Widelands Development Team | 2 | * Copyright (C) 2004-2016 by the Widelands Development Team |
8 | 3 | * | 3 | * |
9 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
10 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
11 | @@ -23,7 +23,7 @@ | |||
12 | 23 | 23 | ||
13 | 24 | ComputerPlayer::ComputerPlayer | 24 | ComputerPlayer::ComputerPlayer |
14 | 25 | (Widelands::Game & g, Widelands::PlayerNumber const pid) | 25 | (Widelands::Game & g, Widelands::PlayerNumber const pid) |
16 | 26 | : m_game(g), m_player_number(pid) | 26 | : game_(g), player_number_(pid) |
17 | 27 | { | 27 | { |
18 | 28 | } | 28 | } |
19 | 29 | 29 | ||
20 | 30 | 30 | ||
21 | === modified file 'src/ai/computer_player.h' | |||
22 | --- src/ai/computer_player.h 2015-12-06 11:15:52 +0000 | |||
23 | +++ src/ai/computer_player.h 2016-01-24 20:25:45 +0000 | |||
24 | @@ -42,8 +42,8 @@ | |||
25 | 42 | 42 | ||
26 | 43 | virtual void think () = 0; | 43 | virtual void think () = 0; |
27 | 44 | 44 | ||
30 | 45 | Widelands::Game & game() const {return m_game;} | 45 | Widelands::Game & game() const {return game_;} |
31 | 46 | Widelands::PlayerNumber player_number() {return m_player_number;} | 46 | Widelands::PlayerNumber player_number() {return player_number_;} |
32 | 47 | 47 | ||
33 | 48 | /** | 48 | /** |
34 | 49 | * Interface to a concrete implementation, used to instantiate AIs. | 49 | * Interface to a concrete implementation, used to instantiate AIs. |
35 | @@ -71,8 +71,8 @@ | |||
36 | 71 | static const Implementation * get_implementation(const std::string & name); | 71 | static const Implementation * get_implementation(const std::string & name); |
37 | 72 | 72 | ||
38 | 73 | private: | 73 | private: |
41 | 74 | Widelands::Game & m_game; | 74 | Widelands::Game & game_; |
42 | 75 | Widelands::PlayerNumber const m_player_number; | 75 | Widelands::PlayerNumber const player_number_; |
43 | 76 | 76 | ||
44 | 77 | DISALLOW_COPY_AND_ASSIGN(ComputerPlayer); | 77 | DISALLOW_COPY_AND_ASSIGN(ComputerPlayer); |
45 | 78 | }; | 78 | }; |
46 | 79 | 79 | ||
47 | === modified file 'src/logic/map_objects/tribes/tribe_descr.h' | |||
48 | --- src/logic/map_objects/tribes/tribe_descr.h 2016-01-23 19:36:55 +0000 | |||
49 | +++ src/logic/map_objects/tribes/tribe_descr.h 2016-01-24 20:25:45 +0000 | |||
50 | @@ -143,7 +143,7 @@ | |||
51 | 143 | 143 | ||
52 | 144 | void resize_ware_orders(size_t maxLength); | 144 | void resize_ware_orders(size_t maxLength); |
53 | 145 | 145 | ||
55 | 146 | const std::vector<std::string>& get_ship_names() const {return ship_names_;}; | 146 | const std::vector<std::string>& get_ship_names() const {return ship_names_;} |
56 | 147 | 147 | ||
57 | 148 | private: | 148 | private: |
58 | 149 | // Helper function for adding a special worker type (carriers etc.) | 149 | // Helper function for adding a special worker type (carriers etc.) |
59 | 150 | 150 | ||
60 | === modified file 'src/logic/player.h' | |||
61 | --- src/logic/player.h 2016-01-22 19:53:32 +0000 | |||
62 | +++ src/logic/player.h 2016-01-24 20:25:45 +0000 | |||
63 | @@ -138,7 +138,7 @@ | |||
64 | 138 | 138 | ||
65 | 139 | /// Data that are used and managed by AI. They are here to have it saved as a port of player's data | 139 | /// Data that are used and managed by AI. They are here to have it saved as a port of player's data |
66 | 140 | struct AiPersistentState { | 140 | struct AiPersistentState { |
68 | 141 | AiPersistentState() : initialized(0){}; | 141 | AiPersistentState() : initialized(0){} |
69 | 142 | 142 | ||
70 | 143 | //was initialized | 143 | //was initialized |
71 | 144 | uint8_t initialized; | 144 | uint8_t initialized; |
72 | @@ -159,7 +159,7 @@ | |||
73 | 159 | 159 | ||
74 | 160 | AiPersistentState* get_mutable_ai_persistent_state(){ | 160 | AiPersistentState* get_mutable_ai_persistent_state(){ |
75 | 161 | return &ai_data; | 161 | return &ai_data; |
77 | 162 | }; | 162 | } |
78 | 163 | 163 | ||
79 | 164 | /// Per-player field information. | 164 | /// Per-player field information. |
80 | 165 | struct Field { | 165 | struct Field { |
81 | 166 | 166 | ||
82 | === modified file 'src/wlapplication.cc' | |||
83 | --- src/wlapplication.cc 2016-01-17 09:55:27 +0000 | |||
84 | +++ src/wlapplication.cc 2016-01-24 20:25:45 +0000 | |||
85 | @@ -1,5 +1,5 @@ | |||
86 | 1 | /* | 1 | /* |
88 | 2 | * Copyright (C) 2006-2015 by the Widelands Development Team | 2 | * Copyright (C) 2006-2016 by the Widelands Development Team |
89 | 3 | * | 3 | * |
90 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
91 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
92 | @@ -179,12 +179,12 @@ | |||
93 | 179 | 179 | ||
94 | 180 | void WLApplication::setup_homedir() { | 180 | void WLApplication::setup_homedir() { |
95 | 181 | //If we don't have a home directory don't do anything | 181 | //If we don't have a home directory don't do anything |
97 | 182 | if (m_homedir.size()) { | 182 | if (homedir_.size()) { |
98 | 183 | //assume some dir exists | 183 | //assume some dir exists |
99 | 184 | try { | 184 | try { |
101 | 185 | log ("Set home directory: %s\n", m_homedir.c_str()); | 185 | log ("Set home directory: %s\n", homedir_.c_str()); |
102 | 186 | 186 | ||
104 | 187 | std::unique_ptr<FileSystem> home(new RealFSImpl(m_homedir)); | 187 | std::unique_ptr<FileSystem> home(new RealFSImpl(homedir_)); |
105 | 188 | home->ensure_directory_exists("."); | 188 | home->ensure_directory_exists("."); |
106 | 189 | g_fs->set_home_file_system(home.release()); | 189 | g_fs->set_home_file_system(home.release()); |
107 | 190 | } catch (const std::exception & e) { | 190 | } catch (const std::exception & e) { |
108 | @@ -232,40 +232,40 @@ | |||
109 | 232 | * \param argv Array of command line arguments | 232 | * \param argv Array of command line arguments |
110 | 233 | */ | 233 | */ |
111 | 234 | WLApplication::WLApplication(int const argc, char const * const * const argv) : | 234 | WLApplication::WLApplication(int const argc, char const * const * const argv) : |
120 | 235 | m_commandline (std::map<std::string, std::string>()), | 235 | commandline_ (std::map<std::string, std::string>()), |
121 | 236 | m_game_type (NONE), | 236 | game_type_ (NONE), |
122 | 237 | m_mouse_swapped (false), | 237 | mouse_swapped_ (false), |
123 | 238 | m_faking_middle_mouse_button(false), | 238 | faking_middle_mouse_button_(false), |
124 | 239 | m_mouse_position (0, 0), | 239 | mouse_position_ (0, 0), |
125 | 240 | m_mouse_locked (0), | 240 | mouse_locked_ (0), |
126 | 241 | m_mouse_compensate_warp(0, 0), | 241 | mouse_compensate_warp_(0, 0), |
127 | 242 | m_should_die (false), | 242 | should_die_ (false), |
128 | 243 | #ifdef _WIN32 | 243 | #ifdef _WIN32 |
130 | 244 | m_homedir(FileSystem::get_homedir() + "\\.widelands"), | 244 | homedir_(FileSystem::get_homedir() + "\\.widelands"), |
131 | 245 | #else | 245 | #else |
133 | 246 | m_homedir(FileSystem::get_homedir() + "/.widelands"), | 246 | homedir_(FileSystem::get_homedir() + "/.widelands"), |
134 | 247 | #endif | 247 | #endif |
136 | 248 | m_redirected_stdio(false) | 248 | redirected_stdio_(false) |
137 | 249 | { | 249 | { |
138 | 250 | g_fs = new LayeredFileSystem(); | 250 | g_fs = new LayeredFileSystem(); |
139 | 251 | 251 | ||
140 | 252 | parse_commandline(argc, argv); //throws ParameterError, handled by main.cc | 252 | parse_commandline(argc, argv); //throws ParameterError, handled by main.cc |
141 | 253 | 253 | ||
146 | 254 | if (m_commandline.count("homedir")) { | 254 | if (commandline_.count("homedir")) { |
147 | 255 | log ("Adding home directory: %s\n", m_commandline["homedir"].c_str()); | 255 | log ("Adding home directory: %s\n", commandline_["homedir"].c_str()); |
148 | 256 | m_homedir = m_commandline["homedir"]; | 256 | homedir_ = commandline_["homedir"]; |
149 | 257 | m_commandline.erase("homedir"); | 257 | commandline_.erase("homedir"); |
150 | 258 | } | 258 | } |
151 | 259 | #ifdef REDIRECT_OUTPUT | 259 | #ifdef REDIRECT_OUTPUT |
152 | 260 | if (!redirect_output()) | 260 | if (!redirect_output()) |
154 | 261 | redirect_output(m_homedir); | 261 | redirect_output(homedir_); |
155 | 262 | #endif | 262 | #endif |
156 | 263 | 263 | ||
157 | 264 | setup_homedir(); | 264 | setup_homedir(); |
158 | 265 | init_settings(); | 265 | init_settings(); |
159 | 266 | 266 | ||
162 | 267 | log("Adding directory: %s\n", m_datadir.c_str()); | 267 | log("Adding directory: %s\n", datadir_.c_str()); |
163 | 268 | g_fs->add_file_system(&FileSystem::create(m_datadir)); | 268 | g_fs->add_file_system(&FileSystem::create(datadir_)); |
164 | 269 | 269 | ||
165 | 270 | init_language(); // search paths must already be set up | 270 | init_language(); // search paths must already be set up |
166 | 271 | changedir_on_mac(); | 271 | changedir_on_mac(); |
167 | @@ -334,7 +334,7 @@ | |||
168 | 334 | delete g_fs; | 334 | delete g_fs; |
169 | 335 | g_fs = nullptr; | 335 | g_fs = nullptr; |
170 | 336 | 336 | ||
172 | 337 | if (m_redirected_stdio) | 337 | if (redirected_stdio_) |
173 | 338 | { | 338 | { |
174 | 339 | std::cout.flush(); | 339 | std::cout.flush(); |
175 | 340 | fclose(stdout); | 340 | fclose(stdout); |
176 | @@ -356,15 +356,15 @@ | |||
177 | 356 | // This also grabs the mouse cursor if so desired. | 356 | // This also grabs the mouse cursor if so desired. |
178 | 357 | refresh_graphics(); | 357 | refresh_graphics(); |
179 | 358 | 358 | ||
181 | 359 | if (m_game_type == EDITOR) { | 359 | if (game_type_ == EDITOR) { |
182 | 360 | g_sound_handler.start_music("ingame"); | 360 | g_sound_handler.start_music("ingame"); |
185 | 361 | EditorInteractive::run_editor(m_filename, m_script_to_run); | 361 | EditorInteractive::run_editor(filename_, script_to_run_); |
186 | 362 | } else if (m_game_type == REPLAY) { | 362 | } else if (game_type_ == REPLAY) { |
187 | 363 | replay(); | 363 | replay(); |
189 | 364 | } else if (m_game_type == LOADGAME) { | 364 | } else if (game_type_ == LOADGAME) { |
190 | 365 | Widelands::Game game; | 365 | Widelands::Game game; |
191 | 366 | try { | 366 | try { |
193 | 367 | game.run_load_game(m_filename.c_str(), m_script_to_run); | 367 | game.run_load_game(filename_.c_str(), script_to_run_); |
194 | 368 | } catch (const Widelands::GameDataError & e) { | 368 | } catch (const Widelands::GameDataError & e) { |
195 | 369 | log("Game not loaded: Game data error: %s\n", e.what()); | 369 | log("Game not loaded: Game data error: %s\n", e.what()); |
196 | 370 | } catch (const std::exception & e) { | 370 | } catch (const std::exception & e) { |
197 | @@ -372,10 +372,10 @@ | |||
198 | 372 | emergency_save(game); | 372 | emergency_save(game); |
199 | 373 | throw; | 373 | throw; |
200 | 374 | } | 374 | } |
202 | 375 | } else if (m_game_type == SCENARIO) { | 375 | } else if (game_type_ == SCENARIO) { |
203 | 376 | Widelands::Game game; | 376 | Widelands::Game game; |
204 | 377 | try { | 377 | try { |
206 | 378 | game.run_splayer_scenario_direct(m_filename.c_str(), m_script_to_run); | 378 | game.run_splayer_scenario_direct(filename_.c_str(), script_to_run_); |
207 | 379 | } catch (const Widelands::GameDataError & e) { | 379 | } catch (const Widelands::GameDataError & e) { |
208 | 380 | log("Scenario not started: Game data error: %s\n", e.what()); | 380 | log("Scenario not started: Game data error: %s\n", e.what()); |
209 | 381 | } catch (const std::exception & e) { | 381 | } catch (const std::exception & e) { |
210 | @@ -383,7 +383,7 @@ | |||
211 | 383 | emergency_save(game); | 383 | emergency_save(game); |
212 | 384 | throw; | 384 | throw; |
213 | 385 | } | 385 | } |
215 | 386 | } else if (m_game_type == INTERNET) { | 386 | } else if (game_type_ == INTERNET) { |
216 | 387 | Widelands::Game game; | 387 | Widelands::Game game; |
217 | 388 | try { | 388 | try { |
218 | 389 | // disable sound completely | 389 | // disable sound completely |
219 | @@ -421,13 +421,13 @@ | |||
220 | 421 | 421 | ||
221 | 422 | // Load the requested map | 422 | // Load the requested map |
222 | 423 | Widelands::Map map; | 423 | Widelands::Map map; |
225 | 424 | map.set_filename(m_filename); | 424 | map.set_filename(filename_); |
226 | 425 | std::unique_ptr<Widelands::MapLoader> ml = map.get_correct_loader(m_filename); | 425 | std::unique_ptr<Widelands::MapLoader> ml = map.get_correct_loader(filename_); |
227 | 426 | if (!ml) { | 426 | if (!ml) { |
228 | 427 | throw WLWarning | 427 | throw WLWarning |
229 | 428 | ("Unsupported format", | 428 | ("Unsupported format", |
230 | 429 | "Widelands could not load the file \"%s\". The file format seems to be incompatible.", | 429 | "Widelands could not load the file \"%s\". The file format seems to be incompatible.", |
232 | 430 | m_filename.c_str()); | 430 | filename_.c_str()); |
233 | 431 | } | 431 | } |
234 | 432 | ml->preload_map(true); | 432 | ml->preload_map(true); |
235 | 433 | 433 | ||
236 | @@ -479,15 +479,15 @@ | |||
237 | 479 | // settings are invisible to the rest of the code | 479 | // settings are invisible to the rest of the code |
238 | 480 | switch (ev.type) { | 480 | switch (ev.type) { |
239 | 481 | case SDL_MOUSEMOTION: | 481 | case SDL_MOUSEMOTION: |
249 | 482 | ev.motion.xrel += m_mouse_compensate_warp.x; | 482 | ev.motion.xrel += mouse_compensate_warp_.x; |
250 | 483 | ev.motion.yrel += m_mouse_compensate_warp.y; | 483 | ev.motion.yrel += mouse_compensate_warp_.y; |
251 | 484 | m_mouse_compensate_warp = Point(0, 0); | 484 | mouse_compensate_warp_ = Point(0, 0); |
252 | 485 | 485 | ||
253 | 486 | if (m_mouse_locked) { | 486 | if (mouse_locked_) { |
254 | 487 | warp_mouse(m_mouse_position); | 487 | warp_mouse(mouse_position_); |
255 | 488 | 488 | ||
256 | 489 | ev.motion.x = m_mouse_position.x; | 489 | ev.motion.x = mouse_position_.x; |
257 | 490 | ev.motion.y = m_mouse_position.y; | 490 | ev.motion.y = mouse_position_.y; |
258 | 491 | } | 491 | } |
259 | 492 | break; | 492 | break; |
260 | 493 | 493 | ||
261 | @@ -509,7 +509,7 @@ | |||
262 | 509 | case SDLK_F10: | 509 | case SDLK_F10: |
263 | 510 | // exits the game. | 510 | // exits the game. |
264 | 511 | if (ctrl) { | 511 | if (ctrl) { |
266 | 512 | m_should_die = true; | 512 | should_die_ = true; |
267 | 513 | } | 513 | } |
268 | 514 | return true; | 514 | return true; |
269 | 515 | 515 | ||
270 | @@ -579,7 +579,7 @@ | |||
271 | 579 | } | 579 | } |
272 | 580 | break; | 580 | break; |
273 | 581 | case SDL_MOUSEMOTION: | 581 | case SDL_MOUSEMOTION: |
275 | 582 | m_mouse_position = Point(ev.motion.x, ev.motion.y); | 582 | mouse_position_ = Point(ev.motion.x, ev.motion.y); |
276 | 583 | 583 | ||
277 | 584 | if ((ev.motion.xrel || ev.motion.yrel) && cb && cb->mouse_move) | 584 | if ((ev.motion.xrel || ev.motion.yrel) && cb && cb->mouse_move) |
278 | 585 | cb->mouse_move | 585 | cb->mouse_move |
279 | @@ -588,7 +588,7 @@ | |||
280 | 588 | ev.motion.xrel, ev.motion.yrel); | 588 | ev.motion.xrel, ev.motion.yrel); |
281 | 589 | break; | 589 | break; |
282 | 590 | case SDL_QUIT: | 590 | case SDL_QUIT: |
284 | 591 | m_should_die = true; | 591 | should_die_ = true; |
285 | 592 | break; | 592 | break; |
286 | 593 | default:; | 593 | default:; |
287 | 594 | } | 594 | } |
288 | @@ -601,7 +601,7 @@ | |||
289 | 601 | void WLApplication::_handle_mousebutton | 601 | void WLApplication::_handle_mousebutton |
290 | 602 | (SDL_Event & ev, InputCallback const * cb) | 602 | (SDL_Event & ev, InputCallback const * cb) |
291 | 603 | { | 603 | { |
293 | 604 | if (m_mouse_swapped) { | 604 | if (mouse_swapped_) { |
294 | 605 | switch (ev.button.button) { | 605 | switch (ev.button.button) { |
295 | 606 | case SDL_BUTTON_LEFT: | 606 | case SDL_BUTTON_LEFT: |
296 | 607 | ev.button.button = SDL_BUTTON_RIGHT; | 607 | ev.button.button = SDL_BUTTON_RIGHT; |
297 | @@ -625,7 +625,7 @@ | |||
298 | 625 | (get_key_state(SDL_SCANCODE_LALT) || get_key_state(SDL_SCANCODE_RALT))) | 625 | (get_key_state(SDL_SCANCODE_LALT) || get_key_state(SDL_SCANCODE_RALT))) |
299 | 626 | { | 626 | { |
300 | 627 | ev.button.button = SDL_BUTTON_LEFT; | 627 | ev.button.button = SDL_BUTTON_LEFT; |
302 | 628 | m_faking_middle_mouse_button = true; | 628 | faking_middle_mouse_button_ = true; |
303 | 629 | } | 629 | } |
304 | 630 | #endif | 630 | #endif |
305 | 631 | 631 | ||
306 | @@ -633,9 +633,9 @@ | |||
307 | 633 | cb->mouse_press(ev.button.button, ev.button.x, ev.button.y); | 633 | cb->mouse_press(ev.button.button, ev.button.x, ev.button.y); |
308 | 634 | else if (ev.type == SDL_MOUSEBUTTONUP) { | 634 | else if (ev.type == SDL_MOUSEBUTTONUP) { |
309 | 635 | if (cb && cb->mouse_release) { | 635 | if (cb && cb->mouse_release) { |
311 | 636 | if (ev.button.button == SDL_BUTTON_MIDDLE && m_faking_middle_mouse_button) { | 636 | if (ev.button.button == SDL_BUTTON_MIDDLE && faking_middle_mouse_button_) { |
312 | 637 | cb->mouse_release(SDL_BUTTON_LEFT, ev.button.x, ev.button.y); | 637 | cb->mouse_release(SDL_BUTTON_LEFT, ev.button.x, ev.button.y); |
314 | 638 | m_faking_middle_mouse_button = false; | 638 | faking_middle_mouse_button_ = false; |
315 | 639 | } | 639 | } |
316 | 640 | cb->mouse_release(ev.button.button, ev.button.x, ev.button.y); | 640 | cb->mouse_release(ev.button.button, ev.button.x, ev.button.y); |
317 | 641 | } | 641 | } |
318 | @@ -646,18 +646,18 @@ | |||
319 | 646 | /// Instantaneously move the mouse cursor without creating a motion event. | 646 | /// Instantaneously move the mouse cursor without creating a motion event. |
320 | 647 | /// | 647 | /// |
321 | 648 | /// SDL_WarpMouseInWindow() *will* create a mousemotion event, which we do not want. | 648 | /// SDL_WarpMouseInWindow() *will* create a mousemotion event, which we do not want. |
323 | 649 | /// As a workaround, we store the delta in m_mouse_compensate_warp and use that to | 649 | /// As a workaround, we store the delta in mouse_compensate_warp_ and use that to |
324 | 650 | /// eliminate the motion event in poll_event() | 650 | /// eliminate the motion event in poll_event() |
325 | 651 | /// | 651 | /// |
326 | 652 | /// \param position The new mouse position | 652 | /// \param position The new mouse position |
327 | 653 | void WLApplication::warp_mouse(const Point position) | 653 | void WLApplication::warp_mouse(const Point position) |
328 | 654 | { | 654 | { |
330 | 655 | m_mouse_position = position; | 655 | mouse_position_ = position; |
331 | 656 | 656 | ||
332 | 657 | Point cur_position; | 657 | Point cur_position; |
333 | 658 | SDL_GetMouseState(&cur_position.x, &cur_position.y); | 658 | SDL_GetMouseState(&cur_position.x, &cur_position.y); |
334 | 659 | if (cur_position != position) { | 659 | if (cur_position != position) { |
336 | 660 | m_mouse_compensate_warp += cur_position - position; | 660 | mouse_compensate_warp_ += cur_position - position; |
337 | 661 | SDL_Window* sdl_window = g_gr->get_sdlwindow(); | 661 | SDL_Window* sdl_window = g_gr->get_sdlwindow(); |
338 | 662 | if (sdl_window) { | 662 | if (sdl_window) { |
339 | 663 | SDL_WarpMouseInWindow(sdl_window, position.x, position.y); | 663 | SDL_WarpMouseInWindow(sdl_window, position.x, position.y); |
340 | @@ -688,7 +688,7 @@ | |||
341 | 688 | if (sdl_window) { | 688 | if (sdl_window) { |
342 | 689 | SDL_SetWindowGrab(sdl_window, SDL_FALSE); | 689 | SDL_SetWindowGrab(sdl_window, SDL_FALSE); |
343 | 690 | } | 690 | } |
345 | 691 | warp_mouse(m_mouse_position); //TODO(unknown): is this redundant? | 691 | warp_mouse(mouse_position_); //TODO(unknown): is this redundant? |
346 | 692 | } | 692 | } |
347 | 693 | } | 693 | } |
348 | 694 | 694 | ||
349 | @@ -767,7 +767,7 @@ | |||
350 | 767 | // Initialize locale and grab "widelands" textdomain | 767 | // Initialize locale and grab "widelands" textdomain |
351 | 768 | i18n::init_locale(); | 768 | i18n::init_locale(); |
352 | 769 | 769 | ||
354 | 770 | i18n::set_localedir(m_datadir + "/locale"); | 770 | i18n::set_localedir(datadir_ + "/locale"); |
355 | 771 | i18n::grab_textdomain("widelands"); | 771 | i18n::grab_textdomain("widelands"); |
356 | 772 | 772 | ||
357 | 773 | // Set locale corresponding to selected language | 773 | // Set locale corresponding to selected language |
358 | @@ -852,12 +852,12 @@ | |||
359 | 852 | opt.erase(pos, opt.size() - pos); | 852 | opt.erase(pos, opt.size() - pos); |
360 | 853 | } | 853 | } |
361 | 854 | 854 | ||
363 | 855 | m_commandline[opt] = value; | 855 | commandline_[opt] = value; |
364 | 856 | } | 856 | } |
365 | 857 | } | 857 | } |
366 | 858 | 858 | ||
367 | 859 | /** | 859 | /** |
369 | 860 | * Parse the command line given in m_commandline | 860 | * Parse the command line given in commandline_ |
370 | 861 | * | 861 | * |
371 | 862 | * \return false if there were errors during parsing \e or if "--help" | 862 | * \return false if there were errors during parsing \e or if "--help" |
372 | 863 | * was given, | 863 | * was given, |
373 | @@ -865,105 +865,105 @@ | |||
374 | 865 | */ | 865 | */ |
375 | 866 | void WLApplication::handle_commandline_parameters() | 866 | void WLApplication::handle_commandline_parameters() |
376 | 867 | { | 867 | { |
381 | 868 | if (m_commandline.count("logfile")) { | 868 | if (commandline_.count("logfile")) { |
382 | 869 | m_logfile = m_commandline["logfile"]; | 869 | logfile_ = commandline_["logfile"]; |
383 | 870 | std::cerr << "Redirecting log target to: " << m_logfile << std::endl; | 870 | std::cerr << "Redirecting log target to: " << logfile_ << std::endl; |
384 | 871 | if (m_logfile.size() != 0) { | 871 | if (logfile_.size() != 0) { |
385 | 872 | //TODO(unknown): (very small) memory leak of 1 ofstream; | 872 | //TODO(unknown): (very small) memory leak of 1 ofstream; |
386 | 873 | //swaw the buffers (internally) of the file and wout | 873 | //swaw the buffers (internally) of the file and wout |
388 | 874 | std::ofstream * widelands_out = new std::ofstream(m_logfile.c_str()); | 874 | std::ofstream * widelands_out = new std::ofstream(logfile_.c_str()); |
389 | 875 | std::streambuf * logbuf = widelands_out->rdbuf(); | 875 | std::streambuf * logbuf = widelands_out->rdbuf(); |
390 | 876 | wout.rdbuf(logbuf); | 876 | wout.rdbuf(logbuf); |
391 | 877 | } | 877 | } |
393 | 878 | m_commandline.erase("logfile"); | 878 | commandline_.erase("logfile"); |
394 | 879 | } | 879 | } |
396 | 880 | if (m_commandline.count("nosound")) { | 880 | if (commandline_.count("nosound")) { |
397 | 881 | g_sound_handler.nosound_ = true; | 881 | g_sound_handler.nosound_ = true; |
399 | 882 | m_commandline.erase("nosound"); | 882 | commandline_.erase("nosound"); |
400 | 883 | } | 883 | } |
402 | 884 | if (m_commandline.count("nozip")) { | 884 | if (commandline_.count("nozip")) { |
403 | 885 | g_options.pull_section("global").create_val("nozip", "true"); | 885 | g_options.pull_section("global").create_val("nozip", "true"); |
405 | 886 | m_commandline.erase("nozip"); | 886 | commandline_.erase("nozip"); |
406 | 887 | } | 887 | } |
407 | 888 | 888 | ||
411 | 889 | if (m_commandline.count("datadir")) { | 889 | if (commandline_.count("datadir")) { |
412 | 890 | m_datadir = m_commandline["datadir"]; | 890 | datadir_ = commandline_["datadir"]; |
413 | 891 | m_commandline.erase("datadir"); | 891 | commandline_.erase("datadir"); |
414 | 892 | } else { | 892 | } else { |
416 | 893 | m_datadir = is_absolute_path(INSTALL_DATADIR) ? | 893 | datadir_ = is_absolute_path(INSTALL_DATADIR) ? |
417 | 894 | INSTALL_DATADIR : | 894 | INSTALL_DATADIR : |
418 | 895 | get_executable_directory() + INSTALL_DATADIR; | 895 | get_executable_directory() + INSTALL_DATADIR; |
419 | 896 | } | 896 | } |
423 | 897 | if (!is_absolute_path(m_datadir)) { | 897 | if (!is_absolute_path(datadir_)) { |
424 | 898 | m_datadir = absolute_path_if_not_windows(FileSystem::get_working_directory() + | 898 | datadir_ = absolute_path_if_not_windows(FileSystem::get_working_directory() + |
425 | 899 | FileSystem::file_separator() + m_datadir); | 899 | FileSystem::file_separator() + datadir_); |
426 | 900 | } | 900 | } |
427 | 901 | 901 | ||
429 | 902 | if (m_commandline.count("verbose")) { | 902 | if (commandline_.count("verbose")) { |
430 | 903 | g_verbose = true; | 903 | g_verbose = true; |
431 | 904 | 904 | ||
445 | 905 | m_commandline.erase("verbose"); | 905 | commandline_.erase("verbose"); |
446 | 906 | } | 906 | } |
447 | 907 | 907 | ||
448 | 908 | if (m_commandline.count("editor")) { | 908 | if (commandline_.count("editor")) { |
449 | 909 | m_filename = m_commandline["editor"]; | 909 | filename_ = commandline_["editor"]; |
450 | 910 | if (m_filename.size() && *m_filename.rbegin() == '/') | 910 | if (filename_.size() && *filename_.rbegin() == '/') |
451 | 911 | m_filename.erase(m_filename.size() - 1); | 911 | filename_.erase(filename_.size() - 1); |
452 | 912 | m_game_type = EDITOR; | 912 | game_type_ = EDITOR; |
453 | 913 | m_commandline.erase("editor"); | 913 | commandline_.erase("editor"); |
454 | 914 | } | 914 | } |
455 | 915 | 915 | ||
456 | 916 | if (m_commandline.count("replay")) { | 916 | if (commandline_.count("replay")) { |
457 | 917 | if (m_game_type != NONE) | 917 | if (game_type_ != NONE) |
458 | 918 | throw wexception("replay can not be combined with other actions"); | 918 | throw wexception("replay can not be combined with other actions"); |
464 | 919 | m_filename = m_commandline["replay"]; | 919 | filename_ = commandline_["replay"]; |
465 | 920 | if (m_filename.size() && *m_filename.rbegin() == '/') | 920 | if (filename_.size() && *filename_.rbegin() == '/') |
466 | 921 | m_filename.erase(m_filename.size() - 1); | 921 | filename_.erase(filename_.size() - 1); |
467 | 922 | m_game_type = REPLAY; | 922 | game_type_ = REPLAY; |
468 | 923 | m_commandline.erase("replay"); | 923 | commandline_.erase("replay"); |
469 | 924 | } | 924 | } |
470 | 925 | 925 | ||
473 | 926 | if (m_commandline.count("loadgame")) { | 926 | if (commandline_.count("loadgame")) { |
474 | 927 | if (m_game_type != NONE) | 927 | if (game_type_ != NONE) |
475 | 928 | throw wexception("loadgame can not be combined with other actions"); | 928 | throw wexception("loadgame can not be combined with other actions"); |
478 | 929 | m_filename = m_commandline["loadgame"]; | 929 | filename_ = commandline_["loadgame"]; |
479 | 930 | if (m_filename.empty()) | 930 | if (filename_.empty()) |
480 | 931 | throw wexception("empty value of command line parameter --loadgame"); | 931 | throw wexception("empty value of command line parameter --loadgame"); |
485 | 932 | if (*m_filename.rbegin() == '/') | 932 | if (*filename_.rbegin() == '/') |
486 | 933 | m_filename.erase(m_filename.size() - 1); | 933 | filename_.erase(filename_.size() - 1); |
487 | 934 | m_game_type = LOADGAME; | 934 | game_type_ = LOADGAME; |
488 | 935 | m_commandline.erase("loadgame"); | 935 | commandline_.erase("loadgame"); |
489 | 936 | } | 936 | } |
490 | 937 | 937 | ||
493 | 938 | if (m_commandline.count("scenario")) { | 938 | if (commandline_.count("scenario")) { |
494 | 939 | if (m_game_type != NONE) | 939 | if (game_type_ != NONE) |
495 | 940 | throw wexception("scenario can not be combined with other actions"); | 940 | throw wexception("scenario can not be combined with other actions"); |
498 | 941 | m_filename = m_commandline["scenario"]; | 941 | filename_ = commandline_["scenario"]; |
499 | 942 | if (m_filename.empty()) | 942 | if (filename_.empty()) |
500 | 943 | throw wexception("empty value of command line parameter --scenario"); | 943 | throw wexception("empty value of command line parameter --scenario"); |
505 | 944 | if (*m_filename.rbegin() == '/') | 944 | if (*filename_.rbegin() == '/') |
506 | 945 | m_filename.erase(m_filename.size() - 1); | 945 | filename_.erase(filename_.size() - 1); |
507 | 946 | m_game_type = SCENARIO; | 946 | game_type_ = SCENARIO; |
508 | 947 | m_commandline.erase("scenario"); | 947 | commandline_.erase("scenario"); |
509 | 948 | } | 948 | } |
512 | 949 | if (m_commandline.count("dedicated")) { | 949 | if (commandline_.count("dedicated")) { |
513 | 950 | if (m_game_type != NONE) | 950 | if (game_type_ != NONE) |
514 | 951 | throw wexception("dedicated can not be combined with other actions"); | 951 | throw wexception("dedicated can not be combined with other actions"); |
517 | 952 | m_filename = m_commandline["dedicated"]; | 952 | filename_ = commandline_["dedicated"]; |
518 | 953 | if (m_filename.empty()) | 953 | if (filename_.empty()) |
519 | 954 | throw wexception("empty value of commandline parameter --dedicated"); | 954 | throw wexception("empty value of commandline parameter --dedicated"); |
524 | 955 | if (*m_filename.rbegin() == '/') | 955 | if (*filename_.rbegin() == '/') |
525 | 956 | m_filename.erase(m_filename.size() - 1); | 956 | filename_.erase(filename_.size() - 1); |
526 | 957 | m_game_type = INTERNET; | 957 | game_type_ = INTERNET; |
527 | 958 | m_commandline.erase("dedicated"); | 958 | commandline_.erase("dedicated"); |
528 | 959 | } | 959 | } |
532 | 960 | if (m_commandline.count("script")) { | 960 | if (commandline_.count("script")) { |
533 | 961 | m_script_to_run = m_commandline["script"]; | 961 | script_to_run_ = commandline_["script"]; |
534 | 962 | if (m_script_to_run.empty()) | 962 | if (script_to_run_.empty()) |
535 | 963 | throw wexception("empty value of command line parameter --script"); | 963 | throw wexception("empty value of command line parameter --script"); |
539 | 964 | if (*m_script_to_run.rbegin() == '/') | 964 | if (*script_to_run_.rbegin() == '/') |
540 | 965 | m_script_to_run.erase(m_script_to_run.size() - 1); | 965 | script_to_run_.erase(script_to_run_.size() - 1); |
541 | 966 | m_commandline.erase("script"); | 966 | commandline_.erase("script"); |
542 | 967 | } | 967 | } |
543 | 968 | 968 | ||
544 | 969 | //If it hasn't been handled yet it's probably an attempt to | 969 | //If it hasn't been handled yet it's probably an attempt to |
545 | @@ -972,10 +972,10 @@ | |||
546 | 972 | //will be taken care of (==ignored) when saving the options | 972 | //will be taken care of (==ignored) when saving the options |
547 | 973 | 973 | ||
548 | 974 | const std::map<std::string, std::string>::const_iterator commandline_end = | 974 | const std::map<std::string, std::string>::const_iterator commandline_end = |
550 | 975 | m_commandline.end(); | 975 | commandline_.end(); |
551 | 976 | for | 976 | for |
552 | 977 | (std::map<std::string, std::string>::const_iterator it = | 977 | (std::map<std::string, std::string>::const_iterator it = |
554 | 978 | m_commandline.begin(); | 978 | commandline_.begin(); |
555 | 979 | it != commandline_end; | 979 | it != commandline_end; |
556 | 980 | ++it) | 980 | ++it) |
557 | 981 | { | 981 | { |
558 | @@ -986,7 +986,7 @@ | |||
559 | 986 | (it->first.c_str(), it->second.c_str()); | 986 | (it->first.c_str(), it->second.c_str()); |
560 | 987 | } | 987 | } |
561 | 988 | 988 | ||
563 | 989 | if (m_commandline.count("help") || m_commandline.count("version")) { | 989 | if (commandline_.count("help") || commandline_.count("version")) { |
564 | 990 | init_language(); | 990 | init_language(); |
565 | 991 | throw ParameterError(); //no message on purpose | 991 | throw ParameterError(); //no message on purpose |
566 | 992 | } | 992 | } |
567 | @@ -1057,7 +1057,7 @@ | |||
568 | 1057 | break; | 1057 | break; |
569 | 1058 | } | 1058 | } |
570 | 1059 | case FullscreenMenuBase::MenuTarget::kEditor: | 1059 | case FullscreenMenuBase::MenuTarget::kEditor: |
572 | 1060 | EditorInteractive::run_editor(m_filename, m_script_to_run); | 1060 | EditorInteractive::run_editor(filename_, script_to_run_); |
573 | 1061 | break; | 1061 | break; |
574 | 1062 | default: | 1062 | default: |
575 | 1063 | case FullscreenMenuBase::MenuTarget::kExit: | 1063 | case FullscreenMenuBase::MenuTarget::kExit: |
576 | @@ -1376,13 +1376,13 @@ | |||
577 | 1376 | void WLApplication::replay() | 1376 | void WLApplication::replay() |
578 | 1377 | { | 1377 | { |
579 | 1378 | Widelands::Game game; | 1378 | Widelands::Game game; |
581 | 1379 | if (m_filename.empty()) { | 1379 | if (filename_.empty()) { |
582 | 1380 | SinglePlayerGameSettingsProvider sp; | 1380 | SinglePlayerGameSettingsProvider sp; |
583 | 1381 | FullscreenMenuLoadGame rm(game, &sp, nullptr, true); | 1381 | FullscreenMenuLoadGame rm(game, &sp, nullptr, true); |
584 | 1382 | if (rm.run<FullscreenMenuBase::MenuTarget>() == FullscreenMenuBase::MenuTarget::kBack) | 1382 | if (rm.run<FullscreenMenuBase::MenuTarget>() == FullscreenMenuBase::MenuTarget::kBack) |
585 | 1383 | return; | 1383 | return; |
586 | 1384 | 1384 | ||
588 | 1385 | m_filename = rm.filename(); | 1385 | filename_ = rm.filename(); |
589 | 1386 | } | 1386 | } |
590 | 1387 | 1387 | ||
591 | 1388 | try { | 1388 | try { |
592 | @@ -1396,7 +1396,7 @@ | |||
593 | 1396 | game.set_ibase | 1396 | game.set_ibase |
594 | 1397 | (new InteractiveSpectator(game, g_options.pull_section("global"))); | 1397 | (new InteractiveSpectator(game, g_options.pull_section("global"))); |
595 | 1398 | game.set_write_replay(false); | 1398 | game.set_write_replay(false); |
597 | 1399 | ReplayGameController rgc(game, m_filename); | 1399 | ReplayGameController rgc(game, filename_); |
598 | 1400 | 1400 | ||
599 | 1401 | game.save_handler().set_allow_saving(false); | 1401 | game.save_handler().set_allow_saving(false); |
600 | 1402 | 1402 | ||
601 | @@ -1404,10 +1404,10 @@ | |||
602 | 1404 | } catch (const std::exception & e) { | 1404 | } catch (const std::exception & e) { |
603 | 1405 | log("Fatal Exception: %s\n", e.what()); | 1405 | log("Fatal Exception: %s\n", e.what()); |
604 | 1406 | emergency_save(game); | 1406 | emergency_save(game); |
606 | 1407 | m_filename.clear(); | 1407 | filename_.clear(); |
607 | 1408 | throw; | 1408 | throw; |
608 | 1409 | } | 1409 | } |
610 | 1410 | m_filename.clear(); | 1410 | filename_.clear(); |
611 | 1411 | } | 1411 | } |
612 | 1412 | 1412 | ||
613 | 1413 | 1413 | ||
614 | @@ -1483,7 +1483,7 @@ | |||
615 | 1483 | memset(&tfile, 0, sizeof(tm)); | 1483 | memset(&tfile, 0, sizeof(tm)); |
616 | 1484 | 1484 | ||
617 | 1485 | tfile.tm_mday = atoi(timestr.substr(8, 2).c_str()); | 1485 | tfile.tm_mday = atoi(timestr.substr(8, 2).c_str()); |
619 | 1486 | tfile.tm_mon = atoi(timestr.substr(5, 2).c_str()) - 1; | 1486 | tfile.tm_mon = atoi(timestr.substr(5, 2).c_str()) - 1; |
620 | 1487 | tfile.tm_year = atoi(timestr.substr(0, 4).c_str()) - 1900; | 1487 | tfile.tm_year = atoi(timestr.substr(0, 4).c_str()) - 1900; |
621 | 1488 | 1488 | ||
622 | 1489 | double tdiff = std::difftime(tnow, mktime(&tfile)) / 86400; | 1489 | double tdiff = std::difftime(tnow, mktime(&tfile)) / 86400; |
623 | @@ -1527,6 +1527,6 @@ | |||
624 | 1527 | /* No buffering */ | 1527 | /* No buffering */ |
625 | 1528 | setbuf(stderr, nullptr); | 1528 | setbuf(stderr, nullptr); |
626 | 1529 | 1529 | ||
628 | 1530 | m_redirected_stdio = true; | 1530 | redirected_stdio_ = true; |
629 | 1531 | return true; | 1531 | return true; |
630 | 1532 | } | 1532 | } |
631 | 1533 | 1533 | ||
632 | === modified file 'src/wlapplication.h' | |||
633 | --- src/wlapplication.h 2016-01-09 15:27:05 +0000 | |||
634 | +++ src/wlapplication.h 2016-01-24 20:25:45 +0000 | |||
635 | @@ -1,5 +1,5 @@ | |||
636 | 1 | /* | 1 | /* |
638 | 2 | * Copyright (C) 2006-2012, 2015 by the Widelands Development Team | 2 | * Copyright (C) 2006-2016 by the Widelands Development Team |
639 | 3 | * | 3 | * |
640 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
641 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
642 | @@ -140,7 +140,7 @@ | |||
643 | 140 | void run(); | 140 | void run(); |
644 | 141 | 141 | ||
645 | 142 | /// \warning true if an external entity wants us to quit | 142 | /// \warning true if an external entity wants us to quit |
647 | 143 | bool should_die() const {return m_should_die;} | 143 | bool should_die() const {return should_die_;} |
648 | 144 | 144 | ||
649 | 145 | /// Get the state of the current KeyBoard Button | 145 | /// Get the state of the current KeyBoard Button |
650 | 146 | /// \warning This function doesn't check for dumbness | 146 | /// \warning This function doesn't check for dumbness |
651 | @@ -151,16 +151,16 @@ | |||
652 | 151 | void set_input_grab(bool grab); | 151 | void set_input_grab(bool grab); |
653 | 152 | 152 | ||
654 | 153 | /// The mouse's current coordinates | 153 | /// The mouse's current coordinates |
656 | 154 | Point get_mouse_position() const {return m_mouse_position;} | 154 | Point get_mouse_position() const {return mouse_position_;} |
657 | 155 | // | 155 | // |
658 | 156 | /// Find out whether the mouse is currently pressed | 156 | /// Find out whether the mouse is currently pressed |
659 | 157 | bool is_mouse_pressed() const {return SDL_GetMouseState(nullptr, nullptr); } | 157 | bool is_mouse_pressed() const {return SDL_GetMouseState(nullptr, nullptr); } |
660 | 158 | 158 | ||
661 | 159 | /// Swap left and right mouse key? | 159 | /// Swap left and right mouse key? |
663 | 160 | void set_mouse_swap(const bool swap) {m_mouse_swapped = swap;} | 160 | void set_mouse_swap(const bool swap) {mouse_swapped_ = swap;} |
664 | 161 | 161 | ||
665 | 162 | /// Lock the mouse cursor into place (e.g., for scrolling the map) | 162 | /// Lock the mouse cursor into place (e.g., for scrolling the map) |
667 | 163 | void set_mouse_lock(const bool locked) {m_mouse_locked = locked;} | 163 | void set_mouse_lock(const bool locked) {mouse_locked_ = locked;} |
668 | 164 | //@} | 164 | //@} |
669 | 165 | 165 | ||
670 | 166 | 166 | ||
671 | @@ -209,47 +209,47 @@ | |||
672 | 209 | /** | 209 | /** |
673 | 210 | * The commandline, conveniently repackaged. | 210 | * The commandline, conveniently repackaged. |
674 | 211 | */ | 211 | */ |
676 | 212 | std::map<std::string, std::string> m_commandline; | 212 | std::map<std::string, std::string> commandline_; |
677 | 213 | 213 | ||
679 | 214 | std::string m_filename; | 214 | std::string filename_; |
680 | 215 | 215 | ||
681 | 216 | /// Script to be run after the game was started with --editor, | 216 | /// Script to be run after the game was started with --editor, |
682 | 217 | /// --scenario or --loadgame. | 217 | /// --scenario or --loadgame. |
684 | 218 | std::string m_script_to_run; | 218 | std::string script_to_run_; |
685 | 219 | 219 | ||
686 | 220 | //Log all output to this file if set, otherwise use cout | 220 | //Log all output to this file if set, otherwise use cout |
688 | 221 | std::string m_logfile; | 221 | std::string logfile_; |
689 | 222 | 222 | ||
691 | 223 | GameType m_game_type; | 223 | GameType game_type_; |
692 | 224 | 224 | ||
693 | 225 | ///True if left and right mouse button should be swapped | 225 | ///True if left and right mouse button should be swapped |
695 | 226 | bool m_mouse_swapped; | 226 | bool mouse_swapped_; |
696 | 227 | 227 | ||
697 | 228 | /// When apple is involved, the middle mouse button is sometimes send, even | 228 | /// When apple is involved, the middle mouse button is sometimes send, even |
698 | 229 | /// if it wasn't pressed. We try to revert this and this helps. | 229 | /// if it wasn't pressed. We try to revert this and this helps. |
700 | 230 | bool m_faking_middle_mouse_button; | 230 | bool faking_middle_mouse_button_; |
701 | 231 | 231 | ||
702 | 232 | ///The current position of the mouse pointer | 232 | ///The current position of the mouse pointer |
704 | 233 | Point m_mouse_position; | 233 | Point mouse_position_; |
705 | 234 | 234 | ||
706 | 235 | ///If true, the mouse cursor will \e not move with a mousemotion event: | 235 | ///If true, the mouse cursor will \e not move with a mousemotion event: |
707 | 236 | ///instead, the map will be scrolled | 236 | ///instead, the map will be scrolled |
709 | 237 | bool m_mouse_locked; | 237 | bool mouse_locked_; |
710 | 238 | 238 | ||
711 | 239 | ///If the mouse needs to be moved in warp_mouse(), this Point is | 239 | ///If the mouse needs to be moved in warp_mouse(), this Point is |
712 | 240 | ///used to cancel the resulting SDL_MouseMotionEvent. | 240 | ///used to cancel the resulting SDL_MouseMotionEvent. |
714 | 241 | Point m_mouse_compensate_warp; | 241 | Point mouse_compensate_warp_; |
715 | 242 | 242 | ||
716 | 243 | ///true if an external entity wants us to quit | 243 | ///true if an external entity wants us to quit |
718 | 244 | bool m_should_die; | 244 | bool should_die_; |
719 | 245 | 245 | ||
721 | 246 | std::string m_homedir; | 246 | std::string homedir_; |
722 | 247 | 247 | ||
723 | 248 | /// flag indicating if stdout and stderr have been redirected | 248 | /// flag indicating if stdout and stderr have been redirected |
725 | 249 | bool m_redirected_stdio; | 249 | bool redirected_stdio_; |
726 | 250 | 250 | ||
727 | 251 | /// Absolute path to the data directory. | 251 | /// Absolute path to the data directory. |
729 | 252 | std::string m_datadir; | 252 | std::string datadir_; |
730 | 253 | 253 | ||
731 | 254 | ///Holds this process' one and only instance of WLApplication, if it was | 254 | ///Holds this process' one and only instance of WLApplication, if it was |
732 | 255 | ///created already. nullptr otherwise. | 255 | ///created already. nullptr otherwise. |
733 | 256 | 256 | ||
734 | === modified file 'src/wui/buildingwindow.cc' | |||
735 | --- src/wui/buildingwindow.cc 2016-01-10 11:36:05 +0000 | |||
736 | +++ src/wui/buildingwindow.cc 2016-01-24 20:25:45 +0000 | |||
737 | @@ -1,5 +1,5 @@ | |||
738 | 1 | /* | 1 | /* |
740 | 2 | * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
741 | 3 | * | 3 | * |
742 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
743 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
744 | @@ -55,27 +55,27 @@ | |||
745 | 55 | (&parent, "building_window", | 55 | (&parent, "building_window", |
746 | 56 | 0, 0, Width, 0, | 56 | 0, 0, Width, 0, |
747 | 57 | b.descr().descname()), | 57 | b.descr().descname()), |
752 | 58 | m_registry(registry), | 58 | registry_(registry), |
753 | 59 | m_building (b), | 59 | building_ (b), |
754 | 60 | m_workarea_overlay_id(0), | 60 | workarea_overlay_id_(0), |
755 | 61 | m_avoid_fastclick(false) | 61 | avoid_fastclick_(false) |
756 | 62 | { | 62 | { |
759 | 63 | delete m_registry; | 63 | delete registry_; |
760 | 64 | m_registry = this; | 64 | registry_ = this; |
761 | 65 | 65 | ||
767 | 66 | m_capscache_player_number = 0; | 66 | capscache_player_number_ = 0; |
768 | 67 | m_capsbuttons = nullptr; | 67 | capsbuttons_ = nullptr; |
769 | 68 | m_capscache = 0; | 68 | capscache_ = 0; |
770 | 69 | m_caps_setup = false; | 69 | caps_setup_ = false; |
771 | 70 | m_toggle_workarea = nullptr; | 70 | toggle_workarea_ = nullptr; |
772 | 71 | 71 | ||
773 | 72 | UI::Box * vbox = new UI::Box(this, 0, 0, UI::Box::Vertical); | 72 | UI::Box * vbox = new UI::Box(this, 0, 0, UI::Box::Vertical); |
774 | 73 | 73 | ||
777 | 74 | m_tabs = new UI::TabPanel(vbox, 0, 0, nullptr); | 74 | tabs_ = new UI::TabPanel(vbox, 0, 0, nullptr); |
778 | 75 | vbox->add(m_tabs, UI::Box::AlignLeft, true); | 75 | vbox->add(tabs_, UI::Box::AlignLeft, true); |
779 | 76 | 76 | ||
782 | 77 | m_capsbuttons = new UI::Box(vbox, 0, 0, UI::Box::Horizontal); | 77 | capsbuttons_ = new UI::Box(vbox, 0, 0, UI::Box::Horizontal); |
783 | 78 | vbox->add(m_capsbuttons, UI::Box::AlignLeft, true); | 78 | vbox->add(capsbuttons_, UI::Box::AlignLeft, true); |
784 | 79 | // actually create buttons on the first call to think(), | 79 | // actually create buttons on the first call to think(), |
785 | 80 | // so that overriding create_capsbuttons() works | 80 | // so that overriding create_capsbuttons() works |
786 | 81 | 81 | ||
787 | @@ -86,7 +86,7 @@ | |||
788 | 86 | show_workarea(); | 86 | show_workarea(); |
789 | 87 | 87 | ||
790 | 88 | // Title for construction site | 88 | // Title for construction site |
792 | 89 | if (upcast(Widelands::ConstructionSite, csite, &m_building)) { | 89 | if (upcast(Widelands::ConstructionSite, csite, &building_)) { |
793 | 90 | // Show name in parenthesis as it may take all width already | 90 | // Show name in parenthesis as it may take all width already |
794 | 91 | const std::string title = (boost::format("(%s)") % csite->building().descname()).str(); | 91 | const std::string title = (boost::format("(%s)") % csite->building().descname()).str(); |
795 | 92 | set_title(title); | 92 | set_title(title); |
796 | @@ -96,10 +96,10 @@ | |||
797 | 96 | 96 | ||
798 | 97 | BuildingWindow::~BuildingWindow() | 97 | BuildingWindow::~BuildingWindow() |
799 | 98 | { | 98 | { |
802 | 99 | if (m_workarea_overlay_id) { | 99 | if (workarea_overlay_id_) { |
803 | 100 | igbase().mutable_field_overlay_manager()->remove_overlay(m_workarea_overlay_id); | 100 | igbase().mutable_field_overlay_manager()->remove_overlay(workarea_overlay_id_); |
804 | 101 | } | 101 | } |
806 | 102 | m_registry = nullptr; | 102 | registry_ = nullptr; |
807 | 103 | } | 103 | } |
808 | 104 | 104 | ||
809 | 105 | namespace Widelands {class BuildingDescr;} | 105 | namespace Widelands {class BuildingDescr;} |
810 | @@ -138,18 +138,18 @@ | |||
811 | 138 | die(); | 138 | die(); |
812 | 139 | 139 | ||
813 | 140 | if | 140 | if |
819 | 141 | (!m_caps_setup | 141 | (!caps_setup_ |
820 | 142 | || | 142 | || |
821 | 143 | m_capscache_player_number != igbase().player_number() | 143 | capscache_player_number_ != igbase().player_number() |
822 | 144 | || | 144 | || |
823 | 145 | building().get_playercaps() != m_capscache) | 145 | building().get_playercaps() != capscache_) |
824 | 146 | { | 146 | { |
827 | 147 | m_capsbuttons->free_children(); | 147 | capsbuttons_->free_children(); |
828 | 148 | create_capsbuttons(m_capsbuttons); | 148 | create_capsbuttons(capsbuttons_); |
829 | 149 | move_out_of_the_way(); | 149 | move_out_of_the_way(); |
831 | 150 | if (!m_avoid_fastclick) | 150 | if (!avoid_fastclick_) |
832 | 151 | warp_mouse_to_fastclick_panel(); | 151 | warp_mouse_to_fastclick_panel(); |
834 | 152 | m_caps_setup = true; | 152 | caps_setup_ = true; |
835 | 153 | } | 153 | } |
836 | 154 | 154 | ||
837 | 155 | 155 | ||
838 | @@ -165,8 +165,8 @@ | |||
839 | 165 | */ | 165 | */ |
840 | 166 | void BuildingWindow::create_capsbuttons(UI::Box * capsbuttons) | 166 | void BuildingWindow::create_capsbuttons(UI::Box * capsbuttons) |
841 | 167 | { | 167 | { |
844 | 168 | m_capscache = building().get_playercaps(); | 168 | capscache_ = building().get_playercaps(); |
845 | 169 | m_capscache_player_number = igbase().player_number(); | 169 | capscache_player_number_ = igbase().player_number(); |
846 | 170 | 170 | ||
847 | 171 | const Widelands::Player & owner = building().owner(); | 171 | const Widelands::Player & owner = building().owner(); |
848 | 172 | const Widelands::PlayerNumber owner_number = owner.player_number(); | 172 | const Widelands::PlayerNumber owner_number = owner.player_number(); |
849 | @@ -176,7 +176,7 @@ | |||
850 | 176 | bool requires_destruction_separator = false; | 176 | bool requires_destruction_separator = false; |
851 | 177 | if (can_act) { | 177 | if (can_act) { |
852 | 178 | // Check if this is a port building and if yes show expedition button | 178 | // Check if this is a port building and if yes show expedition button |
854 | 179 | if (upcast(Widelands::Warehouse const, warehouse, &m_building)) { | 179 | if (upcast(Widelands::Warehouse const, warehouse, &building_)) { |
855 | 180 | if (Widelands::PortDock * pd = warehouse->get_portdock()) { | 180 | if (Widelands::PortDock * pd = warehouse->get_portdock()) { |
856 | 181 | if (pd->expedition_started()) { | 181 | if (pd->expedition_started()) { |
857 | 182 | UI::Button * expeditionbtn = | 182 | UI::Button * expeditionbtn = |
858 | @@ -202,7 +202,7 @@ | |||
859 | 202 | } | 202 | } |
860 | 203 | } | 203 | } |
861 | 204 | else | 204 | else |
863 | 205 | if (upcast(const Widelands::ProductionSite, productionsite, &m_building)) { | 205 | if (upcast(const Widelands::ProductionSite, productionsite, &building_)) { |
864 | 206 | if (!is_a(Widelands::MilitarySite, productionsite)) { | 206 | if (!is_a(Widelands::MilitarySite, productionsite)) { |
865 | 207 | const bool is_stopped = productionsite->is_stopped(); | 207 | const bool is_stopped = productionsite->is_stopped(); |
866 | 208 | UI::Button * stopbtn = | 208 | UI::Button * stopbtn = |
867 | @@ -227,9 +227,9 @@ | |||
868 | 227 | } | 227 | } |
869 | 228 | } // upcast to productionsite | 228 | } // upcast to productionsite |
870 | 229 | 229 | ||
872 | 230 | if (m_capscache & Widelands::Building::PCap_Enhancable) { | 230 | if (capscache_ & Widelands::Building::PCap_Enhancable) { |
873 | 231 | const Widelands::DescriptionIndex & enhancement = | 231 | const Widelands::DescriptionIndex & enhancement = |
875 | 232 | m_building.descr().enhancement(); | 232 | building_.descr().enhancement(); |
876 | 233 | const Widelands::TribeDescr & tribe = owner.tribe(); | 233 | const Widelands::TribeDescr & tribe = owner.tribe(); |
877 | 234 | if (owner.is_building_type_allowed(enhancement)) { | 234 | if (owner.is_building_type_allowed(enhancement)) { |
878 | 235 | const Widelands::BuildingDescr & building_descr = | 235 | const Widelands::BuildingDescr & building_descr = |
879 | @@ -256,7 +256,7 @@ | |||
880 | 256 | } | 256 | } |
881 | 257 | } | 257 | } |
882 | 258 | 258 | ||
884 | 259 | if (m_capscache & Widelands::Building::PCap_Bulldoze) { | 259 | if (capscache_ & Widelands::Building::PCap_Bulldoze) { |
885 | 260 | UI::Button * destroybtn = | 260 | UI::Button * destroybtn = |
886 | 261 | new UI::Button | 261 | new UI::Button |
887 | 262 | (capsbuttons, "destroy", 0, 0, 34, 34, | 262 | (capsbuttons, "destroy", 0, 0, 34, 34, |
888 | @@ -272,9 +272,9 @@ | |||
889 | 272 | requires_destruction_separator = true; | 272 | requires_destruction_separator = true; |
890 | 273 | } | 273 | } |
891 | 274 | 274 | ||
893 | 275 | if (m_capscache & Widelands::Building::PCap_Dismantle) { | 275 | if (capscache_ & Widelands::Building::PCap_Dismantle) { |
894 | 276 | std::map<Widelands::DescriptionIndex, uint8_t> wares; | 276 | std::map<Widelands::DescriptionIndex, uint8_t> wares; |
896 | 277 | Widelands::DismantleSite::count_returned_wares(&m_building, wares); | 277 | Widelands::DismantleSite::count_returned_wares(&building_, wares); |
897 | 278 | UI::Button * dismantlebtn = | 278 | UI::Button * dismantlebtn = |
898 | 279 | new UI::Button | 279 | new UI::Button |
899 | 280 | (capsbuttons, "dismantle", 0, 0, 34, 34, | 280 | (capsbuttons, "dismantle", 0, 0, 34, 34, |
900 | @@ -301,24 +301,24 @@ | |||
901 | 301 | 301 | ||
902 | 302 | if (can_see) { | 302 | if (can_see) { |
903 | 303 | WorkareaInfo wa_info; | 303 | WorkareaInfo wa_info; |
905 | 304 | if (upcast(Widelands::ConstructionSite, csite, &m_building)) { | 304 | if (upcast(Widelands::ConstructionSite, csite, &building_)) { |
906 | 305 | wa_info = csite->building().m_workarea_info; | 305 | wa_info = csite->building().m_workarea_info; |
907 | 306 | } else { | 306 | } else { |
909 | 307 | wa_info = m_building.descr().m_workarea_info; | 307 | wa_info = building_.descr().m_workarea_info; |
910 | 308 | } | 308 | } |
911 | 309 | if (!wa_info.empty()) { | 309 | if (!wa_info.empty()) { |
913 | 310 | m_toggle_workarea = new UI::Button | 310 | toggle_workarea_ = new UI::Button |
914 | 311 | (capsbuttons, "workarea", | 311 | (capsbuttons, "workarea", |
915 | 312 | 0, 0, 34, 34, | 312 | 0, 0, 34, 34, |
916 | 313 | g_gr->images().get("pics/but4.png"), | 313 | g_gr->images().get("pics/but4.png"), |
917 | 314 | g_gr->images().get("pics/workarea123.png"), | 314 | g_gr->images().get("pics/workarea123.png"), |
918 | 315 | _("Hide work area")); | 315 | _("Hide work area")); |
920 | 316 | m_toggle_workarea->sigclicked.connect | 316 | toggle_workarea_->sigclicked.connect |
921 | 317 | (boost::bind(&BuildingWindow::toggle_workarea, boost::ref(*this))); | 317 | (boost::bind(&BuildingWindow::toggle_workarea, boost::ref(*this))); |
922 | 318 | 318 | ||
924 | 319 | capsbuttons->add(m_toggle_workarea, UI::Box::AlignCenter); | 319 | capsbuttons->add(toggle_workarea_, UI::Box::AlignCenter); |
925 | 320 | configure_workarea_button(); | 320 | configure_workarea_button(); |
927 | 321 | set_fastclick_panel(m_toggle_workarea); | 321 | set_fastclick_panel(toggle_workarea_); |
928 | 322 | } | 322 | } |
929 | 323 | 323 | ||
930 | 324 | if (igbase().get_display_flag(InteractiveBase::dfDebug)) { | 324 | if (igbase().get_display_flag(InteractiveBase::dfDebug)) { |
931 | @@ -358,10 +358,10 @@ | |||
932 | 358 | _("Help")); | 358 | _("Help")); |
933 | 359 | 359 | ||
934 | 360 | UI::UniqueWindow::Registry& registry = | 360 | UI::UniqueWindow::Registry& registry = |
936 | 361 | igbase().unique_windows().get_registry(m_building.descr().name() + "_help"); | 361 | igbase().unique_windows().get_registry(building_.descr().name() + "_help"); |
937 | 362 | registry.open_window = [this, ®istry] { | 362 | registry.open_window = [this, ®istry] { |
938 | 363 | new UI::BuildingHelpWindow( | 363 | new UI::BuildingHelpWindow( |
940 | 364 | &igbase(), registry, m_building.descr(), m_building.owner().tribe(), &igbase().egbase().lua()); | 364 | &igbase(), registry, building_.descr(), building_.owner().tribe(), &igbase().egbase().lua()); |
941 | 365 | }; | 365 | }; |
942 | 366 | 366 | ||
943 | 367 | helpbtn->sigclicked.connect(boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(registry))); | 367 | helpbtn->sigclicked.connect(boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(registry))); |
944 | @@ -377,11 +377,11 @@ | |||
945 | 377 | void BuildingWindow::act_bulldoze() | 377 | void BuildingWindow::act_bulldoze() |
946 | 378 | { | 378 | { |
947 | 379 | if (get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL)) { | 379 | if (get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL)) { |
950 | 380 | if (m_building.get_playercaps() & Widelands::Building::PCap_Bulldoze) | 380 | if (building_.get_playercaps() & Widelands::Building::PCap_Bulldoze) |
951 | 381 | igbase().game().send_player_bulldoze(m_building); | 381 | igbase().game().send_player_bulldoze(building_); |
952 | 382 | } | 382 | } |
953 | 383 | else { | 383 | else { |
955 | 384 | show_bulldoze_confirm(dynamic_cast<InteractivePlayer&>(igbase()), m_building); | 384 | show_bulldoze_confirm(dynamic_cast<InteractivePlayer&>(igbase()), building_); |
956 | 385 | } | 385 | } |
957 | 386 | } | 386 | } |
958 | 387 | 387 | ||
959 | @@ -393,11 +393,11 @@ | |||
960 | 393 | void BuildingWindow::act_dismantle() | 393 | void BuildingWindow::act_dismantle() |
961 | 394 | { | 394 | { |
962 | 395 | if (get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL)) { | 395 | if (get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL)) { |
965 | 396 | if (m_building.get_playercaps() & Widelands::Building::PCap_Dismantle) | 396 | if (building_.get_playercaps() & Widelands::Building::PCap_Dismantle) |
966 | 397 | igbase().game().send_player_dismantle(m_building); | 397 | igbase().game().send_player_dismantle(building_); |
967 | 398 | } | 398 | } |
968 | 399 | else { | 399 | else { |
970 | 400 | show_dismantle_confirm(dynamic_cast<InteractivePlayer&>(igbase()), m_building); | 400 | show_dismantle_confirm(dynamic_cast<InteractivePlayer&>(igbase()), building_); |
971 | 401 | } | 401 | } |
972 | 402 | } | 402 | } |
973 | 403 | 403 | ||
974 | @@ -407,8 +407,8 @@ | |||
975 | 407 | =============== | 407 | =============== |
976 | 408 | */ | 408 | */ |
977 | 409 | void BuildingWindow::act_start_stop() { | 409 | void BuildingWindow::act_start_stop() { |
980 | 410 | if (dynamic_cast<const Widelands::ProductionSite *>(&m_building)) | 410 | if (dynamic_cast<const Widelands::ProductionSite *>(&building_)) |
981 | 411 | igbase().game().send_player_start_stop_building (m_building); | 411 | igbase().game().send_player_start_stop_building (building_); |
982 | 412 | 412 | ||
983 | 413 | die(); | 413 | die(); |
984 | 414 | } | 414 | } |
985 | @@ -420,9 +420,9 @@ | |||
986 | 420 | =============== | 420 | =============== |
987 | 421 | */ | 421 | */ |
988 | 422 | void BuildingWindow::act_start_or_cancel_expedition() { | 422 | void BuildingWindow::act_start_or_cancel_expedition() { |
990 | 423 | if (upcast(Widelands::Warehouse const, warehouse, &m_building)) | 423 | if (upcast(Widelands::Warehouse const, warehouse, &building_)) |
991 | 424 | if (warehouse->get_portdock()) | 424 | if (warehouse->get_portdock()) |
993 | 425 | igbase().game().send_player_start_or_cancel_expedition(m_building); | 425 | igbase().game().send_player_start_or_cancel_expedition(building_); |
994 | 426 | 426 | ||
995 | 427 | // No need to die here - as soon as the request is handled, the UI will get updated by the portdock | 427 | // No need to die here - as soon as the request is handled, the UI will get updated by the portdock |
996 | 428 | //die(); | 428 | //die(); |
997 | @@ -436,13 +436,13 @@ | |||
998 | 436 | void BuildingWindow::act_enhance(Widelands::DescriptionIndex id) | 436 | void BuildingWindow::act_enhance(Widelands::DescriptionIndex id) |
999 | 437 | { | 437 | { |
1000 | 438 | if (get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL)) { | 438 | if (get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL)) { |
1003 | 439 | if (m_building.get_playercaps() & Widelands::Building::PCap_Enhancable) | 439 | if (building_.get_playercaps() & Widelands::Building::PCap_Enhancable) |
1004 | 440 | igbase().game().send_player_enhance_building(m_building, id); | 440 | igbase().game().send_player_enhance_building(building_, id); |
1005 | 441 | } | 441 | } |
1006 | 442 | else { | 442 | else { |
1007 | 443 | show_enhance_confirm | 443 | show_enhance_confirm |
1008 | 444 | (dynamic_cast<InteractivePlayer&>(igbase()), | 444 | (dynamic_cast<InteractivePlayer&>(igbase()), |
1010 | 445 | m_building, | 445 | building_, |
1011 | 446 | id); | 446 | id); |
1012 | 447 | } | 447 | } |
1013 | 448 | } | 448 | } |
1014 | @@ -456,7 +456,7 @@ | |||
1015 | 456 | { | 456 | { |
1016 | 457 | show_field_debug | 457 | show_field_debug |
1017 | 458 | (igbase(), | 458 | (igbase(), |
1019 | 459 | igbase().game().map().get_fcoords(m_building.get_position())); | 459 | igbase().game().map().get_fcoords(building_.get_position())); |
1020 | 460 | } | 460 | } |
1021 | 461 | 461 | ||
1022 | 462 | /** | 462 | /** |
1023 | @@ -464,19 +464,19 @@ | |||
1024 | 464 | */ | 464 | */ |
1025 | 465 | void BuildingWindow::show_workarea() | 465 | void BuildingWindow::show_workarea() |
1026 | 466 | { | 466 | { |
1028 | 467 | if (m_workarea_overlay_id) { | 467 | if (workarea_overlay_id_) { |
1029 | 468 | return; // already shown, nothing to be done | 468 | return; // already shown, nothing to be done |
1030 | 469 | } | 469 | } |
1031 | 470 | WorkareaInfo workarea_info; | 470 | WorkareaInfo workarea_info; |
1033 | 471 | if (upcast(Widelands::ConstructionSite, csite, &m_building)) { | 471 | if (upcast(Widelands::ConstructionSite, csite, &building_)) { |
1034 | 472 | workarea_info = csite->building().m_workarea_info; | 472 | workarea_info = csite->building().m_workarea_info; |
1035 | 473 | } else { | 473 | } else { |
1037 | 474 | workarea_info = m_building.descr().m_workarea_info; | 474 | workarea_info = building_.descr().m_workarea_info; |
1038 | 475 | } | 475 | } |
1039 | 476 | if (workarea_info.empty()) { | 476 | if (workarea_info.empty()) { |
1040 | 477 | return; | 477 | return; |
1041 | 478 | } | 478 | } |
1043 | 479 | m_workarea_overlay_id = igbase().show_work_area(workarea_info, m_building.get_position()); | 479 | workarea_overlay_id_ = igbase().show_work_area(workarea_info, building_.get_position()); |
1044 | 480 | 480 | ||
1045 | 481 | configure_workarea_button(); | 481 | configure_workarea_button(); |
1046 | 482 | } | 482 | } |
1047 | @@ -486,33 +486,33 @@ | |||
1048 | 486 | */ | 486 | */ |
1049 | 487 | void BuildingWindow::hide_workarea() | 487 | void BuildingWindow::hide_workarea() |
1050 | 488 | { | 488 | { |
1054 | 489 | if (m_workarea_overlay_id) { | 489 | if (workarea_overlay_id_) { |
1055 | 490 | igbase().hide_work_area(m_workarea_overlay_id); | 490 | igbase().hide_work_area(workarea_overlay_id_); |
1056 | 491 | m_workarea_overlay_id = 0; | 491 | workarea_overlay_id_ = 0; |
1057 | 492 | 492 | ||
1058 | 493 | configure_workarea_button(); | 493 | configure_workarea_button(); |
1059 | 494 | } | 494 | } |
1060 | 495 | } | 495 | } |
1061 | 496 | 496 | ||
1062 | 497 | /** | 497 | /** |
1064 | 498 | * Sets the perm_pressed state and the tooltip. | 498 | * Sets the perpressed_ state and the tooltip. |
1065 | 499 | */ | 499 | */ |
1066 | 500 | void BuildingWindow::configure_workarea_button() | 500 | void BuildingWindow::configure_workarea_button() |
1067 | 501 | { | 501 | { |
1072 | 502 | if (m_toggle_workarea) { | 502 | if (toggle_workarea_) { |
1073 | 503 | if (m_workarea_overlay_id) { | 503 | if (workarea_overlay_id_) { |
1074 | 504 | m_toggle_workarea->set_tooltip(_("Hide work area")); | 504 | toggle_workarea_->set_tooltip(_("Hide work area")); |
1075 | 505 | m_toggle_workarea->set_perm_pressed(true); | 505 | toggle_workarea_->set_perm_pressed(true); |
1076 | 506 | } else { | 506 | } else { |
1079 | 507 | m_toggle_workarea->set_tooltip(_("Show work area")); | 507 | toggle_workarea_->set_tooltip(_("Show work area")); |
1080 | 508 | m_toggle_workarea->set_perm_pressed(false); | 508 | toggle_workarea_->set_perm_pressed(false); |
1081 | 509 | } | 509 | } |
1082 | 510 | } | 510 | } |
1083 | 511 | } | 511 | } |
1084 | 512 | 512 | ||
1085 | 513 | 513 | ||
1086 | 514 | void BuildingWindow::toggle_workarea() { | 514 | void BuildingWindow::toggle_workarea() { |
1088 | 515 | if (m_workarea_overlay_id) { | 515 | if (workarea_overlay_id_) { |
1089 | 516 | hide_workarea(); | 516 | hide_workarea(); |
1090 | 517 | } else { | 517 | } else { |
1091 | 518 | show_workarea(); | 518 | show_workarea(); |
1092 | 519 | 519 | ||
1093 | === modified file 'src/wui/buildingwindow.h' | |||
1094 | --- src/wui/buildingwindow.h 2016-01-07 12:47:17 +0000 | |||
1095 | +++ src/wui/buildingwindow.h 2016-01-24 20:25:45 +0000 | |||
1096 | @@ -1,5 +1,5 @@ | |||
1097 | 1 | /* | 1 | /* |
1099 | 2 | * Copyright (C) 2002-2004, 2006-2010, 2012 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
1100 | 3 | * | 3 | * |
1101 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1102 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1103 | @@ -45,7 +45,7 @@ | |||
1104 | 45 | 45 | ||
1105 | 46 | virtual ~BuildingWindow(); | 46 | virtual ~BuildingWindow(); |
1106 | 47 | 47 | ||
1108 | 48 | Widelands::Building & building() {return m_building;} | 48 | Widelands::Building & building() {return building_;} |
1109 | 49 | 49 | ||
1110 | 50 | InteractiveGameBase & igbase() const { | 50 | InteractiveGameBase & igbase() const { |
1111 | 51 | return dynamic_cast<InteractiveGameBase&>(*get_parent()); | 51 | return dynamic_cast<InteractiveGameBase&>(*get_parent()); |
1112 | @@ -53,10 +53,10 @@ | |||
1113 | 53 | 53 | ||
1114 | 54 | void draw(RenderTarget &) override; | 54 | void draw(RenderTarget &) override; |
1115 | 55 | void think() override; | 55 | void think() override; |
1117 | 56 | void set_avoid_fastclick(bool afc) {m_avoid_fastclick = afc;} | 56 | void set_avoid_fastclick(bool afc) {avoid_fastclick_ = afc;} |
1118 | 57 | 57 | ||
1119 | 58 | protected: | 58 | protected: |
1121 | 59 | UI::TabPanel * get_tabs() {return m_tabs;} | 59 | UI::TabPanel * get_tabs() {return tabs_;} |
1122 | 60 | 60 | ||
1123 | 61 | void act_bulldoze(); | 61 | void act_bulldoze(); |
1124 | 62 | void act_dismantle(); | 62 | void act_dismantle(); |
1125 | @@ -75,23 +75,23 @@ | |||
1126 | 75 | 75 | ||
1127 | 76 | virtual void create_capsbuttons(UI::Box * buttons); | 76 | virtual void create_capsbuttons(UI::Box * buttons); |
1128 | 77 | 77 | ||
1130 | 78 | UI::Window * & m_registry; | 78 | UI::Window * & registry_; |
1131 | 79 | 79 | ||
1132 | 80 | private: | 80 | private: |
1139 | 81 | Widelands::Building& m_building; | 81 | Widelands::Building& building_; |
1140 | 82 | 82 | ||
1141 | 83 | UI::TabPanel * m_tabs; | 83 | UI::TabPanel * tabs_; |
1142 | 84 | 84 | ||
1143 | 85 | UI::Box * m_capsbuttons; ///< \ref UI::Box that contains capabilities buttons | 85 | UI::Box * capsbuttons_; ///< \ref UI::Box that contains capabilities buttons |
1144 | 86 | UI::Button * m_toggle_workarea; | 86 | UI::Button * toggle_workarea_; |
1145 | 87 | 87 | ||
1146 | 88 | // capabilities that were last used in setting up the caps panel | 88 | // capabilities that were last used in setting up the caps panel |
1150 | 89 | uint32_t m_capscache; | 89 | uint32_t capscache_; |
1151 | 90 | Widelands::PlayerNumber m_capscache_player_number; | 90 | Widelands::PlayerNumber capscache_player_number_; |
1152 | 91 | bool m_caps_setup; | 91 | bool caps_setup_; |
1153 | 92 | 92 | ||
1156 | 93 | FieldOverlayManager::OverlayId m_workarea_overlay_id; | 93 | FieldOverlayManager::OverlayId workarea_overlay_id_; |
1157 | 94 | bool m_avoid_fastclick; | 94 | bool avoid_fastclick_; |
1158 | 95 | }; | 95 | }; |
1159 | 96 | 96 | ||
1160 | 97 | #endif // end of include guard: WL_WUI_BUILDINGWINDOW_H | 97 | #endif // end of include guard: WL_WUI_BUILDINGWINDOW_H |
1161 | 98 | 98 | ||
1162 | === modified file 'src/wui/debugconsole.cc' | |||
1163 | --- src/wui/debugconsole.cc 2014-09-20 09:37:47 +0000 | |||
1164 | +++ src/wui/debugconsole.cc 2016-01-24 20:25:45 +0000 | |||
1165 | @@ -1,5 +1,5 @@ | |||
1166 | 1 | /* | 1 | /* |
1168 | 2 | * Copyright (C) 2008-2009 by the Widelands Development Team | 2 | * Copyright (C) 2008-2016 by the Widelands Development Team |
1169 | 3 | * | 3 | * |
1170 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1171 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1172 | @@ -136,7 +136,7 @@ | |||
1173 | 136 | // This check is an evil hack to account for the singleton-nature | 136 | // This check is an evil hack to account for the singleton-nature |
1174 | 137 | // of the Console | 137 | // of the Console |
1175 | 138 | if (this != &g_console) { | 138 | if (this != &g_console) { |
1177 | 139 | for (const auto& command : m_commands) { | 139 | for (const auto& command : commands_) { |
1178 | 140 | g_console.commands.erase(command); | 140 | g_console.commands.erase(command); |
1179 | 141 | } | 141 | } |
1180 | 142 | } | 142 | } |
1181 | @@ -145,7 +145,7 @@ | |||
1182 | 145 | void Handler::addCommand(const std::string & cmd, const HandlerFn & fun) | 145 | void Handler::addCommand(const std::string & cmd, const HandlerFn & fun) |
1183 | 146 | { | 146 | { |
1184 | 147 | g_console.commands[cmd] = fun; | 147 | g_console.commands[cmd] = fun; |
1186 | 148 | m_commands.push_back(cmd); | 148 | commands_.push_back(cmd); |
1187 | 149 | } | 149 | } |
1188 | 150 | 150 | ||
1189 | 151 | void Handler::setDefaultCommand(const HandlerFn & fun) | 151 | void Handler::setDefaultCommand(const HandlerFn & fun) |
1190 | 152 | 152 | ||
1191 | === modified file 'src/wui/debugconsole.h' | |||
1192 | --- src/wui/debugconsole.h 2014-09-19 09:07:14 +0000 | |||
1193 | +++ src/wui/debugconsole.h 2016-01-24 20:25:45 +0000 | |||
1194 | @@ -1,5 +1,5 @@ | |||
1195 | 1 | /* | 1 | /* |
1197 | 2 | * Copyright (C) 2008-2010 by the Widelands Development Team | 2 | * Copyright (C) 2008-2016 by the Widelands Development Team |
1198 | 3 | * | 3 | * |
1199 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1200 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1201 | @@ -60,7 +60,7 @@ | |||
1202 | 60 | void setDefaultCommand(const HandlerFn &); | 60 | void setDefaultCommand(const HandlerFn &); |
1203 | 61 | 61 | ||
1204 | 62 | private: | 62 | private: |
1206 | 63 | std::vector<std::string> m_commands; | 63 | std::vector<std::string> commands_; |
1207 | 64 | }; | 64 | }; |
1208 | 65 | 65 | ||
1209 | 66 | /** | 66 | /** |
1210 | 67 | 67 | ||
1211 | === modified file 'src/wui/edge_overlay_manager.cc' | |||
1212 | --- src/wui/edge_overlay_manager.cc 2015-03-29 18:07:45 +0000 | |||
1213 | +++ src/wui/edge_overlay_manager.cc 2016-01-24 20:25:45 +0000 | |||
1214 | @@ -1,5 +1,5 @@ | |||
1215 | 1 | /* | 1 | /* |
1217 | 2 | * Copyright (C) 2006-2015 by the Widelands Development Team | 2 | * Copyright (C) 2006-2016 by the Widelands Development Team |
1218 | 3 | * | 3 | * |
1219 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1220 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1221 | @@ -19,21 +19,21 @@ | |||
1222 | 19 | 19 | ||
1223 | 20 | #include "wui/edge_overlay_manager.h" | 20 | #include "wui/edge_overlay_manager.h" |
1224 | 21 | 21 | ||
1226 | 22 | EdgeOverlayManager::EdgeOverlayManager() : m_current_overlay_id(0) { | 22 | EdgeOverlayManager::EdgeOverlayManager() : current_overlay_id_(0) { |
1227 | 23 | } | 23 | } |
1228 | 24 | 24 | ||
1229 | 25 | EdgeOverlayManager::OverlayId EdgeOverlayManager::next_overlay_id() { | 25 | EdgeOverlayManager::OverlayId EdgeOverlayManager::next_overlay_id() { |
1232 | 26 | ++m_current_overlay_id; | 26 | ++current_overlay_id_; |
1233 | 27 | return m_current_overlay_id; | 27 | return current_overlay_id_; |
1234 | 28 | } | 28 | } |
1235 | 29 | 29 | ||
1236 | 30 | void EdgeOverlayManager::register_overlay | 30 | void EdgeOverlayManager::register_overlay |
1237 | 31 | (Widelands::Coords const c, uint8_t const where, OverlayId const overlay_id) | 31 | (Widelands::Coords const c, uint8_t const where, OverlayId const overlay_id) |
1238 | 32 | { | 32 | { |
1239 | 33 | const RegisteredRoadOverlays overlay = {overlay_id, where}; | 33 | const RegisteredRoadOverlays overlay = {overlay_id, where}; |
1243 | 34 | RegisteredRoadOverlaysMap::iterator it = m_overlays.find(c); | 34 | RegisteredRoadOverlaysMap::iterator it = overlays_.find(c); |
1244 | 35 | if (it == m_overlays.end()) | 35 | if (it == overlays_.end()) |
1245 | 36 | m_overlays.insert | 36 | overlays_.insert |
1246 | 37 | (std::pair<const Widelands::Coords, | 37 | (std::pair<const Widelands::Coords, |
1247 | 38 | RegisteredRoadOverlays>(c, overlay)); | 38 | RegisteredRoadOverlays>(c, overlay)); |
1248 | 39 | else | 39 | else |
1249 | @@ -41,25 +41,25 @@ | |||
1250 | 41 | } | 41 | } |
1251 | 42 | 42 | ||
1252 | 43 | void EdgeOverlayManager::remove_overlay(const Widelands::Coords c) { | 43 | void EdgeOverlayManager::remove_overlay(const Widelands::Coords c) { |
1256 | 44 | const RegisteredRoadOverlaysMap::iterator it = m_overlays.find(c); | 44 | const RegisteredRoadOverlaysMap::iterator it = overlays_.find(c); |
1257 | 45 | if (it != m_overlays.end()) | 45 | if (it != overlays_.end()) |
1258 | 46 | m_overlays.erase(it); | 46 | overlays_.erase(it); |
1259 | 47 | } | 47 | } |
1260 | 48 | 48 | ||
1261 | 49 | void EdgeOverlayManager::remove_overlay(OverlayId const overlay_id) { | 49 | void EdgeOverlayManager::remove_overlay(OverlayId const overlay_id) { |
1263 | 50 | RegisteredRoadOverlaysMap::iterator it = m_overlays.begin(); | 50 | RegisteredRoadOverlaysMap::iterator it = overlays_.begin(); |
1264 | 51 | const RegisteredRoadOverlaysMap::const_iterator end = | 51 | const RegisteredRoadOverlaysMap::const_iterator end = |
1266 | 52 | m_overlays.end(); | 52 | overlays_.end(); |
1267 | 53 | while (it != end) | 53 | while (it != end) |
1268 | 54 | if (it->second.overlay_id == overlay_id) | 54 | if (it->second.overlay_id == overlay_id) |
1270 | 55 | m_overlays.erase(it++); // Necessary! | 55 | overlays_.erase(it++); // Necessary! |
1271 | 56 | else | 56 | else |
1272 | 57 | ++it; | 57 | ++it; |
1273 | 58 | } | 58 | } |
1274 | 59 | 59 | ||
1275 | 60 | uint8_t EdgeOverlayManager::get_overlay(const Widelands::Coords c) const { | 60 | uint8_t EdgeOverlayManager::get_overlay(const Widelands::Coords c) const { |
1278 | 61 | RegisteredRoadOverlaysMap::const_iterator const it = m_overlays.find(c); | 61 | RegisteredRoadOverlaysMap::const_iterator const it = overlays_.find(c); |
1279 | 62 | if (it != m_overlays.end()) | 62 | if (it != overlays_.end()) |
1280 | 63 | return it->second.where; | 63 | return it->second.where; |
1281 | 64 | return 0; | 64 | return 0; |
1282 | 65 | } | 65 | } |
1283 | 66 | 66 | ||
1284 | === modified file 'src/wui/edge_overlay_manager.h' | |||
1285 | --- src/wui/edge_overlay_manager.h 2015-03-29 18:07:45 +0000 | |||
1286 | +++ src/wui/edge_overlay_manager.h 2016-01-24 20:25:45 +0000 | |||
1287 | @@ -54,8 +54,8 @@ | |||
1288 | 54 | using RegisteredRoadOverlaysMap = | 54 | using RegisteredRoadOverlaysMap = |
1289 | 55 | std::map<const Widelands::Coords, RegisteredRoadOverlays, Widelands::Coords::OrderingFunctor>; | 55 | std::map<const Widelands::Coords, RegisteredRoadOverlays, Widelands::Coords::OrderingFunctor>; |
1290 | 56 | 56 | ||
1293 | 57 | OverlayId m_current_overlay_id; | 57 | OverlayId current_overlay_id_; |
1294 | 58 | RegisteredRoadOverlaysMap m_overlays; | 58 | RegisteredRoadOverlaysMap overlays_; |
1295 | 59 | 59 | ||
1296 | 60 | DISALLOW_COPY_AND_ASSIGN(EdgeOverlayManager); | 60 | DISALLOW_COPY_AND_ASSIGN(EdgeOverlayManager); |
1297 | 61 | }; | 61 | }; |
1298 | 62 | 62 | ||
1299 | === modified file 'src/wui/field_overlay_manager.cc' | |||
1300 | --- src/wui/field_overlay_manager.cc 2016-01-15 19:48:47 +0000 | |||
1301 | +++ src/wui/field_overlay_manager.cc 2016-01-24 20:25:45 +0000 | |||
1302 | @@ -1,5 +1,5 @@ | |||
1303 | 1 | /* | 1 | /* |
1305 | 2 | * Copyright (C) 2002-2004, 2006-2008, 2010-2011, 2013 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
1306 | 3 | * | 3 | * |
1307 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1308 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1309 | @@ -26,8 +26,8 @@ | |||
1310 | 26 | #include "graphic/graphic.h" | 26 | #include "graphic/graphic.h" |
1311 | 27 | #include "logic/field.h" | 27 | #include "logic/field.h" |
1312 | 28 | 28 | ||
1315 | 29 | FieldOverlayManager::FieldOverlayManager() : m_current_overlay_id(0) { | 29 | FieldOverlayManager::FieldOverlayManager() : current_overlay_id_(0) { |
1316 | 30 | OverlayInfo * buildhelp_info = m_buildhelp_infos; | 30 | OverlayInfo * buildhelp_info = buildhelp_infos_; |
1317 | 31 | const char * filenames[] = { | 31 | const char * filenames[] = { |
1318 | 32 | "pics/set_flag.png", | 32 | "pics/set_flag.png", |
1319 | 33 | "pics/small.png", | 33 | "pics/small.png", |
1320 | @@ -55,16 +55,16 @@ | |||
1321 | 55 | } | 55 | } |
1322 | 56 | 56 | ||
1323 | 57 | bool FieldOverlayManager::buildhelp() const { | 57 | bool FieldOverlayManager::buildhelp() const { |
1325 | 58 | return m_buildhelp; | 58 | return buildhelp_; |
1326 | 59 | } | 59 | } |
1327 | 60 | 60 | ||
1328 | 61 | void FieldOverlayManager::show_buildhelp(const bool value) { | 61 | void FieldOverlayManager::show_buildhelp(const bool value) { |
1330 | 62 | m_buildhelp = value; | 62 | buildhelp_ = value; |
1331 | 63 | } | 63 | } |
1332 | 64 | 64 | ||
1333 | 65 | void FieldOverlayManager::get_overlays(Widelands::FCoords const c, | 65 | void FieldOverlayManager::get_overlays(Widelands::FCoords const c, |
1334 | 66 | std::vector<OverlayInfo>* result) const { | 66 | std::vector<OverlayInfo>* result) const { |
1336 | 67 | const RegisteredOverlaysMap & overlay_map = m_overlays[Widelands::TCoords<>::None]; | 67 | const RegisteredOverlaysMap & overlay_map = overlays_[Widelands::TCoords<>::None]; |
1337 | 68 | RegisteredOverlaysMap::const_iterator it = overlay_map.lower_bound(c); | 68 | RegisteredOverlaysMap::const_iterator it = overlay_map.lower_bound(c); |
1338 | 69 | 69 | ||
1339 | 70 | while (it != overlay_map.end() && it->first == c && it->second.level <= kLevelForBuildHelp) { | 70 | while (it != overlay_map.end() && it->first == c && it->second.level <= kLevelForBuildHelp) { |
1340 | @@ -72,10 +72,10 @@ | |||
1341 | 72 | ++it; | 72 | ++it; |
1342 | 73 | } | 73 | } |
1343 | 74 | 74 | ||
1345 | 75 | if (m_buildhelp) { | 75 | if (buildhelp_) { |
1346 | 76 | int buildhelp_overlay_index = get_buildhelp_overlay(c); | 76 | int buildhelp_overlay_index = get_buildhelp_overlay(c); |
1347 | 77 | if (buildhelp_overlay_index < Widelands::Field::Buildhelp_None) { | 77 | if (buildhelp_overlay_index < Widelands::Field::Buildhelp_None) { |
1349 | 78 | result->emplace_back(m_buildhelp_infos[buildhelp_overlay_index]); | 78 | result->emplace_back(buildhelp_infos_[buildhelp_overlay_index]); |
1350 | 79 | } | 79 | } |
1351 | 80 | } | 80 | } |
1352 | 81 | 81 | ||
1353 | @@ -90,7 +90,7 @@ | |||
1354 | 90 | assert(c.t == Widelands::TCoords<>::D || c.t == Widelands::TCoords<>::R); | 90 | assert(c.t == Widelands::TCoords<>::D || c.t == Widelands::TCoords<>::R); |
1355 | 91 | 91 | ||
1356 | 92 | 92 | ||
1358 | 93 | const RegisteredOverlaysMap & overlay_map = m_overlays[c.t]; | 93 | const RegisteredOverlaysMap & overlay_map = overlays_[c.t]; |
1359 | 94 | RegisteredOverlaysMap::const_iterator it = overlay_map.lower_bound(c); | 94 | RegisteredOverlaysMap::const_iterator it = overlay_map.lower_bound(c); |
1360 | 95 | while (it != overlay_map.end() && it->first == c) { | 95 | while (it != overlay_map.end() && it->first == c) { |
1361 | 96 | result->emplace_back(it->second.pic, it->second.hotspot); | 96 | result->emplace_back(it->second.pic, it->second.hotspot); |
1362 | @@ -100,7 +100,7 @@ | |||
1363 | 100 | 100 | ||
1364 | 101 | int FieldOverlayManager::get_buildhelp_overlay(const Widelands::FCoords& fc) const { | 101 | int FieldOverlayManager::get_buildhelp_overlay(const Widelands::FCoords& fc) const { |
1365 | 102 | Widelands::NodeCaps const caps = | 102 | Widelands::NodeCaps const caps = |
1367 | 103 | m_callback ? static_cast<Widelands::NodeCaps>(m_callback(fc)) : fc.field->nodecaps(); | 103 | callback_ ? static_cast<Widelands::NodeCaps>(callback_(fc)) : fc.field->nodecaps(); |
1368 | 104 | 104 | ||
1369 | 105 | const int value = caps & Widelands::BUILDCAPS_MINE ? | 105 | const int value = caps & Widelands::BUILDCAPS_MINE ? |
1370 | 106 | Widelands::Field::Buildhelp_Mine : | 106 | Widelands::Field::Buildhelp_Mine : |
1371 | @@ -130,7 +130,7 @@ | |||
1372 | 130 | hotspot = Point(pic->width() / 2, pic->height() / 2); | 130 | hotspot = Point(pic->width() / 2, pic->height() / 2); |
1373 | 131 | } | 131 | } |
1374 | 132 | 132 | ||
1376 | 133 | RegisteredOverlaysMap & overlay_map = m_overlays[c.t]; | 133 | RegisteredOverlaysMap & overlay_map = overlays_[c.t]; |
1377 | 134 | for | 134 | for |
1378 | 135 | (RegisteredOverlaysMap::iterator it = overlay_map.find(c); | 135 | (RegisteredOverlaysMap::iterator it = overlay_map.find(c); |
1379 | 136 | it != overlay_map.end() && it->first == c; | 136 | it != overlay_map.end() && it->first == c; |
1380 | @@ -180,7 +180,7 @@ | |||
1381 | 180 | void FieldOverlayManager::remove_overlay(Widelands::TCoords<> const c, const Image* pic) { | 180 | void FieldOverlayManager::remove_overlay(Widelands::TCoords<> const c, const Image* pic) { |
1382 | 181 | assert(c.t <= 2); | 181 | assert(c.t <= 2); |
1383 | 182 | 182 | ||
1385 | 183 | RegisteredOverlaysMap & overlay_map = m_overlays[c.t]; | 183 | RegisteredOverlaysMap & overlay_map = overlays_[c.t]; |
1386 | 184 | 184 | ||
1387 | 185 | if (overlay_map.count(c)) { | 185 | if (overlay_map.count(c)) { |
1388 | 186 | RegisteredOverlaysMap::iterator it = overlay_map.lower_bound(c); | 186 | RegisteredOverlaysMap::iterator it = overlay_map.lower_bound(c); |
1389 | @@ -196,8 +196,8 @@ | |||
1390 | 196 | } | 196 | } |
1391 | 197 | 197 | ||
1392 | 198 | void FieldOverlayManager::remove_overlay(const OverlayId overlay_id) { | 198 | void FieldOverlayManager::remove_overlay(const OverlayId overlay_id) { |
1395 | 199 | const RegisteredOverlaysMap * const overlays_end = m_overlays + 3; | 199 | const RegisteredOverlaysMap * const overlays_end = overlays_ + 3; |
1396 | 200 | for (RegisteredOverlaysMap * j = m_overlays; j != overlays_end; ++j) | 200 | for (RegisteredOverlaysMap * j = overlays_; j != overlays_end; ++j) |
1397 | 201 | for (RegisteredOverlaysMap::iterator it = j->begin(); it != j->end();) { | 201 | for (RegisteredOverlaysMap::iterator it = j->begin(); it != j->end();) { |
1398 | 202 | it->second.overlay_ids.erase(overlay_id); | 202 | it->second.overlay_ids.erase(overlay_id); |
1399 | 203 | if (it->second.overlay_ids.empty()) | 203 | if (it->second.overlay_ids.empty()) |
1400 | @@ -208,16 +208,16 @@ | |||
1401 | 208 | } | 208 | } |
1402 | 209 | 209 | ||
1403 | 210 | void FieldOverlayManager::remove_all_overlays() { | 210 | void FieldOverlayManager::remove_all_overlays() { |
1407 | 211 | m_overlays[0].clear(); | 211 | overlays_[0].clear(); |
1408 | 212 | m_overlays[1].clear(); | 212 | overlays_[1].clear(); |
1409 | 213 | m_overlays[2].clear(); | 213 | overlays_[2].clear(); |
1410 | 214 | } | 214 | } |
1411 | 215 | 215 | ||
1412 | 216 | void FieldOverlayManager::register_overlay_callback_function(CallbackFn function) { | 216 | void FieldOverlayManager::register_overlay_callback_function(CallbackFn function) { |
1414 | 217 | m_callback = function; | 217 | callback_ = function; |
1415 | 218 | } | 218 | } |
1416 | 219 | 219 | ||
1417 | 220 | FieldOverlayManager::OverlayId FieldOverlayManager::next_overlay_id() { | 220 | FieldOverlayManager::OverlayId FieldOverlayManager::next_overlay_id() { |
1420 | 221 | ++m_current_overlay_id; | 221 | ++current_overlay_id_; |
1421 | 222 | return m_current_overlay_id; | 222 | return current_overlay_id_; |
1422 | 223 | } | 223 | } |
1423 | 224 | 224 | ||
1424 | === modified file 'src/wui/field_overlay_manager.h' | |||
1425 | --- src/wui/field_overlay_manager.h 2016-01-15 19:48:47 +0000 | |||
1426 | +++ src/wui/field_overlay_manager.h 2016-01-24 20:25:45 +0000 | |||
1427 | @@ -126,19 +126,19 @@ | |||
1428 | 126 | RegisteredOverlays, | 126 | RegisteredOverlays, |
1429 | 127 | Widelands::Coords::OrderingFunctor>; | 127 | Widelands::Coords::OrderingFunctor>; |
1430 | 128 | 128 | ||
1433 | 129 | // Returns the index into m_buildhelp_infos for the correct fieldcaps for | 129 | // Returns the index into buildhelp_infos_ for the correct fieldcaps for |
1434 | 130 | // 'fc' according to the current 'm_callback'. | 130 | // 'fc' according to the current 'callback_'. |
1435 | 131 | int get_buildhelp_overlay(const Widelands::FCoords& fc) const; | 131 | int get_buildhelp_overlay(const Widelands::FCoords& fc) const; |
1436 | 132 | 132 | ||
1437 | 133 | // indexed by TCoords<>::TriangleIndex | 133 | // indexed by TCoords<>::TriangleIndex |
1439 | 134 | RegisteredOverlaysMap m_overlays[3]; | 134 | RegisteredOverlaysMap overlays_[3]; |
1440 | 135 | 135 | ||
1443 | 136 | OverlayInfo m_buildhelp_infos[Widelands::Field::Buildhelp_None]; | 136 | OverlayInfo buildhelp_infos_[Widelands::Field::Buildhelp_None]; |
1444 | 137 | bool m_buildhelp; | 137 | bool buildhelp_; |
1445 | 138 | 138 | ||
1446 | 139 | // this callback is used to define where overlays are drawn. | 139 | // this callback is used to define where overlays are drawn. |
1449 | 140 | CallbackFn m_callback; | 140 | CallbackFn callback_; |
1450 | 141 | OverlayId m_current_overlay_id; | 141 | OverlayId current_overlay_id_; |
1451 | 142 | }; | 142 | }; |
1452 | 143 | 143 | ||
1453 | 144 | #endif // end of include guard: WL_WUI_FIELD_OVERLAY_MANAGER_H | 144 | #endif // end of include guard: WL_WUI_FIELD_OVERLAY_MANAGER_H |
1454 | 145 | 145 | ||
1455 | === modified file 'src/wui/game_chat_menu.cc' | |||
1456 | --- src/wui/game_chat_menu.cc 2014-09-20 09:37:47 +0000 | |||
1457 | +++ src/wui/game_chat_menu.cc 2016-01-24 20:25:45 +0000 | |||
1458 | @@ -1,5 +1,5 @@ | |||
1459 | 1 | /* | 1 | /* |
1461 | 2 | * Copyright (C) 2002-2004, 2006-2008, 2011 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
1462 | 3 | * | 3 | * |
1463 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1464 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1465 | @@ -36,17 +36,17 @@ | |||
1466 | 36 | const std::string & title) | 36 | const std::string & title) |
1467 | 37 | : | 37 | : |
1468 | 38 | UI::UniqueWindow(parent, "chat", ®istry, 440, 235, title), | 38 | UI::UniqueWindow(parent, "chat", ®istry, 440, 235, title), |
1470 | 39 | m_chat(this, 5, 5, get_inner_w() - 10, get_inner_h() - 10, chat) | 39 | chat_(this, 5, 5, get_inner_w() - 10, get_inner_h() - 10, chat) |
1471 | 40 | { | 40 | { |
1472 | 41 | if (get_usedefaultpos()) | 41 | if (get_usedefaultpos()) |
1473 | 42 | center_to_parent(); | 42 | center_to_parent(); |
1474 | 43 | 43 | ||
1481 | 44 | m_close_on_send = false; | 44 | close_on_send_ = false; |
1482 | 45 | 45 | ||
1483 | 46 | m_chat.sent.connect(boost::bind(&GameChatMenu::acknowledge, this)); | 46 | chat_.sent.connect(boost::bind(&GameChatMenu::acknowledge, this)); |
1484 | 47 | m_chat.aborted.connect(boost::bind(&GameChatMenu::acknowledge, this)); | 47 | chat_.aborted.connect(boost::bind(&GameChatMenu::acknowledge, this)); |
1485 | 48 | 48 | ||
1486 | 49 | enter_chat_message(m_close_on_send); | 49 | enter_chat_message(close_on_send_); |
1487 | 50 | } | 50 | } |
1488 | 51 | 51 | ||
1489 | 52 | GameChatMenu* GameChatMenu::create_chat_console( | 52 | GameChatMenu* GameChatMenu::create_chat_console( |
1490 | @@ -67,13 +67,13 @@ | |||
1491 | 67 | 67 | ||
1492 | 68 | void GameChatMenu::enter_chat_message(bool close_on_send) | 68 | void GameChatMenu::enter_chat_message(bool close_on_send) |
1493 | 69 | { | 69 | { |
1496 | 70 | m_chat.focus_edit(); | 70 | chat_.focus_edit(); |
1497 | 71 | m_close_on_send = close_on_send; | 71 | close_on_send_ = close_on_send; |
1498 | 72 | } | 72 | } |
1499 | 73 | 73 | ||
1500 | 74 | 74 | ||
1501 | 75 | void GameChatMenu::acknowledge() | 75 | void GameChatMenu::acknowledge() |
1502 | 76 | { | 76 | { |
1504 | 77 | if (m_close_on_send) | 77 | if (close_on_send_) |
1505 | 78 | die(); | 78 | die(); |
1506 | 79 | } | 79 | } |
1507 | 80 | 80 | ||
1508 | === modified file 'src/wui/game_chat_menu.h' | |||
1509 | --- src/wui/game_chat_menu.h 2014-07-05 16:41:51 +0000 | |||
1510 | +++ src/wui/game_chat_menu.h 2016-01-24 20:25:45 +0000 | |||
1511 | @@ -1,5 +1,5 @@ | |||
1512 | 1 | /* | 1 | /* |
1514 | 2 | * Copyright (C) 2002-2004, 2006, 2008 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016, 2008 by the Widelands Development Team |
1515 | 3 | * | 3 | * |
1516 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1517 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1518 | @@ -50,8 +50,8 @@ | |||
1519 | 50 | private: | 50 | private: |
1520 | 51 | GameChatMenu(UI::Panel *, UI::UniqueWindow::Registry &, ChatProvider &, const std::string & title); | 51 | GameChatMenu(UI::Panel *, UI::UniqueWindow::Registry &, ChatProvider &, const std::string & title); |
1521 | 52 | void acknowledge(); | 52 | void acknowledge(); |
1524 | 53 | GameChatPanel m_chat; | 53 | GameChatPanel chat_; |
1525 | 54 | bool m_close_on_send; | 54 | bool close_on_send_; |
1526 | 55 | }; | 55 | }; |
1527 | 56 | 56 | ||
1528 | 57 | #endif // end of include guard: WL_WUI_GAME_CHAT_MENU_H | 57 | #endif // end of include guard: WL_WUI_GAME_CHAT_MENU_H |
1529 | 58 | 58 | ||
1530 | === modified file 'src/wui/game_main_menu.cc' | |||
1531 | --- src/wui/game_main_menu.cc 2014-10-11 09:11:29 +0000 | |||
1532 | +++ src/wui/game_main_menu.cc 2016-01-24 20:25:45 +0000 | |||
1533 | @@ -1,5 +1,5 @@ | |||
1534 | 1 | /* | 1 | /* |
1536 | 2 | * Copyright (C) 2002-2004, 2006, 2008 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
1537 | 3 | * | 3 | * |
1538 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1539 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1540 | @@ -37,8 +37,8 @@ | |||
1541 | 37 | InteractivePlayer::GameMainMenuWindows & windows) | 37 | InteractivePlayer::GameMainMenuWindows & windows) |
1542 | 38 | : | 38 | : |
1543 | 39 | UI::UniqueWindow(&plr, "main_menu", ®istry, 180, 55, _("Statistics Menu")), | 39 | UI::UniqueWindow(&plr, "main_menu", ®istry, 180, 55, _("Statistics Menu")), |
1546 | 40 | m_player (plr), | 40 | player_ (plr), |
1547 | 41 | m_windows (windows), | 41 | windows_ (windows), |
1548 | 42 | general_stats | 42 | general_stats |
1549 | 43 | (this, "general_stats", | 43 | (this, "general_stats", |
1550 | 44 | posx(0, 4), posy(0, 3), buttonw(4), buttonh(1), | 44 | posx(0, 4), posy(0, 3), buttonw(4), buttonh(1), |
1551 | @@ -65,13 +65,13 @@ | |||
1552 | 65 | _("Stock")) | 65 | _("Stock")) |
1553 | 66 | { | 66 | { |
1554 | 67 | general_stats.sigclicked.connect | 67 | general_stats.sigclicked.connect |
1556 | 68 | (boost::bind(&GeneralStatisticsMenu::Registry::toggle, boost::ref(m_windows.general_stats))); | 68 | (boost::bind(&GeneralStatisticsMenu::Registry::toggle, boost::ref(windows_.general_stats))); |
1557 | 69 | ware_stats.sigclicked.connect | 69 | ware_stats.sigclicked.connect |
1559 | 70 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.ware_stats))); | 70 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(windows_.ware_stats))); |
1560 | 71 | building_stats.sigclicked.connect | 71 | building_stats.sigclicked.connect |
1562 | 72 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.building_stats))); | 72 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(windows_.building_stats))); |
1563 | 73 | stock.sigclicked.connect | 73 | stock.sigclicked.connect |
1565 | 74 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.stock))); | 74 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(windows_.stock))); |
1566 | 75 | 75 | ||
1567 | 76 | #define INIT_BTN_HOOKS(registry, btn) \ | 76 | #define INIT_BTN_HOOKS(registry, btn) \ |
1568 | 77 | assert (!registry.on_create); \ | 77 | assert (!registry.on_create); \ |
1569 | @@ -80,19 +80,19 @@ | |||
1570 | 80 | registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \ | 80 | registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \ |
1571 | 81 | if (registry.window) btn.set_perm_pressed(true); \ | 81 | if (registry.window) btn.set_perm_pressed(true); \ |
1572 | 82 | 82 | ||
1577 | 83 | INIT_BTN_HOOKS(m_windows.general_stats, general_stats) | 83 | INIT_BTN_HOOKS(windows_.general_stats, general_stats) |
1578 | 84 | INIT_BTN_HOOKS(m_windows.ware_stats, ware_stats) | 84 | INIT_BTN_HOOKS(windows_.ware_stats, ware_stats) |
1579 | 85 | INIT_BTN_HOOKS(m_windows.building_stats, building_stats) | 85 | INIT_BTN_HOOKS(windows_.building_stats, building_stats) |
1580 | 86 | INIT_BTN_HOOKS(m_windows.stock, stock) | 86 | INIT_BTN_HOOKS(windows_.stock, stock) |
1581 | 87 | 87 | ||
1590 | 88 | m_windows.general_stats.open_window = [this] { | 88 | windows_.general_stats.open_window = [this] { |
1591 | 89 | new GeneralStatisticsMenu(m_player, m_windows.general_stats); | 89 | new GeneralStatisticsMenu(player_, windows_.general_stats); |
1592 | 90 | }; | 90 | }; |
1593 | 91 | m_windows.ware_stats.open_window = [this] { | 91 | windows_.ware_stats.open_window = [this] { |
1594 | 92 | new WareStatisticsMenu(m_player, m_windows.ware_stats); | 92 | new WareStatisticsMenu(player_, windows_.ware_stats); |
1595 | 93 | }; | 93 | }; |
1596 | 94 | m_windows.building_stats.open_window = [this] { | 94 | windows_.building_stats.open_window = [this] { |
1597 | 95 | new BuildingStatisticsMenu(m_player, m_windows.building_stats); | 95 | new BuildingStatisticsMenu(player_, windows_.building_stats); |
1598 | 96 | }; | 96 | }; |
1599 | 97 | 97 | ||
1600 | 98 | if (get_usedefaultpos()) | 98 | if (get_usedefaultpos()) |
1601 | @@ -109,8 +109,8 @@ | |||
1602 | 109 | registry.on_create = 0; \ | 109 | registry.on_create = 0; \ |
1603 | 110 | registry.on_delete = 0; | 110 | registry.on_delete = 0; |
1604 | 111 | 111 | ||
1609 | 112 | DEINIT_BTN_HOOKS(m_windows.general_stats, general_stats) | 112 | DEINIT_BTN_HOOKS(windows_.general_stats, general_stats) |
1610 | 113 | DEINIT_BTN_HOOKS(m_windows.ware_stats, ware_stats) | 113 | DEINIT_BTN_HOOKS(windows_.ware_stats, ware_stats) |
1611 | 114 | DEINIT_BTN_HOOKS(m_windows.building_stats, building_stats) | 114 | DEINIT_BTN_HOOKS(windows_.building_stats, building_stats) |
1612 | 115 | DEINIT_BTN_HOOKS(m_windows.stock, stock) | 115 | DEINIT_BTN_HOOKS(windows_.stock, stock) |
1613 | 116 | } | 116 | } |
1614 | 117 | 117 | ||
1615 | === modified file 'src/wui/game_main_menu.h' | |||
1616 | --- src/wui/game_main_menu.h 2014-09-10 16:57:31 +0000 | |||
1617 | +++ src/wui/game_main_menu.h 2016-01-24 20:25:45 +0000 | |||
1618 | @@ -1,5 +1,5 @@ | |||
1619 | 1 | /* | 1 | /* |
1621 | 2 | * Copyright (C) 2002-2004, 2006, 2008 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
1622 | 3 | * | 3 | * |
1623 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1624 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1625 | @@ -33,8 +33,8 @@ | |||
1626 | 33 | ~GameMainMenu(); | 33 | ~GameMainMenu(); |
1627 | 34 | 34 | ||
1628 | 35 | private: | 35 | private: |
1631 | 36 | InteractivePlayer & m_player; | 36 | InteractivePlayer & player_; |
1632 | 37 | InteractivePlayer::GameMainMenuWindows & m_windows; | 37 | InteractivePlayer::GameMainMenuWindows & windows_; |
1633 | 38 | UI::Button general_stats; | 38 | UI::Button general_stats; |
1634 | 39 | UI::Button ware_stats; | 39 | UI::Button ware_stats; |
1635 | 40 | UI::Button building_stats; | 40 | UI::Button building_stats; |
1636 | 41 | 41 | ||
1637 | === modified file 'src/wui/game_main_menu_save_game.cc' | |||
1638 | --- src/wui/game_main_menu_save_game.cc 2015-11-01 10:11:56 +0000 | |||
1639 | +++ src/wui/game_main_menu_save_game.cc 2016-01-24 20:25:45 +0000 | |||
1640 | @@ -1,5 +1,5 @@ | |||
1641 | 1 | /* | 1 | /* |
1643 | 2 | * Copyright (C) 2002-2004, 2006-2008, 2010-2013 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
1644 | 3 | * | 3 | * |
1645 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1646 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1647 | @@ -59,31 +59,31 @@ | |||
1648 | 59 | UI::UniqueWindow | 59 | UI::UniqueWindow |
1649 | 60 | (&parent, "save_game", ®istry, | 60 | (&parent, "save_game", ®istry, |
1650 | 61 | WINDOW_WIDTH, WINDOW_HEIGHT, _("Save Game")), | 61 | WINDOW_WIDTH, WINDOW_HEIGHT, _("Save Game")), |
1653 | 62 | m_ls (this, HSPACING, VSPACING, LIST_WIDTH, LIST_HEIGHT), | 62 | ls_ (this, HSPACING, VSPACING, LIST_WIDTH, LIST_HEIGHT), |
1654 | 63 | m_name_label | 63 | name_label_ |
1655 | 64 | (this, DESCRIPTION_X, 5, 0, 20, _("Map Name:"), UI::Align_CenterLeft), | 64 | (this, DESCRIPTION_X, 5, 0, 20, _("Map Name:"), UI::Align_CenterLeft), |
1657 | 65 | m_mapname | 65 | mapname_ |
1658 | 66 | (this, DESCRIPTION_X, 20, 0, 20, " ", UI::Align_CenterLeft), | 66 | (this, DESCRIPTION_X, 20, 0, 20, " ", UI::Align_CenterLeft), |
1660 | 67 | m_gametime_label | 67 | gametime_label_ |
1661 | 68 | (this, DESCRIPTION_X, 45, 0, 20, _("Game Time:"), UI::Align_CenterLeft), | 68 | (this, DESCRIPTION_X, 45, 0, 20, _("Game Time:"), UI::Align_CenterLeft), |
1663 | 69 | m_gametime | 69 | gametime_ |
1664 | 70 | (this, DESCRIPTION_X, 60, 0, 20, " ", UI::Align_CenterLeft), | 70 | (this, DESCRIPTION_X, 60, 0, 20, " ", UI::Align_CenterLeft), |
1666 | 71 | m_players_label | 71 | players_label_ |
1667 | 72 | (this, DESCRIPTION_X, 85, 0, 20, " ", UI::Align_CenterLeft), | 72 | (this, DESCRIPTION_X, 85, 0, 20, " ", UI::Align_CenterLeft), |
1669 | 73 | m_win_condition_label | 73 | win_condition_label_ |
1670 | 74 | (this, DESCRIPTION_X, 110, 0, 20, _("Win condition:"), UI::Align_CenterLeft), | 74 | (this, DESCRIPTION_X, 110, 0, 20, _("Win condition:"), UI::Align_CenterLeft), |
1672 | 75 | m_win_condition | 75 | win_condition_ |
1673 | 76 | (this, DESCRIPTION_X, 125, 0, 20, " ", UI::Align_CenterLeft), | 76 | (this, DESCRIPTION_X, 125, 0, 20, " ", UI::Align_CenterLeft), |
1675 | 77 | m_curdir(SaveHandler::get_base_dir()) | 77 | curdir_(SaveHandler::get_base_dir()) |
1676 | 78 | { | 78 | { |
1678 | 79 | m_editbox = | 79 | editbox_ = |
1679 | 80 | new UI::EditBox | 80 | new UI::EditBox |
1680 | 81 | (this, HSPACING, EDITBOX_Y, LIST_WIDTH, EDITBOX_HEIGHT, | 81 | (this, HSPACING, EDITBOX_Y, LIST_WIDTH, EDITBOX_HEIGHT, |
1681 | 82 | g_gr->images().get("pics/but1.png")); | 82 | g_gr->images().get("pics/but1.png")); |
1684 | 83 | m_editbox->changed.connect(boost::bind(&GameMainMenuSaveGame::edit_box_changed, this)); | 83 | editbox_->changed.connect(boost::bind(&GameMainMenuSaveGame::edit_box_changed, this)); |
1685 | 84 | m_editbox->ok.connect(boost::bind(&GameMainMenuSaveGame::ok, this)); | 84 | editbox_->ok.connect(boost::bind(&GameMainMenuSaveGame::ok, this)); |
1686 | 85 | 85 | ||
1688 | 86 | m_button_ok = | 86 | button_ok_ = |
1689 | 87 | new UI::Button | 87 | new UI::Button |
1690 | 88 | (this, "ok", | 88 | (this, "ok", |
1691 | 89 | DESCRIPTION_X, OK_Y, DESCRIPTION_WIDTH, BUTTON_HEIGHT, | 89 | DESCRIPTION_X, OK_Y, DESCRIPTION_WIDTH, BUTTON_HEIGHT, |
1692 | @@ -91,7 +91,7 @@ | |||
1693 | 91 | _("OK"), | 91 | _("OK"), |
1694 | 92 | std::string(), | 92 | std::string(), |
1695 | 93 | false); | 93 | false); |
1697 | 94 | m_button_ok->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::ok, this)); | 94 | button_ok_->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::ok, this)); |
1698 | 95 | 95 | ||
1699 | 96 | UI::Button * cancelbtn = | 96 | UI::Button * cancelbtn = |
1700 | 97 | new UI::Button | 97 | new UI::Button |
1701 | @@ -109,8 +109,8 @@ | |||
1702 | 109 | _("Delete")); | 109 | _("Delete")); |
1703 | 110 | deletebtn->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::delete_clicked, this)); | 110 | deletebtn->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::delete_clicked, this)); |
1704 | 111 | 111 | ||
1707 | 112 | m_ls.selected.connect(boost::bind(&GameMainMenuSaveGame::selected, this, _1)); | 112 | ls_.selected.connect(boost::bind(&GameMainMenuSaveGame::selected, this, _1)); |
1708 | 113 | m_ls.double_clicked.connect(boost::bind(&GameMainMenuSaveGame::double_clicked, this, _1)); | 113 | ls_.double_clicked.connect(boost::bind(&GameMainMenuSaveGame::double_clicked, this, _1)); |
1709 | 114 | 114 | ||
1710 | 115 | fill_list(); | 115 | fill_list(); |
1711 | 116 | 116 | ||
1712 | @@ -125,21 +125,21 @@ | |||
1713 | 125 | { | 125 | { |
1714 | 126 | //Try to translate the map name. | 126 | //Try to translate the map name. |
1715 | 127 | i18n::Textdomain td("maps"); | 127 | i18n::Textdomain td("maps"); |
1717 | 128 | m_mapname.set_text(_(parent.game().get_map()->get_name())); | 128 | mapname_.set_text(_(parent.game().get_map()->get_name())); |
1718 | 129 | } | 129 | } |
1719 | 130 | uint32_t gametime = parent.game().get_gametime(); | 130 | uint32_t gametime = parent.game().get_gametime(); |
1721 | 131 | m_gametime.set_text(gametimestring(gametime)); | 131 | gametime_.set_text(gametimestring(gametime)); |
1722 | 132 | 132 | ||
1723 | 133 | int player_nr = parent.game().player_manager()->get_number_of_players(); | 133 | int player_nr = parent.game().player_manager()->get_number_of_players(); |
1725 | 134 | m_players_label.set_text( | 134 | players_label_.set_text( |
1726 | 135 | (boost::format(ngettext("%i player", "%i players", player_nr)) % player_nr).str()); | 135 | (boost::format(ngettext("%i player", "%i players", player_nr)) % player_nr).str()); |
1727 | 136 | { | 136 | { |
1728 | 137 | i18n::Textdomain td("win_conditions"); | 137 | i18n::Textdomain td("win_conditions"); |
1730 | 138 | m_win_condition.set_text(_(parent.game().get_win_condition_displayname())); | 138 | win_condition_.set_text(_(parent.game().get_win_condition_displayname())); |
1731 | 139 | } | 139 | } |
1732 | 140 | } | 140 | } |
1733 | 141 | 141 | ||
1735 | 142 | m_editbox->focus(); | 142 | editbox_->focus(); |
1736 | 143 | pause_game(true); | 143 | pause_game(true); |
1737 | 144 | } | 144 | } |
1738 | 145 | 145 | ||
1739 | @@ -148,35 +148,35 @@ | |||
1740 | 148 | * called when a item is selected | 148 | * called when a item is selected |
1741 | 149 | */ | 149 | */ |
1742 | 150 | void GameMainMenuSaveGame::selected(uint32_t) { | 150 | void GameMainMenuSaveGame::selected(uint32_t) { |
1744 | 151 | const std::string & name = m_ls.get_selected(); | 151 | const std::string & name = ls_.get_selected(); |
1745 | 152 | 152 | ||
1746 | 153 | Widelands::GameLoader gl(name, igbase().game()); | 153 | Widelands::GameLoader gl(name, igbase().game()); |
1747 | 154 | Widelands::GamePreloadPacket gpdp; | 154 | Widelands::GamePreloadPacket gpdp; |
1748 | 155 | gl.preload_game(gpdp); // This has worked before, no problem | 155 | gl.preload_game(gpdp); // This has worked before, no problem |
1749 | 156 | { | 156 | { |
1751 | 157 | m_editbox->set_text(FileSystem::filename_without_ext(name.c_str())); | 157 | editbox_->set_text(FileSystem::filename_without_ext(name.c_str())); |
1752 | 158 | } | 158 | } |
1754 | 159 | m_button_ok->set_enabled(true); | 159 | button_ok_->set_enabled(true); |
1755 | 160 | 160 | ||
1756 | 161 | //Try to translate the map name. | 161 | //Try to translate the map name. |
1757 | 162 | { | 162 | { |
1758 | 163 | i18n::Textdomain td("maps"); | 163 | i18n::Textdomain td("maps"); |
1760 | 164 | m_mapname.set_text(_(gpdp.get_mapname())); | 164 | mapname_.set_text(_(gpdp.get_mapname())); |
1761 | 165 | } | 165 | } |
1762 | 166 | 166 | ||
1763 | 167 | uint32_t gametime = gpdp.get_gametime(); | 167 | uint32_t gametime = gpdp.get_gametime(); |
1765 | 168 | m_gametime.set_text(gametimestring(gametime)); | 168 | gametime_.set_text(gametimestring(gametime)); |
1766 | 169 | 169 | ||
1767 | 170 | if (gpdp.get_number_of_players() > 0) { | 170 | if (gpdp.get_number_of_players() > 0) { |
1768 | 171 | const std::string text = | 171 | const std::string text = |
1769 | 172 | (boost::format(ngettext("%u Player", "%u Players", gpdp.get_number_of_players())) | 172 | (boost::format(ngettext("%u Player", "%u Players", gpdp.get_number_of_players())) |
1770 | 173 | % static_cast<unsigned int>(gpdp.get_number_of_players())).str(); | 173 | % static_cast<unsigned int>(gpdp.get_number_of_players())).str(); |
1772 | 174 | m_players_label.set_text(text); | 174 | players_label_.set_text(text); |
1773 | 175 | } else { | 175 | } else { |
1774 | 176 | // Keep label empty | 176 | // Keep label empty |
1776 | 177 | m_players_label.set_text(""); | 177 | players_label_.set_text(""); |
1777 | 178 | } | 178 | } |
1779 | 179 | m_win_condition.set_text(gpdp.get_win_condition()); | 179 | win_condition_.set_text(gpdp.get_win_condition()); |
1780 | 180 | } | 180 | } |
1781 | 181 | 181 | ||
1782 | 182 | /** | 182 | /** |
1783 | @@ -190,11 +190,11 @@ | |||
1784 | 190 | * fill the file list | 190 | * fill the file list |
1785 | 191 | */ | 191 | */ |
1786 | 192 | void GameMainMenuSaveGame::fill_list() { | 192 | void GameMainMenuSaveGame::fill_list() { |
1788 | 193 | m_ls.clear(); | 193 | ls_.clear(); |
1789 | 194 | FilenameSet gamefiles; | 194 | FilenameSet gamefiles; |
1790 | 195 | 195 | ||
1791 | 196 | // Fill it with all files we find. | 196 | // Fill it with all files we find. |
1793 | 197 | gamefiles = g_fs->list_directory(m_curdir); | 197 | gamefiles = g_fs->list_directory(curdir_); |
1794 | 198 | 198 | ||
1795 | 199 | Widelands::GamePreloadPacket gpdp; | 199 | Widelands::GamePreloadPacket gpdp; |
1796 | 200 | 200 | ||
1797 | @@ -208,17 +208,17 @@ | |||
1798 | 208 | try { | 208 | try { |
1799 | 209 | Widelands::GameLoader gl(name, igbase().game()); | 209 | Widelands::GameLoader gl(name, igbase().game()); |
1800 | 210 | gl.preload_game(gpdp); | 210 | gl.preload_game(gpdp); |
1802 | 211 | m_ls.add(FileSystem::filename_without_ext(name), name); | 211 | ls_.add(FileSystem::filename_without_ext(name), name); |
1803 | 212 | } catch (const WException &) {} // we simply skip illegal entries | 212 | } catch (const WException &) {} // we simply skip illegal entries |
1804 | 213 | } | 213 | } |
1805 | 214 | } | 214 | } |
1806 | 215 | 215 | ||
1807 | 216 | void GameMainMenuSaveGame::select_by_name(std::string name) | 216 | void GameMainMenuSaveGame::select_by_name(std::string name) |
1808 | 217 | { | 217 | { |
1811 | 218 | for (uint32_t idx = 0; idx < m_ls.size(); idx++) { | 218 | for (uint32_t idx = 0; idx < ls_.size(); idx++) { |
1812 | 219 | const std::string val = m_ls[idx]; | 219 | const std::string val = ls_[idx]; |
1813 | 220 | if (name == val) { | 220 | if (name == val) { |
1815 | 221 | m_ls.select(idx); | 221 | ls_.select(idx); |
1816 | 222 | return; | 222 | return; |
1817 | 223 | } | 223 | } |
1818 | 224 | } | 224 | } |
1819 | @@ -228,7 +228,7 @@ | |||
1820 | 228 | * The editbox was changed. Enable ok button | 228 | * The editbox was changed. Enable ok button |
1821 | 229 | */ | 229 | */ |
1822 | 230 | void GameMainMenuSaveGame::edit_box_changed() { | 230 | void GameMainMenuSaveGame::edit_box_changed() { |
1824 | 231 | m_button_ok->set_enabled(m_editbox->text().size()); | 231 | button_ok_->set_enabled(editbox_->text().size()); |
1825 | 232 | } | 232 | } |
1826 | 233 | 233 | ||
1827 | 234 | static void dosave | 234 | static void dosave |
1828 | @@ -260,7 +260,7 @@ | |||
1829 | 260 | (boost::format(_("A file with the name ‘%s’ already exists. Overwrite?")) | 260 | (boost::format(_("A file with the name ‘%s’ already exists. Overwrite?")) |
1830 | 261 | % FileSystem::fs_filename(filename.c_str())).str(), | 261 | % FileSystem::fs_filename(filename.c_str())).str(), |
1831 | 262 | MBoxType::kOkCancel), | 262 | MBoxType::kOkCancel), |
1833 | 263 | m_filename(filename) | 263 | filename_(filename) |
1834 | 264 | {} | 264 | {} |
1835 | 265 | 265 | ||
1836 | 266 | GameMainMenuSaveGame & menu_save_game() { | 266 | GameMainMenuSaveGame & menu_save_game() { |
1837 | @@ -270,8 +270,8 @@ | |||
1838 | 270 | 270 | ||
1839 | 271 | void clicked_ok() override | 271 | void clicked_ok() override |
1840 | 272 | { | 272 | { |
1843 | 273 | g_fs->fs_unlink(m_filename); | 273 | g_fs->fs_unlink(filename_); |
1844 | 274 | dosave(menu_save_game().igbase(), m_filename); | 274 | dosave(menu_save_game().igbase(), filename_); |
1845 | 275 | menu_save_game().die(); | 275 | menu_save_game().die(); |
1846 | 276 | } | 276 | } |
1847 | 277 | 277 | ||
1848 | @@ -281,7 +281,7 @@ | |||
1849 | 281 | } | 281 | } |
1850 | 282 | 282 | ||
1851 | 283 | private: | 283 | private: |
1853 | 284 | std::string const m_filename; | 284 | std::string const filename_; |
1854 | 285 | }; | 285 | }; |
1855 | 286 | 286 | ||
1856 | 287 | /** | 287 | /** |
1857 | @@ -289,12 +289,12 @@ | |||
1858 | 289 | */ | 289 | */ |
1859 | 290 | void GameMainMenuSaveGame::ok() | 290 | void GameMainMenuSaveGame::ok() |
1860 | 291 | { | 291 | { |
1862 | 292 | if (m_editbox->text().empty()) | 292 | if (editbox_->text().empty()) |
1863 | 293 | return; | 293 | return; |
1864 | 294 | 294 | ||
1865 | 295 | std::string const complete_filename = | 295 | std::string const complete_filename = |
1866 | 296 | igbase().game().save_handler().create_file_name | 296 | igbase().game().save_handler().create_file_name |
1868 | 297 | (m_curdir, m_editbox->text()); | 297 | (curdir_, editbox_->text()); |
1869 | 298 | 298 | ||
1870 | 299 | // Check if file exists. If it does, show a warning. | 299 | // Check if file exists. If it does, show a warning. |
1871 | 300 | if (g_fs->file_exists(complete_filename)) { | 300 | if (g_fs->file_exists(complete_filename)) { |
1872 | @@ -324,12 +324,12 @@ | |||
1873 | 324 | (boost::format(_("Do you really want to delete the file %s?")) % | 324 | (boost::format(_("Do you really want to delete the file %s?")) % |
1874 | 325 | FileSystem::fs_filename(filename.c_str())), | 325 | FileSystem::fs_filename(filename.c_str())), |
1875 | 326 | MBoxType::kOkCancel), | 326 | MBoxType::kOkCancel), |
1877 | 327 | m_filename(filename) | 327 | filename_(filename) |
1878 | 328 | {} | 328 | {} |
1879 | 329 | 329 | ||
1880 | 330 | void clicked_ok() override | 330 | void clicked_ok() override |
1881 | 331 | { | 331 | { |
1883 | 332 | g_fs->fs_unlink(m_filename); | 332 | g_fs->fs_unlink(filename_); |
1884 | 333 | dynamic_cast<GameMainMenuSaveGame&>(*get_parent()).fill_list(); | 333 | dynamic_cast<GameMainMenuSaveGame&>(*get_parent()).fill_list(); |
1885 | 334 | die(); | 334 | die(); |
1886 | 335 | } | 335 | } |
1887 | @@ -340,7 +340,7 @@ | |||
1888 | 340 | } | 340 | } |
1889 | 341 | 341 | ||
1890 | 342 | private: | 342 | private: |
1892 | 343 | std::string const m_filename; | 343 | std::string const filename_; |
1893 | 344 | }; | 344 | }; |
1894 | 345 | 345 | ||
1895 | 346 | 346 | ||
1896 | @@ -351,7 +351,7 @@ | |||
1897 | 351 | { | 351 | { |
1898 | 352 | std::string const complete_filename = | 352 | std::string const complete_filename = |
1899 | 353 | igbase().game().save_handler().create_file_name | 353 | igbase().game().save_handler().create_file_name |
1901 | 354 | (m_curdir, m_editbox->text()); | 354 | (curdir_, editbox_->text()); |
1902 | 355 | 355 | ||
1903 | 356 | // Check if file exists. If it does, let the user confirm the deletion. | 356 | // Check if file exists. If it does, let the user confirm the deletion. |
1904 | 357 | if (g_fs->file_exists(complete_filename)) | 357 | if (g_fs->file_exists(complete_filename)) |
1905 | 358 | 358 | ||
1906 | === modified file 'src/wui/game_main_menu_save_game.h' | |||
1907 | --- src/wui/game_main_menu_save_game.h 2014-11-28 16:40:55 +0000 | |||
1908 | +++ src/wui/game_main_menu_save_game.h 2016-01-24 20:25:45 +0000 | |||
1909 | @@ -1,5 +1,5 @@ | |||
1910 | 1 | /* | 1 | /* |
1912 | 2 | * Copyright (C) 2002-2004, 2006, 2008-2013 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
1913 | 3 | * | 3 | * |
1914 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1915 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1916 | @@ -51,15 +51,15 @@ | |||
1917 | 51 | bool save_game(std::string); | 51 | bool save_game(std::string); |
1918 | 52 | void pause_game(bool paused); | 52 | void pause_game(bool paused); |
1919 | 53 | 53 | ||
1929 | 54 | UI::Listselect<std::string> m_ls; | 54 | UI::Listselect<std::string> ls_; |
1930 | 55 | UI::EditBox * m_editbox; | 55 | UI::EditBox * editbox_; |
1931 | 56 | UI::Textarea m_name_label, m_mapname, m_gametime_label, m_gametime, m_players_label, | 56 | UI::Textarea name_label_, mapname_, gametime_label_, gametime_, players_label_, |
1932 | 57 | m_win_condition_label, m_win_condition; | 57 | win_condition_label_, win_condition_; |
1933 | 58 | UI::Button * m_button_ok; | 58 | UI::Button * button_ok_; |
1934 | 59 | std::string m_curdir; | 59 | std::string curdir_; |
1935 | 60 | std::string m_parentdir; | 60 | std::string parentdir_; |
1936 | 61 | std::string m_filename; | 61 | std::string filename_; |
1937 | 62 | bool m_overwrite; | 62 | bool overwrite_; |
1938 | 63 | }; | 63 | }; |
1939 | 64 | 64 | ||
1940 | 65 | #endif // end of include guard: WL_WUI_GAME_MAIN_MENU_SAVE_GAME_H | 65 | #endif // end of include guard: WL_WUI_GAME_MAIN_MENU_SAVE_GAME_H |
1941 | 66 | 66 | ||
1942 | === modified file 'src/wui/game_message_menu.cc' | |||
1943 | --- src/wui/game_message_menu.cc 2016-01-18 19:35:25 +0000 | |||
1944 | +++ src/wui/game_message_menu.cc 2016-01-24 20:25:45 +0000 | |||
1945 | @@ -1,5 +1,5 @@ | |||
1946 | 1 | /* | 1 | /* |
1948 | 2 | * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
1949 | 3 | * | 3 | * |
1950 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
1951 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
1952 | @@ -79,7 +79,7 @@ | |||
1953 | 79 | list->focus(); | 79 | list->focus(); |
1954 | 80 | 80 | ||
1955 | 81 | // Buttons for message types | 81 | // Buttons for message types |
1957 | 82 | m_geologistsbtn = | 82 | geologistsbtn_ = |
1958 | 83 | new UI::Button | 83 | new UI::Button |
1959 | 84 | (this, "filter_geologists_messages", | 84 | (this, "filter_geologists_messages", |
1960 | 85 | kPadding, kPadding, kButtonSize, kButtonSize, | 85 | kPadding, kPadding, kButtonSize, kButtonSize, |
1961 | @@ -87,10 +87,10 @@ | |||
1962 | 87 | g_gr->images().get("pics/menu_geologist.png"), | 87 | g_gr->images().get("pics/menu_geologist.png"), |
1963 | 88 | "", | 88 | "", |
1964 | 89 | true); | 89 | true); |
1966 | 90 | m_geologistsbtn->sigclicked.connect | 90 | geologistsbtn_->sigclicked.connect |
1967 | 91 | (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kGeologists)); | 91 | (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kGeologists)); |
1968 | 92 | 92 | ||
1970 | 93 | m_economybtn = | 93 | economybtn_ = |
1971 | 94 | new UI::Button | 94 | new UI::Button |
1972 | 95 | (this, "filter_economy_messages", | 95 | (this, "filter_economy_messages", |
1973 | 96 | 2 * kPadding + kButtonSize, kPadding, kButtonSize, kButtonSize, | 96 | 2 * kPadding + kButtonSize, kPadding, kButtonSize, kButtonSize, |
1974 | @@ -98,10 +98,10 @@ | |||
1975 | 98 | g_gr->images().get("pics/genstats_nrwares.png"), | 98 | g_gr->images().get("pics/genstats_nrwares.png"), |
1976 | 99 | "", | 99 | "", |
1977 | 100 | true); | 100 | true); |
1979 | 101 | m_economybtn->sigclicked.connect | 101 | economybtn_->sigclicked.connect |
1980 | 102 | (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kEconomy)); | 102 | (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kEconomy)); |
1981 | 103 | 103 | ||
1983 | 104 | m_seafaringbtn = | 104 | seafaringbtn_ = |
1984 | 105 | new UI::Button | 105 | new UI::Button |
1985 | 106 | (this, "filter_seafaring_messages", | 106 | (this, "filter_seafaring_messages", |
1986 | 107 | 3 * kPadding + 2 * kButtonSize, kPadding, kButtonSize, kButtonSize, | 107 | 3 * kPadding + 2 * kButtonSize, kPadding, kButtonSize, kButtonSize, |
1987 | @@ -109,10 +109,10 @@ | |||
1988 | 109 | g_gr->images().get("pics/start_expedition.png"), | 109 | g_gr->images().get("pics/start_expedition.png"), |
1989 | 110 | "", | 110 | "", |
1990 | 111 | true); | 111 | true); |
1992 | 112 | m_seafaringbtn->sigclicked.connect | 112 | seafaringbtn_->sigclicked.connect |
1993 | 113 | (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kSeafaring)); | 113 | (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kSeafaring)); |
1994 | 114 | 114 | ||
1996 | 115 | m_warfarebtn = | 115 | warfarebtn_ = |
1997 | 116 | new UI::Button | 116 | new UI::Button |
1998 | 117 | (this, "filter_warfare_messages", | 117 | (this, "filter_warfare_messages", |
1999 | 118 | 4 * kPadding + 3 * kButtonSize, kPadding, kButtonSize, kButtonSize, | 118 | 4 * kPadding + 3 * kButtonSize, kPadding, kButtonSize, kButtonSize, |
2000 | @@ -120,10 +120,10 @@ | |||
2001 | 120 | g_gr->images().get("pics/messages_warfare.png"), | 120 | g_gr->images().get("pics/messages_warfare.png"), |
2002 | 121 | "", | 121 | "", |
2003 | 122 | true); | 122 | true); |
2005 | 123 | m_warfarebtn->sigclicked.connect | 123 | warfarebtn_->sigclicked.connect |
2006 | 124 | (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kWarfare)); | 124 | (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kWarfare)); |
2007 | 125 | 125 | ||
2009 | 126 | m_scenariobtn = | 126 | scenariobtn_ = |
2010 | 127 | new UI::Button | 127 | new UI::Button |
2011 | 128 | (this, "filter_scenario_messages", | 128 | (this, "filter_scenario_messages", |
2012 | 129 | 5 * kPadding + 4 * kButtonSize, kPadding, kButtonSize, kButtonSize, | 129 | 5 * kPadding + 4 * kButtonSize, kPadding, kButtonSize, kButtonSize, |
2013 | @@ -131,14 +131,14 @@ | |||
2014 | 131 | g_gr->images().get("pics/menu_objectives.png"), | 131 | g_gr->images().get("pics/menu_objectives.png"), |
2015 | 132 | "", | 132 | "", |
2016 | 133 | true); | 133 | true); |
2018 | 134 | m_scenariobtn->sigclicked.connect | 134 | scenariobtn_->sigclicked.connect |
2019 | 135 | (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kScenario)); | 135 | (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kScenario)); |
2020 | 136 | 136 | ||
2022 | 137 | m_message_filter = Widelands::Message::Type::kAllMessages; | 137 | message_filter_ = Widelands::Message::Type::kAllMessages; |
2023 | 138 | set_filter_messages_tooltips(); | 138 | set_filter_messages_tooltips(); |
2024 | 139 | // End: Buttons for message types | 139 | // End: Buttons for message types |
2025 | 140 | 140 | ||
2027 | 141 | m_archivebtn = | 141 | archivebtn_ = |
2028 | 142 | new UI::Button | 142 | new UI::Button |
2029 | 143 | (this, "archive_or_restore_selected_messages", | 143 | (this, "archive_or_restore_selected_messages", |
2030 | 144 | kPadding, kWindowHeight - kPadding - kButtonSize, kButtonSize, kButtonSize, | 144 | kPadding, kWindowHeight - kPadding - kButtonSize, kButtonSize, kButtonSize, |
2031 | @@ -148,26 +148,26 @@ | |||
2032 | 148 | (boost::format(_("Del: %s")) | 148 | (boost::format(_("Del: %s")) |
2033 | 149 | /** TRANSLATORS: Tooltip in the messages window */ | 149 | /** TRANSLATORS: Tooltip in the messages window */ |
2034 | 150 | % _("Archive selected message")).str()); | 150 | % _("Archive selected message")).str()); |
2036 | 151 | m_archivebtn->sigclicked.connect | 151 | archivebtn_->sigclicked.connect |
2037 | 152 | (boost::bind(&GameMessageMenu::archive_or_restore, this)); | 152 | (boost::bind(&GameMessageMenu::archive_or_restore, this)); |
2038 | 153 | 153 | ||
2040 | 154 | m_togglemodebtn = | 154 | togglemodebtn_ = |
2041 | 155 | new UI::Button | 155 | new UI::Button |
2042 | 156 | (this, "toggle_between_inbox_or_archive", | 156 | (this, "toggle_between_inbox_or_archive", |
2045 | 157 | m_archivebtn->get_x() + m_archivebtn->get_w() + kPadding, | 157 | archivebtn_->get_x() + archivebtn_->get_w() + kPadding, |
2046 | 158 | m_archivebtn->get_y(), | 158 | archivebtn_->get_y(), |
2047 | 159 | kButtonSize, | 159 | kButtonSize, |
2048 | 160 | kButtonSize, | 160 | kButtonSize, |
2049 | 161 | g_gr->images().get("pics/but2.png"), | 161 | g_gr->images().get("pics/but2.png"), |
2050 | 162 | g_gr->images().get("pics/message_archived.png"), | 162 | g_gr->images().get("pics/message_archived.png"), |
2051 | 163 | _("Show Archive")); | 163 | _("Show Archive")); |
2053 | 164 | m_togglemodebtn->sigclicked.connect | 164 | togglemodebtn_->sigclicked.connect |
2054 | 165 | (boost::bind(&GameMessageMenu::toggle_mode, this)); | 165 | (boost::bind(&GameMessageMenu::toggle_mode, this)); |
2055 | 166 | 166 | ||
2057 | 167 | m_centerviewbtn = | 167 | centerviewbtn_ = |
2058 | 168 | new UI::Button | 168 | new UI::Button |
2059 | 169 | (this, "center_main_mapview_on_location", | 169 | (this, "center_main_mapview_on_location", |
2061 | 170 | kWindowWidth - kPadding - kButtonSize, m_archivebtn->get_y(), kButtonSize, kButtonSize, | 170 | kWindowWidth - kPadding - kButtonSize, archivebtn_->get_y(), kButtonSize, kButtonSize, |
2062 | 171 | g_gr->images().get("pics/but2.png"), | 171 | g_gr->images().get("pics/but2.png"), |
2063 | 172 | g_gr->images().get("pics/menu_goto.png"), | 172 | g_gr->images().get("pics/menu_goto.png"), |
2064 | 173 | /** TRANSLATORS: %s is a tooltip, G is the corresponding hotkey */ | 173 | /** TRANSLATORS: %s is a tooltip, G is the corresponding hotkey */ |
2065 | @@ -175,7 +175,7 @@ | |||
2066 | 175 | /** TRANSLATORS: Tooltip in the messages window */ | 175 | /** TRANSLATORS: Tooltip in the messages window */ |
2067 | 176 | % _("Center main mapview on location")).str(), | 176 | % _("Center main mapview on location")).str(), |
2068 | 177 | false); | 177 | false); |
2070 | 178 | m_centerviewbtn->sigclicked.connect(boost::bind(&GameMessageMenu::center_view, this)); | 178 | centerviewbtn_->sigclicked.connect(boost::bind(&GameMessageMenu::center_view, this)); |
2071 | 179 | 179 | ||
2072 | 180 | if (get_usedefaultpos()) | 180 | if (get_usedefaultpos()) |
2073 | 181 | center_to_parent(); | 181 | center_to_parent(); |
2074 | @@ -298,8 +298,8 @@ | |||
2075 | 298 | // Update messages in the list and remove messages | 298 | // Update messages in the list and remove messages |
2076 | 299 | // that should no longer be shown | 299 | // that should no longer be shown |
2077 | 300 | for (uint32_t j = list->size(); j; --j) { | 300 | for (uint32_t j = list->size(); j; --j) { |
2080 | 301 | MessageId m_id((*list)[j - 1]); | 301 | MessageId id_((*list)[j - 1]); |
2081 | 302 | if (Message const * const message = mq[m_id]) { | 302 | if (Message const * const message = mq[id_]) { |
2082 | 303 | if ((mode == Archive) != (message->status() == Message::Status::kArchived)) { | 303 | if ((mode == Archive) != (message->status() == Message::Status::kArchived)) { |
2083 | 304 | list->remove(j - 1); | 304 | list->remove(j - 1); |
2084 | 305 | } else { | 305 | } else { |
2085 | @@ -325,11 +325,11 @@ | |||
2086 | 325 | } | 325 | } |
2087 | 326 | 326 | ||
2088 | 327 | // Filter message type | 327 | // Filter message type |
2090 | 328 | if (m_message_filter != Message::Type::kAllMessages) { | 328 | if (message_filter_ != Message::Type::kAllMessages) { |
2091 | 329 | for (uint32_t j = list->size(); j; --j) { | 329 | for (uint32_t j = list->size(); j; --j) { |
2095 | 330 | MessageId m_id((*list)[j - 1]); | 330 | MessageId id_((*list)[j - 1]); |
2096 | 331 | if (Message const * const message = mq[m_id]) { | 331 | if (Message const * const message = mq[id_]) { |
2097 | 332 | if (message->message_type_category() != m_message_filter) { | 332 | if (message->message_type_category() != message_filter_) { |
2098 | 333 | list->remove(j - 1); | 333 | list->remove(j - 1); |
2099 | 334 | } | 334 | } |
2100 | 335 | } | 335 | } |
2101 | @@ -343,7 +343,7 @@ | |||
2102 | 343 | // be a solution without this extra update(). | 343 | // be a solution without this extra update(). |
2103 | 344 | list->update(); | 344 | list->update(); |
2104 | 345 | } else { | 345 | } else { |
2106 | 346 | m_centerviewbtn->set_enabled(false); | 346 | centerviewbtn_->set_enabled(false); |
2107 | 347 | message_body.set_text(std::string()); | 347 | message_body.set_text(std::string()); |
2108 | 348 | } | 348 | } |
2109 | 349 | } | 349 | } |
2110 | @@ -376,7 +376,7 @@ | |||
2111 | 376 | (*new Widelands::CmdMessageSetStatusRead | 376 | (*new Widelands::CmdMessageSetStatusRead |
2112 | 377 | (game.get_gametime(), player.player_number(), id)); | 377 | (game.get_gametime(), player.player_number(), id)); |
2113 | 378 | } | 378 | } |
2115 | 379 | m_centerviewbtn->set_enabled(message->position()); | 379 | centerviewbtn_->set_enabled(message->position()); |
2116 | 380 | 380 | ||
2117 | 381 | message_body.set_text( | 381 | message_body.set_text( |
2118 | 382 | (boost::format("<rt><p font-size=18 font-weight=bold font-color=D1D1D1>%s<br></p>" | 382 | (boost::format("<rt><p font-size=18 font-weight=bold font-color=D1D1D1>%s<br></p>" |
2119 | @@ -386,7 +386,7 @@ | |||
2120 | 386 | return; | 386 | return; |
2121 | 387 | } | 387 | } |
2122 | 388 | } | 388 | } |
2124 | 389 | m_centerviewbtn->set_enabled(false); | 389 | centerviewbtn_->set_enabled(false); |
2125 | 390 | message_body.set_text(std::string()); | 390 | message_body.set_text(std::string()); |
2126 | 391 | } | 391 | } |
2127 | 392 | 392 | ||
2128 | @@ -394,7 +394,7 @@ | |||
2129 | 394 | * a message was double clicked | 394 | * a message was double clicked |
2130 | 395 | */ | 395 | */ |
2131 | 396 | void GameMessageMenu::double_clicked(uint32_t const /* t */) { | 396 | void GameMessageMenu::double_clicked(uint32_t const /* t */) { |
2133 | 397 | if (m_centerviewbtn->enabled()) center_view(); | 397 | if (centerviewbtn_->enabled()) center_view(); |
2134 | 398 | } | 398 | } |
2135 | 399 | 399 | ||
2136 | 400 | /** | 400 | /** |
2137 | @@ -406,7 +406,7 @@ | |||
2138 | 406 | switch (code.sym) { | 406 | switch (code.sym) { |
2139 | 407 | // Don't forget to change the tooltips if any of these get reassigned | 407 | // Don't forget to change the tooltips if any of these get reassigned |
2140 | 408 | case SDLK_g: | 408 | case SDLK_g: |
2142 | 409 | if (m_centerviewbtn->enabled()) | 409 | if (centerviewbtn_->enabled()) |
2143 | 410 | center_view(); | 410 | center_view(); |
2144 | 411 | return true; | 411 | return true; |
2145 | 412 | case SDLK_0: | 412 | case SDLK_0: |
2146 | @@ -495,19 +495,19 @@ | |||
2147 | 495 | void GameMessageMenu::filter_messages(Widelands::Message::Type const msgtype) { | 495 | void GameMessageMenu::filter_messages(Widelands::Message::Type const msgtype) { |
2148 | 496 | switch (msgtype) { | 496 | switch (msgtype) { |
2149 | 497 | case Widelands::Message::Type::kGeologists: | 497 | case Widelands::Message::Type::kGeologists: |
2151 | 498 | toggle_filter_messages_button(*m_geologistsbtn, msgtype); | 498 | toggle_filter_messages_button(*geologistsbtn_, msgtype); |
2152 | 499 | break; | 499 | break; |
2153 | 500 | case Widelands::Message::Type::kEconomy: | 500 | case Widelands::Message::Type::kEconomy: |
2155 | 501 | toggle_filter_messages_button(*m_economybtn, msgtype); | 501 | toggle_filter_messages_button(*economybtn_, msgtype); |
2156 | 502 | break; | 502 | break; |
2157 | 503 | case Widelands::Message::Type::kSeafaring: | 503 | case Widelands::Message::Type::kSeafaring: |
2159 | 504 | toggle_filter_messages_button(*m_seafaringbtn, msgtype); | 504 | toggle_filter_messages_button(*seafaringbtn_, msgtype); |
2160 | 505 | break; | 505 | break; |
2161 | 506 | case Widelands::Message::Type::kWarfare: | 506 | case Widelands::Message::Type::kWarfare: |
2163 | 507 | toggle_filter_messages_button(*m_warfarebtn, msgtype); | 507 | toggle_filter_messages_button(*warfarebtn_, msgtype); |
2164 | 508 | break; | 508 | break; |
2165 | 509 | case Widelands::Message::Type::kScenario: | 509 | case Widelands::Message::Type::kScenario: |
2167 | 510 | toggle_filter_messages_button(*m_scenariobtn, msgtype); | 510 | toggle_filter_messages_button(*scenariobtn_, msgtype); |
2168 | 511 | break; | 511 | break; |
2169 | 512 | 512 | ||
2170 | 513 | case Widelands::Message::Type::kNoMessages: | 513 | case Widelands::Message::Type::kNoMessages: |
2171 | @@ -523,12 +523,12 @@ | |||
2172 | 523 | case Widelands::Message::Type::kWarfareSiteLost: | 523 | case Widelands::Message::Type::kWarfareSiteLost: |
2173 | 524 | case Widelands::Message::Type::kWarfareUnderAttack: | 524 | case Widelands::Message::Type::kWarfareUnderAttack: |
2174 | 525 | set_filter_messages_tooltips(); | 525 | set_filter_messages_tooltips(); |
2181 | 526 | m_message_filter = Widelands::Message::Type::kAllMessages; | 526 | message_filter_ = Widelands::Message::Type::kAllMessages; |
2182 | 527 | m_geologistsbtn->set_perm_pressed(false); | 527 | geologistsbtn_->set_perm_pressed(false); |
2183 | 528 | m_economybtn->set_perm_pressed(false); | 528 | economybtn_ ->set_perm_pressed(false); |
2184 | 529 | m_seafaringbtn->set_perm_pressed(false); | 529 | seafaringbtn_ ->set_perm_pressed(false); |
2185 | 530 | m_warfarebtn->set_perm_pressed(false); | 530 | warfarebtn_ ->set_perm_pressed(false); |
2186 | 531 | m_scenariobtn->set_perm_pressed(false); | 531 | scenariobtn_ ->set_perm_pressed(false); |
2187 | 532 | break; | 532 | break; |
2188 | 533 | } | 533 | } |
2189 | 534 | think(); | 534 | think(); |
2190 | @@ -541,15 +541,15 @@ | |||
2191 | 541 | set_filter_messages_tooltips(); | 541 | set_filter_messages_tooltips(); |
2192 | 542 | if (button.get_perm_pressed()) { | 542 | if (button.get_perm_pressed()) { |
2193 | 543 | button.set_perm_pressed(false); | 543 | button.set_perm_pressed(false); |
2195 | 544 | m_message_filter = Widelands::Message::Type::kAllMessages; | 544 | message_filter_ = Widelands::Message::Type::kAllMessages; |
2196 | 545 | } else { | 545 | } else { |
2202 | 546 | m_geologistsbtn->set_perm_pressed(false); | 546 | geologistsbtn_->set_perm_pressed(false); |
2203 | 547 | m_economybtn->set_perm_pressed(false); | 547 | economybtn_->set_perm_pressed(false); |
2204 | 548 | m_seafaringbtn->set_perm_pressed(false); | 548 | seafaringbtn_->set_perm_pressed(false); |
2205 | 549 | m_warfarebtn->set_perm_pressed(false); | 549 | warfarebtn_->set_perm_pressed(false); |
2206 | 550 | m_scenariobtn->set_perm_pressed(false); | 550 | scenariobtn_->set_perm_pressed(false); |
2207 | 551 | button.set_perm_pressed(true); | 551 | button.set_perm_pressed(true); |
2209 | 552 | m_message_filter = msgtype; | 552 | message_filter_ = msgtype; |
2210 | 553 | /** TRANSLATORS: %1% is a tooltip, %2% is the corresponding hotkey */ | 553 | /** TRANSLATORS: %1% is a tooltip, %2% is the corresponding hotkey */ |
2211 | 554 | button.set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) | 554 | button.set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) |
2212 | 555 | /** TRANSLATORS: Tooltip in the messages window */ | 555 | /** TRANSLATORS: Tooltip in the messages window */ |
2213 | @@ -562,23 +562,23 @@ | |||
2214 | 562 | * Helper for filter_messages | 562 | * Helper for filter_messages |
2215 | 563 | */ | 563 | */ |
2216 | 564 | void GameMessageMenu::set_filter_messages_tooltips() { | 564 | void GameMessageMenu::set_filter_messages_tooltips() { |
2218 | 565 | m_geologistsbtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) | 565 | geologistsbtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) |
2219 | 566 | /** TRANSLATORS: Tooltip in the messages window */ | 566 | /** TRANSLATORS: Tooltip in the messages window */ |
2220 | 567 | % _("Show geologists' messages only") | 567 | % _("Show geologists' messages only") |
2221 | 568 | % "1").str()); | 568 | % "1").str()); |
2223 | 569 | m_economybtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) | 569 | economybtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) |
2224 | 570 | /** TRANSLATORS: Tooltip in the messages window */ | 570 | /** TRANSLATORS: Tooltip in the messages window */ |
2225 | 571 | % _("Show economy messages only") | 571 | % _("Show economy messages only") |
2226 | 572 | % "2").str()); | 572 | % "2").str()); |
2228 | 573 | m_seafaringbtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) | 573 | seafaringbtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) |
2229 | 574 | /** TRANSLATORS: Tooltip in the messages window */ | 574 | /** TRANSLATORS: Tooltip in the messages window */ |
2230 | 575 | % _("Show seafaring messages only") | 575 | % _("Show seafaring messages only") |
2231 | 576 | % "3").str()); | 576 | % "3").str()); |
2233 | 577 | m_warfarebtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) | 577 | warfarebtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) |
2234 | 578 | /** TRANSLATORS: Tooltip in the messages window */ | 578 | /** TRANSLATORS: Tooltip in the messages window */ |
2235 | 579 | % _("Show warfare messages only") | 579 | % _("Show warfare messages only") |
2236 | 580 | % "4").str()); | 580 | % "4").str()); |
2238 | 581 | m_scenariobtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) | 581 | scenariobtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)")) |
2239 | 582 | /** TRANSLATORS: Tooltip in the messages window */ | 582 | /** TRANSLATORS: Tooltip in the messages window */ |
2240 | 583 | % _("Show scenario messages only") | 583 | % _("Show scenario messages only") |
2241 | 584 | % "5").str()); | 584 | % "5").str()); |
2242 | @@ -626,24 +626,24 @@ | |||
2243 | 626 | case Inbox: | 626 | case Inbox: |
2244 | 627 | mode = Archive; | 627 | mode = Archive; |
2245 | 628 | set_title(_("Messages: Archive")); | 628 | set_title(_("Messages: Archive")); |
2247 | 629 | m_archivebtn->set_pic(g_gr->images().get("pics/message_restore.png")); | 629 | archivebtn_->set_pic(g_gr->images().get("pics/message_restore.png")); |
2248 | 630 | /** TRANSLATORS: %s is a tooltip, Del is the corresponding hotkey */ | 630 | /** TRANSLATORS: %s is a tooltip, Del is the corresponding hotkey */ |
2250 | 631 | m_archivebtn->set_tooltip((boost::format(_("Del: %s")) | 631 | archivebtn_->set_tooltip((boost::format(_("Del: %s")) |
2251 | 632 | /** TRANSLATORS: Tooltip in the messages window */ | 632 | /** TRANSLATORS: Tooltip in the messages window */ |
2252 | 633 | % _("Restore selected message")).str()); | 633 | % _("Restore selected message")).str()); |
2255 | 634 | m_togglemodebtn->set_pic(g_gr->images().get("pics/message_new.png")); | 634 | togglemodebtn_->set_pic(g_gr->images().get("pics/message_new.png")); |
2256 | 635 | m_togglemodebtn->set_tooltip(_("Show Inbox")); | 635 | togglemodebtn_->set_tooltip(_("Show Inbox")); |
2257 | 636 | break; | 636 | break; |
2258 | 637 | case Archive: | 637 | case Archive: |
2259 | 638 | mode = Inbox; | 638 | mode = Inbox; |
2260 | 639 | set_title(_("Messages: Inbox")); | 639 | set_title(_("Messages: Inbox")); |
2262 | 640 | m_archivebtn->set_pic(g_gr->images().get("pics/message_archive.png")); | 640 | archivebtn_->set_pic(g_gr->images().get("pics/message_archive.png")); |
2263 | 641 | /** TRANSLATORS: %s is a tooltip, Del is the corresponding hotkey */ | 641 | /** TRANSLATORS: %s is a tooltip, Del is the corresponding hotkey */ |
2265 | 642 | m_archivebtn->set_tooltip((boost::format(_("Del: %s")) | 642 | archivebtn_->set_tooltip((boost::format(_("Del: %s")) |
2266 | 643 | /** TRANSLATORS: Tooltip in the messages window */ | 643 | /** TRANSLATORS: Tooltip in the messages window */ |
2267 | 644 | % _("Archive selected message")).str()); | 644 | % _("Archive selected message")).str()); |
2270 | 645 | m_togglemodebtn->set_pic(g_gr->images().get("pics/message_archived.png")); | 645 | togglemodebtn_->set_pic(g_gr->images().get("pics/message_archived.png")); |
2271 | 646 | m_togglemodebtn->set_tooltip(_("Show Archive")); | 646 | togglemodebtn_->set_tooltip(_("Show Archive")); |
2272 | 647 | break; | 647 | break; |
2273 | 648 | } | 648 | } |
2274 | 649 | } | 649 | } |
2275 | 650 | 650 | ||
2276 | === modified file 'src/wui/game_message_menu.h' | |||
2277 | --- src/wui/game_message_menu.h 2015-09-11 06:24:02 +0000 | |||
2278 | +++ src/wui/game_message_menu.h 2016-01-24 20:25:45 +0000 | |||
2279 | @@ -1,5 +1,5 @@ | |||
2280 | 1 | /* | 1 | /* |
2282 | 2 | * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
2283 | 3 | * | 3 | * |
2284 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
2285 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
2286 | @@ -70,17 +70,17 @@ | |||
2287 | 70 | 70 | ||
2288 | 71 | UI::Table<uintptr_t> * list; | 71 | UI::Table<uintptr_t> * list; |
2289 | 72 | UI::MultilineTextarea message_body; | 72 | UI::MultilineTextarea message_body; |
2293 | 73 | UI::Button * m_archivebtn; | 73 | UI::Button * archivebtn_; |
2294 | 74 | UI::Button * m_togglemodebtn; | 74 | UI::Button * togglemodebtn_; |
2295 | 75 | UI::Button * m_centerviewbtn; | 75 | UI::Button * centerviewbtn_; |
2296 | 76 | Mode mode; | 76 | Mode mode; |
2297 | 77 | // Buttons for message types | 77 | // Buttons for message types |
2304 | 78 | UI::Button * m_geologistsbtn; | 78 | UI::Button * geologistsbtn_; |
2305 | 79 | UI::Button * m_economybtn; | 79 | UI::Button * economybtn_; |
2306 | 80 | UI::Button * m_seafaringbtn; | 80 | UI::Button * seafaringbtn_; |
2307 | 81 | UI::Button * m_warfarebtn; | 81 | UI::Button * warfarebtn_; |
2308 | 82 | UI::Button * m_scenariobtn; | 82 | UI::Button * scenariobtn_; |
2309 | 83 | Widelands::Message::Type m_message_filter; | 83 | Widelands::Message::Type message_filter_; |
2310 | 84 | }; | 84 | }; |
2311 | 85 | 85 | ||
2312 | 86 | #endif // end of include guard: WL_WUI_GAME_MESSAGE_MENU_H | 86 | #endif // end of include guard: WL_WUI_GAME_MESSAGE_MENU_H |
2313 | 87 | 87 | ||
2314 | === modified file 'src/wui/game_summary.cc' | |||
2315 | --- src/wui/game_summary.cc 2016-01-17 08:29:59 +0000 | |||
2316 | +++ src/wui/game_summary.cc 2016-01-24 20:25:45 +0000 | |||
2317 | @@ -1,5 +1,5 @@ | |||
2318 | 1 | /* | 1 | /* |
2320 | 2 | * Copyright (C) 2007-2008 by the Widelands Development Team | 2 | * Copyright (C) 2007-2016 by the Widelands Development Team |
2321 | 3 | * | 3 | * |
2322 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
2323 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
2324 | @@ -41,82 +41,82 @@ | |||
2325 | 41 | GameSummaryScreen::GameSummaryScreen | 41 | GameSummaryScreen::GameSummaryScreen |
2326 | 42 | (InteractiveGameBase * parent, UI::UniqueWindow::Registry * r) | 42 | (InteractiveGameBase * parent, UI::UniqueWindow::Registry * r) |
2327 | 43 | : UI::UniqueWindow(parent, "game_summary", r, 0, 0, _("Game over")), | 43 | : UI::UniqueWindow(parent, "game_summary", r, 0, 0, _("Game over")), |
2329 | 44 | m_game(parent->game()) | 44 | game_(parent->game()) |
2330 | 45 | { | 45 | { |
2331 | 46 | // Init boxes | 46 | // Init boxes |
2332 | 47 | UI::Box * vbox = new UI::Box(this, 0, 0, UI::Box::Vertical, 0, 0, PADDING); | 47 | UI::Box * vbox = new UI::Box(this, 0, 0, UI::Box::Vertical, 0, 0, PADDING); |
2335 | 48 | m_title_area = new UI::Textarea(vbox, "", UI::Align_HCenter); | 48 | title_area_ = new UI::Textarea(vbox, "", UI::Align_HCenter); |
2336 | 49 | vbox->add(m_title_area, UI::Box::AlignCenter); | 49 | vbox->add(title_area_, UI::Box::AlignCenter); |
2337 | 50 | vbox->add_space(PADDING); | 50 | vbox->add_space(PADDING); |
2338 | 51 | 51 | ||
2339 | 52 | UI::Box * hbox1 = new UI::Box(this, 0, 0, UI::Box::Horizontal); | 52 | UI::Box * hbox1 = new UI::Box(this, 0, 0, UI::Box::Horizontal); |
2342 | 53 | m_players_table = new UI::Table<uintptr_t const>(hbox1, 0, 0, 0, 0); | 53 | players_table_ = new UI::Table<uintptr_t const>(hbox1, 0, 0, 0, 0); |
2343 | 54 | m_players_table->fit_height(m_game.player_manager()->get_players_end_status().size()); | 54 | players_table_->fit_height(game_.player_manager()->get_players_end_status().size()); |
2344 | 55 | hbox1->add_space(PADDING); | 55 | hbox1->add_space(PADDING); |
2346 | 56 | hbox1->add(m_players_table, UI::Box::AlignTop); | 56 | hbox1->add(players_table_, UI::Box::AlignTop); |
2347 | 57 | hbox1->add_space(PADDING); | 57 | hbox1->add_space(PADDING); |
2348 | 58 | 58 | ||
2349 | 59 | UI::Box * info_box = new UI::Box(hbox1, 0, 0, UI::Box::Vertical, 0, 0); | 59 | UI::Box * info_box = new UI::Box(hbox1, 0, 0, UI::Box::Vertical, 0, 0); |
2353 | 60 | m_info_area_label = new UI::Textarea(info_box, _("Player info:")); | 60 | info_area_label_ = new UI::Textarea(info_box, _("Player info:")); |
2354 | 61 | info_box->add(m_info_area_label, UI::Box::AlignLeft); | 61 | info_box->add(info_area_label_, UI::Box::AlignLeft); |
2355 | 62 | m_info_area = new UI::MultilineTextarea( | 62 | info_area_ = new UI::MultilineTextarea( |
2356 | 63 | info_box, 0, 0, 130, | 63 | info_box, 0, 0, 130, |
2358 | 64 | std::max(130, m_players_table->get_h() - m_info_area_label->get_h() - PADDING), | 64 | std::max(130, players_table_->get_h() - info_area_label_->get_h() - PADDING), |
2359 | 65 | ""); | 65 | ""); |
2361 | 66 | info_box->add(m_info_area, UI::Box::AlignLeft, true); | 66 | info_box->add(info_area_, UI::Box::AlignLeft, true); |
2362 | 67 | info_box->add_space(PADDING); | 67 | info_box->add_space(PADDING); |
2363 | 68 | hbox1->add(info_box, UI::Box::AlignTop); | 68 | hbox1->add(info_box, UI::Box::AlignTop); |
2364 | 69 | hbox1->add_space(PADDING); | 69 | hbox1->add_space(PADDING); |
2365 | 70 | vbox->add(hbox1, UI::Box::AlignLeft); | 70 | vbox->add(hbox1, UI::Box::AlignLeft); |
2366 | 71 | 71 | ||
2381 | 72 | UI::Box * bottom_box = new UI::Box(this, 0, 0, UI::Box::Horizontal); | 72 | UI::Box * bottobox_ = new UI::Box(this, 0, 0, UI::Box::Horizontal); |
2382 | 73 | 73 | ||
2383 | 74 | bottom_box->add_space(PADDING); | 74 | bottobox_->add_space(PADDING); |
2384 | 75 | 75 | ||
2385 | 76 | m_gametime_label = new UI::Textarea(bottom_box, _("Elapsed time:")); | 76 | gametime_label_ = new UI::Textarea(bottobox_, _("Elapsed time:")); |
2386 | 77 | bottom_box->add(m_gametime_label, UI::Box::AlignCenter); | 77 | bottobox_->add(gametime_label_, UI::Box::AlignCenter); |
2387 | 78 | bottom_box->add_space(PADDING); | 78 | bottobox_->add_space(PADDING); |
2388 | 79 | m_gametime_value = new UI::Textarea(bottom_box, gametimestring(m_game.get_gametime())); | 79 | gametime_value_ = new UI::Textarea(bottobox_, gametimestring(game_.get_gametime())); |
2389 | 80 | bottom_box->add(m_gametime_value, UI::Box::AlignCenter); | 80 | bottobox_->add(gametime_value_, UI::Box::AlignCenter); |
2390 | 81 | 81 | ||
2391 | 82 | bottom_box->add_inf_space(); | 82 | bottobox_->add_inf_space(); |
2392 | 83 | 83 | ||
2393 | 84 | m_continue_button = new UI::Button | 84 | continue_button_ = new UI::Button |
2394 | 85 | (bottom_box, "continue_button", | 85 | (bottobox_, "continue_button", |
2395 | 86 | 0, 0, 35, 35, | 86 | 0, 0, 35, 35, |
2396 | 87 | g_gr->images().get("pics/but4.png"), | 87 | g_gr->images().get("pics/but4.png"), |
2397 | 88 | g_gr->images().get("pics/continue.png"), | 88 | g_gr->images().get("pics/continue.png"), |
2398 | 89 | _("Continue playing")); | 89 | _("Continue playing")); |
2403 | 90 | bottom_box->add(m_continue_button, UI::Box::AlignCenter); | 90 | bottobox_->add(continue_button_, UI::Box::AlignCenter); |
2404 | 91 | bottom_box->add_space(PADDING); | 91 | bottobox_->add_space(PADDING); |
2405 | 92 | m_stop_button = new UI::Button | 92 | stop_button_ = new UI::Button |
2406 | 93 | (bottom_box, "stop_button", | 93 | (bottobox_, "stop_button", |
2407 | 94 | 0, 0, 35, 35, | 94 | 0, 0, 35, 35, |
2408 | 95 | g_gr->images().get("pics/but4.png"), | 95 | g_gr->images().get("pics/but4.png"), |
2409 | 96 | g_gr->images().get("pics/menu_exit_game.png"), | 96 | g_gr->images().get("pics/menu_exit_game.png"), |
2410 | 97 | _("Exit Game")); | 97 | _("Exit Game")); |
2413 | 98 | bottom_box->add(m_stop_button, UI::Box::AlignCenter); | 98 | bottobox_->add(stop_button_, UI::Box::AlignCenter); |
2414 | 99 | bottom_box->add_space(PADDING); | 99 | bottobox_->add_space(PADDING); |
2415 | 100 | 100 | ||
2417 | 101 | vbox->add(bottom_box, UI::Box::AlignLeft, true); | 101 | vbox->add(bottobox_, UI::Box::AlignLeft, true); |
2418 | 102 | vbox->add_space(PADDING); | 102 | vbox->add_space(PADDING); |
2419 | 103 | set_center_panel(vbox); | 103 | set_center_panel(vbox); |
2420 | 104 | 104 | ||
2421 | 105 | // Prepare table | 105 | // Prepare table |
2426 | 106 | m_players_table->add_column(150, _("Player")); | 106 | players_table_->add_column(150, _("Player")); |
2427 | 107 | m_players_table->add_column(80, _("Team"), "", UI::Align_HCenter); | 107 | players_table_->add_column(80, _("Team"), "", UI::Align_HCenter); |
2428 | 108 | m_players_table->add_column(100, _("Status"), "", UI::Align_HCenter); | 108 | players_table_->add_column(100, _("Status"), "", UI::Align_HCenter); |
2429 | 109 | m_players_table->add_column(100, _("Time")); | 109 | players_table_->add_column(100, _("Time")); |
2430 | 110 | 110 | ||
2431 | 111 | // Prepare Elements | 111 | // Prepare Elements |
2433 | 112 | m_title_area->set_textstyle(UI::TextStyle::ui_big()); | 112 | title_area_->set_textstyle(UI::TextStyle::ui_big()); |
2434 | 113 | 113 | ||
2435 | 114 | // Connections | 114 | // Connections |
2437 | 115 | m_continue_button->sigclicked.connect | 115 | continue_button_->sigclicked.connect |
2438 | 116 | (boost::bind(&GameSummaryScreen::continue_clicked, this)); | 116 | (boost::bind(&GameSummaryScreen::continue_clicked, this)); |
2440 | 117 | m_stop_button->sigclicked.connect | 117 | stop_button_->sigclicked.connect |
2441 | 118 | (boost::bind(&GameSummaryScreen::stop_clicked, this)); | 118 | (boost::bind(&GameSummaryScreen::stop_clicked, this)); |
2443 | 119 | m_players_table->selected.connect | 119 | players_table_->selected.connect |
2444 | 120 | (boost::bind(&GameSummaryScreen::player_selected, this, _1)); | 120 | (boost::bind(&GameSummaryScreen::player_selected, this, _1)); |
2445 | 121 | 121 | ||
2446 | 122 | // Window | 122 | // Window |
2447 | @@ -140,12 +140,12 @@ | |||
2448 | 140 | void GameSummaryScreen::fill_data() | 140 | void GameSummaryScreen::fill_data() |
2449 | 141 | { | 141 | { |
2450 | 142 | std::vector<Widelands::PlayerEndStatus> players_status | 142 | std::vector<Widelands::PlayerEndStatus> players_status |
2452 | 143 | = m_game.player_manager()->get_players_end_status(); | 143 | = game_.player_manager()->get_players_end_status(); |
2453 | 144 | bool local_in_game = false; | 144 | bool local_in_game = false; |
2454 | 145 | bool local_won = false; | 145 | bool local_won = false; |
2455 | 146 | Widelands::Player* single_won = nullptr; | 146 | Widelands::Player* single_won = nullptr; |
2458 | 147 | uint8_t team_won = 0; | 147 | uint8_t teawon_ = 0; |
2459 | 148 | InteractivePlayer* ipl = m_game.get_ipl(); | 148 | InteractivePlayer* ipl = game_.get_ipl(); |
2460 | 149 | //this defines a row to be selected, current player, | 149 | //this defines a row to be selected, current player, |
2461 | 150 | //if not then the first line | 150 | //if not then the first line |
2462 | 151 | uint32_t current_player_position = 0; | 151 | uint32_t current_player_position = 0; |
2463 | @@ -157,8 +157,8 @@ | |||
2464 | 157 | local_won = pes.result == Widelands::PlayerEndResult::PLAYER_WON; | 157 | local_won = pes.result == Widelands::PlayerEndResult::PLAYER_WON; |
2465 | 158 | current_player_position = i; | 158 | current_player_position = i; |
2466 | 159 | } | 159 | } |
2469 | 160 | Widelands::Player* p = m_game.get_player(pes.player); | 160 | Widelands::Player* p = game_.get_player(pes.player); |
2470 | 161 | UI::Table<uintptr_t const>::EntryRecord & te = m_players_table->add(i); | 161 | UI::Table<uintptr_t const>::EntryRecord & te = players_table_->add(i); |
2471 | 162 | // Player name & pic | 162 | // Player name & pic |
2472 | 163 | std::string pic_path = | 163 | std::string pic_path = |
2473 | 164 | (boost::format("pics/genstats_enable_plr_0%|1$u|.png") | 164 | (boost::format("pics/genstats_enable_plr_0%|1$u|.png") |
2474 | @@ -166,10 +166,10 @@ | |||
2475 | 166 | const Image* pic = g_gr->images().get(pic_path); | 166 | const Image* pic = g_gr->images().get(pic_path); |
2476 | 167 | te.set_picture(0, pic, p->get_name()); | 167 | te.set_picture(0, pic, p->get_name()); |
2477 | 168 | // Team | 168 | // Team |
2479 | 169 | std::string team_str = | 169 | std::string teastr_ = |
2480 | 170 | (boost::format("%|1$u|") | 170 | (boost::format("%|1$u|") |
2481 | 171 | % static_cast<unsigned int>(p->team_number())).str(); | 171 | % static_cast<unsigned int>(p->team_number())).str(); |
2483 | 172 | te.set_string(1, team_str); | 172 | te.set_string(1, teastr_); |
2484 | 173 | // Status | 173 | // Status |
2485 | 174 | std::string stat_str; | 174 | std::string stat_str; |
2486 | 175 | switch (pes.result) { | 175 | switch (pes.result) { |
2487 | @@ -183,7 +183,7 @@ | |||
2488 | 183 | if (!single_won) { | 183 | if (!single_won) { |
2489 | 184 | single_won = p; | 184 | single_won = p; |
2490 | 185 | } else { | 185 | } else { |
2492 | 186 | team_won = p->team_number(); | 186 | teawon_ = p->team_number(); |
2493 | 187 | } | 187 | } |
2494 | 188 | break; | 188 | break; |
2495 | 189 | case Widelands::PlayerEndResult::PLAYER_RESIGNED: | 189 | case Widelands::PlayerEndResult::PLAYER_RESIGNED: |
2496 | @@ -203,24 +203,24 @@ | |||
2497 | 203 | 203 | ||
2498 | 204 | if (local_in_game) { | 204 | if (local_in_game) { |
2499 | 205 | if (local_won) { | 205 | if (local_won) { |
2501 | 206 | m_title_area->set_text(_("You won!")); | 206 | title_area_->set_text(_("You won!")); |
2502 | 207 | } else { | 207 | } else { |
2504 | 208 | m_title_area->set_text(_("You lost.")); | 208 | title_area_->set_text(_("You lost.")); |
2505 | 209 | } | 209 | } |
2506 | 210 | } else { | 210 | } else { |
2508 | 211 | if (team_won <= 0) { | 211 | if (teawon_ <= 0) { |
2509 | 212 | assert(single_won); | 212 | assert(single_won); |
2511 | 213 | m_title_area->set_text | 213 | title_area_->set_text |
2512 | 214 | ((boost::format(_("%s won!")) % single_won->get_name()).str()); | 214 | ((boost::format(_("%s won!")) % single_won->get_name()).str()); |
2513 | 215 | } else { | 215 | } else { |
2515 | 216 | m_title_area->set_text | 216 | title_area_->set_text |
2516 | 217 | ((boost::format(_("Team %|1$u| won!")) | 217 | ((boost::format(_("Team %|1$u| won!")) |
2518 | 218 | % static_cast<unsigned int>(team_won)).str()); | 218 | % static_cast<unsigned int>(teawon_)).str()); |
2519 | 219 | } | 219 | } |
2520 | 220 | } | 220 | } |
2522 | 221 | m_players_table->update(); | 221 | players_table_->update(); |
2523 | 222 | if (!players_status.empty()) { | 222 | if (!players_status.empty()) { |
2525 | 223 | m_players_table->select(current_player_position); | 223 | players_table_->select(current_player_position); |
2526 | 224 | } | 224 | } |
2527 | 225 | } | 225 | } |
2528 | 226 | 226 | ||
2529 | @@ -231,17 +231,17 @@ | |||
2530 | 231 | 231 | ||
2531 | 232 | void GameSummaryScreen::stop_clicked() | 232 | void GameSummaryScreen::stop_clicked() |
2532 | 233 | { | 233 | { |
2534 | 234 | m_game.get_ibase()->end_modal<UI::Panel::Returncodes>(UI::Panel::Returncodes::kBack); | 234 | game_.get_ibase()->end_modal<UI::Panel::Returncodes>(UI::Panel::Returncodes::kBack); |
2535 | 235 | } | 235 | } |
2536 | 236 | 236 | ||
2537 | 237 | void GameSummaryScreen::player_selected(uint32_t entry_index) | 237 | void GameSummaryScreen::player_selected(uint32_t entry_index) |
2538 | 238 | { | 238 | { |
2540 | 239 | const uintptr_t selected_player_index = (*m_players_table)[entry_index]; | 239 | const uintptr_t selected_player_index = (*players_table_)[entry_index]; |
2541 | 240 | const Widelands::PlayerEndStatus& player_status = | 240 | const Widelands::PlayerEndStatus& player_status = |
2543 | 241 | m_game.player_manager()->get_players_end_status()[selected_player_index]; | 241 | game_.player_manager()->get_players_end_status()[selected_player_index]; |
2544 | 242 | 242 | ||
2545 | 243 | std::string info_str = parse_player_info(player_status.info); | 243 | std::string info_str = parse_player_info(player_status.info); |
2547 | 244 | m_info_area->set_text(info_str); | 244 | info_area_->set_text(info_str); |
2548 | 245 | layout(); | 245 | layout(); |
2549 | 246 | } | 246 | } |
2550 | 247 | 247 | ||
2551 | 248 | 248 | ||
2552 | === modified file 'src/wui/game_summary.h' | |||
2553 | --- src/wui/game_summary.h 2015-03-21 14:11:39 +0000 | |||
2554 | +++ src/wui/game_summary.h 2016-01-24 20:25:45 +0000 | |||
2555 | @@ -1,5 +1,5 @@ | |||
2556 | 1 | /* | 1 | /* |
2558 | 2 | * Copyright (C) 2007-2008 by the Widelands Development Team | 2 | * Copyright (C) 2007-2016 by the Widelands Development Team |
2559 | 3 | * | 3 | * |
2560 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
2561 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
2562 | @@ -47,15 +47,15 @@ | |||
2563 | 47 | void player_selected(uint32_t idx); | 47 | void player_selected(uint32_t idx); |
2564 | 48 | std::string parse_player_info(std::string info); | 48 | std::string parse_player_info(std::string info); |
2565 | 49 | 49 | ||
2575 | 50 | Widelands::Game & m_game; | 50 | Widelands::Game & game_; |
2576 | 51 | UI::Textarea * m_title_area; | 51 | UI::Textarea * title_area_; |
2577 | 52 | UI::Textarea * m_gametime_label; | 52 | UI::Textarea * gametime_label_; |
2578 | 53 | UI::Textarea * m_gametime_value; | 53 | UI::Textarea * gametime_value_; |
2579 | 54 | UI::Textarea * m_info_area_label; | 54 | UI::Textarea * info_area_label_; |
2580 | 55 | UI::MultilineTextarea * m_info_area; | 55 | UI::MultilineTextarea * info_area_; |
2581 | 56 | UI::Button * m_continue_button; | 56 | UI::Button * continue_button_; |
2582 | 57 | UI::Button * m_stop_button; | 57 | UI::Button * stop_button_; |
2583 | 58 | UI::Table<uintptr_t const> * m_players_table; | 58 | UI::Table<uintptr_t const> * players_table_; |
2584 | 59 | }; | 59 | }; |
2585 | 60 | 60 | ||
2586 | 61 | #endif // end of include guard: WL_WUI_GAME_SUMMARY_H | 61 | #endif // end of include guard: WL_WUI_GAME_SUMMARY_H |
2587 | 62 | 62 | ||
2588 | === modified file 'src/wui/game_tips.cc' | |||
2589 | --- src/wui/game_tips.cc 2014-11-27 12:02:08 +0000 | |||
2590 | +++ src/wui/game_tips.cc 2016-01-24 20:25:45 +0000 | |||
2591 | @@ -1,5 +1,5 @@ | |||
2592 | 1 | /* | 1 | /* |
2594 | 2 | * Copyright (C) 2007-2008, 2010 by the Widelands Development Team | 2 | * Copyright (C) 2007-2016 by the Widelands Development Team |
2595 | 3 | * | 3 | * |
2596 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
2597 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
2598 | @@ -33,11 +33,11 @@ | |||
2599 | 33 | GameTips::GameTips | 33 | GameTips::GameTips |
2600 | 34 | (UI::ProgressWindow & progressWindow, const std::vector<std::string>& names) | 34 | (UI::ProgressWindow & progressWindow, const std::vector<std::string>& names) |
2601 | 35 | : | 35 | : |
2607 | 36 | m_lastUpdated (0), | 36 | lastUpdated_ (0), |
2608 | 37 | m_updateAfter (0), | 37 | updateAfter_ (0), |
2609 | 38 | m_progressWindow(progressWindow), | 38 | progressWindow_(progressWindow), |
2610 | 39 | m_registered (false), | 39 | registered_ (false), |
2611 | 40 | m_lastTip (0) | 40 | lastTip_ (0) |
2612 | 41 | { | 41 | { |
2613 | 42 | // Loading texts-locals, for translating the tips | 42 | // Loading texts-locals, for translating the tips |
2614 | 43 | i18n::Textdomain textdomain("texts"); | 43 | i18n::Textdomain textdomain("texts"); |
2615 | @@ -45,11 +45,11 @@ | |||
2616 | 45 | for (uint8_t i = 0; i < names.size(); ++i) | 45 | for (uint8_t i = 0; i < names.size(); ++i) |
2617 | 46 | load_tips(names[i]); | 46 | load_tips(names[i]); |
2618 | 47 | 47 | ||
2620 | 48 | if (!m_tips.empty()) { | 48 | if (!tips_.empty()) { |
2621 | 49 | // add visualization only if any tips are loaded | 49 | // add visualization only if any tips are loaded |
2625 | 50 | m_progressWindow.add_visualization(this); | 50 | progressWindow_.add_visualization(this); |
2626 | 51 | m_registered = true; | 51 | registered_ = true; |
2627 | 52 | m_lastTip = m_tips.size(); | 52 | lastTip_ = tips_.size(); |
2628 | 53 | } | 53 | } |
2629 | 54 | } | 54 | } |
2630 | 55 | 55 | ||
2631 | @@ -71,7 +71,7 @@ | |||
2632 | 71 | Tip tip; | 71 | Tip tip; |
2633 | 72 | tip.text = text; | 72 | tip.text = text; |
2634 | 73 | tip.interval = s->get_int("sec", DEFAULT_INTERVAL); | 73 | tip.interval = s->get_int("sec", DEFAULT_INTERVAL); |
2636 | 74 | m_tips.push_back (tip); | 74 | tips_.push_back (tip); |
2637 | 75 | } | 75 | } |
2638 | 76 | } catch (std::exception &) { | 76 | } catch (std::exception &) { |
2639 | 77 | // just ignore - tips do not impact game | 77 | // just ignore - tips do not impact game |
2640 | @@ -81,24 +81,24 @@ | |||
2641 | 81 | 81 | ||
2642 | 82 | void GameTips::update(bool repaint) { | 82 | void GameTips::update(bool repaint) { |
2643 | 83 | uint8_t ticks = SDL_GetTicks(); | 83 | uint8_t ticks = SDL_GetTicks(); |
2648 | 84 | if (ticks >= (m_lastUpdated + m_updateAfter)) { | 84 | if (ticks >= (lastUpdated_ + updateAfter_)) { |
2649 | 85 | const uint32_t next = rand() % m_tips.size(); | 85 | const uint32_t next = rand() % tips_.size(); |
2650 | 86 | if (next == m_lastTip) | 86 | if (next == lastTip_) |
2651 | 87 | m_lastTip = (next + 1) % m_tips.size(); | 87 | lastTip_ = (next + 1) % tips_.size(); |
2652 | 88 | else | 88 | else |
2654 | 89 | m_lastTip = next; | 89 | lastTip_ = next; |
2655 | 90 | show_tip(next); | 90 | show_tip(next); |
2658 | 91 | m_lastUpdated = SDL_GetTicks(); | 91 | lastUpdated_ = SDL_GetTicks(); |
2659 | 92 | m_updateAfter = m_tips[next].interval * 1000; | 92 | updateAfter_ = tips_[next].interval * 1000; |
2660 | 93 | } else if (repaint) { | 93 | } else if (repaint) { |
2662 | 94 | show_tip(m_lastTip); | 94 | show_tip(lastTip_); |
2663 | 95 | } | 95 | } |
2664 | 96 | } | 96 | } |
2665 | 97 | 97 | ||
2666 | 98 | void GameTips::stop() { | 98 | void GameTips::stop() { |
2670 | 99 | if (m_registered) { | 99 | if (registered_) { |
2671 | 100 | m_progressWindow.remove_visualization(this); | 100 | progressWindow_.remove_visualization(this); |
2672 | 101 | m_registered = false; | 101 | registered_ = false; |
2673 | 102 | } | 102 | } |
2674 | 103 | } | 103 | } |
2675 | 104 | 104 | ||
2676 | @@ -117,7 +117,7 @@ | |||
2677 | 117 | rt.blit(pt, pic_background); | 117 | rt.blit(pt, pic_background); |
2678 | 118 | 118 | ||
2679 | 119 | Point center(tips_area.x + tips_area.w / 2, tips_area.y + tips_area.h / 2); | 119 | Point center(tips_area.x + tips_area.w / 2, tips_area.y + tips_area.h / 2); |
2681 | 120 | const Image* rendered_text = UI::g_fh1->render(as_game_tip(m_tips[index].text), tips_area.w); | 120 | const Image* rendered_text = UI::g_fh1->render(as_game_tip(tips_[index].text), tips_area.w); |
2682 | 121 | rt.blit(center - Point(rendered_text->width() / 2, rendered_text->height() / 2), rendered_text); | 121 | rt.blit(center - Point(rendered_text->width() / 2, rendered_text->height() / 2), rendered_text); |
2683 | 122 | 122 | ||
2684 | 123 | g_gr->update(); | 123 | g_gr->update(); |
2685 | 124 | 124 | ||
2686 | === modified file 'src/wui/game_tips.h' | |||
2687 | --- src/wui/game_tips.h 2014-07-26 10:43:23 +0000 | |||
2688 | +++ src/wui/game_tips.h 2016-01-24 20:25:45 +0000 | |||
2689 | @@ -1,5 +1,5 @@ | |||
2690 | 1 | /* | 1 | /* |
2692 | 2 | * Copyright (C) 2007-2008 by the Widelands Development Team | 2 | * Copyright (C) 2007-2016 by the Widelands Development Team |
2693 | 3 | * | 3 | * |
2694 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
2695 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
2696 | @@ -43,13 +43,13 @@ | |||
2697 | 43 | void load_tips(std::string); | 43 | void load_tips(std::string); |
2698 | 44 | void show_tip(int32_t index); | 44 | void show_tip(int32_t index); |
2699 | 45 | 45 | ||
2705 | 46 | uint32_t m_lastUpdated; | 46 | uint32_t lastUpdated_; |
2706 | 47 | uint32_t m_updateAfter; | 47 | uint32_t updateAfter_; |
2707 | 48 | UI::ProgressWindow & m_progressWindow; | 48 | UI::ProgressWindow & progressWindow_; |
2708 | 49 | bool m_registered; | 49 | bool registered_; |
2709 | 50 | uint32_t m_lastTip; | 50 | uint32_t lastTip_; |
2710 | 51 | 51 | ||
2712 | 52 | std::vector<Tip> m_tips; | 52 | std::vector<Tip> tips_; |
2713 | 53 | }; | 53 | }; |
2714 | 54 | 54 | ||
2715 | 55 | #endif // end of include guard: WL_WUI_GAME_TIPS_H | 55 | #endif // end of include guard: WL_WUI_GAME_TIPS_H |
2716 | 56 | 56 | ||
2717 | === modified file 'src/wui/gamechatpanel.cc' | |||
2718 | --- src/wui/gamechatpanel.cc 2014-09-20 09:37:47 +0000 | |||
2719 | +++ src/wui/gamechatpanel.cc 2016-01-24 20:25:45 +0000 | |||
2720 | @@ -33,7 +33,7 @@ | |||
2721 | 33 | ChatProvider & chat) | 33 | ChatProvider & chat) |
2722 | 34 | : | 34 | : |
2723 | 35 | UI::Panel(parent, x, y, w, h), | 35 | UI::Panel(parent, x, y, w, h), |
2725 | 36 | m_chat (chat), | 36 | chat_ (chat), |
2726 | 37 | chatbox (this, 0, 0, w, h - 25, "", UI::Align_Left, 1), | 37 | chatbox (this, 0, 0, w, h - 25, "", UI::Align_Left, 1), |
2727 | 38 | editbox (this, 0, h - 20, w, 20), | 38 | editbox (this, 0, h - 20, w, 20), |
2728 | 39 | chat_message_counter(std::numeric_limits<uint32_t>::max()) | 39 | chat_message_counter(std::numeric_limits<uint32_t>::max()) |
2729 | @@ -57,7 +57,7 @@ | |||
2730 | 57 | */ | 57 | */ |
2731 | 58 | void GameChatPanel::recalculate() | 58 | void GameChatPanel::recalculate() |
2732 | 59 | { | 59 | { |
2734 | 60 | const std::vector<ChatMessage> msgs = m_chat.get_messages(); | 60 | const std::vector<ChatMessage> msgs = chat_.get_messages(); |
2735 | 61 | 61 | ||
2736 | 62 | std::string str = "<rt>"; | 62 | std::string str = "<rt>"; |
2737 | 63 | for (uint32_t i = 0; i < msgs.size(); ++i) { | 63 | for (uint32_t i = 0; i < msgs.size(); ++i) { |
2738 | @@ -75,7 +75,7 @@ | |||
2739 | 75 | // Note: if many messages arrive simultaneously, | 75 | // Note: if many messages arrive simultaneously, |
2740 | 76 | // the latest is a system message and some others | 76 | // the latest is a system message and some others |
2741 | 77 | // are not, then this act wrong! | 77 | // are not, then this act wrong! |
2743 | 78 | if (!msgs.back().sender.empty() && !m_chat.sound_off()) | 78 | if (!msgs.back().sender.empty() && !chat_.sound_off()) |
2744 | 79 | { | 79 | { |
2745 | 80 | // The latest message is not a system message | 80 | // The latest message is not a system message |
2746 | 81 | if (std::string::npos == msgs.back().sender.find("(IRC)") && chat_message_counter < msgs.size()) | 81 | if (std::string::npos == msgs.back().sender.find("(IRC)") && chat_message_counter < msgs.size()) |
2747 | @@ -104,7 +104,7 @@ | |||
2748 | 104 | const std::string & str = editbox.text(); | 104 | const std::string & str = editbox.text(); |
2749 | 105 | 105 | ||
2750 | 106 | if (str.size()) | 106 | if (str.size()) |
2752 | 107 | m_chat.send(str); | 107 | chat_.send(str); |
2753 | 108 | 108 | ||
2754 | 109 | editbox.set_text(""); | 109 | editbox.set_text(""); |
2755 | 110 | sent(); | 110 | sent(); |
2756 | 111 | 111 | ||
2757 | === modified file 'src/wui/gamechatpanel.h' | |||
2758 | --- src/wui/gamechatpanel.h 2014-09-20 09:37:47 +0000 | |||
2759 | +++ src/wui/gamechatpanel.h 2016-01-24 20:25:45 +0000 | |||
2760 | @@ -1,5 +1,5 @@ | |||
2761 | 1 | /* | 1 | /* |
2763 | 2 | * Copyright (C) 2008-2011 by the Widelands Development Team | 2 | * Copyright (C) 2008-2016 by the Widelands Development Team |
2764 | 3 | * | 3 | * |
2765 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
2766 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
2767 | @@ -54,7 +54,7 @@ | |||
2768 | 54 | void key_enter(); | 54 | void key_enter(); |
2769 | 55 | void key_escape(); | 55 | void key_escape(); |
2770 | 56 | 56 | ||
2772 | 57 | ChatProvider & m_chat; | 57 | ChatProvider & chat_; |
2773 | 58 | UI::MultilineTextarea chatbox; | 58 | UI::MultilineTextarea chatbox; |
2774 | 59 | UI::EditBox editbox; | 59 | UI::EditBox editbox; |
2775 | 60 | uint32_t chat_message_counter; | 60 | uint32_t chat_message_counter; |
2776 | 61 | 61 | ||
2777 | === modified file 'src/wui/general_statistics_menu.cc' | |||
2778 | --- src/wui/general_statistics_menu.cc 2015-11-28 22:29:26 +0000 | |||
2779 | +++ src/wui/general_statistics_menu.cc 2016-01-24 20:25:45 +0000 | |||
2780 | @@ -1,5 +1,5 @@ | |||
2781 | 1 | /* | 1 | /* |
2783 | 2 | * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
2784 | 3 | * | 3 | * |
2785 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
2786 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
2787 | @@ -52,21 +52,21 @@ | |||
2788 | 52 | UI::UniqueWindow | 52 | UI::UniqueWindow |
2789 | 53 | (&parent, "statistics_menu", ®istry, | 53 | (&parent, "statistics_menu", ®istry, |
2790 | 54 | 440, 400, _("General Statistics")), | 54 | 440, 400, _("General Statistics")), |
2795 | 55 | m_my_registry (®istry), | 55 | my_registry_ (®istry), |
2796 | 56 | m_box (this, 0, 0, UI::Box::Vertical, 0, 0, 5), | 56 | box_ (this, 0, 0, UI::Box::Vertical, 0, 0, 5), |
2797 | 57 | m_plot (&m_box, 0, 0, 430, PLOT_HEIGHT), | 57 | plot_ (&box_, 0, 0, 430, PLOT_HEIGHT), |
2798 | 58 | m_selected_information(0) | 58 | selected_information_(0) |
2799 | 59 | { | 59 | { |
2806 | 60 | assert (m_my_registry); | 60 | assert (my_registry_); |
2807 | 61 | 61 | ||
2808 | 62 | m_selected_information = m_my_registry->selected_information; | 62 | selected_information_ = my_registry_->selected_information; |
2809 | 63 | 63 | ||
2810 | 64 | set_center_panel(&m_box); | 64 | set_center_panel(&box_); |
2811 | 65 | m_box.set_border(5, 5, 5, 5); | 65 | box_.set_border(5, 5, 5, 5); |
2812 | 66 | 66 | ||
2813 | 67 | // Setup plot data | 67 | // Setup plot data |
2816 | 68 | m_plot.set_sample_rate(STATISTICS_SAMPLE_TIME); | 68 | plot_.set_sample_rate(STATISTICS_SAMPLE_TIME); |
2817 | 69 | m_plot.set_plotmode(WuiPlotArea::PLOTMODE_ABSOLUTE); | 69 | plot_.set_plotmode(WuiPlotArea::PLOTMODE_ABSOLUTE); |
2818 | 70 | Game & game = *parent.get_game(); | 70 | Game & game = *parent.get_game(); |
2819 | 71 | const Game::GeneralStatsVector & genstats = | 71 | const Game::GeneralStatsVector & genstats = |
2820 | 72 | game.get_general_statistics(); | 72 | game.get_general_statistics(); |
2821 | @@ -74,14 +74,14 @@ | |||
2822 | 74 | general_statistics_size = genstats.size(); | 74 | general_statistics_size = genstats.size(); |
2823 | 75 | 75 | ||
2824 | 76 | // Is there a hook dataset? | 76 | // Is there a hook dataset? |
2826 | 77 | m_ndatasets = NR_BASE_DATASETS; | 77 | ndatasets_ = NR_BASE_DATASETS; |
2827 | 78 | std::unique_ptr<LuaTable> hook = game.lua().get_hook("custom_statistic"); | 78 | std::unique_ptr<LuaTable> hook = game.lua().get_hook("custom_statistic"); |
2828 | 79 | std::string cs_name, cs_pic; | 79 | std::string cs_name, cs_pic; |
2829 | 80 | if (hook) { | 80 | if (hook) { |
2830 | 81 | hook->do_not_warn_about_unaccessed_keys(); | 81 | hook->do_not_warn_about_unaccessed_keys(); |
2831 | 82 | cs_name = hook->get_string("name"); | 82 | cs_name = hook->get_string("name"); |
2832 | 83 | cs_pic = hook->get_string("pic"); | 83 | cs_pic = hook->get_string("pic"); |
2834 | 84 | m_ndatasets++; | 84 | ndatasets_++; |
2835 | 85 | } | 85 | } |
2836 | 86 | 86 | ||
2837 | 87 | for | 87 | for |
2838 | @@ -90,56 +90,56 @@ | |||
2839 | 90 | ++i) | 90 | ++i) |
2840 | 91 | { | 91 | { |
2841 | 92 | const RGBColor & color = Player::Colors[i]; | 92 | const RGBColor & color = Player::Colors[i]; |
2874 | 93 | m_plot.register_plot_data | 93 | plot_.register_plot_data |
2875 | 94 | (i * m_ndatasets + 0, &genstats[i].land_size, | 94 | (i * ndatasets_ + 0, &genstats[i].land_size, |
2876 | 95 | color); | 95 | color); |
2877 | 96 | m_plot.register_plot_data | 96 | plot_.register_plot_data |
2878 | 97 | (i * m_ndatasets + 1, &genstats[i].nr_workers, | 97 | (i * ndatasets_ + 1, &genstats[i].nr_workers, |
2879 | 98 | color); | 98 | color); |
2880 | 99 | m_plot.register_plot_data | 99 | plot_.register_plot_data |
2881 | 100 | (i * m_ndatasets + 2, &genstats[i].nr_buildings, | 100 | (i * ndatasets_ + 2, &genstats[i].nr_buildings, |
2882 | 101 | color); | 101 | color); |
2883 | 102 | m_plot.register_plot_data | 102 | plot_.register_plot_data |
2884 | 103 | (i * m_ndatasets + 3, &genstats[i].nr_wares, | 103 | (i * ndatasets_ + 3, &genstats[i].nr_wares, |
2885 | 104 | color); | 104 | color); |
2886 | 105 | m_plot.register_plot_data | 105 | plot_.register_plot_data |
2887 | 106 | (i * m_ndatasets + 4, &genstats[i].productivity, | 106 | (i * ndatasets_ + 4, &genstats[i].productivity, |
2888 | 107 | color); | 107 | color); |
2889 | 108 | m_plot.register_plot_data | 108 | plot_.register_plot_data |
2890 | 109 | (i * m_ndatasets + 5, &genstats[i].nr_casualties, | 109 | (i * ndatasets_ + 5, &genstats[i].nr_casualties, |
2891 | 110 | color); | 110 | color); |
2892 | 111 | m_plot.register_plot_data | 111 | plot_.register_plot_data |
2893 | 112 | (i * m_ndatasets + 6, &genstats[i].nr_kills, | 112 | (i * ndatasets_ + 6, &genstats[i].nr_kills, |
2894 | 113 | color); | 113 | color); |
2895 | 114 | m_plot.register_plot_data | 114 | plot_.register_plot_data |
2896 | 115 | (i * m_ndatasets + 7, &genstats[i].nr_msites_lost, | 115 | (i * ndatasets_ + 7, &genstats[i].nr_msites_lost, |
2897 | 116 | color); | 116 | color); |
2898 | 117 | m_plot.register_plot_data | 117 | plot_.register_plot_data |
2899 | 118 | (i * m_ndatasets + 8, &genstats[i].nr_msites_defeated, | 118 | (i * ndatasets_ + 8, &genstats[i].nr_msites_defeated, |
2900 | 119 | color); | 119 | color); |
2901 | 120 | m_plot.register_plot_data | 120 | plot_.register_plot_data |
2902 | 121 | (i * m_ndatasets + 9, &genstats[i].nr_civil_blds_lost, | 121 | (i * ndatasets_ + 9, &genstats[i].nr_civil_blds_lost, |
2903 | 122 | color); | 122 | color); |
2904 | 123 | m_plot.register_plot_data | 123 | plot_.register_plot_data |
2905 | 124 | (i * m_ndatasets + 10, &genstats[i].miltary_strength, | 124 | (i * ndatasets_ + 10, &genstats[i].miltary_strength, |
2906 | 125 | color); | 125 | color); |
2907 | 126 | if (hook) { | 126 | if (hook) { |
2910 | 127 | m_plot.register_plot_data | 127 | plot_.register_plot_data |
2911 | 128 | (i * m_ndatasets + 11, &genstats[i].custom_statistic, | 128 | (i * ndatasets_ + 11, &genstats[i].custom_statistic, |
2912 | 129 | color); | 129 | color); |
2913 | 130 | } | 130 | } |
2914 | 131 | if (game.get_player(i + 1)) // Show area plot | 131 | if (game.get_player(i + 1)) // Show area plot |
2918 | 132 | m_plot.show_plot | 132 | plot_.show_plot |
2919 | 133 | (i * m_ndatasets + m_selected_information, | 133 | (i * ndatasets_ + selected_information_, |
2920 | 134 | m_my_registry->selected_players[i]); | 134 | my_registry_->selected_players[i]); |
2921 | 135 | } | 135 | } |
2922 | 136 | 136 | ||
2924 | 137 | m_plot.set_time(m_my_registry->time); | 137 | plot_.set_time(my_registry_->time); |
2925 | 138 | 138 | ||
2926 | 139 | // Setup Widgets | 139 | // Setup Widgets |
2928 | 140 | m_box.add(&m_plot, UI::Box::AlignTop); | 140 | box_.add(&plot_, UI::Box::AlignTop); |
2929 | 141 | 141 | ||
2931 | 142 | UI::Box * hbox1 = new UI::Box(&m_box, 0, 0, UI::Box::Horizontal, 0, 0, 1); | 142 | UI::Box * hbox1 = new UI::Box(&box_, 0, 0, UI::Box::Horizontal, 0, 0, 1); |
2932 | 143 | 143 | ||
2933 | 144 | uint32_t plr_in_game = 0; | 144 | uint32_t plr_in_game = 0; |
2934 | 145 | PlayerNumber const nr_players = game.map().get_nrplayers(); | 145 | PlayerNumber const nr_players = game.map().get_nrplayers(); |
2935 | @@ -157,21 +157,21 @@ | |||
2936 | 157 | player->get_name().c_str()); | 157 | player->get_name().c_str()); |
2937 | 158 | cb.sigclicked.connect | 158 | cb.sigclicked.connect |
2938 | 159 | (boost::bind(&GeneralStatisticsMenu::cb_changed_to, this, p)); | 159 | (boost::bind(&GeneralStatisticsMenu::cb_changed_to, this, p)); |
2940 | 160 | cb.set_perm_pressed(m_my_registry->selected_players[p - 1]); | 160 | cb.set_perm_pressed(my_registry_->selected_players[p - 1]); |
2941 | 161 | 161 | ||
2943 | 162 | m_cbs[p - 1] = &cb; | 162 | cbs_[p - 1] = &cb; |
2944 | 163 | 163 | ||
2945 | 164 | hbox1->add(&cb, UI::Box::AlignLeft, false, true); | 164 | hbox1->add(&cb, UI::Box::AlignLeft, false, true); |
2946 | 165 | } else // player nr p does not exist | 165 | } else // player nr p does not exist |
2952 | 166 | m_cbs[p - 1] = nullptr; | 166 | cbs_[p - 1] = nullptr; |
2953 | 167 | 167 | ||
2954 | 168 | m_box.add(hbox1, UI::Box::AlignTop, true); | 168 | box_.add(hbox1, UI::Box::AlignTop, true); |
2955 | 169 | 169 | ||
2956 | 170 | UI::Box * hbox2 = new UI::Box(&m_box, 0, 0, UI::Box::Horizontal, 0, 0, 1); | 170 | UI::Box * hbox2 = new UI::Box(&box_, 0, 0, UI::Box::Horizontal, 0, 0, 1); |
2957 | 171 | 171 | ||
2958 | 172 | UI::Radiobutton * btn; | 172 | UI::Radiobutton * btn; |
2959 | 173 | 173 | ||
2961 | 174 | m_radiogroup.add_button | 174 | radiogroup_.add_button |
2962 | 175 | (hbox2, | 175 | (hbox2, |
2963 | 176 | Point(0, 0), | 176 | Point(0, 0), |
2964 | 177 | g_gr->images().get("pics/genstats_landsize.png"), | 177 | g_gr->images().get("pics/genstats_landsize.png"), |
2965 | @@ -179,7 +179,7 @@ | |||
2966 | 179 | &btn); | 179 | &btn); |
2967 | 180 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 180 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
2968 | 181 | 181 | ||
2970 | 182 | m_radiogroup.add_button | 182 | radiogroup_.add_button |
2971 | 183 | (hbox2, | 183 | (hbox2, |
2972 | 184 | Point(0, 0), | 184 | Point(0, 0), |
2973 | 185 | g_gr->images().get("pics/genstats_nrworkers.png"), | 185 | g_gr->images().get("pics/genstats_nrworkers.png"), |
2974 | @@ -187,7 +187,7 @@ | |||
2975 | 187 | &btn); | 187 | &btn); |
2976 | 188 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 188 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
2977 | 189 | 189 | ||
2979 | 190 | m_radiogroup.add_button | 190 | radiogroup_.add_button |
2980 | 191 | (hbox2, | 191 | (hbox2, |
2981 | 192 | Point(0, 0), | 192 | Point(0, 0), |
2982 | 193 | g_gr->images().get("pics/genstats_nrbuildings.png"), | 193 | g_gr->images().get("pics/genstats_nrbuildings.png"), |
2983 | @@ -195,7 +195,7 @@ | |||
2984 | 195 | &btn); | 195 | &btn); |
2985 | 196 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 196 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
2986 | 197 | 197 | ||
2988 | 198 | m_radiogroup.add_button | 198 | radiogroup_.add_button |
2989 | 199 | (hbox2, | 199 | (hbox2, |
2990 | 200 | Point(0, 0), | 200 | Point(0, 0), |
2991 | 201 | g_gr->images().get("pics/genstats_nrwares.png"), | 201 | g_gr->images().get("pics/genstats_nrwares.png"), |
2992 | @@ -203,7 +203,7 @@ | |||
2993 | 203 | &btn); | 203 | &btn); |
2994 | 204 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 204 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
2995 | 205 | 205 | ||
2997 | 206 | m_radiogroup.add_button | 206 | radiogroup_.add_button |
2998 | 207 | (hbox2, | 207 | (hbox2, |
2999 | 208 | Point(0, 0), | 208 | Point(0, 0), |
3000 | 209 | g_gr->images().get("pics/genstats_productivity.png"), | 209 | g_gr->images().get("pics/genstats_productivity.png"), |
3001 | @@ -211,7 +211,7 @@ | |||
3002 | 211 | &btn); | 211 | &btn); |
3003 | 212 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 212 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
3004 | 213 | 213 | ||
3006 | 214 | m_radiogroup.add_button | 214 | radiogroup_.add_button |
3007 | 215 | (hbox2, | 215 | (hbox2, |
3008 | 216 | Point(0, 0), | 216 | Point(0, 0), |
3009 | 217 | g_gr->images().get("pics/genstats_casualties.png"), | 217 | g_gr->images().get("pics/genstats_casualties.png"), |
3010 | @@ -219,7 +219,7 @@ | |||
3011 | 219 | &btn); | 219 | &btn); |
3012 | 220 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 220 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
3013 | 221 | 221 | ||
3015 | 222 | m_radiogroup.add_button | 222 | radiogroup_.add_button |
3016 | 223 | (hbox2, | 223 | (hbox2, |
3017 | 224 | Point(0, 0), | 224 | Point(0, 0), |
3018 | 225 | g_gr->images().get("pics/genstats_kills.png"), | 225 | g_gr->images().get("pics/genstats_kills.png"), |
3019 | @@ -227,7 +227,7 @@ | |||
3020 | 227 | &btn); | 227 | &btn); |
3021 | 228 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 228 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
3022 | 229 | 229 | ||
3024 | 230 | m_radiogroup.add_button | 230 | radiogroup_.add_button |
3025 | 231 | (hbox2, | 231 | (hbox2, |
3026 | 232 | Point(0, 0), | 232 | Point(0, 0), |
3027 | 233 | g_gr->images().get("pics/genstats_msites_lost.png"), | 233 | g_gr->images().get("pics/genstats_msites_lost.png"), |
3028 | @@ -235,7 +235,7 @@ | |||
3029 | 235 | &btn); | 235 | &btn); |
3030 | 236 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 236 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
3031 | 237 | 237 | ||
3033 | 238 | m_radiogroup.add_button | 238 | radiogroup_.add_button |
3034 | 239 | (hbox2, | 239 | (hbox2, |
3035 | 240 | Point(0, 0), | 240 | Point(0, 0), |
3036 | 241 | g_gr->images().get("pics/genstats_msites_defeated.png"), | 241 | g_gr->images().get("pics/genstats_msites_defeated.png"), |
3037 | @@ -243,7 +243,7 @@ | |||
3038 | 243 | &btn); | 243 | &btn); |
3039 | 244 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 244 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
3040 | 245 | 245 | ||
3042 | 246 | m_radiogroup.add_button | 246 | radiogroup_.add_button |
3043 | 247 | (hbox2, | 247 | (hbox2, |
3044 | 248 | Point(0, 0), | 248 | Point(0, 0), |
3045 | 249 | g_gr->images().get("pics/genstats_civil_blds_lost.png"), | 249 | g_gr->images().get("pics/genstats_civil_blds_lost.png"), |
3046 | @@ -251,7 +251,7 @@ | |||
3047 | 251 | &btn); | 251 | &btn); |
3048 | 252 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 252 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
3049 | 253 | 253 | ||
3051 | 254 | m_radiogroup.add_button | 254 | radiogroup_.add_button |
3052 | 255 | (hbox2, | 255 | (hbox2, |
3053 | 256 | Point(0, 0), | 256 | Point(0, 0), |
3054 | 257 | g_gr->images().get("pics/genstats_militarystrength.png"), | 257 | g_gr->images().get("pics/genstats_militarystrength.png"), |
3055 | @@ -260,7 +260,7 @@ | |||
3056 | 260 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 260 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
3057 | 261 | 261 | ||
3058 | 262 | if (hook) { | 262 | if (hook) { |
3060 | 263 | m_radiogroup.add_button | 263 | radiogroup_.add_button |
3061 | 264 | (hbox2, | 264 | (hbox2, |
3062 | 265 | Point(0, 0), | 265 | Point(0, 0), |
3063 | 266 | g_gr->images().get(cs_pic), | 266 | g_gr->images().get(cs_pic), |
3064 | @@ -269,15 +269,15 @@ | |||
3065 | 269 | hbox2->add(btn, UI::Box::AlignLeft, false, true); | 269 | hbox2->add(btn, UI::Box::AlignLeft, false, true); |
3066 | 270 | } | 270 | } |
3067 | 271 | 271 | ||
3070 | 272 | m_radiogroup.set_state(m_selected_information); | 272 | radiogroup_.set_state(selected_information_); |
3071 | 273 | m_radiogroup.changedto.connect | 273 | radiogroup_.changedto.connect |
3072 | 274 | (boost::bind(&GeneralStatisticsMenu::radiogroup_changed, this, _1)); | 274 | (boost::bind(&GeneralStatisticsMenu::radiogroup_changed, this, _1)); |
3073 | 275 | 275 | ||
3075 | 276 | m_box.add(hbox2, UI::Box::AlignTop, true); | 276 | box_.add(hbox2, UI::Box::AlignTop, true); |
3076 | 277 | 277 | ||
3078 | 278 | m_box.add | 278 | box_.add |
3079 | 279 | (new WuiPlotAreaSlider | 279 | (new WuiPlotAreaSlider |
3081 | 280 | (&m_box, m_plot, 0, 0, 100, 45, | 280 | (&box_, plot_, 0, 0, 100, 45, |
3082 | 281 | g_gr->images().get("pics/but1.png")) | 281 | g_gr->images().get("pics/but1.png")) |
3083 | 282 | , UI::Box::AlignTop | 282 | , UI::Box::AlignTop |
3084 | 283 | , true); | 283 | , true); |
3085 | @@ -288,11 +288,11 @@ | |||
3086 | 288 | Game & game = dynamic_cast<InteractiveGameBase&>(*get_parent()).game(); | 288 | Game & game = dynamic_cast<InteractiveGameBase&>(*get_parent()).game(); |
3087 | 289 | if (game.is_loaded()) { | 289 | if (game.is_loaded()) { |
3088 | 290 | // Save informations for recreation, if window is reopened | 290 | // Save informations for recreation, if window is reopened |
3091 | 291 | m_my_registry->selected_information = m_selected_information; | 291 | my_registry_->selected_information = selected_information_; |
3092 | 292 | m_my_registry->time = m_plot.get_time(); | 292 | my_registry_->time = plot_.get_time(); |
3093 | 293 | PlayerNumber const nr_players = game.map().get_nrplayers(); | 293 | PlayerNumber const nr_players = game.map().get_nrplayers(); |
3094 | 294 | iterate_players_existing_novar(p, nr_players, game) { | 294 | iterate_players_existing_novar(p, nr_players, game) { |
3096 | 295 | m_my_registry->selected_players[p - 1] = m_cbs[p - 1]->get_perm_pressed(); | 295 | my_registry_->selected_players[p - 1] = cbs_[p - 1]->get_perm_pressed(); |
3097 | 296 | } | 296 | } |
3098 | 297 | } | 297 | } |
3099 | 298 | } | 298 | } |
3100 | @@ -310,11 +310,11 @@ | |||
3101 | 310 | void GeneralStatisticsMenu::cb_changed_to(int32_t const id) | 310 | void GeneralStatisticsMenu::cb_changed_to(int32_t const id) |
3102 | 311 | { | 311 | { |
3103 | 312 | // This represents our player number | 312 | // This represents our player number |
3105 | 313 | m_cbs[id - 1]->set_perm_pressed(!m_cbs[id - 1]->get_perm_pressed()); | 313 | cbs_[id - 1]->set_perm_pressed(!cbs_[id - 1]->get_perm_pressed()); |
3106 | 314 | 314 | ||
3110 | 315 | m_plot.show_plot | 315 | plot_.show_plot |
3111 | 316 | ((id - 1) * m_ndatasets + m_selected_information, | 316 | ((id - 1) * ndatasets_ + selected_information_, |
3112 | 317 | m_cbs[id - 1]->get_perm_pressed()); | 317 | cbs_[id - 1]->get_perm_pressed()); |
3113 | 318 | } | 318 | } |
3114 | 319 | 319 | ||
3115 | 320 | /* | 320 | /* |
3116 | @@ -325,11 +325,11 @@ | |||
3117 | 325 | dynamic_cast<InteractiveGameBase&>(*get_parent()).game() | 325 | dynamic_cast<InteractiveGameBase&>(*get_parent()).game() |
3118 | 326 | .get_general_statistics().size(); | 326 | .get_general_statistics().size(); |
3119 | 327 | for (uint32_t i = 0; i < statistics_size; ++i) | 327 | for (uint32_t i = 0; i < statistics_size; ++i) |
3125 | 328 | if (m_cbs[i]) { | 328 | if (cbs_[i]) { |
3126 | 329 | m_plot.show_plot | 329 | plot_.show_plot |
3127 | 330 | (i * m_ndatasets + id, m_cbs[i]->get_perm_pressed()); | 330 | (i * ndatasets_ + id, cbs_[i]->get_perm_pressed()); |
3128 | 331 | m_plot.show_plot | 331 | plot_.show_plot |
3129 | 332 | (i * m_ndatasets + m_selected_information, false); | 332 | (i * ndatasets_ + selected_information_, false); |
3130 | 333 | } | 333 | } |
3132 | 334 | m_selected_information = id; | 334 | selected_information_ = id; |
3133 | 335 | } | 335 | } |
3134 | 336 | 336 | ||
3135 | === modified file 'src/wui/general_statistics_menu.h' | |||
3136 | --- src/wui/general_statistics_menu.h 2014-09-10 13:03:40 +0000 | |||
3137 | +++ src/wui/general_statistics_menu.h 2016-01-24 20:25:45 +0000 | |||
3138 | @@ -1,5 +1,5 @@ | |||
3139 | 1 | /* | 1 | /* |
3141 | 2 | * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
3142 | 3 | * | 3 | * |
3143 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
3144 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
3145 | @@ -53,13 +53,13 @@ | |||
3146 | 53 | virtual ~GeneralStatisticsMenu(); | 53 | virtual ~GeneralStatisticsMenu(); |
3147 | 54 | 54 | ||
3148 | 55 | private: | 55 | private: |
3156 | 56 | Registry * m_my_registry; | 56 | Registry * my_registry_; |
3157 | 57 | UI::Box m_box; | 57 | UI::Box box_; |
3158 | 58 | WuiPlotArea m_plot; | 58 | WuiPlotArea plot_; |
3159 | 59 | UI::Radiogroup m_radiogroup; | 59 | UI::Radiogroup radiogroup_; |
3160 | 60 | int32_t m_selected_information; | 60 | int32_t selected_information_; |
3161 | 61 | UI::Button * m_cbs[MAX_PLAYERS]; | 61 | UI::Button * cbs_[MAX_PLAYERS]; |
3162 | 62 | uint32_t m_ndatasets; | 62 | uint32_t ndatasets_; |
3163 | 63 | 63 | ||
3164 | 64 | void clicked_help(); | 64 | void clicked_help(); |
3165 | 65 | void cb_changed_to(int32_t); | 65 | void cb_changed_to(int32_t); |
3166 | 66 | 66 | ||
3167 | === modified file 'src/wui/interactive_gamebase.cc' | |||
3168 | --- src/wui/interactive_gamebase.cc 2016-01-16 15:57:31 +0000 | |||
3169 | +++ src/wui/interactive_gamebase.cc 2016-01-24 20:25:45 +0000 | |||
3170 | @@ -1,5 +1,5 @@ | |||
3171 | 1 | /* | 1 | /* |
3173 | 2 | * Copyright (C) 2007-2011 by the Widelands Development Team | 2 | * Copyright (C) 2007-2016 by the Widelands Development Team |
3174 | 3 | * | 3 | * |
3175 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
3176 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
3177 | @@ -52,25 +52,25 @@ | |||
3178 | 52 | : | 52 | : |
3179 | 53 | InteractiveBase(_game, global_s), | 53 | InteractiveBase(_game, global_s), |
3180 | 54 | chat_provider_(nullptr), | 54 | chat_provider_(nullptr), |
3182 | 55 | m_building_census_format | 55 | building_census_format_ |
3183 | 56 | (global_s.get_string("building_census_format", "%N")), | 56 | (global_s.get_string("building_census_format", "%N")), |
3185 | 57 | m_building_statistics_format | 57 | building_statistics_format_ |
3186 | 58 | (global_s.get_string("building_statistics_format", "%t")), | 58 | (global_s.get_string("building_statistics_format", "%t")), |
3188 | 59 | m_building_tooltip_format | 59 | building_tooltip_format_ |
3189 | 60 | (global_s.get_string("building_tooltip_format", "%r")), | 60 | (global_s.get_string("building_tooltip_format", "%r")), |
3193 | 61 | m_chatenabled(chatenabled), | 61 | chatenabled_(chatenabled), |
3194 | 62 | m_multiplayer(multiplayer), | 62 | multiplayer_(multiplayer), |
3195 | 63 | m_playertype(pt), | 63 | playertype_(pt), |
3196 | 64 | 64 | ||
3197 | 65 | #define INIT_BTN(picture, name, tooltip) \ | 65 | #define INIT_BTN(picture, name, tooltip) \ |
3198 | 66 | TOOLBAR_BUTTON_COMMON_PARAMETERS(name), \ | 66 | TOOLBAR_BUTTON_COMMON_PARAMETERS(name), \ |
3199 | 67 | g_gr->images().get("pics/" picture ".png"), \ | 67 | g_gr->images().get("pics/" picture ".png"), \ |
3200 | 68 | tooltip \ | 68 | tooltip \ |
3201 | 69 | 69 | ||
3203 | 70 | m_toggle_buildhelp | 70 | toggle_buildhelp_ |
3204 | 71 | (INIT_BTN("menu_toggle_buildhelp", "buildhelp", _("Show Building Spaces (on/off)"))) | 71 | (INIT_BTN("menu_toggle_buildhelp", "buildhelp", _("Show Building Spaces (on/off)"))) |
3205 | 72 | { | 72 | { |
3207 | 73 | m_toggle_buildhelp.sigclicked.connect(boost::bind(&InteractiveGameBase::toggle_buildhelp, this)); | 73 | toggle_buildhelp_.sigclicked.connect(boost::bind(&InteractiveGameBase::toggle_buildhelp, this)); |
3208 | 74 | } | 74 | } |
3209 | 75 | 75 | ||
3210 | 76 | /// \return a pointer to the running \ref Game instance. | 76 | /// \return a pointer to the running \ref Game instance. |
3211 | @@ -90,7 +90,7 @@ | |||
3212 | 90 | chat_provider_ = &chat; | 90 | chat_provider_ = &chat; |
3213 | 91 | chat_overlay_->set_chat_provider(chat); | 91 | chat_overlay_->set_chat_provider(chat); |
3214 | 92 | 92 | ||
3216 | 93 | m_chatenabled = true; | 93 | chatenabled_ = true; |
3217 | 94 | } | 94 | } |
3218 | 95 | 95 | ||
3219 | 96 | ChatProvider * InteractiveGameBase::get_chat_provider() | 96 | ChatProvider * InteractiveGameBase::get_chat_provider() |
3220 | @@ -137,7 +137,7 @@ | |||
3221 | 137 | Widelands::Map & map = egbase().map(); | 137 | Widelands::Map & map = egbase().map(); |
3222 | 138 | auto* overlay_manager = mutable_field_overlay_manager(); | 138 | auto* overlay_manager = mutable_field_overlay_manager(); |
3223 | 139 | show_buildhelp(false); | 139 | show_buildhelp(false); |
3225 | 140 | m_toggle_buildhelp.set_perm_pressed(buildhelp()); | 140 | toggle_buildhelp_.set_perm_pressed(buildhelp()); |
3226 | 141 | 141 | ||
3227 | 142 | overlay_manager->register_overlay_callback_function | 142 | overlay_manager->register_overlay_callback_function |
3228 | 143 | (boost::bind(&InteractiveGameBase::calculate_buildcaps, this, _1)); | 143 | (boost::bind(&InteractiveGameBase::calculate_buildcaps, this, _1)); |
3229 | @@ -147,14 +147,14 @@ | |||
3230 | 147 | map.recalc_whole_map(egbase().world()); | 147 | map.recalc_whole_map(egbase().world()); |
3231 | 148 | 148 | ||
3232 | 149 | // Close game-relevant UI windows (but keep main menu open) | 149 | // Close game-relevant UI windows (but keep main menu open) |
3235 | 150 | delete m_fieldaction.window; | 150 | delete fieldaction_.window; |
3236 | 151 | m_fieldaction.window = nullptr; | 151 | fieldaction_.window = nullptr; |
3237 | 152 | 152 | ||
3238 | 153 | hide_minimap(); | 153 | hide_minimap(); |
3239 | 154 | } | 154 | } |
3240 | 155 | 155 | ||
3241 | 156 | void InteractiveGameBase::on_buildhelp_changed(const bool value) { | 156 | void InteractiveGameBase::on_buildhelp_changed(const bool value) { |
3243 | 157 | m_toggle_buildhelp.set_perm_pressed(value); | 157 | toggle_buildhelp_.set_perm_pressed(value); |
3244 | 158 | } | 158 | } |
3245 | 159 | 159 | ||
3246 | 160 | /** | 160 | /** |
3247 | @@ -188,10 +188,10 @@ | |||
3248 | 188 | void InteractiveGameBase::show_game_summary() | 188 | void InteractiveGameBase::show_game_summary() |
3249 | 189 | { | 189 | { |
3250 | 190 | game().game_controller()->set_desired_speed(0); | 190 | game().game_controller()->set_desired_speed(0); |
3254 | 191 | if (m_game_summary.window) { | 191 | if (game_summary_.window) { |
3255 | 192 | m_game_summary.window->set_visible(true); | 192 | game_summary_.window->set_visible(true); |
3256 | 193 | m_game_summary.window->think(); | 193 | game_summary_.window->think(); |
3257 | 194 | return; | 194 | return; |
3258 | 195 | } | 195 | } |
3260 | 196 | new GameSummaryScreen(this, &m_game_summary); | 196 | new GameSummaryScreen(this, &game_summary_); |
3261 | 197 | } | 197 | } |
3262 | 198 | 198 | ||
3263 | === modified file 'src/wui/interactive_gamebase.h' | |||
3264 | --- src/wui/interactive_gamebase.h 2016-01-16 15:57:31 +0000 | |||
3265 | +++ src/wui/interactive_gamebase.h 2016-01-24 20:25:45 +0000 | |||
3266 | @@ -1,5 +1,5 @@ | |||
3267 | 1 | /* | 1 | /* |
3269 | 2 | * Copyright (C) 2002-2003, 2006-2013 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
3270 | 3 | * | 3 | * |
3271 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
3272 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
3273 | @@ -62,13 +62,13 @@ | |||
3274 | 62 | 62 | ||
3275 | 63 | // TODO(sirver): Remove the use of these methods as the strings are no longer configurable. | 63 | // TODO(sirver): Remove the use of these methods as the strings are no longer configurable. |
3276 | 64 | const std::string & building_census_format () const { | 64 | const std::string & building_census_format () const { |
3278 | 65 | return m_building_census_format; | 65 | return building_census_format_; |
3279 | 66 | } | 66 | } |
3280 | 67 | const std::string & building_statistics_format () const { | 67 | const std::string & building_statistics_format () const { |
3282 | 68 | return m_building_statistics_format; | 68 | return building_statistics_format_; |
3283 | 69 | } | 69 | } |
3284 | 70 | const std::string & building_tooltip_format () const { | 70 | const std::string & building_tooltip_format () const { |
3286 | 71 | return m_building_tooltip_format; | 71 | return building_tooltip_format_; |
3287 | 72 | } | 72 | } |
3288 | 73 | 73 | ||
3289 | 74 | virtual bool can_see(Widelands::PlayerNumber) const = 0; | 74 | virtual bool can_see(Widelands::PlayerNumber) const = 0; |
3290 | @@ -76,11 +76,11 @@ | |||
3291 | 76 | virtual Widelands::PlayerNumber player_number() const = 0; | 76 | virtual Widelands::PlayerNumber player_number() const = 0; |
3292 | 77 | 77 | ||
3293 | 78 | virtual void node_action() = 0; | 78 | virtual void node_action() = 0; |
3296 | 79 | const PlayerType & get_playertype()const {return m_playertype;} | 79 | const PlayerType & get_playertype()const {return playertype_;} |
3297 | 80 | void set_playertype(const PlayerType & pt) {m_playertype = pt;} | 80 | void set_playertype(const PlayerType & pt) {playertype_ = pt;} |
3298 | 81 | 81 | ||
3299 | 82 | bool try_show_ship_window(); | 82 | bool try_show_ship_window(); |
3301 | 83 | bool is_multiplayer() {return m_multiplayer;} | 83 | bool is_multiplayer() {return multiplayer_;} |
3302 | 84 | 84 | ||
3303 | 85 | void show_game_summary(); | 85 | void show_game_summary(); |
3304 | 86 | void postload() override; | 86 | void postload() override; |
3305 | @@ -90,18 +90,18 @@ | |||
3306 | 90 | void draw_overlay(RenderTarget &) override; | 90 | void draw_overlay(RenderTarget &) override; |
3307 | 91 | virtual int32_t calculate_buildcaps(const Widelands::TCoords<Widelands::FCoords> c) = 0; | 91 | virtual int32_t calculate_buildcaps(const Widelands::TCoords<Widelands::FCoords> c) = 0; |
3308 | 92 | 92 | ||
3310 | 93 | GameMainMenuWindows m_mainm_windows; | 93 | GameMainMenuWindows main_windows_; |
3311 | 94 | ChatProvider * chat_provider_; | 94 | ChatProvider * chat_provider_; |
3320 | 95 | std::string m_building_census_format; | 95 | std::string building_census_format_; |
3321 | 96 | std::string m_building_statistics_format; | 96 | std::string building_statistics_format_; |
3322 | 97 | std::string m_building_tooltip_format; | 97 | std::string building_tooltip_format_; |
3323 | 98 | bool m_chatenabled; | 98 | bool chatenabled_; |
3324 | 99 | bool m_multiplayer; | 99 | bool multiplayer_; |
3325 | 100 | PlayerType m_playertype; | 100 | PlayerType playertype_; |
3326 | 101 | UI::UniqueWindow::Registry m_fieldaction; | 101 | UI::UniqueWindow::Registry fieldaction_; |
3327 | 102 | UI::UniqueWindow::Registry m_game_summary; | 102 | UI::UniqueWindow::Registry game_summary_; |
3328 | 103 | 103 | ||
3330 | 104 | UI::Button m_toggle_buildhelp; | 104 | UI::Button toggle_buildhelp_; |
3331 | 105 | 105 | ||
3332 | 106 | private: | 106 | private: |
3333 | 107 | void on_buildhelp_changed(const bool value) override; | 107 | void on_buildhelp_changed(const bool value) override; |
3334 | 108 | 108 | ||
3335 | === modified file 'src/wui/interactive_player.cc' | |||
3336 | --- src/wui/interactive_player.cc 2016-01-16 15:57:31 +0000 | |||
3337 | +++ src/wui/interactive_player.cc 2016-01-24 20:25:45 +0000 | |||
3338 | @@ -1,5 +1,5 @@ | |||
3339 | 1 | /* | 1 | /* |
3341 | 2 | * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
3342 | 3 | * | 3 | * |
3343 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
3344 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
3345 | @@ -66,8 +66,8 @@ | |||
3346 | 66 | bool const multiplayer) | 66 | bool const multiplayer) |
3347 | 67 | : | 67 | : |
3348 | 68 | InteractiveGameBase (_game, global_s, NONE, multiplayer, multiplayer), | 68 | InteractiveGameBase (_game, global_s, NONE, multiplayer, multiplayer), |
3351 | 69 | m_auto_roadbuild_mode(global_s.get_bool("auto_roadbuild_mode", true)), | 69 | auto_roadbuild_mode_(global_s.get_bool("auto_roadbuild_mode", true)), |
3352 | 70 | m_flag_to_connect(Widelands::Coords::null()), | 70 | flag_to_connect_(Widelands::Coords::null()), |
3353 | 71 | 71 | ||
3354 | 72 | // Chat is different, as chat_provider_ needs to be checked when toggling | 72 | // Chat is different, as chat_provider_ needs to be checked when toggling |
3355 | 73 | // Minimap is different as it warps and stuff | 73 | // Minimap is different as it warps and stuff |
3356 | @@ -84,59 +84,59 @@ | |||
3357 | 84 | tooltip \ | 84 | tooltip \ |
3358 | 85 | 85 | ||
3359 | 86 | 86 | ||
3361 | 87 | m_toggle_chat | 87 | toggle_chat_ |
3362 | 88 | (INIT_BTN_this | 88 | (INIT_BTN_this |
3363 | 89 | ("menu_chat", "chat", _("Chat"))), | 89 | ("menu_chat", "chat", _("Chat"))), |
3365 | 90 | m_toggle_options_menu | 90 | toggle_options_menu_ |
3366 | 91 | (INIT_BTN | 91 | (INIT_BTN |
3367 | 92 | ("menu_options_menu", "options_menu", _("Options"))), | 92 | ("menu_options_menu", "options_menu", _("Options"))), |
3369 | 93 | m_toggle_statistics_menu | 93 | toggle_statistics_menu_ |
3370 | 94 | (INIT_BTN | 94 | (INIT_BTN |
3371 | 95 | ("menu_toggle_menu", "statistics_menu", _("Statistics"))), | 95 | ("menu_toggle_menu", "statistics_menu", _("Statistics"))), |
3373 | 96 | m_toggle_objectives | 96 | toggle_objectives_ |
3374 | 97 | (INIT_BTN | 97 | (INIT_BTN |
3375 | 98 | ("menu_objectives", "objectives", _("Objectives"))), | 98 | ("menu_objectives", "objectives", _("Objectives"))), |
3377 | 99 | m_toggle_minimap | 99 | toggle_minimap_ |
3378 | 100 | (INIT_BTN_this | 100 | (INIT_BTN_this |
3379 | 101 | ("menu_toggle_minimap", "minimap", _("Minimap"))), | 101 | ("menu_toggle_minimap", "minimap", _("Minimap"))), |
3381 | 102 | m_toggle_message_menu | 102 | toggle_message_menu_ |
3382 | 103 | (INIT_BTN | 103 | (INIT_BTN |
3383 | 104 | ("menu_toggle_oldmessage_menu", "messages", _("Messages"))), | 104 | ("menu_toggle_oldmessage_menu", "messages", _("Messages"))), |
3385 | 105 | m_toggle_help | 105 | toggle_help_ |
3386 | 106 | (INIT_BTN | 106 | (INIT_BTN |
3387 | 107 | ("menu_help", "help", _("Tribal Encyclopedia"))) | 107 | ("menu_help", "help", _("Tribal Encyclopedia"))) |
3388 | 108 | 108 | ||
3389 | 109 | { | 109 | { |
3391 | 110 | m_toggle_chat.sigclicked.connect | 110 | toggle_chat_.sigclicked.connect |
3392 | 111 | (boost::bind(&InteractivePlayer::toggle_chat, this)); | 111 | (boost::bind(&InteractivePlayer::toggle_chat, this)); |
3400 | 112 | m_toggle_options_menu.sigclicked.connect | 112 | toggle_options_menu_.sigclicked.connect |
3401 | 113 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_options))); | 113 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(options_))); |
3402 | 114 | m_toggle_statistics_menu.sigclicked.connect | 114 | toggle_statistics_menu_.sigclicked.connect |
3403 | 115 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_statisticsmenu))); | 115 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(statisticsmenu_))); |
3404 | 116 | m_toggle_objectives.sigclicked.connect | 116 | toggle_objectives_.sigclicked.connect |
3405 | 117 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_objectives))); | 117 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(objectives_))); |
3406 | 118 | m_toggle_minimap.sigclicked.connect | 118 | toggle_minimap_.sigclicked.connect |
3407 | 119 | (boost::bind(&InteractivePlayer::toggle_minimap, this)); | 119 | (boost::bind(&InteractivePlayer::toggle_minimap, this)); |
3412 | 120 | m_toggle_message_menu.sigclicked.connect | 120 | toggle_message_menu_.sigclicked.connect |
3413 | 121 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_message_menu))); | 121 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(message_menu_))); |
3414 | 122 | m_toggle_help.sigclicked.connect | 122 | toggle_help_.sigclicked.connect |
3415 | 123 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_encyclopedia))); | 123 | (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(encyclopedia_))); |
3416 | 124 | 124 | ||
3417 | 125 | // TODO(unknown): instead of making unneeded buttons invisible after generation, | 125 | // TODO(unknown): instead of making unneeded buttons invisible after generation, |
3418 | 126 | // they should not at all be generated. -> implement more dynamic toolbar UI | 126 | // they should not at all be generated. -> implement more dynamic toolbar UI |
3423 | 127 | toolbar_.add(&m_toggle_options_menu, UI::Box::AlignLeft); | 127 | toolbar_.add(&toggle_options_menu_, UI::Box::AlignLeft); |
3424 | 128 | toolbar_.add(&m_toggle_statistics_menu, UI::Box::AlignLeft); | 128 | toolbar_.add(&toggle_statistics_menu_, UI::Box::AlignLeft); |
3425 | 129 | toolbar_.add(&m_toggle_minimap, UI::Box::AlignLeft); | 129 | toolbar_.add(&toggle_minimap_, UI::Box::AlignLeft); |
3426 | 130 | toolbar_.add(&m_toggle_buildhelp, UI::Box::AlignLeft); | 130 | toolbar_.add(&toggle_buildhelp_, UI::Box::AlignLeft); |
3427 | 131 | if (multiplayer) { | 131 | if (multiplayer) { |
3431 | 132 | toolbar_.add(&m_toggle_chat, UI::Box::AlignLeft); | 132 | toolbar_.add(&toggle_chat_, UI::Box::AlignLeft); |
3432 | 133 | m_toggle_chat.set_visible(false); | 133 | toggle_chat_.set_visible(false); |
3433 | 134 | m_toggle_chat.set_enabled(false); | 134 | toggle_chat_.set_enabled(false); |
3434 | 135 | } | 135 | } |
3435 | 136 | 136 | ||
3439 | 137 | toolbar_.add(&m_toggle_help, UI::Box::AlignLeft); | 137 | toolbar_.add(&toggle_help_, UI::Box::AlignLeft); |
3440 | 138 | toolbar_.add(&m_toggle_objectives, UI::Box::AlignLeft); | 138 | toolbar_.add(&toggle_objectives_, UI::Box::AlignLeft); |
3441 | 139 | toolbar_.add(&m_toggle_message_menu, UI::Box::AlignLeft); | 139 | toolbar_.add(&toggle_message_menu_, UI::Box::AlignLeft); |
3442 | 140 | 140 | ||
3443 | 141 | set_player_number(plyn); | 141 | set_player_number(plyn); |
3444 | 142 | fieldclicked.connect(boost::bind(&InteractivePlayer::node_action, this)); | 142 | fieldclicked.connect(boost::bind(&InteractivePlayer::node_action, this)); |
3445 | @@ -148,22 +148,22 @@ | |||
3446 | 148 | registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \ | 148 | registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \ |
3447 | 149 | if (registry.window) btn.set_perm_pressed(true); \ | 149 | if (registry.window) btn.set_perm_pressed(true); \ |
3448 | 150 | 150 | ||
3456 | 151 | INIT_BTN_HOOKS(m_chat, m_toggle_chat) | 151 | INIT_BTN_HOOKS(chat_, toggle_chat_) |
3457 | 152 | INIT_BTN_HOOKS(m_options, m_toggle_options_menu) | 152 | INIT_BTN_HOOKS(options_, toggle_options_menu_) |
3458 | 153 | INIT_BTN_HOOKS(m_statisticsmenu, m_toggle_statistics_menu) | 153 | INIT_BTN_HOOKS(statisticsmenu_, toggle_statistics_menu_) |
3459 | 154 | INIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap) | 154 | INIT_BTN_HOOKS(minimap_registry(), toggle_minimap_) |
3460 | 155 | INIT_BTN_HOOKS(m_objectives, m_toggle_objectives) | 155 | INIT_BTN_HOOKS(objectives_, toggle_objectives_) |
3461 | 156 | INIT_BTN_HOOKS(m_encyclopedia, m_toggle_help) | 156 | INIT_BTN_HOOKS(encyclopedia_, toggle_help_) |
3462 | 157 | INIT_BTN_HOOKS(m_message_menu, m_toggle_message_menu) | 157 | INIT_BTN_HOOKS(message_menu_, toggle_message_menu_) |
3463 | 158 | 158 | ||
3468 | 159 | m_encyclopedia.open_window = [this] {new EncyclopediaWindow(*this, m_encyclopedia);}; | 159 | encyclopedia_.open_window = [this] {new EncyclopediaWindow(*this, encyclopedia_);}; |
3469 | 160 | m_options.open_window = [this] {new GameOptionsMenu(*this, m_options, m_mainm_windows);}; | 160 | options_.open_window = [this] {new GameOptionsMenu(*this, options_, main_windows_);}; |
3470 | 161 | m_statisticsmenu.open_window = [this] { | 161 | statisticsmenu_.open_window = [this] { |
3471 | 162 | new GameMainMenu(*this, m_statisticsmenu, m_mainm_windows); | 162 | new GameMainMenu(*this, statisticsmenu_, main_windows_); |
3472 | 163 | }; | 163 | }; |
3476 | 164 | m_objectives.open_window = [this] {new GameObjectivesMenu(this, m_objectives);}; | 164 | objectives_.open_window = [this] {new GameObjectivesMenu(this, objectives_);}; |
3477 | 165 | m_message_menu.open_window = [this] {new GameMessageMenu(*this, m_message_menu);}; | 165 | message_menu_.open_window = [this] {new GameMessageMenu(*this, message_menu_);}; |
3478 | 166 | m_mainm_windows.stock.open_window = [this] {new StockMenu(*this, m_mainm_windows.stock);}; | 166 | main_windows_.stock.open_window = [this] {new StockMenu(*this, main_windows_.stock);}; |
3479 | 167 | 167 | ||
3480 | 168 | #ifndef NDEBUG // only in debug builds | 168 | #ifndef NDEBUG // only in debug builds |
3481 | 169 | addCommand | 169 | addCommand |
3482 | @@ -177,46 +177,46 @@ | |||
3483 | 177 | registry.on_create = 0; \ | 177 | registry.on_create = 0; \ |
3484 | 178 | registry.on_delete = 0; | 178 | registry.on_delete = 0; |
3485 | 179 | 179 | ||
3493 | 180 | DEINIT_BTN_HOOKS(m_chat, m_toggle_chat) | 180 | DEINIT_BTN_HOOKS(chat_, toggle_chat_) |
3494 | 181 | DEINIT_BTN_HOOKS(m_options, m_toggle_options_menu) | 181 | DEINIT_BTN_HOOKS(options_, toggle_options_menu_) |
3495 | 182 | DEINIT_BTN_HOOKS(m_statisticsmenu, m_toggle_statistics_menu) | 182 | DEINIT_BTN_HOOKS(statisticsmenu_, toggle_statistics_menu_) |
3496 | 183 | DEINIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap) | 183 | DEINIT_BTN_HOOKS(minimap_registry(), toggle_minimap_) |
3497 | 184 | DEINIT_BTN_HOOKS(m_objectives, m_toggle_objectives) | 184 | DEINIT_BTN_HOOKS(objectives_, toggle_objectives_) |
3498 | 185 | DEINIT_BTN_HOOKS(m_encyclopedia, m_toggle_help) | 185 | DEINIT_BTN_HOOKS(encyclopedia_, toggle_help_) |
3499 | 186 | DEINIT_BTN_HOOKS(m_message_menu, m_toggle_message_menu) | 186 | DEINIT_BTN_HOOKS(message_menu_, toggle_message_menu_) |
3500 | 187 | } | 187 | } |
3501 | 188 | 188 | ||
3502 | 189 | void InteractivePlayer::think() | 189 | void InteractivePlayer::think() |
3503 | 190 | { | 190 | { |
3504 | 191 | InteractiveBase::think(); | 191 | InteractiveBase::think(); |
3505 | 192 | 192 | ||
3508 | 193 | if (m_flag_to_connect) { | 193 | if (flag_to_connect_) { |
3509 | 194 | Widelands::Field & field = egbase().map()[m_flag_to_connect]; | 194 | Widelands::Field & field = egbase().map()[flag_to_connect_]; |
3510 | 195 | if (upcast(Widelands::Flag const, flag, field.get_immovable())) { | 195 | if (upcast(Widelands::Flag const, flag, field.get_immovable())) { |
3511 | 196 | if (!flag->has_road() && !is_building_road()) | 196 | if (!flag->has_road() && !is_building_road()) |
3513 | 197 | if (m_auto_roadbuild_mode) { | 197 | if (auto_roadbuild_mode_) { |
3514 | 198 | // There might be a fieldaction window open, showing a button | 198 | // There might be a fieldaction window open, showing a button |
3515 | 199 | // for roadbuilding. If that dialog remains open so that the | 199 | // for roadbuilding. If that dialog remains open so that the |
3516 | 200 | // button is clicked, we would enter roadbuilding mode while | 200 | // button is clicked, we would enter roadbuilding mode while |
3517 | 201 | // we are already in roadbuilding mode from the call below. | 201 | // we are already in roadbuilding mode from the call below. |
3518 | 202 | // That is not allowed. Therefore we must delete the | 202 | // That is not allowed. Therefore we must delete the |
3519 | 203 | // fieldaction window before entering roadbuilding mode here. | 203 | // fieldaction window before entering roadbuilding mode here. |
3523 | 204 | delete m_fieldaction.window; | 204 | delete fieldaction_.window; |
3524 | 205 | m_fieldaction.window = nullptr; | 205 | fieldaction_.window = nullptr; |
3525 | 206 | warp_mouse_to_node(m_flag_to_connect); | 206 | warp_mouse_to_node(flag_to_connect_); |
3526 | 207 | set_sel_pos | 207 | set_sel_pos |
3527 | 208 | (Widelands::NodeAndTriangle<> | 208 | (Widelands::NodeAndTriangle<> |
3529 | 209 | (m_flag_to_connect, | 209 | (flag_to_connect_, |
3530 | 210 | Widelands::TCoords<> | 210 | Widelands::TCoords<> |
3533 | 211 | (m_flag_to_connect, Widelands::TCoords<>::D))); | 211 | (flag_to_connect_, Widelands::TCoords<>::D))); |
3534 | 212 | start_build_road(m_flag_to_connect, field.get_owned_by()); | 212 | start_build_road(flag_to_connect_, field.get_owned_by()); |
3535 | 213 | } | 213 | } |
3537 | 214 | m_flag_to_connect = Widelands::Coords::null(); | 214 | flag_to_connect_ = Widelands::Coords::null(); |
3538 | 215 | } | 215 | } |
3539 | 216 | } | 216 | } |
3540 | 217 | if (is_multiplayer()) { | 217 | if (is_multiplayer()) { |
3543 | 218 | m_toggle_chat.set_visible(m_chatenabled); | 218 | toggle_chat_.set_visible(chatenabled_); |
3544 | 219 | m_toggle_chat.set_enabled(m_chatenabled); | 219 | toggle_chat_.set_enabled(chatenabled_); |
3545 | 220 | } | 220 | } |
3546 | 221 | { | 221 | { |
3547 | 222 | char const * msg_icon = "pics/menu_toggle_oldmessage_menu.png"; | 222 | char const * msg_icon = "pics/menu_toggle_oldmessage_menu.png"; |
3548 | @@ -230,8 +230,8 @@ | |||
3549 | 230 | (boost::format(ngettext("%u new message", "%u new messages", nr_new_messages)) % | 230 | (boost::format(ngettext("%u new message", "%u new messages", nr_new_messages)) % |
3550 | 231 | nr_new_messages).str(); | 231 | nr_new_messages).str(); |
3551 | 232 | } | 232 | } |
3554 | 233 | m_toggle_message_menu.set_pic(g_gr->images().get(msg_icon)); | 233 | toggle_message_menu_.set_pic(g_gr->images().get(msg_icon)); |
3555 | 234 | m_toggle_message_menu.set_tooltip(msg_tooltip); | 234 | toggle_message_menu_.set_tooltip(msg_tooltip); |
3556 | 235 | } | 235 | } |
3557 | 236 | } | 236 | } |
3558 | 237 | 237 | ||
3559 | @@ -239,18 +239,18 @@ | |||
3560 | 239 | void InteractivePlayer::popup_message | 239 | void InteractivePlayer::popup_message |
3561 | 240 | (Widelands::MessageId const id, const Widelands::Message & message) | 240 | (Widelands::MessageId const id, const Widelands::Message & message) |
3562 | 241 | { | 241 | { |
3565 | 242 | m_message_menu.create(); | 242 | message_menu_.create(); |
3566 | 243 | dynamic_cast<GameMessageMenu&>(*m_message_menu.window) | 243 | dynamic_cast<GameMessageMenu&>(*message_menu_.window) |
3567 | 244 | .show_new_message(id, message); | 244 | .show_new_message(id, message); |
3568 | 245 | } | 245 | } |
3569 | 246 | 246 | ||
3570 | 247 | 247 | ||
3571 | 248 | // Toolbar button callback functions. | 248 | // Toolbar button callback functions. |
3572 | 249 | void InteractivePlayer::toggle_chat() { | 249 | void InteractivePlayer::toggle_chat() { |
3575 | 250 | if (m_chat.window) | 250 | if (chat_.window) |
3576 | 251 | delete m_chat.window; | 251 | delete chat_.window; |
3577 | 252 | else if (chat_provider_) | 252 | else if (chat_provider_) |
3579 | 253 | GameChatMenu::create_chat_console(this, m_chat, *chat_provider_); | 253 | GameChatMenu::create_chat_console(this, chat_, *chat_provider_); |
3580 | 254 | } | 254 | } |
3581 | 255 | 255 | ||
3582 | 256 | bool InteractivePlayer::can_see(Widelands::PlayerNumber const p) const | 256 | bool InteractivePlayer::can_see(Widelands::PlayerNumber const p) const |
3583 | @@ -263,7 +263,7 @@ | |||
3584 | 263 | } | 263 | } |
3585 | 264 | Widelands::PlayerNumber InteractivePlayer::player_number() const | 264 | Widelands::PlayerNumber InteractivePlayer::player_number() const |
3586 | 265 | { | 265 | { |
3588 | 266 | return m_player_number; | 266 | return player_number_; |
3589 | 267 | } | 267 | } |
3590 | 268 | 268 | ||
3591 | 269 | int32_t InteractivePlayer::calculate_buildcaps(const Widelands::TCoords<Widelands::FCoords> c) { | 269 | int32_t InteractivePlayer::calculate_buildcaps(const Widelands::TCoords<Widelands::FCoords> c) { |
3592 | @@ -289,7 +289,7 @@ | |||
3593 | 289 | } | 289 | } |
3594 | 290 | 290 | ||
3595 | 291 | // everything else can bring up the temporary dialog | 291 | // everything else can bring up the temporary dialog |
3597 | 292 | show_field_action(this, get_player(), &m_fieldaction); | 292 | show_field_action(this, get_player(), &fieldaction_); |
3598 | 293 | } | 293 | } |
3599 | 294 | } | 294 | } |
3600 | 295 | 295 | ||
3601 | @@ -315,7 +315,7 @@ | |||
3602 | 315 | return true; | 315 | return true; |
3603 | 316 | 316 | ||
3604 | 317 | case SDLK_i: | 317 | case SDLK_i: |
3606 | 318 | m_mainm_windows.stock.toggle(); | 318 | main_windows_.stock.toggle(); |
3607 | 319 | return true; | 319 | return true; |
3608 | 320 | 320 | ||
3609 | 321 | case SDLK_m: | 321 | case SDLK_m: |
3610 | @@ -323,11 +323,11 @@ | |||
3611 | 323 | return true; | 323 | return true; |
3612 | 324 | 324 | ||
3613 | 325 | case SDLK_n: | 325 | case SDLK_n: |
3615 | 326 | m_message_menu.toggle(); | 326 | message_menu_.toggle(); |
3616 | 327 | return true; | 327 | return true; |
3617 | 328 | 328 | ||
3618 | 329 | case SDLK_o: | 329 | case SDLK_o: |
3620 | 330 | m_objectives.toggle(); | 330 | objectives_.toggle(); |
3621 | 331 | return true; | 331 | return true; |
3622 | 332 | 332 | ||
3623 | 333 | case SDLK_c: | 333 | case SDLK_c: |
3624 | @@ -335,16 +335,16 @@ | |||
3625 | 335 | return true; | 335 | return true; |
3626 | 336 | 336 | ||
3627 | 337 | case SDLK_b: | 337 | case SDLK_b: |
3630 | 338 | if (m_mainm_windows.building_stats.window == nullptr) { | 338 | if (main_windows_.building_stats.window == nullptr) { |
3631 | 339 | new BuildingStatisticsMenu(*this, m_mainm_windows.building_stats); | 339 | new BuildingStatisticsMenu(*this, main_windows_.building_stats); |
3632 | 340 | } else { | 340 | } else { |
3634 | 341 | m_mainm_windows.building_stats.toggle(); | 341 | main_windows_.building_stats.toggle(); |
3635 | 342 | } | 342 | } |
3636 | 343 | return true; | 343 | return true; |
3637 | 344 | 344 | ||
3638 | 345 | case SDLK_s: | 345 | case SDLK_s: |
3639 | 346 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) | 346 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) |
3641 | 347 | new GameMainMenuSaveGame(*this, m_mainm_windows.savegame); | 347 | new GameMainMenuSaveGame(*this, main_windows_.savegame); |
3642 | 348 | else | 348 | else |
3643 | 349 | set_display_flag | 349 | set_display_flag |
3644 | 350 | (dfShowStatistics, !get_display_flag(dfShowStatistics)); | 350 | (dfShowStatistics, !get_display_flag(dfShowStatistics)); |
3645 | @@ -355,16 +355,16 @@ | |||
3646 | 355 | break; | 355 | break; |
3647 | 356 | /* no break */ | 356 | /* no break */ |
3648 | 357 | case SDLK_HOME: | 357 | case SDLK_HOME: |
3650 | 358 | move_view_to(game().map().get_starting_pos(m_player_number)); | 358 | move_view_to(game().map().get_starting_pos(player_number_)); |
3651 | 359 | return true; | 359 | return true; |
3652 | 360 | 360 | ||
3653 | 361 | case SDLK_KP_ENTER: | 361 | case SDLK_KP_ENTER: |
3654 | 362 | case SDLK_RETURN: | 362 | case SDLK_RETURN: |
3656 | 363 | if (!chat_provider_ | !m_chatenabled || !is_multiplayer()) | 363 | if (!chat_provider_ | !chatenabled_ || !is_multiplayer()) |
3657 | 364 | break; | 364 | break; |
3658 | 365 | 365 | ||
3661 | 366 | if (!m_chat.window) | 366 | if (!chat_.window) |
3662 | 367 | GameChatMenu::create_chat_console(this, m_chat, *chat_provider_); | 367 | GameChatMenu::create_chat_console(this, chat_, *chat_provider_); |
3663 | 368 | 368 | ||
3664 | 369 | return true; | 369 | return true; |
3665 | 370 | default: | 370 | default: |
3666 | @@ -380,7 +380,7 @@ | |||
3667 | 380 | * player | 380 | * player |
3668 | 381 | */ | 381 | */ |
3669 | 382 | void InteractivePlayer::set_player_number(uint32_t const n) { | 382 | void InteractivePlayer::set_player_number(uint32_t const n) { |
3671 | 383 | m_player_number = n; | 383 | player_number_ = n; |
3672 | 384 | } | 384 | } |
3673 | 385 | 385 | ||
3674 | 386 | 386 | ||
3675 | @@ -404,10 +404,10 @@ | |||
3676 | 404 | } | 404 | } |
3677 | 405 | 405 | ||
3678 | 406 | DebugConsole::write( | 406 | DebugConsole::write( |
3681 | 407 | str(boost::format("Switching from #%1% to #%2%.") % static_cast<int>(m_player_number) % n)); | 407 | str(boost::format("Switching from #%1% to #%2%.") % static_cast<int>(player_number_) % n)); |
3682 | 408 | m_player_number = n; | 408 | player_number_ = n; |
3683 | 409 | 409 | ||
3685 | 410 | if (UI::UniqueWindow* const building_statistics_window = m_mainm_windows.building_stats.window) { | 410 | if (UI::UniqueWindow* const building_statistics_window = main_windows_.building_stats.window) { |
3686 | 411 | dynamic_cast<BuildingStatisticsMenu&>(*building_statistics_window).update(); | 411 | dynamic_cast<BuildingStatisticsMenu&>(*building_statistics_window).update(); |
3687 | 412 | } | 412 | } |
3688 | 413 | } | 413 | } |
3689 | 414 | 414 | ||
3690 | === modified file 'src/wui/interactive_player.h' | |||
3691 | --- src/wui/interactive_player.h 2015-11-01 10:11:56 +0000 | |||
3692 | +++ src/wui/interactive_player.h 2016-01-24 20:25:45 +0000 | |||
3693 | @@ -1,5 +1,5 @@ | |||
3694 | 1 | /* | 1 | /* |
3696 | 2 | * Copyright (C) 2002-2003, 2006-2010 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
3697 | 3 | * | 3 | * |
3698 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
3699 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
3700 | @@ -63,11 +63,11 @@ | |||
3701 | 63 | bool handle_key(bool down, SDL_Keysym) override; | 63 | bool handle_key(bool down, SDL_Keysym) override; |
3702 | 64 | 64 | ||
3703 | 65 | Widelands::Player & player() const { | 65 | Widelands::Player & player() const { |
3705 | 66 | return game().player(m_player_number); | 66 | return game().player(player_number_); |
3706 | 67 | } | 67 | } |
3707 | 68 | Widelands::Player * get_player() const override { | 68 | Widelands::Player * get_player() const override { |
3708 | 69 | assert(&game()); | 69 | assert(&game()); |
3710 | 70 | return game().get_player(m_player_number); | 70 | return game().get_player(player_number_); |
3711 | 71 | } | 71 | } |
3712 | 72 | 72 | ||
3713 | 73 | // for savegames | 73 | // for savegames |
3714 | @@ -78,7 +78,7 @@ | |||
3715 | 78 | void think() override; | 78 | void think() override; |
3716 | 79 | 79 | ||
3717 | 80 | void set_flag_to_connect(Widelands::Coords const location) { | 80 | void set_flag_to_connect(Widelands::Coords const location) { |
3719 | 81 | m_flag_to_connect = location; | 81 | flag_to_connect_ = location; |
3720 | 82 | } | 82 | } |
3721 | 83 | 83 | ||
3722 | 84 | void popup_message(Widelands::MessageId, const Widelands::Message &); | 84 | void popup_message(Widelands::MessageId, const Widelands::Message &); |
3723 | @@ -87,24 +87,24 @@ | |||
3724 | 87 | private: | 87 | private: |
3725 | 88 | void cmdSwitchPlayer(const std::vector<std::string> & args); | 88 | void cmdSwitchPlayer(const std::vector<std::string> & args); |
3726 | 89 | 89 | ||
3745 | 90 | Widelands::PlayerNumber m_player_number; | 90 | Widelands::PlayerNumber player_number_; |
3746 | 91 | bool m_auto_roadbuild_mode; | 91 | bool auto_roadbuild_mode_; |
3747 | 92 | Widelands::Coords m_flag_to_connect; | 92 | Widelands::Coords flag_to_connect_; |
3748 | 93 | 93 | ||
3749 | 94 | UI::Button m_toggle_chat; | 94 | UI::Button toggle_chat_; |
3750 | 95 | UI::Button m_toggle_options_menu; | 95 | UI::Button toggle_options_menu_; |
3751 | 96 | UI::Button m_toggle_statistics_menu; | 96 | UI::Button toggle_statistics_menu_; |
3752 | 97 | UI::Button m_toggle_objectives; | 97 | UI::Button toggle_objectives_; |
3753 | 98 | UI::Button m_toggle_minimap; | 98 | UI::Button toggle_minimap_; |
3754 | 99 | UI::Button m_toggle_message_menu; | 99 | UI::Button toggle_message_menu_; |
3755 | 100 | UI::Button m_toggle_help; | 100 | UI::Button toggle_help_; |
3756 | 101 | 101 | ||
3757 | 102 | UI::UniqueWindow::Registry m_chat; | 102 | UI::UniqueWindow::Registry chat_; |
3758 | 103 | UI::UniqueWindow::Registry m_options; | 103 | UI::UniqueWindow::Registry options_; |
3759 | 104 | UI::UniqueWindow::Registry m_statisticsmenu; | 104 | UI::UniqueWindow::Registry statisticsmenu_; |
3760 | 105 | UI::UniqueWindow::Registry m_objectives; | 105 | UI::UniqueWindow::Registry objectives_; |
3761 | 106 | UI::UniqueWindow::Registry m_encyclopedia; | 106 | UI::UniqueWindow::Registry encyclopedia_; |
3762 | 107 | UI::UniqueWindow::Registry m_message_menu; | 107 | UI::UniqueWindow::Registry message_menu_; |
3763 | 108 | }; | 108 | }; |
3764 | 109 | 109 | ||
3765 | 110 | 110 | ||
3766 | 111 | 111 | ||
3767 | === modified file 'src/wui/interactive_spectator.cc' | |||
3768 | --- src/wui/interactive_spectator.cc 2016-01-16 15:57:31 +0000 | |||
3769 | +++ src/wui/interactive_spectator.cc 2016-01-24 20:25:45 +0000 | |||
3770 | @@ -1,5 +1,5 @@ | |||
3771 | 1 | /* | 1 | /* |
3773 | 2 | * Copyright (C) 2007-2011 by the Widelands Development Team | 2 | * Copyright (C) 2007-2016 by the Widelands Development Team |
3774 | 3 | * | 3 | * |
3775 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
3776 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
3777 | @@ -49,49 +49,49 @@ | |||
3778 | 49 | g_gr->images().get("pics/" picture ".png"), \ | 49 | g_gr->images().get("pics/" picture ".png"), \ |
3779 | 50 | tooltip \ | 50 | tooltip \ |
3780 | 51 | 51 | ||
3782 | 52 | m_toggle_chat | 52 | toggle_chat_ |
3783 | 53 | (INIT_BTN("menu_chat", "chat", _("Chat"))), | 53 | (INIT_BTN("menu_chat", "chat", _("Chat"))), |
3785 | 54 | m_exit | 54 | exit_ |
3786 | 55 | (INIT_BTN("menu_exit_game", "exit_replay", _("Exit Replay"))), | 55 | (INIT_BTN("menu_exit_game", "exit_replay", _("Exit Replay"))), |
3788 | 56 | m_save | 56 | save_ |
3789 | 57 | (INIT_BTN("menu_save_game", "save_game", _("Save Game"))), | 57 | (INIT_BTN("menu_save_game", "save_game", _("Save Game"))), |
3791 | 58 | m_toggle_options_menu | 58 | toggle_options_menu_ |
3792 | 59 | (INIT_BTN("menu_options_menu", "options_menu", _("Options"))), | 59 | (INIT_BTN("menu_options_menu", "options_menu", _("Options"))), |
3794 | 60 | m_toggle_statistics | 60 | toggle_statistics_ |
3795 | 61 | (INIT_BTN("menu_general_stats", "general_stats", _("Statistics"))), | 61 | (INIT_BTN("menu_general_stats", "general_stats", _("Statistics"))), |
3797 | 62 | m_toggle_minimap | 62 | toggle_minimap_ |
3798 | 63 | (INIT_BTN("menu_toggle_minimap", "minimap", _("Minimap"))) | 63 | (INIT_BTN("menu_toggle_minimap", "minimap", _("Minimap"))) |
3799 | 64 | { | 64 | { |
3806 | 65 | m_toggle_chat.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_chat, this)); | 65 | toggle_chat_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_chat, this)); |
3807 | 66 | m_exit.sigclicked.connect(boost::bind(&InteractiveSpectator::exit_btn, this)); | 66 | exit_.sigclicked.connect(boost::bind(&InteractiveSpectator::exit_btn, this)); |
3808 | 67 | m_save.sigclicked.connect(boost::bind(&InteractiveSpectator::save_btn, this)); | 67 | save_.sigclicked.connect(boost::bind(&InteractiveSpectator::save_btn, this)); |
3809 | 68 | m_toggle_options_menu.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_options_menu, this)); | 68 | toggle_options_menu_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_options_menu, this)); |
3810 | 69 | m_toggle_statistics.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_statistics, this)); | 69 | toggle_statistics_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_statistics, this)); |
3811 | 70 | m_toggle_minimap.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_minimap, this)); | 70 | toggle_minimap_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_minimap, this)); |
3812 | 71 | 71 | ||
3813 | 72 | toolbar_.set_layout_toplevel(true); | 72 | toolbar_.set_layout_toplevel(true); |
3814 | 73 | if (!is_multiplayer()) { | 73 | if (!is_multiplayer()) { |
3817 | 74 | toolbar_.add(&m_exit, UI::Box::AlignLeft); | 74 | toolbar_.add(&exit_, UI::Box::AlignLeft); |
3818 | 75 | toolbar_.add(&m_save, UI::Box::AlignLeft); | 75 | toolbar_.add(&save_, UI::Box::AlignLeft); |
3819 | 76 | } else | 76 | } else |
3825 | 77 | toolbar_.add(&m_toggle_options_menu, UI::Box::AlignLeft); | 77 | toolbar_.add(&toggle_options_menu_, UI::Box::AlignLeft); |
3826 | 78 | toolbar_.add(&m_toggle_statistics, UI::Box::AlignLeft); | 78 | toolbar_.add(&toggle_statistics_, UI::Box::AlignLeft); |
3827 | 79 | toolbar_.add(&m_toggle_minimap, UI::Box::AlignLeft); | 79 | toolbar_.add(&toggle_minimap_, UI::Box::AlignLeft); |
3828 | 80 | toolbar_.add(&m_toggle_buildhelp, UI::Box::AlignLeft); | 80 | toolbar_.add(&toggle_buildhelp_, UI::Box::AlignLeft); |
3829 | 81 | toolbar_.add(&m_toggle_chat, UI::Box::AlignLeft); | 81 | toolbar_.add(&toggle_chat_, UI::Box::AlignLeft); |
3830 | 82 | 82 | ||
3831 | 83 | // TODO(unknown): instead of making unneeded buttons invisible after generation, | 83 | // TODO(unknown): instead of making unneeded buttons invisible after generation, |
3832 | 84 | // they should not at all be generated. -> implement more dynamic toolbar UI | 84 | // they should not at all be generated. -> implement more dynamic toolbar UI |
3833 | 85 | if (is_multiplayer()) { | 85 | if (is_multiplayer()) { |
3838 | 86 | m_exit.set_visible(false); | 86 | exit_.set_visible(false); |
3839 | 87 | m_exit.set_enabled(false); | 87 | exit_.set_enabled(false); |
3840 | 88 | m_save.set_visible(false); | 88 | save_.set_visible(false); |
3841 | 89 | m_save.set_enabled(false); | 89 | save_.set_enabled(false); |
3842 | 90 | } else { | 90 | } else { |
3847 | 91 | m_toggle_chat.set_visible(false); | 91 | toggle_chat_.set_visible(false); |
3848 | 92 | m_toggle_chat.set_enabled(false); | 92 | toggle_chat_.set_enabled(false); |
3849 | 93 | m_toggle_options_menu.set_visible(false); | 93 | toggle_options_menu_.set_visible(false); |
3850 | 94 | m_toggle_options_menu.set_enabled(false); | 94 | toggle_options_menu_.set_enabled(false); |
3851 | 95 | } | 95 | } |
3852 | 96 | 96 | ||
3853 | 97 | adjust_toolbar_position(); | 97 | adjust_toolbar_position(); |
3854 | @@ -99,17 +99,17 @@ | |||
3855 | 99 | // Setup all screen elements | 99 | // Setup all screen elements |
3856 | 100 | fieldclicked.connect(boost::bind(&InteractiveSpectator::node_action, this)); | 100 | fieldclicked.connect(boost::bind(&InteractiveSpectator::node_action, this)); |
3857 | 101 | 101 | ||
3862 | 102 | #define INIT_BTN_HOOKS(registry, btn) \ | 102 | #define INIT_BTN_HOOKS(registry, btn) \ |
3863 | 103 | registry.on_create = std::bind(&UI::Button::set_perm_pressed, &btn, true); \ | 103 | registry.on_create = std::bind(&UI::Button::set_perm_pressed, &btn, true); \ |
3864 | 104 | registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \ | 104 | registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \ |
3865 | 105 | if (registry.window) \ | 105 | if (registry.window) \ |
3866 | 106 | btn.set_perm_pressed(true); | 106 | btn.set_perm_pressed(true); |
3867 | 107 | 107 | ||
3873 | 108 | INIT_BTN_HOOKS(m_chat, m_toggle_chat) | 108 | INIT_BTN_HOOKS(chat_, toggle_chat_) |
3874 | 109 | INIT_BTN_HOOKS(m_options, m_toggle_options_menu) | 109 | INIT_BTN_HOOKS(options_, toggle_options_menu_) |
3875 | 110 | INIT_BTN_HOOKS(m_mainm_windows.general_stats, m_toggle_statistics) | 110 | INIT_BTN_HOOKS(main_windows_.general_stats, toggle_statistics_) |
3876 | 111 | INIT_BTN_HOOKS(m_mainm_windows.savegame, m_save) | 111 | INIT_BTN_HOOKS(main_windows_.savegame, save_) |
3877 | 112 | INIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap) | 112 | INIT_BTN_HOOKS(minimap_registry(), toggle_minimap_) |
3878 | 113 | 113 | ||
3879 | 114 | } | 114 | } |
3880 | 115 | 115 | ||
3881 | @@ -119,15 +119,15 @@ | |||
3882 | 119 | // buttons. The assertions are safeguards in case somewhere else in the | 119 | // buttons. The assertions are safeguards in case somewhere else in the |
3883 | 120 | // code someone would overwrite our hooks. | 120 | // code someone would overwrite our hooks. |
3884 | 121 | 121 | ||
3887 | 122 | #define DEINIT_BTN_HOOKS(registry, btn) \ | 122 | #define DEINIT_BTN_HOOKS(registry, btn) \ |
3888 | 123 | registry.on_create = 0; \ | 123 | registry.on_create = 0; \ |
3889 | 124 | registry.on_delete = 0; | 124 | registry.on_delete = 0; |
3890 | 125 | 125 | ||
3896 | 126 | DEINIT_BTN_HOOKS(m_chat, m_toggle_chat) | 126 | DEINIT_BTN_HOOKS(chat_, toggle_chat_) |
3897 | 127 | DEINIT_BTN_HOOKS(m_options, m_toggle_options_menu) | 127 | DEINIT_BTN_HOOKS(options_, toggle_options_menu_) |
3898 | 128 | DEINIT_BTN_HOOKS(m_mainm_windows.general_stats, m_toggle_statistics) | 128 | DEINIT_BTN_HOOKS(main_windows_.general_stats, toggle_statistics_) |
3899 | 129 | DEINIT_BTN_HOOKS(m_mainm_windows.savegame, m_save) | 129 | DEINIT_BTN_HOOKS(main_windows_.savegame, save_) |
3900 | 130 | DEINIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap) | 130 | DEINIT_BTN_HOOKS(minimap_registry(), toggle_minimap_) |
3901 | 131 | } | 131 | } |
3902 | 132 | 132 | ||
3903 | 133 | 133 | ||
3904 | @@ -160,10 +160,10 @@ | |||
3905 | 160 | // Toolbar button callback functions. | 160 | // Toolbar button callback functions. |
3906 | 161 | void InteractiveSpectator::toggle_chat() | 161 | void InteractiveSpectator::toggle_chat() |
3907 | 162 | { | 162 | { |
3910 | 163 | if (m_chat.window) | 163 | if (chat_.window) |
3911 | 164 | delete m_chat.window; | 164 | delete chat_.window; |
3912 | 165 | else if (chat_provider_) | 165 | else if (chat_provider_) |
3914 | 166 | GameChatMenu::create_chat_console(this, m_chat, *chat_provider_); | 166 | GameChatMenu::create_chat_console(this, chat_, *chat_provider_); |
3915 | 167 | } | 167 | } |
3916 | 168 | 168 | ||
3917 | 169 | 169 | ||
3918 | @@ -181,10 +181,10 @@ | |||
3919 | 181 | if (is_multiplayer()) { | 181 | if (is_multiplayer()) { |
3920 | 182 | return; | 182 | return; |
3921 | 183 | } | 183 | } |
3924 | 184 | if (m_mainm_windows.savegame.window) | 184 | if (main_windows_.savegame.window) |
3925 | 185 | delete m_mainm_windows.savegame.window; | 185 | delete main_windows_.savegame.window; |
3926 | 186 | else { | 186 | else { |
3928 | 187 | new GameMainMenuSaveGame(*this, m_mainm_windows.savegame); | 187 | new GameMainMenuSaveGame(*this, main_windows_.savegame); |
3929 | 188 | } | 188 | } |
3930 | 189 | } | 189 | } |
3931 | 190 | 190 | ||
3932 | @@ -193,18 +193,18 @@ | |||
3933 | 193 | if (!is_multiplayer()) { | 193 | if (!is_multiplayer()) { |
3934 | 194 | return; | 194 | return; |
3935 | 195 | } | 195 | } |
3938 | 196 | if (m_options.window) | 196 | if (options_.window) |
3939 | 197 | delete m_options.window; | 197 | delete options_.window; |
3940 | 198 | else | 198 | else |
3942 | 199 | new GameOptionsMenu(*this, m_options, m_mainm_windows); | 199 | new GameOptionsMenu(*this, options_, main_windows_); |
3943 | 200 | } | 200 | } |
3944 | 201 | 201 | ||
3945 | 202 | 202 | ||
3946 | 203 | void InteractiveSpectator::toggle_statistics() { | 203 | void InteractiveSpectator::toggle_statistics() { |
3949 | 204 | if (m_mainm_windows.general_stats.window) | 204 | if (main_windows_.general_stats.window) |
3950 | 205 | delete m_mainm_windows.general_stats.window; | 205 | delete main_windows_.general_stats.window; |
3951 | 206 | else | 206 | else |
3953 | 207 | new GeneralStatisticsMenu(*this, m_mainm_windows.general_stats); | 207 | new GeneralStatisticsMenu(*this, main_windows_.general_stats); |
3954 | 208 | } | 208 | } |
3955 | 209 | 209 | ||
3956 | 210 | 210 | ||
3957 | @@ -237,7 +237,7 @@ | |||
3958 | 237 | return; | 237 | return; |
3959 | 238 | 238 | ||
3960 | 239 | // everything else can bring up the temporary dialog | 239 | // everything else can bring up the temporary dialog |
3962 | 240 | show_field_action(this, nullptr, &m_fieldaction); | 240 | show_field_action(this, nullptr, &fieldaction_); |
3963 | 241 | } | 241 | } |
3964 | 242 | 242 | ||
3965 | 243 | 243 | ||
3966 | @@ -262,7 +262,7 @@ | |||
3967 | 262 | 262 | ||
3968 | 263 | case SDLK_s: | 263 | case SDLK_s: |
3969 | 264 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) { | 264 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) { |
3971 | 265 | new GameMainMenuSaveGame(*this, m_mainm_windows.savegame); | 265 | new GameMainMenuSaveGame(*this, main_windows_.savegame); |
3972 | 266 | } else | 266 | } else |
3973 | 267 | set_display_flag | 267 | set_display_flag |
3974 | 268 | (dfShowStatistics, !get_display_flag(dfShowStatistics)); | 268 | (dfShowStatistics, !get_display_flag(dfShowStatistics)); |
3975 | @@ -270,13 +270,13 @@ | |||
3976 | 270 | 270 | ||
3977 | 271 | case SDLK_RETURN: | 271 | case SDLK_RETURN: |
3978 | 272 | case SDLK_KP_ENTER: | 272 | case SDLK_KP_ENTER: |
3980 | 273 | if (!chat_provider_ | !m_chatenabled) | 273 | if (!chat_provider_ | !chatenabled_) |
3981 | 274 | break; | 274 | break; |
3982 | 275 | 275 | ||
3985 | 276 | if (!m_chat.window) | 276 | if (!chat_.window) |
3986 | 277 | GameChatMenu::create_chat_console(this, m_chat, *chat_provider_); | 277 | GameChatMenu::create_chat_console(this, chat_, *chat_provider_); |
3987 | 278 | 278 | ||
3989 | 279 | dynamic_cast<GameChatMenu*>(m_chat.window)->enter_chat_message(); | 279 | dynamic_cast<GameChatMenu*>(chat_.window)->enter_chat_message(); |
3990 | 280 | return true; | 280 | return true; |
3991 | 281 | 281 | ||
3992 | 282 | default: | 282 | default: |
3993 | 283 | 283 | ||
3994 | === modified file 'src/wui/interactive_spectator.h' | |||
3995 | --- src/wui/interactive_spectator.h 2015-11-01 10:11:56 +0000 | |||
3996 | +++ src/wui/interactive_spectator.h 2016-01-24 20:25:45 +0000 | |||
3997 | @@ -1,5 +1,5 @@ | |||
3998 | 1 | /* | 1 | /* |
4000 | 2 | * Copyright (C) 2002-2003, 2006-2008 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
4001 | 3 | * | 3 | * |
4002 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4003 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4004 | @@ -58,16 +58,16 @@ | |||
4005 | 58 | void node_action() override; | 58 | void node_action() override; |
4006 | 59 | 59 | ||
4007 | 60 | private: | 60 | private: |
4018 | 61 | UI::Button m_toggle_chat; | 61 | UI::Button toggle_chat_; |
4019 | 62 | UI::Button m_exit; | 62 | UI::Button exit_; |
4020 | 63 | UI::Button m_save; | 63 | UI::Button save_; |
4021 | 64 | UI::Button m_toggle_options_menu; | 64 | UI::Button toggle_options_menu_; |
4022 | 65 | UI::Button m_toggle_statistics; | 65 | UI::Button toggle_statistics_; |
4023 | 66 | UI::Button m_toggle_minimap; | 66 | UI::Button toggle_minimap_; |
4024 | 67 | 67 | ||
4025 | 68 | 68 | ||
4026 | 69 | UI::UniqueWindow::Registry m_chat; | 69 | UI::UniqueWindow::Registry chat_; |
4027 | 70 | UI::UniqueWindow::Registry m_options; | 70 | UI::UniqueWindow::Registry options_; |
4028 | 71 | }; | 71 | }; |
4029 | 72 | 72 | ||
4030 | 73 | 73 | ||
4031 | 74 | 74 | ||
4032 | === modified file 'src/wui/itemwaresdisplay.cc' | |||
4033 | --- src/wui/itemwaresdisplay.cc 2016-01-17 19:54:32 +0000 | |||
4034 | +++ src/wui/itemwaresdisplay.cc 2016-01-24 20:25:45 +0000 | |||
4035 | @@ -1,5 +1,5 @@ | |||
4036 | 1 | /* | 1 | /* |
4038 | 2 | * Copyright (C) 2011, 2013 by the Widelands Development Team | 2 | * Copyright (C) 2011-2016 by the Widelands Development Team |
4039 | 3 | * | 3 | * |
4040 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4041 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4042 | @@ -40,9 +40,9 @@ | |||
4043 | 40 | */ | 40 | */ |
4044 | 41 | ItemWaresDisplay::ItemWaresDisplay(Panel * parent, const Widelands::Player & gplayer) : | 41 | ItemWaresDisplay::ItemWaresDisplay(Panel * parent, const Widelands::Player & gplayer) : |
4045 | 42 | Panel(parent, 0, 0, 0, 0), | 42 | Panel(parent, 0, 0, 0, 0), |
4049 | 43 | m_player(gplayer), | 43 | player_(gplayer), |
4050 | 44 | m_capacity(0), | 44 | capacity_(0), |
4051 | 45 | m_items_per_row(IWD_DefaultItemsPerRow) | 45 | items_per_row_(IWD_DefaultItemsPerRow) |
4052 | 46 | { | 46 | { |
4053 | 47 | set_desired_size(2 * IWD_HBorder, 2 * IWD_VBorder); | 47 | set_desired_size(2 * IWD_HBorder, 2 * IWD_VBorder); |
4054 | 48 | } | 48 | } |
4055 | @@ -52,8 +52,8 @@ | |||
4056 | 52 | */ | 52 | */ |
4057 | 53 | void ItemWaresDisplay::clear() | 53 | void ItemWaresDisplay::clear() |
4058 | 54 | { | 54 | { |
4061 | 55 | if (!m_items.empty()) { | 55 | if (!items_.empty()) { |
4062 | 56 | m_items.clear(); | 56 | items_.clear(); |
4063 | 57 | update(); | 57 | update(); |
4064 | 58 | } | 58 | } |
4065 | 59 | } | 59 | } |
4066 | @@ -66,8 +66,8 @@ | |||
4067 | 66 | */ | 66 | */ |
4068 | 67 | void ItemWaresDisplay::set_capacity(uint32_t cap) | 67 | void ItemWaresDisplay::set_capacity(uint32_t cap) |
4069 | 68 | { | 68 | { |
4072 | 69 | if (cap != m_capacity) { | 69 | if (cap != capacity_) { |
4073 | 70 | m_capacity = cap; | 70 | capacity_ = cap; |
4074 | 71 | recalc_desired_size(); | 71 | recalc_desired_size(); |
4075 | 72 | } | 72 | } |
4076 | 73 | } | 73 | } |
4077 | @@ -77,16 +77,16 @@ | |||
4078 | 77 | */ | 77 | */ |
4079 | 78 | void ItemWaresDisplay::set_items_per_row(uint32_t nr) | 78 | void ItemWaresDisplay::set_items_per_row(uint32_t nr) |
4080 | 79 | { | 79 | { |
4083 | 80 | if (nr != m_items_per_row) { | 80 | if (nr != items_per_row_) { |
4084 | 81 | m_items_per_row = nr; | 81 | items_per_row_ = nr; |
4085 | 82 | recalc_desired_size(); | 82 | recalc_desired_size(); |
4086 | 83 | } | 83 | } |
4087 | 84 | } | 84 | } |
4088 | 85 | 85 | ||
4089 | 86 | void ItemWaresDisplay::recalc_desired_size() | 86 | void ItemWaresDisplay::recalc_desired_size() |
4090 | 87 | { | 87 | { |
4093 | 88 | uint32_t nrrows = (m_capacity + m_items_per_row - 1) / m_items_per_row; | 88 | uint32_t nrrows = (capacity_ + items_per_row_ - 1) / items_per_row_; |
4094 | 89 | uint32_t rowitems = m_capacity >= m_items_per_row ? m_items_per_row : m_capacity; | 89 | uint32_t rowitems = capacity_ >= items_per_row_ ? items_per_row_ : capacity_; |
4095 | 90 | 90 | ||
4096 | 91 | set_desired_size(2 * IWD_HBorder + rowitems * IWD_ItemWidth, 2 * IWD_VBorder + nrrows * IWD_ItemHeight); | 91 | set_desired_size(2 * IWD_HBorder + rowitems * IWD_ItemWidth, 2 * IWD_VBorder + nrrows * IWD_ItemHeight); |
4097 | 92 | } | 92 | } |
4098 | @@ -99,7 +99,7 @@ | |||
4099 | 99 | Item it; | 99 | Item it; |
4100 | 100 | it.worker = worker; | 100 | it.worker = worker; |
4101 | 101 | it.index = index; | 101 | it.index = index; |
4103 | 102 | m_items.push_back(it); | 102 | items_.push_back(it); |
4104 | 103 | update(); | 103 | update(); |
4105 | 104 | } | 104 | } |
4106 | 105 | 105 | ||
4107 | @@ -109,10 +109,10 @@ | |||
4108 | 109 | 109 | ||
4109 | 110 | dst.fill_rect(Rect(Point(0, 0), get_w(), get_h()), RGBAColor(0, 0, 0, 0)); | 110 | dst.fill_rect(Rect(Point(0, 0), get_w(), get_h()), RGBAColor(0, 0, 0, 0)); |
4110 | 111 | 111 | ||
4115 | 112 | for (uint32_t idx = 0; idx < m_items.size(); ++idx) { | 112 | for (uint32_t idx = 0; idx < items_.size(); ++idx) { |
4116 | 113 | const Item & it = m_items[idx]; | 113 | const Item & it = items_[idx]; |
4117 | 114 | uint32_t row = idx / m_items_per_row; | 114 | uint32_t row = idx / items_per_row_; |
4118 | 115 | uint32_t col = idx % m_items_per_row; | 115 | uint32_t col = idx % items_per_row_; |
4119 | 116 | 116 | ||
4120 | 117 | uint32_t x = IWD_HBorder / 2 + col * IWD_ItemWidth; | 117 | uint32_t x = IWD_HBorder / 2 + col * IWD_ItemWidth; |
4121 | 118 | uint32_t y = IWD_VBorder + row * IWD_ItemHeight; | 118 | uint32_t y = IWD_VBorder + row * IWD_ItemHeight; |
4122 | 119 | 119 | ||
4123 | === modified file 'src/wui/itemwaresdisplay.h' | |||
4124 | --- src/wui/itemwaresdisplay.h 2015-11-11 09:52:55 +0000 | |||
4125 | +++ src/wui/itemwaresdisplay.h 2016-01-24 20:25:45 +0000 | |||
4126 | @@ -1,5 +1,5 @@ | |||
4127 | 1 | /* | 1 | /* |
4129 | 2 | * Copyright (C) 2011 by the Widelands Development Team | 2 | * Copyright (C) 2011-2016 by the Widelands Development Team |
4130 | 3 | * | 3 | * |
4131 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4132 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4133 | @@ -36,12 +36,12 @@ | |||
4134 | 36 | struct ItemWaresDisplay : UI::Panel { | 36 | struct ItemWaresDisplay : UI::Panel { |
4135 | 37 | ItemWaresDisplay(UI::Panel * parent, const Widelands::Player & player); | 37 | ItemWaresDisplay(UI::Panel * parent, const Widelands::Player & player); |
4136 | 38 | 38 | ||
4138 | 39 | const Widelands::Player & player() const {return m_player;} | 39 | const Widelands::Player & player() const {return player_;} |
4139 | 40 | 40 | ||
4141 | 41 | uint32_t capacity() const {return m_capacity;} | 41 | uint32_t capacity() const {return capacity_;} |
4142 | 42 | void set_capacity(uint32_t cap); | 42 | void set_capacity(uint32_t cap); |
4143 | 43 | 43 | ||
4145 | 44 | uint32_t items_per_row() const {return m_items_per_row;} | 44 | uint32_t items_per_row() const {return items_per_row_;} |
4146 | 45 | void set_items_per_row(uint32_t nr); | 45 | void set_items_per_row(uint32_t nr); |
4147 | 46 | 46 | ||
4148 | 47 | void clear(); | 47 | void clear(); |
4149 | @@ -57,10 +57,10 @@ | |||
4150 | 57 | 57 | ||
4151 | 58 | void recalc_desired_size(); | 58 | void recalc_desired_size(); |
4152 | 59 | 59 | ||
4157 | 60 | const Widelands::Player & m_player; | 60 | const Widelands::Player & player_; |
4158 | 61 | uint32_t m_capacity; | 61 | uint32_t capacity_; |
4159 | 62 | uint32_t m_items_per_row; | 62 | uint32_t items_per_row_; |
4160 | 63 | std::vector<Item> m_items; | 63 | std::vector<Item> items_; |
4161 | 64 | }; | 64 | }; |
4162 | 65 | 65 | ||
4163 | 66 | #endif // end of include guard: WL_WUI_ITEMWARESDISPLAY_H | 66 | #endif // end of include guard: WL_WUI_ITEMWARESDISPLAY_H |
4164 | 67 | 67 | ||
4165 | === modified file 'src/wui/mapdata.h' | |||
4166 | --- src/wui/mapdata.h 2016-01-17 08:29:59 +0000 | |||
4167 | +++ src/wui/mapdata.h 2016-01-24 20:25:45 +0000 | |||
4168 | @@ -1,5 +1,5 @@ | |||
4169 | 1 | /* | 1 | /* |
4171 | 2 | * Copyright (C) 2002, 2006-2009, 2011, 2014-2015 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
4172 | 3 | * | 3 | * |
4173 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4174 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4175 | @@ -36,8 +36,8 @@ | |||
4176 | 36 | * Author data for a map or scenario. | 36 | * Author data for a map or scenario. |
4177 | 37 | */ | 37 | */ |
4178 | 38 | struct MapAuthorData { | 38 | struct MapAuthorData { |
4181 | 39 | const std::string& get_names() const {return m_names;} | 39 | const std::string& get_names() const {return names_;} |
4182 | 40 | size_t get_number() const {return m_number;} | 40 | size_t get_number() const {return number_;} |
4183 | 41 | 41 | ||
4184 | 42 | // Parses author list string into localized contatenated list | 42 | // Parses author list string into localized contatenated list |
4185 | 43 | // string. Use , as list separator and no whitespaces between | 43 | // string. Use , as list separator and no whitespaces between |
4186 | @@ -45,13 +45,13 @@ | |||
4187 | 45 | MapAuthorData(const std::string& author_list) { | 45 | MapAuthorData(const std::string& author_list) { |
4188 | 46 | std::vector<std::string> authors; | 46 | std::vector<std::string> authors; |
4189 | 47 | boost::split(authors, author_list, boost::is_any_of(",")); | 47 | boost::split(authors, author_list, boost::is_any_of(",")); |
4192 | 48 | m_names = i18n::localize_list(authors, i18n::ConcatenateWith::AMPERSAND); | 48 | names_ = i18n::localize_list(authors, i18n::ConcatenateWith::AMPERSAND); |
4193 | 49 | m_number = authors.size(); | 49 | number_ = authors.size(); |
4194 | 50 | } | 50 | } |
4195 | 51 | 51 | ||
4196 | 52 | private: | 52 | private: |
4199 | 53 | std::string m_names; | 53 | std::string names_; |
4200 | 54 | size_t m_number; | 54 | size_t number_; |
4201 | 55 | }; | 55 | }; |
4202 | 56 | 56 | ||
4203 | 57 | /** | 57 | /** |
4204 | 58 | 58 | ||
4205 | === modified file 'src/wui/mapview.cc' | |||
4206 | --- src/wui/mapview.cc 2015-03-29 18:07:45 +0000 | |||
4207 | +++ src/wui/mapview.cc 2016-01-24 20:25:45 +0000 | |||
4208 | @@ -33,10 +33,10 @@ | |||
4209 | 33 | MapView::MapView( | 33 | MapView::MapView( |
4210 | 34 | UI::Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h, InteractiveBase& player) | 34 | UI::Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h, InteractiveBase& player) |
4211 | 35 | : UI::Panel(parent, x, y, w, h), | 35 | : UI::Panel(parent, x, y, w, h), |
4216 | 36 | m_renderer(new GameRenderer()), | 36 | renderer_(new GameRenderer()), |
4217 | 37 | m_intbase(player), | 37 | intbase_(player), |
4218 | 38 | m_viewpoint(Point(0, 0)), | 38 | viewpoint_(Point(0, 0)), |
4219 | 39 | m_dragging(false) { | 39 | dragging_(false) { |
4220 | 40 | } | 40 | } |
4221 | 41 | 41 | ||
4222 | 42 | MapView::~MapView() | 42 | MapView::~MapView() |
4223 | @@ -50,7 +50,7 @@ | |||
4224 | 50 | const Widelands::Map & map = intbase().egbase().map(); | 50 | const Widelands::Map & map = intbase().egbase().map(); |
4225 | 51 | Point p; | 51 | Point p; |
4226 | 52 | MapviewPixelFunctions::get_save_pix(map, c, p.x, p.y); | 52 | MapviewPixelFunctions::get_save_pix(map, c, p.x, p.y); |
4228 | 53 | p -= m_viewpoint; | 53 | p -= viewpoint_; |
4229 | 54 | 54 | ||
4230 | 55 | // If the user has scrolled the node outside the viewable area, he most | 55 | // If the user has scrolled the node outside the viewable area, he most |
4231 | 56 | // surely doesn't want to jump there. | 56 | // surely doesn't want to jump there. |
4232 | @@ -86,15 +86,15 @@ | |||
4233 | 86 | } | 86 | } |
4234 | 87 | 87 | ||
4235 | 88 | if (upcast(InteractivePlayer const, interactive_player, &intbase())) { | 88 | if (upcast(InteractivePlayer const, interactive_player, &intbase())) { |
4237 | 89 | m_renderer->rendermap(dst, egbase, m_viewpoint, interactive_player->player()); | 89 | renderer_->rendermap(dst, egbase, viewpoint_, interactive_player->player()); |
4238 | 90 | } else { | 90 | } else { |
4240 | 91 | m_renderer->rendermap(dst, egbase, m_viewpoint); | 91 | renderer_->rendermap(dst, egbase, viewpoint_); |
4241 | 92 | } | 92 | } |
4242 | 93 | } | 93 | } |
4243 | 94 | 94 | ||
4244 | 95 | void MapView::set_changeview(const MapView::ChangeViewFn & fn) | 95 | void MapView::set_changeview(const MapView::ChangeViewFn & fn) |
4245 | 96 | { | 96 | { |
4247 | 97 | m_changeview = fn; | 97 | changeview_ = fn; |
4248 | 98 | } | 98 | } |
4249 | 99 | 99 | ||
4250 | 100 | /* | 100 | /* |
4251 | @@ -104,22 +104,22 @@ | |||
4252 | 104 | */ | 104 | */ |
4253 | 105 | void MapView::set_viewpoint(Point vp, bool jump) | 105 | void MapView::set_viewpoint(Point vp, bool jump) |
4254 | 106 | { | 106 | { |
4256 | 107 | if (vp == m_viewpoint) | 107 | if (vp == viewpoint_) |
4257 | 108 | return; | 108 | return; |
4258 | 109 | 109 | ||
4259 | 110 | MapviewPixelFunctions::normalize_pix(intbase().egbase().map(), vp); | 110 | MapviewPixelFunctions::normalize_pix(intbase().egbase().map(), vp); |
4261 | 111 | m_viewpoint = vp; | 111 | viewpoint_ = vp; |
4262 | 112 | 112 | ||
4266 | 113 | if (m_changeview) | 113 | if (changeview_) |
4267 | 114 | m_changeview(vp, jump); | 114 | changeview_(vp, jump); |
4268 | 115 | changeview(m_viewpoint.x, m_viewpoint.y); | 115 | changeview(viewpoint_.x, viewpoint_.y); |
4269 | 116 | } | 116 | } |
4270 | 117 | 117 | ||
4271 | 118 | 118 | ||
4272 | 119 | void MapView::stop_dragging() { | 119 | void MapView::stop_dragging() { |
4273 | 120 | WLApplication::get()->set_mouse_lock(false); | 120 | WLApplication::get()->set_mouse_lock(false); |
4274 | 121 | grab_mouse(false); | 121 | grab_mouse(false); |
4276 | 122 | m_dragging = false; | 122 | dragging_ = false; |
4277 | 123 | } | 123 | } |
4278 | 124 | 124 | ||
4279 | 125 | /** | 125 | /** |
4280 | @@ -138,7 +138,7 @@ | |||
4281 | 138 | 138 | ||
4282 | 139 | fieldclicked(); | 139 | fieldclicked(); |
4283 | 140 | } else if (btn == SDL_BUTTON_RIGHT) { | 140 | } else if (btn == SDL_BUTTON_RIGHT) { |
4285 | 141 | m_dragging = true; | 141 | dragging_ = true; |
4286 | 142 | grab_mouse(true); | 142 | grab_mouse(true); |
4287 | 143 | WLApplication::get()->set_mouse_lock(true); | 143 | WLApplication::get()->set_mouse_lock(true); |
4288 | 144 | } | 144 | } |
4289 | @@ -146,7 +146,7 @@ | |||
4290 | 146 | } | 146 | } |
4291 | 147 | bool MapView::handle_mouserelease(const uint8_t btn, int32_t, int32_t) | 147 | bool MapView::handle_mouserelease(const uint8_t btn, int32_t, int32_t) |
4292 | 148 | { | 148 | { |
4294 | 149 | if (btn == SDL_BUTTON_RIGHT && m_dragging) | 149 | if (btn == SDL_BUTTON_RIGHT && dragging_) |
4295 | 150 | stop_dragging(); | 150 | stop_dragging(); |
4296 | 151 | return true; | 151 | return true; |
4297 | 152 | } | 152 | } |
4298 | @@ -160,7 +160,7 @@ | |||
4299 | 160 | bool MapView::handle_mousemove | 160 | bool MapView::handle_mousemove |
4300 | 161 | (uint8_t const state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) | 161 | (uint8_t const state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) |
4301 | 162 | { | 162 | { |
4303 | 163 | if (m_dragging) { | 163 | if (dragging_) { |
4304 | 164 | if (state & SDL_BUTTON(SDL_BUTTON_RIGHT)) | 164 | if (state & SDL_BUTTON(SDL_BUTTON_RIGHT)) |
4305 | 165 | set_rel_viewpoint(Point(xdiff, ydiff), false); | 165 | set_rel_viewpoint(Point(xdiff, ydiff), false); |
4306 | 166 | else stop_dragging(); | 166 | else stop_dragging(); |
4307 | @@ -183,8 +183,8 @@ | |||
4308 | 183 | =============== | 183 | =============== |
4309 | 184 | */ | 184 | */ |
4310 | 185 | void MapView::track_sel(Point m) { | 185 | void MapView::track_sel(Point m) { |
4313 | 186 | m += m_viewpoint; | 186 | m += viewpoint_; |
4314 | 187 | m_intbase.set_sel_pos | 187 | intbase_.set_sel_pos |
4315 | 188 | (MapviewPixelFunctions::calc_node_and_triangle | 188 | (MapviewPixelFunctions::calc_node_and_triangle |
4316 | 189 | (intbase().egbase().map(), m.x, m.y)); | 189 | (intbase().egbase().map(), m.x, m.y)); |
4317 | 190 | } | 190 | } |
4318 | 191 | 191 | ||
4319 | === modified file 'src/wui/mapview.h' | |||
4320 | --- src/wui/mapview.h 2014-11-13 08:25:45 +0000 | |||
4321 | +++ src/wui/mapview.h 2016-01-24 20:25:45 +0000 | |||
4322 | @@ -1,5 +1,5 @@ | |||
4323 | 1 | /* | 1 | /* |
4325 | 2 | * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
4326 | 3 | * | 3 | * |
4327 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4328 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4329 | @@ -63,10 +63,10 @@ | |||
4330 | 63 | void warp_mouse_to_node(Widelands::Coords); | 63 | void warp_mouse_to_node(Widelands::Coords); |
4331 | 64 | 64 | ||
4332 | 65 | void set_viewpoint(Point vp, bool jump); | 65 | void set_viewpoint(Point vp, bool jump); |
4334 | 66 | void set_rel_viewpoint(Point r, bool jump) {set_viewpoint(m_viewpoint + r, jump);} | 66 | void set_rel_viewpoint(Point r, bool jump) {set_viewpoint(viewpoint_ + r, jump);} |
4335 | 67 | 67 | ||
4338 | 68 | Point get_viewpoint() const {return m_viewpoint;} | 68 | Point get_viewpoint() const {return viewpoint_;} |
4339 | 69 | bool is_dragging() const {return m_dragging;} | 69 | bool is_dragging() const {return dragging_;} |
4340 | 70 | 70 | ||
4341 | 71 | // Drawing | 71 | // Drawing |
4342 | 72 | void draw(RenderTarget &) override; | 72 | void draw(RenderTarget &) override; |
4343 | @@ -80,16 +80,16 @@ | |||
4344 | 80 | void track_sel(Point m); | 80 | void track_sel(Point m); |
4345 | 81 | 81 | ||
4346 | 82 | protected: | 82 | protected: |
4348 | 83 | InteractiveBase & intbase() const {return m_intbase;} | 83 | InteractiveBase & intbase() const {return intbase_;} |
4349 | 84 | 84 | ||
4350 | 85 | private: | 85 | private: |
4351 | 86 | void stop_dragging(); | 86 | void stop_dragging(); |
4352 | 87 | 87 | ||
4358 | 88 | std::unique_ptr<GameRenderer> m_renderer; | 88 | std::unique_ptr<GameRenderer> renderer_; |
4359 | 89 | InteractiveBase & m_intbase; | 89 | InteractiveBase & intbase_; |
4360 | 90 | ChangeViewFn m_changeview; | 90 | ChangeViewFn changeview_; |
4361 | 91 | Point m_viewpoint; | 91 | Point viewpoint_; |
4362 | 92 | bool m_dragging; | 92 | bool dragging_; |
4363 | 93 | }; | 93 | }; |
4364 | 94 | 94 | ||
4365 | 95 | 95 | ||
4366 | 96 | 96 | ||
4367 | === modified file 'src/wui/minimap.cc' | |||
4368 | --- src/wui/minimap.cc 2015-11-28 11:04:12 +0000 | |||
4369 | +++ src/wui/minimap.cc 2016-01-24 20:25:45 +0000 | |||
4370 | @@ -1,5 +1,5 @@ | |||
4371 | 1 | /* | 1 | /* |
4373 | 2 | * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
4374 | 3 | * | 3 | * |
4375 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4376 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4377 | @@ -36,11 +36,11 @@ | |||
4378 | 36 | InteractiveBase & ibase) | 36 | InteractiveBase & ibase) |
4379 | 37 | : | 37 | : |
4380 | 38 | UI::Panel (&parent, x, y, 10, 10), | 38 | UI::Panel (&parent, x, y, 10, 10), |
4386 | 39 | m_ibase (ibase), | 39 | ibase_ (ibase), |
4387 | 40 | m_viewx (0), | 40 | viewx_ (0), |
4388 | 41 | m_viewy (0), | 41 | viewy_ (0), |
4389 | 42 | m_pic_map_spot(g_gr->images().get("pics/map_spot.png")), | 42 | pic_map_spot_(g_gr->images().get("pics/map_spot.png")), |
4390 | 43 | m_flags (flags) | 43 | flags_ (flags) |
4391 | 44 | {} | 44 | {} |
4392 | 45 | 45 | ||
4393 | 46 | 46 | ||
4394 | @@ -52,8 +52,8 @@ | |||
4395 | 52 | */ | 52 | */ |
4396 | 53 | void MiniMap::View::set_view_pos(const int32_t x, const int32_t y) | 53 | void MiniMap::View::set_view_pos(const int32_t x, const int32_t y) |
4397 | 54 | { | 54 | { |
4400 | 55 | m_viewx = x / TRIANGLE_WIDTH; | 55 | viewx_ = x / TRIANGLE_WIDTH; |
4401 | 56 | m_viewy = y / TRIANGLE_HEIGHT; | 56 | viewy_ = y / TRIANGLE_HEIGHT; |
4402 | 57 | 57 | ||
4403 | 58 | update(); | 58 | update(); |
4404 | 59 | } | 59 | } |
4405 | @@ -62,12 +62,12 @@ | |||
4406 | 62 | void MiniMap::View::draw(RenderTarget & dst) | 62 | void MiniMap::View::draw(RenderTarget & dst) |
4407 | 63 | { | 63 | { |
4408 | 64 | minimap_image_ = | 64 | minimap_image_ = |
4415 | 65 | draw_minimap(m_ibase.egbase(), | 65 | draw_minimap(ibase_.egbase(), |
4416 | 66 | m_ibase.get_player(), | 66 | ibase_.get_player(), |
4417 | 67 | (*m_flags) & (MiniMapLayer::Zoom2) ? | 67 | (*flags_) & (MiniMapLayer::Zoom2) ? |
4418 | 68 | Point((m_viewx - get_w() / 4), (m_viewy - get_h() / 4)) : | 68 | Point((viewx_ - get_w() / 4), (viewy_ - get_h() / 4)) : |
4419 | 69 | Point((m_viewx - get_w() / 2), (m_viewy - get_h() / 2)), | 69 | Point((viewx_ - get_w() / 2), (viewy_ - get_h() / 2)), |
4420 | 70 | *m_flags | MiniMapLayer::ViewWindow); | 70 | *flags_ | MiniMapLayer::ViewWindow); |
4421 | 71 | dst.blit(Point(), minimap_image_.get()); | 71 | dst.blit(Point(), minimap_image_.get()); |
4422 | 72 | } | 72 | } |
4423 | 73 | 73 | ||
4424 | @@ -83,15 +83,15 @@ | |||
4425 | 83 | 83 | ||
4426 | 84 | // calculates the coordinates corresponding to the mouse position | 84 | // calculates the coordinates corresponding to the mouse position |
4427 | 85 | Widelands::Coords c; | 85 | Widelands::Coords c; |
4429 | 86 | if (*m_flags & MiniMapLayer::Zoom2) | 86 | if (*flags_ & MiniMapLayer::Zoom2) |
4430 | 87 | c = Widelands::Coords | 87 | c = Widelands::Coords |
4433 | 88 | (m_viewx + 1 - (get_w() / 2 - x) / 2, | 88 | (viewx_ + 1 - (get_w() / 2 - x) / 2, |
4434 | 89 | m_viewy + 1 - (get_h() / 2 - y) / 2); | 89 | viewy_ + 1 - (get_h() / 2 - y) / 2); |
4435 | 90 | else | 90 | else |
4436 | 91 | c = Widelands::Coords | 91 | c = Widelands::Coords |
4438 | 92 | (m_viewx + 1 - get_w() / 2 + x, m_viewy + 1 - get_h() / 2 + y); | 92 | (viewx_ + 1 - get_w() / 2 + x, viewy_ + 1 - get_h() / 2 + y); |
4439 | 93 | 93 | ||
4441 | 94 | m_ibase.egbase().map().normalize_coords(c); | 94 | ibase_.egbase().map().normalize_coords(c); |
4442 | 95 | 95 | ||
4443 | 96 | dynamic_cast<MiniMap&>(*get_parent()).warpview(c.x * TRIANGLE_WIDTH, c.y * TRIANGLE_HEIGHT); | 96 | dynamic_cast<MiniMap&>(*get_parent()).warpview(c.x * TRIANGLE_WIDTH, c.y * TRIANGLE_HEIGHT); |
4444 | 97 | 97 | ||
4445 | @@ -102,7 +102,7 @@ | |||
4446 | 102 | } | 102 | } |
4447 | 103 | 103 | ||
4448 | 104 | void MiniMap::View::set_zoom(int32_t z) { | 104 | void MiniMap::View::set_zoom(int32_t z) { |
4450 | 105 | const Widelands::Map & map = m_ibase.egbase().map(); | 105 | const Widelands::Map & map = ibase_.egbase().map(); |
4451 | 106 | set_size((map.get_width() * z), (map.get_height()) * z); | 106 | set_size((map.get_width() * z), (map.get_height()) * z); |
4452 | 107 | } | 107 | } |
4453 | 108 | 108 | ||
4454 | @@ -129,52 +129,52 @@ | |||
4455 | 129 | inline uint32_t MiniMap::number_of_buttons_per_row() const {return 3;} | 129 | inline uint32_t MiniMap::number_of_buttons_per_row() const {return 3;} |
4456 | 130 | inline uint32_t MiniMap::number_of_button_rows () const {return 2;} | 130 | inline uint32_t MiniMap::number_of_button_rows () const {return 2;} |
4457 | 131 | inline uint32_t MiniMap::but_w () const { | 131 | inline uint32_t MiniMap::but_w () const { |
4459 | 132 | return m_view.get_w() / number_of_buttons_per_row(); | 132 | return view_.get_w() / number_of_buttons_per_row(); |
4460 | 133 | } | 133 | } |
4461 | 134 | inline uint32_t MiniMap::but_h () const {return 20;} | 134 | inline uint32_t MiniMap::but_h () const {return 20;} |
4462 | 135 | MiniMap::MiniMap(InteractiveBase & ibase, Registry * const registry) | 135 | MiniMap::MiniMap(InteractiveBase & ibase, Registry * const registry) |
4463 | 136 | : | 136 | : |
4464 | 137 | UI::UniqueWindow(&ibase, "minimap", registry, 0, 0, _("Map")), | 137 | UI::UniqueWindow(&ibase, "minimap", registry, 0, 0, _("Map")), |
4466 | 138 | m_view(*this, ®istry->flags, 0, 0, 0, 0, ibase), | 138 | view_(*this, ®istry->flags, 0, 0, 0, 0, ibase), |
4467 | 139 | 139 | ||
4468 | 140 | button_terrn | 140 | button_terrn |
4469 | 141 | (this, "terrain", | 141 | (this, "terrain", |
4471 | 142 | but_w() * 0, m_view.get_h() + but_h() * 0, but_w(), but_h(), | 142 | but_w() * 0, view_.get_h() + but_h() * 0, but_w(), but_h(), |
4472 | 143 | g_gr->images().get("pics/but0.png"), | 143 | g_gr->images().get("pics/but0.png"), |
4473 | 144 | g_gr->images().get("pics/button_terrn.png"), | 144 | g_gr->images().get("pics/button_terrn.png"), |
4474 | 145 | _("Terrain"), | 145 | _("Terrain"), |
4475 | 146 | true, false, true), | 146 | true, false, true), |
4476 | 147 | button_owner | 147 | button_owner |
4477 | 148 | (this, "owner", | 148 | (this, "owner", |
4479 | 149 | but_w() * 1, m_view.get_h() + but_h() * 0, but_w(), but_h(), | 149 | but_w() * 1, view_.get_h() + but_h() * 0, but_w(), but_h(), |
4480 | 150 | g_gr->images().get("pics/but0.png"), | 150 | g_gr->images().get("pics/but0.png"), |
4481 | 151 | g_gr->images().get("pics/button_owner.png"), | 151 | g_gr->images().get("pics/button_owner.png"), |
4482 | 152 | _("Owner"), | 152 | _("Owner"), |
4483 | 153 | true, false, true), | 153 | true, false, true), |
4484 | 154 | button_flags | 154 | button_flags |
4485 | 155 | (this, "flags", | 155 | (this, "flags", |
4487 | 156 | but_w() * 2, m_view.get_h() + but_h() * 0, but_w(), but_h(), | 156 | but_w() * 2, view_.get_h() + but_h() * 0, but_w(), but_h(), |
4488 | 157 | g_gr->images().get("pics/but0.png"), | 157 | g_gr->images().get("pics/but0.png"), |
4489 | 158 | g_gr->images().get("pics/button_flags.png"), | 158 | g_gr->images().get("pics/button_flags.png"), |
4490 | 159 | _("Flags"), | 159 | _("Flags"), |
4491 | 160 | true, false, true), | 160 | true, false, true), |
4492 | 161 | button_roads | 161 | button_roads |
4493 | 162 | (this, "roads", | 162 | (this, "roads", |
4495 | 163 | but_w() * 0, m_view.get_h() + but_h() * 1, but_w(), but_h(), | 163 | but_w() * 0, view_.get_h() + but_h() * 1, but_w(), but_h(), |
4496 | 164 | g_gr->images().get("pics/but0.png"), | 164 | g_gr->images().get("pics/but0.png"), |
4497 | 165 | g_gr->images().get("pics/button_roads.png"), | 165 | g_gr->images().get("pics/button_roads.png"), |
4498 | 166 | _("Roads"), | 166 | _("Roads"), |
4499 | 167 | true, false, true), | 167 | true, false, true), |
4500 | 168 | button_bldns | 168 | button_bldns |
4501 | 169 | (this, "buildings", | 169 | (this, "buildings", |
4503 | 170 | but_w() * 1, m_view.get_h() + but_h() * 1, but_w(), but_h(), | 170 | but_w() * 1, view_.get_h() + but_h() * 1, but_w(), but_h(), |
4504 | 171 | g_gr->images().get("pics/but0.png"), | 171 | g_gr->images().get("pics/but0.png"), |
4505 | 172 | g_gr->images().get("pics/button_bldns.png"), | 172 | g_gr->images().get("pics/button_bldns.png"), |
4506 | 173 | _("Buildings"), | 173 | _("Buildings"), |
4507 | 174 | true, false, true), | 174 | true, false, true), |
4508 | 175 | button_zoom | 175 | button_zoom |
4509 | 176 | (this, "zoom", | 176 | (this, "zoom", |
4511 | 177 | but_w() * 2, m_view.get_h() + but_h() * 1, but_w(), but_h(), | 177 | but_w() * 2, view_.get_h() + but_h() * 1, but_w(), but_h(), |
4512 | 178 | g_gr->images().get("pics/but0.png"), | 178 | g_gr->images().get("pics/but0.png"), |
4513 | 179 | g_gr->images().get("pics/button_zoom.png"), | 179 | g_gr->images().get("pics/button_zoom.png"), |
4514 | 180 | _("Zoom"), | 180 | _("Zoom"), |
4515 | @@ -198,37 +198,37 @@ | |||
4516 | 198 | 198 | ||
4517 | 199 | 199 | ||
4518 | 200 | void MiniMap::toggle(MiniMapLayer const button) { | 200 | void MiniMap::toggle(MiniMapLayer const button) { |
4520 | 201 | *m_view.m_flags = MiniMapLayer(*m_view.m_flags ^ button); | 201 | *view_.flags_ = MiniMapLayer(*view_.flags_ ^ button); |
4521 | 202 | if (button == MiniMapLayer::Zoom2) | 202 | if (button == MiniMapLayer::Zoom2) |
4522 | 203 | resize(); | 203 | resize(); |
4523 | 204 | update_button_permpressed(); | 204 | update_button_permpressed(); |
4524 | 205 | } | 205 | } |
4525 | 206 | 206 | ||
4526 | 207 | void MiniMap::resize() { | 207 | void MiniMap::resize() { |
4528 | 208 | m_view.set_zoom(*m_view.m_flags & MiniMapLayer::Zoom2 ? 2 : 1); | 208 | view_.set_zoom(*view_.flags_ & MiniMapLayer::Zoom2 ? 2 : 1); |
4529 | 209 | set_inner_size | 209 | set_inner_size |
4532 | 210 | (m_view.get_w(), m_view.get_h() + number_of_button_rows() * but_h()); | 210 | (view_.get_w(), view_.get_h() + number_of_button_rows() * but_h()); |
4533 | 211 | button_terrn.set_pos(Point(but_w() * 0, m_view.get_h() + but_h() * 0)); | 211 | button_terrn.set_pos(Point(but_w() * 0, view_.get_h() + but_h() * 0)); |
4534 | 212 | button_terrn.set_size(but_w(), but_h()); | 212 | button_terrn.set_size(but_w(), but_h()); |
4536 | 213 | button_owner.set_pos(Point(but_w() * 1, m_view.get_h() + but_h() * 0)); | 213 | button_owner.set_pos(Point(but_w() * 1, view_.get_h() + but_h() * 0)); |
4537 | 214 | button_owner.set_size(but_w(), but_h()); | 214 | button_owner.set_size(but_w(), but_h()); |
4539 | 215 | button_flags.set_pos(Point(but_w() * 2, m_view.get_h() + but_h() * 0)); | 215 | button_flags.set_pos(Point(but_w() * 2, view_.get_h() + but_h() * 0)); |
4540 | 216 | button_flags.set_size(but_w(), but_h()); | 216 | button_flags.set_size(but_w(), but_h()); |
4542 | 217 | button_roads.set_pos(Point(but_w() * 0, m_view.get_h() + but_h() * 1)); | 217 | button_roads.set_pos(Point(but_w() * 0, view_.get_h() + but_h() * 1)); |
4543 | 218 | button_roads.set_size(but_w(), but_h()); | 218 | button_roads.set_size(but_w(), but_h()); |
4545 | 219 | button_bldns.set_pos(Point(but_w() * 1, m_view.get_h() + but_h() * 1)); | 219 | button_bldns.set_pos(Point(but_w() * 1, view_.get_h() + but_h() * 1)); |
4546 | 220 | button_bldns.set_size(but_w(), but_h()); | 220 | button_bldns.set_size(but_w(), but_h()); |
4548 | 221 | button_zoom .set_pos(Point(but_w() * 2, m_view.get_h() + but_h() * 1)); | 221 | button_zoom .set_pos(Point(but_w() * 2, view_.get_h() + but_h() * 1)); |
4549 | 222 | button_zoom .set_size(but_w(), but_h()); | 222 | button_zoom .set_size(but_w(), but_h()); |
4550 | 223 | move_inside_parent(); | 223 | move_inside_parent(); |
4551 | 224 | } | 224 | } |
4552 | 225 | 225 | ||
4553 | 226 | // Makes the buttons reflect the selected layers | 226 | // Makes the buttons reflect the selected layers |
4554 | 227 | void MiniMap::update_button_permpressed() { | 227 | void MiniMap::update_button_permpressed() { |
4561 | 228 | button_terrn.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Terrain); | 228 | button_terrn.set_perm_pressed(*view_.flags_ & MiniMapLayer::Terrain); |
4562 | 229 | button_owner.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Owner); | 229 | button_owner.set_perm_pressed(*view_.flags_ & MiniMapLayer::Owner); |
4563 | 230 | button_flags.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Flag); | 230 | button_flags.set_perm_pressed(*view_.flags_ & MiniMapLayer::Flag); |
4564 | 231 | button_roads.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Road); | 231 | button_roads.set_perm_pressed(*view_.flags_ & MiniMapLayer::Road); |
4565 | 232 | button_bldns.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Building); | 232 | button_bldns.set_perm_pressed(*view_.flags_ & MiniMapLayer::Building); |
4566 | 233 | button_zoom .set_perm_pressed(*m_view.m_flags & MiniMapLayer::Zoom2); | 233 | button_zoom .set_perm_pressed(*view_.flags_ & MiniMapLayer::Zoom2); |
4567 | 234 | } | 234 | } |
4568 | 235 | 235 | ||
4569 | === modified file 'src/wui/minimap.h' | |||
4570 | --- src/wui/minimap.h 2015-02-20 07:45:49 +0000 | |||
4571 | +++ src/wui/minimap.h 2016-01-24 20:25:45 +0000 | |||
4572 | @@ -1,5 +1,5 @@ | |||
4573 | 1 | /* | 1 | /* |
4575 | 2 | * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team | 2 | * Copyright (C) 2002-20116 by the Widelands Development Team |
4576 | 3 | * | 3 | * |
4577 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4578 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4579 | @@ -46,7 +46,7 @@ | |||
4580 | 46 | boost::signals2::signal<void (int32_t, int32_t)> warpview; | 46 | boost::signals2::signal<void (int32_t, int32_t)> warpview; |
4581 | 47 | 47 | ||
4582 | 48 | void set_view_pos(int32_t const x, int32_t const y) { | 48 | void set_view_pos(int32_t const x, int32_t const y) { |
4584 | 49 | m_view.set_view_pos(x, y); | 49 | view_.set_view_pos(x, y); |
4585 | 50 | } | 50 | } |
4586 | 51 | 51 | ||
4587 | 52 | private: | 52 | private: |
4588 | @@ -79,16 +79,16 @@ | |||
4589 | 79 | void set_zoom(int32_t z); | 79 | void set_zoom(int32_t z); |
4590 | 80 | 80 | ||
4591 | 81 | private: | 81 | private: |
4595 | 82 | InteractiveBase & m_ibase; | 82 | InteractiveBase & ibase_; |
4596 | 83 | int32_t m_viewx, m_viewy; | 83 | int32_t viewx_, viewy_; |
4597 | 84 | const Image* m_pic_map_spot; | 84 | const Image* pic_map_spot_; |
4598 | 85 | 85 | ||
4599 | 86 | // This needs to be owned since it will be rendered by the RenderQueue | 86 | // This needs to be owned since it will be rendered by the RenderQueue |
4600 | 87 | // later, so it must be valid for the whole frame. | 87 | // later, so it must be valid for the whole frame. |
4601 | 88 | std::unique_ptr<Texture> minimap_image_; | 88 | std::unique_ptr<Texture> minimap_image_; |
4602 | 89 | 89 | ||
4603 | 90 | public: | 90 | public: |
4605 | 91 | MiniMapLayer* m_flags; | 91 | MiniMapLayer* flags_; |
4606 | 92 | }; | 92 | }; |
4607 | 93 | 93 | ||
4608 | 94 | uint32_t number_of_buttons_per_row() const; | 94 | uint32_t number_of_buttons_per_row() const; |
4609 | @@ -96,7 +96,7 @@ | |||
4610 | 96 | uint32_t but_w () const; | 96 | uint32_t but_w () const; |
4611 | 97 | uint32_t but_h () const; | 97 | uint32_t but_h () const; |
4612 | 98 | 98 | ||
4614 | 99 | View m_view; | 99 | View view_; |
4615 | 100 | UI::Button button_terrn; | 100 | UI::Button button_terrn; |
4616 | 101 | UI::Button button_owner; | 101 | UI::Button button_owner; |
4617 | 102 | UI::Button button_flags; | 102 | UI::Button button_flags; |
4618 | 103 | 103 | ||
4619 | === modified file 'src/wui/multiplayersetupgroup.cc' | |||
4620 | --- src/wui/multiplayersetupgroup.cc 2015-12-11 19:06:50 +0000 | |||
4621 | +++ src/wui/multiplayersetupgroup.cc 2016-01-24 20:25:45 +0000 | |||
4622 | @@ -1,5 +1,5 @@ | |||
4623 | 1 | /* | 1 | /* |
4625 | 2 | * Copyright (C) 2010-2011 by the Widelands Development Team | 2 | * Copyright (C) 2010-2016 by the Widelands Development Team |
4626 | 3 | * | 3 | * |
4627 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4628 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4629 | @@ -51,8 +51,8 @@ | |||
4630 | 51 | type_icon(nullptr), | 51 | type_icon(nullptr), |
4631 | 52 | type(nullptr), | 52 | type(nullptr), |
4632 | 53 | s(settings), | 53 | s(settings), |
4635 | 54 | m_id(id), | 54 | id_(id), |
4636 | 55 | m_save(-2) | 55 | save_(-2) |
4637 | 56 | { | 56 | { |
4638 | 57 | set_size(w, h); | 57 | set_size(w, h); |
4639 | 58 | name = new UI::Textarea | 58 | name = new UI::Textarea |
4640 | @@ -81,7 +81,7 @@ | |||
4641 | 81 | 81 | ||
4642 | 82 | /// Switch human players and spectator | 82 | /// Switch human players and spectator |
4643 | 83 | void toggle_type() { | 83 | void toggle_type() { |
4645 | 84 | UserSettings us = s->settings().users.at(m_id); | 84 | UserSettings us = s->settings().users.at(id_); |
4646 | 85 | int16_t p = us.position; | 85 | int16_t p = us.position; |
4647 | 86 | if (p == UserSettings::none()) | 86 | if (p == UserSettings::none()) |
4648 | 87 | p = -1; | 87 | p = -1; |
4649 | @@ -101,7 +101,7 @@ | |||
4650 | 101 | 101 | ||
4651 | 102 | /// Care about visibility and current values | 102 | /// Care about visibility and current values |
4652 | 103 | void refresh() { | 103 | void refresh() { |
4654 | 104 | UserSettings us = s->settings().users.at(m_id); | 104 | UserSettings us = s->settings().users.at(id_); |
4655 | 105 | if (us.position == UserSettings::not_connected()) { | 105 | if (us.position == UserSettings::not_connected()) { |
4656 | 106 | std::string free_i18n = _("free"); | 106 | std::string free_i18n = _("free"); |
4657 | 107 | std::string free_text = | 107 | std::string free_text = |
4658 | @@ -113,7 +113,7 @@ | |||
4659 | 113 | type_icon->set_visible(false); | 113 | type_icon->set_visible(false); |
4660 | 114 | } else { | 114 | } else { |
4661 | 115 | name->set_text(us.name); | 115 | name->set_text(us.name); |
4663 | 116 | if (m_save != us.position) { | 116 | if (save_ != us.position) { |
4664 | 117 | std::string pic; | 117 | std::string pic; |
4665 | 118 | std::string temp_tooltip; | 118 | std::string temp_tooltip; |
4666 | 119 | if (us.position < UserSettings::highest_playernum()) { | 119 | if (us.position < UserSettings::highest_playernum()) { |
4667 | @@ -127,7 +127,7 @@ | |||
4668 | 127 | } | 127 | } |
4669 | 128 | 128 | ||
4670 | 129 | // Either Button if changeable OR text if not | 129 | // Either Button if changeable OR text if not |
4672 | 130 | if (m_id == s->settings().usernum) { | 130 | if (id_ == s->settings().usernum) { |
4673 | 131 | type->set_pic(g_gr->images().get(pic)); | 131 | type->set_pic(g_gr->images().get(pic)); |
4674 | 132 | type->set_tooltip(temp_tooltip); | 132 | type->set_tooltip(temp_tooltip); |
4675 | 133 | type->set_visible(true); | 133 | type->set_visible(true); |
4676 | @@ -136,7 +136,7 @@ | |||
4677 | 136 | type_icon->set_tooltip(temp_tooltip); | 136 | type_icon->set_tooltip(temp_tooltip); |
4678 | 137 | type_icon->set_visible(true); | 137 | type_icon->set_visible(true); |
4679 | 138 | } | 138 | } |
4681 | 139 | m_save = us.position; | 139 | save_ = us.position; |
4682 | 140 | } | 140 | } |
4683 | 141 | } | 141 | } |
4684 | 142 | } | 142 | } |
4685 | @@ -145,8 +145,8 @@ | |||
4686 | 145 | UI::Icon * type_icon; | 145 | UI::Icon * type_icon; |
4687 | 146 | UI::Button * type; | 146 | UI::Button * type; |
4688 | 147 | GameSettingsProvider * const s; | 147 | GameSettingsProvider * const s; |
4691 | 148 | uint8_t const m_id; | 148 | uint8_t const id_; |
4692 | 149 | int16_t m_save; // saved position to check rewrite need. | 149 | int16_t save_; // saved position to check rewrite need. |
4693 | 150 | }; | 150 | }; |
4694 | 151 | 151 | ||
4695 | 152 | struct MultiPlayerPlayerGroup : public UI::Box { | 152 | struct MultiPlayerPlayerGroup : public UI::Box { |
4696 | @@ -165,9 +165,9 @@ | |||
4697 | 165 | init(nullptr), | 165 | init(nullptr), |
4698 | 166 | s(settings), | 166 | s(settings), |
4699 | 167 | n(npsb), | 167 | n(npsb), |
4703 | 168 | m_id(id), | 168 | id_(id), |
4704 | 169 | m_tribepics(tp), | 169 | tribepics_(tp), |
4705 | 170 | m_tribenames(tn) | 170 | tribenames_(tn) |
4706 | 171 | { | 171 | { |
4707 | 172 | set_size(w, h); | 172 | set_size(w, h); |
4708 | 173 | 173 | ||
4709 | @@ -217,42 +217,42 @@ | |||
4710 | 217 | 217 | ||
4711 | 218 | /// Toggle through the types | 218 | /// Toggle through the types |
4712 | 219 | void toggle_type() { | 219 | void toggle_type() { |
4714 | 220 | n->toggle_type(m_id); | 220 | n->toggle_type(id_); |
4715 | 221 | } | 221 | } |
4716 | 222 | 222 | ||
4717 | 223 | /// Toggle through the tribes + handle shared in players | 223 | /// Toggle through the tribes + handle shared in players |
4718 | 224 | void toggle_tribe() { | 224 | void toggle_tribe() { |
4720 | 225 | n->toggle_tribe(m_id); | 225 | n->toggle_tribe(id_); |
4721 | 226 | } | 226 | } |
4722 | 227 | 227 | ||
4723 | 228 | /// Toggle through the initializations | 228 | /// Toggle through the initializations |
4724 | 229 | void toggle_init() { | 229 | void toggle_init() { |
4726 | 230 | n->toggle_init(m_id); | 230 | n->toggle_init(id_); |
4727 | 231 | } | 231 | } |
4728 | 232 | 232 | ||
4729 | 233 | /// Toggle through the teams | 233 | /// Toggle through the teams |
4730 | 234 | void toggle_team() { | 234 | void toggle_team() { |
4732 | 235 | n->toggle_team(m_id); | 235 | n->toggle_team(id_); |
4733 | 236 | } | 236 | } |
4734 | 237 | 237 | ||
4735 | 238 | /// Refresh all user interfaces | 238 | /// Refresh all user interfaces |
4736 | 239 | void refresh() { | 239 | void refresh() { |
4737 | 240 | const GameSettings & settings = s->settings(); | 240 | const GameSettings & settings = s->settings(); |
4738 | 241 | 241 | ||
4740 | 242 | if (m_id >= settings.players.size()) { | 242 | if (id_ >= settings.players.size()) { |
4741 | 243 | set_visible(false); | 243 | set_visible(false); |
4742 | 244 | return; | 244 | return; |
4743 | 245 | } | 245 | } |
4744 | 246 | 246 | ||
4746 | 247 | n->refresh(m_id); | 247 | n->refresh(id_); |
4747 | 248 | 248 | ||
4748 | 249 | set_visible(true); | 249 | set_visible(true); |
4749 | 250 | 250 | ||
4755 | 251 | const PlayerSettings & player_setting = settings.players[m_id]; | 251 | const PlayerSettings & player_setting = settings.players[id_]; |
4756 | 252 | bool typeaccess = s->can_change_player_state(m_id); | 252 | bool typeaccess = s->can_change_player_state(id_); |
4757 | 253 | bool tribeaccess = s->can_change_player_tribe(m_id); | 253 | bool tribeaccess = s->can_change_player_tribe(id_); |
4758 | 254 | bool const initaccess = s->can_change_player_init(m_id); | 254 | bool const initaccess = s->can_change_player_init(id_); |
4759 | 255 | bool teamaccess = s->can_change_player_team(m_id); | 255 | bool teamaccess = s->can_change_player_team(id_); |
4760 | 256 | 256 | ||
4761 | 257 | type->set_enabled(typeaccess); | 257 | type->set_enabled(typeaccess); |
4762 | 258 | if (player_setting.state == PlayerSettings::stateClosed) { | 258 | if (player_setting.state == PlayerSettings::stateClosed) { |
4763 | @@ -320,21 +320,21 @@ | |||
4764 | 320 | type->set_pic(g_gr->images().get(pic)); | 320 | type->set_pic(g_gr->images().get(pic)); |
4765 | 321 | if (player_setting.random_tribe) { | 321 | if (player_setting.random_tribe) { |
4766 | 322 | std::string random = pgettext("tribe", "Random"); | 322 | std::string random = pgettext("tribe", "Random"); |
4769 | 323 | if (!m_tribenames["random"].size()) | 323 | if (!tribenames_["random"].size()) |
4770 | 324 | m_tribepics[random] = g_gr->images().get("pics/random.png"); | 324 | tribepics_[random] = g_gr->images().get("pics/random.png"); |
4771 | 325 | tribe->set_tooltip(random.c_str()); | 325 | tribe->set_tooltip(random.c_str()); |
4773 | 326 | tribe->set_pic(m_tribepics[random]); | 326 | tribe->set_pic(tribepics_[random]); |
4774 | 327 | } else { | 327 | } else { |
4776 | 328 | if (!m_tribenames[player_setting.tribe].size()) { | 328 | if (!tribenames_[player_setting.tribe].size()) { |
4777 | 329 | // get tribes name and picture | 329 | // get tribes name and picture |
4778 | 330 | i18n::Textdomain td("tribes"); | 330 | i18n::Textdomain td("tribes"); |
4779 | 331 | for (const TribeBasicInfo& tribeinfo : settings.tribes) { | 331 | for (const TribeBasicInfo& tribeinfo : settings.tribes) { |
4782 | 332 | m_tribenames[tribeinfo.name] = _(tribeinfo.descname); | 332 | tribenames_[tribeinfo.name] = _(tribeinfo.descname); |
4783 | 333 | m_tribepics[tribeinfo.name] = g_gr->images().get(tribeinfo.icon); | 333 | tribepics_[tribeinfo.name] = g_gr->images().get(tribeinfo.icon); |
4784 | 334 | } | 334 | } |
4785 | 335 | } | 335 | } |
4788 | 336 | tribe->set_tooltip(m_tribenames[player_setting.tribe].c_str()); | 336 | tribe->set_tooltip(tribenames_[player_setting.tribe].c_str()); |
4789 | 337 | tribe->set_pic(m_tribepics[player_setting.tribe]); | 337 | tribe->set_pic(tribepics_[player_setting.tribe]); |
4790 | 338 | } | 338 | } |
4791 | 339 | tribe->set_flat(false); | 339 | tribe->set_flat(false); |
4792 | 340 | 340 | ||
4793 | @@ -375,9 +375,9 @@ | |||
4794 | 375 | UI::Button * team; | 375 | UI::Button * team; |
4795 | 376 | GameSettingsProvider * const s; | 376 | GameSettingsProvider * const s; |
4796 | 377 | NetworkPlayerSettingsBackend * const n; | 377 | NetworkPlayerSettingsBackend * const n; |
4800 | 378 | uint8_t const m_id; | 378 | uint8_t const id_; |
4801 | 379 | std::map<std::string, const Image* > & m_tribepics; | 379 | std::map<std::string, const Image* > & tribepics_; |
4802 | 380 | std::map<std::string, std::string> & m_tribenames; | 380 | std::map<std::string, std::string> & tribenames_; |
4803 | 381 | }; | 381 | }; |
4804 | 382 | 382 | ||
4805 | 383 | MultiPlayerSetupGroup::MultiPlayerSetupGroup | 383 | MultiPlayerSetupGroup::MultiPlayerSetupGroup |
4806 | @@ -392,9 +392,9 @@ | |||
4807 | 392 | npsb(new NetworkPlayerSettingsBackend(s)), | 392 | npsb(new NetworkPlayerSettingsBackend(s)), |
4808 | 393 | clientbox(this, 0, buth, UI::Box::Vertical, w / 3, h - buth), | 393 | clientbox(this, 0, buth, UI::Box::Vertical, w / 3, h - buth), |
4809 | 394 | playerbox(this, w * 6 / 15, buth, UI::Box::Vertical, w * 9 / 15, h - buth), | 394 | playerbox(this, w * 6 / 15, buth, UI::Box::Vertical, w * 9 / 15, h - buth), |
4813 | 395 | m_buth(buth), | 395 | buth_(buth), |
4814 | 396 | m_fsize(fsize), | 396 | fsize_(fsize), |
4815 | 397 | m_fname(fname) | 397 | fname_(fname) |
4816 | 398 | { | 398 | { |
4817 | 399 | UI::TextStyle tsmaller(UI::TextStyle::makebold(UI::Font::get(fname, fsize * 3 / 4), UI_FONT_CLR_FG)); | 399 | UI::TextStyle tsmaller(UI::TextStyle::makebold(UI::Font::get(fname, fsize * 3 / 4), UI_FONT_CLR_FG)); |
4818 | 400 | 400 | ||
4819 | @@ -462,7 +462,7 @@ | |||
4820 | 462 | (&playerbox, i, | 462 | (&playerbox, i, |
4821 | 463 | 0, 0, playerbox.get_w(), buth, | 463 | 0, 0, playerbox.get_w(), buth, |
4822 | 464 | s, npsb.get(), | 464 | s, npsb.get(), |
4824 | 465 | m_tribepics, m_tribenames); | 465 | tribepics_, tribenames_); |
4825 | 466 | playerbox.add(multi_player_player_groups.at(i), 1); | 466 | playerbox.add(multi_player_player_groups.at(i), 1); |
4826 | 467 | } | 467 | } |
4827 | 468 | refresh(); | 468 | refresh(); |
4828 | @@ -488,7 +488,7 @@ | |||
4829 | 488 | for (uint32_t i = 0; i < settings.users.size(); ++i) { | 488 | for (uint32_t i = 0; i < settings.users.size(); ++i) { |
4830 | 489 | if (!multi_player_client_groups.at(i)) { | 489 | if (!multi_player_client_groups.at(i)) { |
4831 | 490 | multi_player_client_groups.at(i) = new MultiPlayerClientGroup( | 490 | multi_player_client_groups.at(i) = new MultiPlayerClientGroup( |
4833 | 491 | &clientbox, i, 0, 0, clientbox.get_w(), m_buth, s, UI::Font::get(m_fname, m_fsize)); | 491 | &clientbox, i, 0, 0, clientbox.get_w(), buth_, s, UI::Font::get(fname_, fsize_)); |
4834 | 492 | clientbox.add(&*multi_player_client_groups.at(i), 1); | 492 | clientbox.add(&*multi_player_client_groups.at(i), 1); |
4835 | 493 | } | 493 | } |
4836 | 494 | multi_player_client_groups.at(i)->refresh(); | 494 | multi_player_client_groups.at(i)->refresh(); |
4837 | 495 | 495 | ||
4838 | === modified file 'src/wui/multiplayersetupgroup.h' | |||
4839 | --- src/wui/multiplayersetupgroup.h 2015-01-21 21:21:46 +0000 | |||
4840 | +++ src/wui/multiplayersetupgroup.h 2016-01-24 20:25:45 +0000 | |||
4841 | @@ -1,5 +1,5 @@ | |||
4842 | 1 | /* | 1 | /* |
4844 | 2 | * Copyright (C) 2010 by the Widelands Development Team | 2 | * Copyright (C) 2010-2016 by the Widelands Development Team |
4845 | 3 | * | 3 | * |
4846 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4847 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4848 | @@ -64,11 +64,11 @@ | |||
4849 | 64 | UI::Box clientbox, playerbox; | 64 | UI::Box clientbox, playerbox; |
4850 | 65 | std::vector<UI::Textarea *> labels; | 65 | std::vector<UI::Textarea *> labels; |
4851 | 66 | 66 | ||
4854 | 67 | uint32_t m_buth, m_fsize; | 67 | uint32_t buth_, fsize_; |
4855 | 68 | std::string m_fname; | 68 | std::string fname_; |
4856 | 69 | 69 | ||
4859 | 70 | std::map<std::string, const Image* > m_tribepics; | 70 | std::map<std::string, const Image* > tribepics_; |
4860 | 71 | std::map<std::string, std::string> m_tribenames; | 71 | std::map<std::string, std::string> tribenames_; |
4861 | 72 | }; | 72 | }; |
4862 | 73 | 73 | ||
4863 | 74 | 74 | ||
4864 | 75 | 75 | ||
4865 | === modified file 'src/wui/playerdescrgroup.cc' | |||
4866 | --- src/wui/playerdescrgroup.cc 2016-01-17 09:54:31 +0000 | |||
4867 | +++ src/wui/playerdescrgroup.cc 2016-01-24 20:25:45 +0000 | |||
4868 | @@ -180,16 +180,16 @@ | |||
4869 | 180 | d->btnPlayerType->set_title(title); | 180 | d->btnPlayerType->set_title(title); |
4870 | 181 | 181 | ||
4871 | 182 | TribeBasicInfo info = Widelands::Tribes::tribeinfo(player.tribe); | 182 | TribeBasicInfo info = Widelands::Tribes::tribeinfo(player.tribe); |
4873 | 183 | if (!m_tribenames[player.tribe].size()) { | 183 | if (!tribenames_[player.tribe].size()) { |
4874 | 184 | // Tribe's localized name | 184 | // Tribe's localized name |
4876 | 185 | m_tribenames[player.tribe] = info.descname; | 185 | tribenames_[player.tribe] = info.descname; |
4877 | 186 | } | 186 | } |
4878 | 187 | if (player.random_tribe) { | 187 | if (player.random_tribe) { |
4879 | 188 | d->btnPlayerTribe->set_title(pgettext("tribe", "Random")); | 188 | d->btnPlayerTribe->set_title(pgettext("tribe", "Random")); |
4880 | 189 | d->btnPlayerTribe->set_tooltip(_("The tribe will be set at random.")); | 189 | d->btnPlayerTribe->set_tooltip(_("The tribe will be set at random.")); |
4881 | 190 | } else { | 190 | } else { |
4882 | 191 | i18n::Textdomain td("tribes"); | 191 | i18n::Textdomain td("tribes"); |
4884 | 192 | d->btnPlayerTribe->set_title(_(m_tribenames[player.tribe])); | 192 | d->btnPlayerTribe->set_title(_(tribenames_[player.tribe])); |
4885 | 193 | d->btnPlayerTribe->set_tooltip(info.tooltip); | 193 | d->btnPlayerTribe->set_tooltip(info.tooltip); |
4886 | 194 | } | 194 | } |
4887 | 195 | 195 | ||
4888 | 196 | 196 | ||
4889 | === modified file 'src/wui/playerdescrgroup.h' | |||
4890 | --- src/wui/playerdescrgroup.h 2014-12-06 12:22:35 +0000 | |||
4891 | +++ src/wui/playerdescrgroup.h 2016-01-24 20:25:45 +0000 | |||
4892 | @@ -1,5 +1,5 @@ | |||
4893 | 1 | /* | 1 | /* |
4895 | 2 | * Copyright (C) 2002, 2006, 2008, 2010 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
4896 | 3 | * | 3 | * |
4897 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4898 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4899 | @@ -55,7 +55,7 @@ | |||
4900 | 55 | void toggle_playerteam(); | 55 | void toggle_playerteam(); |
4901 | 56 | 56 | ||
4902 | 57 | PlayerDescriptionGroupImpl * d; | 57 | PlayerDescriptionGroupImpl * d; |
4904 | 58 | std::map<std::string, std::string> m_tribenames; | 58 | std::map<std::string, std::string> tribenames_; |
4905 | 59 | }; | 59 | }; |
4906 | 60 | 60 | ||
4907 | 61 | 61 | ||
4908 | 62 | 62 | ||
4909 | === modified file 'src/wui/plot_area.cc' | |||
4910 | --- src/wui/plot_area.cc 2016-01-18 19:35:25 +0000 | |||
4911 | +++ src/wui/plot_area.cc 2016-01-24 20:25:45 +0000 | |||
4912 | @@ -1,5 +1,5 @@ | |||
4913 | 1 | /* | 1 | /* |
4915 | 2 | * Copyright (C) 2002-2004, 2008-2013 by the Widelands Development Team | 2 | * Copyright (C) 2002-2016 by the Widelands Development Team |
4916 | 3 | * | 3 | * |
4917 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
4918 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
4919 | @@ -247,10 +247,10 @@ | |||
4920 | 247 | int32_t const x, int32_t const y, int32_t const w, int32_t const h) | 247 | int32_t const x, int32_t const y, int32_t const w, int32_t const h) |
4921 | 248 | : | 248 | : |
4922 | 249 | UI::Panel (parent, x, y, w, h), | 249 | UI::Panel (parent, x, y, w, h), |
4927 | 250 | m_plotmode(PLOTMODE_ABSOLUTE), | 250 | plotmode_(PLOTMODE_ABSOLUTE), |
4928 | 251 | m_sample_rate(0), | 251 | sample_rate_(0), |
4929 | 252 | m_time (TIME_GAME), | 252 | time_ (TIME_GAME), |
4930 | 253 | m_game_time_id(0) | 253 | game_time_id_(0) |
4931 | 254 | {} | 254 | {} |
4932 | 255 | 255 | ||
4933 | 256 | 256 | ||
4934 | @@ -258,15 +258,15 @@ | |||
4935 | 258 | uint32_t game_time = 0; | 258 | uint32_t game_time = 0; |
4936 | 259 | 259 | ||
4937 | 260 | // Find running time of the game, based on the plot data | 260 | // Find running time of the game, based on the plot data |
4941 | 261 | for (uint32_t plot = 0; plot < m_plotdata.size(); ++plot) | 261 | for (uint32_t plot = 0; plot < plotdata_.size(); ++plot) |
4942 | 262 | if (game_time < m_plotdata[plot].dataset->size() * m_sample_rate) | 262 | if (game_time < plotdata_[plot].dataset->size() * sample_rate_) |
4943 | 263 | game_time = m_plotdata[plot].dataset->size() * m_sample_rate; | 263 | game_time = plotdata_[plot].dataset->size() * sample_rate_; |
4944 | 264 | return game_time; | 264 | return game_time; |
4945 | 265 | } | 265 | } |
4946 | 266 | 266 | ||
4947 | 267 | std::vector<std::string> WuiPlotArea::get_labels() { | 267 | std::vector<std::string> WuiPlotArea::get_labels() { |
4948 | 268 | std::vector<std::string> labels; | 268 | std::vector<std::string> labels; |
4950 | 269 | for (int32_t i = 0; i < m_game_time_id; i++) { | 269 | for (int32_t i = 0; i < game_time_id_; i++) { |
4951 | 270 | UNIT unit = get_suggested_unit(time_in_ms[i]); | 270 | UNIT unit = get_suggested_unit(time_in_ms[i]); |
4952 | 271 | uint32_t val = ms_to_unit(unit, time_in_ms[i]); | 271 | uint32_t val = ms_to_unit(unit, time_in_ms[i]); |
4953 | 272 | labels.push_back((boost::format(get_unit_name(unit)) % boost::lexical_cast<std::string>(val)).str()); | 272 | labels.push_back((boost::format(get_unit_name(unit)) % boost::lexical_cast<std::string>(val)).str()); |
4954 | @@ -276,7 +276,7 @@ | |||
4955 | 276 | } | 276 | } |
4956 | 277 | 277 | ||
4957 | 278 | uint32_t WuiPlotArea::get_plot_time() { | 278 | uint32_t WuiPlotArea::get_plot_time() { |
4959 | 279 | if (m_time == TIME_GAME) { | 279 | if (time_ == TIME_GAME) { |
4960 | 280 | // Start with the game time | 280 | // Start with the game time |
4961 | 281 | uint32_t time_ms = get_game_time(); | 281 | uint32_t time_ms = get_game_time(); |
4962 | 282 | 282 | ||
4963 | @@ -297,7 +297,7 @@ | |||
4964 | 297 | } | 297 | } |
4965 | 298 | return time_ms; | 298 | return time_ms; |
4966 | 299 | } else { | 299 | } else { |
4968 | 300 | return time_in_ms[m_time]; | 300 | return time_in_ms[time_]; |
4969 | 301 | } | 301 | } |
4970 | 302 | } | 302 | } |
4971 | 303 | 303 | ||
4972 | @@ -316,8 +316,8 @@ | |||
4973 | 316 | uint32_t i; | 316 | uint32_t i; |
4974 | 317 | for (i = 1; i < 7 && time_in_ms[i] <= game_time; i++) { | 317 | for (i = 1; i < 7 && time_in_ms[i] <= game_time; i++) { |
4975 | 318 | } | 318 | } |
4978 | 319 | m_game_time_id = i; | 319 | game_time_id_ = i; |
4979 | 320 | return m_game_time_id; | 320 | return game_time_id_; |
4980 | 321 | } | 321 | } |
4981 | 322 | 322 | ||
4982 | 323 | /* | 323 | /* |
4983 | @@ -331,22 +331,22 @@ | |||
4984 | 331 | draw_diagram(time_ms, get_inner_w(), get_inner_h(), xline_length, dst); | 331 | draw_diagram(time_ms, get_inner_w(), get_inner_h(), xline_length, dst); |
4985 | 332 | 332 | ||
4986 | 333 | // How many do we take together when relative ploting | 333 | // How many do we take together when relative ploting |
4988 | 334 | const int32_t how_many = calc_how_many(time_ms, m_sample_rate); | 334 | const int32_t how_many = calc_how_many(time_ms, sample_rate_); |
4989 | 335 | 335 | ||
4990 | 336 | uint32_t max = 0; | 336 | uint32_t max = 0; |
4991 | 337 | // Find the maximum value. | 337 | // Find the maximum value. |
4998 | 338 | if (m_plotmode == PLOTMODE_ABSOLUTE) { | 338 | if (plotmode_ == PLOTMODE_ABSOLUTE) { |
4999 | 339 | for (uint32_t i = 0; i < m_plotdata.size(); ++i) | 339 | for (uint32_t i = 0; i < plotdata_.size(); ++i) |
5000 | 340 | if (m_plotdata[i].showplot) { | 340 | if (plotdata_[i].showplot) { |
4995 | 341 | for (uint32_t l = 0; l < m_plotdata[i].dataset->size(); ++l) | ||
4996 | 342 | if (max < (*m_plotdata[i].dataset)[l]) | ||
4997 | 343 | max = (*m_plotdata[i].dataset)[l]; |
Hi, I am bunnybot (https:/ /github. com/widelands/ bunnybot).
I am keeping the source branch lp:~klaus-halfmann/widelands/bug-1395278-wui mirrored to https:/ /github. com/widelands/ widelands/ tree/_klaus_ halfmann_ widelands_ bug_1395278_ wui
You can give me commands by starting a line with @bunnybot <command>. I understand:
merge: Merges the source branch into the target branch, closing the merge proposal. I will use the proposed commit message if it is set.