Merge lp:~klaus-halfmann/widelands/bug-1395278-wui into lp:widelands

Proposed by Klaus Halfmann
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
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+283747@code.launchpad.net

Description of the change

Migration from m_... to ..._ mostly in wui

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

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.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 381. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/104490091.
Appveyor build 288. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_klaus_halfmann_widelands_bug_1395278_wui-288.

Revision history for this message
SirVer (sirver) wrote :

Travis fails, because you have to fix one CMakeTarget: /home/travis/build/widelands/widelands/src/ai/CMakeLists.txt:1: ai misses DEPENDS on base_time_string, because it includes base/time_string.h

you can get these warnings locally by running 'make codecheck'

otherwise lgtm.

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

Another way to run codecheck that works better for me is:

cmake/codecheck/CodeCheck.py src/* | grep -v "src/third_party"

More on CodeCheck and regression tests: https://wl.widelands.org/wiki/RegressionTests/

Revision history for this message
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/CodeCheck.py src/* | grep -v "src/third_party"
>
> More on CodeCheck and regression tests: https://wl.widelands.org/wiki/RegressionTests/
> --
> https://code.launchpad.net/~klaus-halfmann/widelands/bug-1395278-wui/+merge/283747
> You are reviewing the proposed merge of lp:~klaus-halfmann/widelands/bug-1395278-wui into lp:widelands.

Revision history for this message
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 :)

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

The reason I never tun "make codecheck is that I get a screenful of

[ 15%] Built target see_if_codecheck_needs_to_run_425808b46d62349edb2afc756e74770b1a35a46d

And it's pretty impossible to find the actual codecheck messages among them.

Revision history for this message
SirVer (sirver) wrote :

ninja is not printing that. You can throttle ninja by using ninja -j1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/ai/computer_player.cc'
--- src/ai/computer_player.cc 2015-12-06 12:37:51 +0000
+++ src/ai/computer_player.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2004, 2006-2009 by the Widelands Development Team2 * Copyright (C) 2004-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -23,7 +23,7 @@
2323
24ComputerPlayer::ComputerPlayer24ComputerPlayer::ComputerPlayer
25 (Widelands::Game & g, Widelands::PlayerNumber const pid)25 (Widelands::Game & g, Widelands::PlayerNumber const pid)
26 : m_game(g), m_player_number(pid)26 : game_(g), player_number_(pid)
27{27{
28}28}
2929
3030
=== modified file 'src/ai/computer_player.h'
--- src/ai/computer_player.h 2015-12-06 11:15:52 +0000
+++ src/ai/computer_player.h 2016-01-24 20:25:45 +0000
@@ -42,8 +42,8 @@
4242
43 virtual void think () = 0;43 virtual void think () = 0;
4444
45 Widelands::Game & game() const {return m_game;}45 Widelands::Game & game() const {return game_;}
46 Widelands::PlayerNumber player_number() {return m_player_number;}46 Widelands::PlayerNumber player_number() {return player_number_;}
4747
48 /**48 /**
49 * Interface to a concrete implementation, used to instantiate AIs.49 * Interface to a concrete implementation, used to instantiate AIs.
@@ -71,8 +71,8 @@
71 static const Implementation * get_implementation(const std::string & name);71 static const Implementation * get_implementation(const std::string & name);
7272
73private:73private:
74 Widelands::Game & m_game;74 Widelands::Game & game_;
75 Widelands::PlayerNumber const m_player_number;75 Widelands::PlayerNumber const player_number_;
7676
77 DISALLOW_COPY_AND_ASSIGN(ComputerPlayer);77 DISALLOW_COPY_AND_ASSIGN(ComputerPlayer);
78};78};
7979
=== modified file 'src/logic/map_objects/tribes/tribe_descr.h'
--- src/logic/map_objects/tribes/tribe_descr.h 2016-01-23 19:36:55 +0000
+++ src/logic/map_objects/tribes/tribe_descr.h 2016-01-24 20:25:45 +0000
@@ -143,7 +143,7 @@
143143
144 void resize_ware_orders(size_t maxLength);144 void resize_ware_orders(size_t maxLength);
145145
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_;}
147147
148private:148private:
149 // Helper function for adding a special worker type (carriers etc.)149 // Helper function for adding a special worker type (carriers etc.)
150150
=== modified file 'src/logic/player.h'
--- src/logic/player.h 2016-01-22 19:53:32 +0000
+++ src/logic/player.h 2016-01-24 20:25:45 +0000
@@ -138,7 +138,7 @@
138138
139 /// Data that are used and managed by AI. They are here to have it saved as a port of player's data139 /// Data that are used and managed by AI. They are here to have it saved as a port of player's data
140 struct AiPersistentState {140 struct AiPersistentState {
141 AiPersistentState() : initialized(0){};141 AiPersistentState() : initialized(0){}
142142
143 //was initialized143 //was initialized
144 uint8_t initialized;144 uint8_t initialized;
@@ -159,7 +159,7 @@
159159
160 AiPersistentState* get_mutable_ai_persistent_state(){160 AiPersistentState* get_mutable_ai_persistent_state(){
161 return &ai_data;161 return &ai_data;
162 };162 }
163163
164 /// Per-player field information.164 /// Per-player field information.
165 struct Field {165 struct Field {
166166
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2016-01-17 09:55:27 +0000
+++ src/wlapplication.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2006-2015 by the Widelands Development Team2 * Copyright (C) 2006-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -179,12 +179,12 @@
179179
180void WLApplication::setup_homedir() {180void WLApplication::setup_homedir() {
181 //If we don't have a home directory don't do anything181 //If we don't have a home directory don't do anything
182 if (m_homedir.size()) {182 if (homedir_.size()) {
183 //assume some dir exists183 //assume some dir exists
184 try {184 try {
185 log ("Set home directory: %s\n", m_homedir.c_str());185 log ("Set home directory: %s\n", homedir_.c_str());
186186
187 std::unique_ptr<FileSystem> home(new RealFSImpl(m_homedir));187 std::unique_ptr<FileSystem> home(new RealFSImpl(homedir_));
188 home->ensure_directory_exists(".");188 home->ensure_directory_exists(".");
189 g_fs->set_home_file_system(home.release());189 g_fs->set_home_file_system(home.release());
190 } catch (const std::exception & e) {190 } catch (const std::exception & e) {
@@ -232,40 +232,40 @@
232 * \param argv Array of command line arguments232 * \param argv Array of command line arguments
233 */233 */
234WLApplication::WLApplication(int const argc, char const * const * const argv) :234WLApplication::WLApplication(int const argc, char const * const * const argv) :
235m_commandline (std::map<std::string, std::string>()),235commandline_ (std::map<std::string, std::string>()),
236m_game_type (NONE),236game_type_ (NONE),
237m_mouse_swapped (false),237mouse_swapped_ (false),
238m_faking_middle_mouse_button(false),238faking_middle_mouse_button_(false),
239m_mouse_position (0, 0),239mouse_position_ (0, 0),
240m_mouse_locked (0),240mouse_locked_ (0),
241m_mouse_compensate_warp(0, 0),241mouse_compensate_warp_(0, 0),
242m_should_die (false),242should_die_ (false),
243#ifdef _WIN32243#ifdef _WIN32
244m_homedir(FileSystem::get_homedir() + "\\.widelands"),244homedir_(FileSystem::get_homedir() + "\\.widelands"),
245#else245#else
246m_homedir(FileSystem::get_homedir() + "/.widelands"),246homedir_(FileSystem::get_homedir() + "/.widelands"),
247#endif247#endif
248m_redirected_stdio(false)248redirected_stdio_(false)
249{249{
250 g_fs = new LayeredFileSystem();250 g_fs = new LayeredFileSystem();
251251
252 parse_commandline(argc, argv); //throws ParameterError, handled by main.cc252 parse_commandline(argc, argv); //throws ParameterError, handled by main.cc
253253
254 if (m_commandline.count("homedir")) {254 if (commandline_.count("homedir")) {
255 log ("Adding home directory: %s\n", m_commandline["homedir"].c_str());255 log ("Adding home directory: %s\n", commandline_["homedir"].c_str());
256 m_homedir = m_commandline["homedir"];256 homedir_ = commandline_["homedir"];
257 m_commandline.erase("homedir");257 commandline_.erase("homedir");
258 }258 }
259#ifdef REDIRECT_OUTPUT259#ifdef REDIRECT_OUTPUT
260 if (!redirect_output())260 if (!redirect_output())
261 redirect_output(m_homedir);261 redirect_output(homedir_);
262#endif262#endif
263263
264 setup_homedir();264 setup_homedir();
265 init_settings();265 init_settings();
266266
267 log("Adding directory: %s\n", m_datadir.c_str());267 log("Adding directory: %s\n", datadir_.c_str());
268 g_fs->add_file_system(&FileSystem::create(m_datadir));268 g_fs->add_file_system(&FileSystem::create(datadir_));
269269
270 init_language(); // search paths must already be set up270 init_language(); // search paths must already be set up
271 changedir_on_mac();271 changedir_on_mac();
@@ -334,7 +334,7 @@
334 delete g_fs;334 delete g_fs;
335 g_fs = nullptr;335 g_fs = nullptr;
336336
337 if (m_redirected_stdio)337 if (redirected_stdio_)
338 {338 {
339 std::cout.flush();339 std::cout.flush();
340 fclose(stdout);340 fclose(stdout);
@@ -356,15 +356,15 @@
356 // This also grabs the mouse cursor if so desired.356 // This also grabs the mouse cursor if so desired.
357 refresh_graphics();357 refresh_graphics();
358358
359 if (m_game_type == EDITOR) {359 if (game_type_ == EDITOR) {
360 g_sound_handler.start_music("ingame");360 g_sound_handler.start_music("ingame");
361 EditorInteractive::run_editor(m_filename, m_script_to_run);361 EditorInteractive::run_editor(filename_, script_to_run_);
362 } else if (m_game_type == REPLAY) {362 } else if (game_type_ == REPLAY) {
363 replay();363 replay();
364 } else if (m_game_type == LOADGAME) {364 } else if (game_type_ == LOADGAME) {
365 Widelands::Game game;365 Widelands::Game game;
366 try {366 try {
367 game.run_load_game(m_filename.c_str(), m_script_to_run);367 game.run_load_game(filename_.c_str(), script_to_run_);
368 } catch (const Widelands::GameDataError & e) {368 } catch (const Widelands::GameDataError & e) {
369 log("Game not loaded: Game data error: %s\n", e.what());369 log("Game not loaded: Game data error: %s\n", e.what());
370 } catch (const std::exception & e) {370 } catch (const std::exception & e) {
@@ -372,10 +372,10 @@
372 emergency_save(game);372 emergency_save(game);
373 throw;373 throw;
374 }374 }
375 } else if (m_game_type == SCENARIO) {375 } else if (game_type_ == SCENARIO) {
376 Widelands::Game game;376 Widelands::Game game;
377 try {377 try {
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_);
379 } catch (const Widelands::GameDataError & e) {379 } catch (const Widelands::GameDataError & e) {
380 log("Scenario not started: Game data error: %s\n", e.what());380 log("Scenario not started: Game data error: %s\n", e.what());
381 } catch (const std::exception & e) {381 } catch (const std::exception & e) {
@@ -383,7 +383,7 @@
383 emergency_save(game);383 emergency_save(game);
384 throw;384 throw;
385 }385 }
386 } else if (m_game_type == INTERNET) {386 } else if (game_type_ == INTERNET) {
387 Widelands::Game game;387 Widelands::Game game;
388 try {388 try {
389 // disable sound completely389 // disable sound completely
@@ -421,13 +421,13 @@
421421
422 // Load the requested map422 // Load the requested map
423 Widelands::Map map;423 Widelands::Map map;
424 map.set_filename(m_filename);424 map.set_filename(filename_);
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_);
426 if (!ml) {426 if (!ml) {
427 throw WLWarning427 throw WLWarning
428 ("Unsupported format",428 ("Unsupported format",
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.",
430 m_filename.c_str());430 filename_.c_str());
431 }431 }
432 ml->preload_map(true);432 ml->preload_map(true);
433433
@@ -479,15 +479,15 @@
479 // settings are invisible to the rest of the code479 // settings are invisible to the rest of the code
480 switch (ev.type) {480 switch (ev.type) {
481 case SDL_MOUSEMOTION:481 case SDL_MOUSEMOTION:
482 ev.motion.xrel += m_mouse_compensate_warp.x;482 ev.motion.xrel += mouse_compensate_warp_.x;
483 ev.motion.yrel += m_mouse_compensate_warp.y;483 ev.motion.yrel += mouse_compensate_warp_.y;
484 m_mouse_compensate_warp = Point(0, 0);484 mouse_compensate_warp_ = Point(0, 0);
485485
486 if (m_mouse_locked) {486 if (mouse_locked_) {
487 warp_mouse(m_mouse_position);487 warp_mouse(mouse_position_);
488488
489 ev.motion.x = m_mouse_position.x;489 ev.motion.x = mouse_position_.x;
490 ev.motion.y = m_mouse_position.y;490 ev.motion.y = mouse_position_.y;
491 }491 }
492 break;492 break;
493493
@@ -509,7 +509,7 @@
509 case SDLK_F10:509 case SDLK_F10:
510 // exits the game.510 // exits the game.
511 if (ctrl) {511 if (ctrl) {
512 m_should_die = true;512 should_die_ = true;
513 }513 }
514 return true;514 return true;
515515
@@ -579,7 +579,7 @@
579 }579 }
580 break;580 break;
581 case SDL_MOUSEMOTION:581 case SDL_MOUSEMOTION:
582 m_mouse_position = Point(ev.motion.x, ev.motion.y);582 mouse_position_ = Point(ev.motion.x, ev.motion.y);
583583
584 if ((ev.motion.xrel || ev.motion.yrel) && cb && cb->mouse_move)584 if ((ev.motion.xrel || ev.motion.yrel) && cb && cb->mouse_move)
585 cb->mouse_move585 cb->mouse_move
@@ -588,7 +588,7 @@
588 ev.motion.xrel, ev.motion.yrel);588 ev.motion.xrel, ev.motion.yrel);
589 break;589 break;
590 case SDL_QUIT:590 case SDL_QUIT:
591 m_should_die = true;591 should_die_ = true;
592 break;592 break;
593 default:;593 default:;
594 }594 }
@@ -601,7 +601,7 @@
601void WLApplication::_handle_mousebutton601void WLApplication::_handle_mousebutton
602 (SDL_Event & ev, InputCallback const * cb)602 (SDL_Event & ev, InputCallback const * cb)
603{603{
604 if (m_mouse_swapped) {604 if (mouse_swapped_) {
605 switch (ev.button.button) {605 switch (ev.button.button) {
606 case SDL_BUTTON_LEFT:606 case SDL_BUTTON_LEFT:
607 ev.button.button = SDL_BUTTON_RIGHT;607 ev.button.button = SDL_BUTTON_RIGHT;
@@ -625,7 +625,7 @@
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)))
626 {626 {
627 ev.button.button = SDL_BUTTON_LEFT;627 ev.button.button = SDL_BUTTON_LEFT;
628 m_faking_middle_mouse_button = true;628 faking_middle_mouse_button_ = true;
629 }629 }
630#endif630#endif
631631
@@ -633,9 +633,9 @@
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);
634 else if (ev.type == SDL_MOUSEBUTTONUP) {634 else if (ev.type == SDL_MOUSEBUTTONUP) {
635 if (cb && cb->mouse_release) {635 if (cb && cb->mouse_release) {
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_) {
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);
638 m_faking_middle_mouse_button = false;638 faking_middle_mouse_button_ = false;
639 }639 }
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);
641 }641 }
@@ -646,18 +646,18 @@
646/// Instantaneously move the mouse cursor without creating a motion event.646/// Instantaneously move the mouse cursor without creating a motion event.
647///647///
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.
649/// As a workaround, we store the delta in m_mouse_compensate_warp and use that to649/// As a workaround, we store the delta in mouse_compensate_warp_ and use that to
650/// eliminate the motion event in poll_event()650/// eliminate the motion event in poll_event()
651///651///
652/// \param position The new mouse position652/// \param position The new mouse position
653void WLApplication::warp_mouse(const Point position)653void WLApplication::warp_mouse(const Point position)
654{654{
655 m_mouse_position = position;655 mouse_position_ = position;
656656
657 Point cur_position;657 Point cur_position;
658 SDL_GetMouseState(&cur_position.x, &cur_position.y);658 SDL_GetMouseState(&cur_position.x, &cur_position.y);
659 if (cur_position != position) {659 if (cur_position != position) {
660 m_mouse_compensate_warp += cur_position - position;660 mouse_compensate_warp_ += cur_position - position;
661 SDL_Window* sdl_window = g_gr->get_sdlwindow();661 SDL_Window* sdl_window = g_gr->get_sdlwindow();
662 if (sdl_window) {662 if (sdl_window) {
663 SDL_WarpMouseInWindow(sdl_window, position.x, position.y);663 SDL_WarpMouseInWindow(sdl_window, position.x, position.y);
@@ -688,7 +688,7 @@
688 if (sdl_window) {688 if (sdl_window) {
689 SDL_SetWindowGrab(sdl_window, SDL_FALSE);689 SDL_SetWindowGrab(sdl_window, SDL_FALSE);
690 }690 }
691 warp_mouse(m_mouse_position); //TODO(unknown): is this redundant?691 warp_mouse(mouse_position_); //TODO(unknown): is this redundant?
692 }692 }
693}693}
694694
@@ -767,7 +767,7 @@
767 // Initialize locale and grab "widelands" textdomain767 // Initialize locale and grab "widelands" textdomain
768 i18n::init_locale();768 i18n::init_locale();
769769
770 i18n::set_localedir(m_datadir + "/locale");770 i18n::set_localedir(datadir_ + "/locale");
771 i18n::grab_textdomain("widelands");771 i18n::grab_textdomain("widelands");
772772
773 // Set locale corresponding to selected language773 // Set locale corresponding to selected language
@@ -852,12 +852,12 @@
852 opt.erase(pos, opt.size() - pos);852 opt.erase(pos, opt.size() - pos);
853 }853 }
854854
855 m_commandline[opt] = value;855 commandline_[opt] = value;
856 }856 }
857}857}
858858
859/**859/**
860 * Parse the command line given in m_commandline860 * Parse the command line given in commandline_
861 *861 *
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"
863 * was given,863 * was given,
@@ -865,105 +865,105 @@
865*/865*/
866void WLApplication::handle_commandline_parameters()866void WLApplication::handle_commandline_parameters()
867{867{
868 if (m_commandline.count("logfile")) {868 if (commandline_.count("logfile")) {
869 m_logfile = m_commandline["logfile"];869 logfile_ = commandline_["logfile"];
870 std::cerr << "Redirecting log target to: " << m_logfile << std::endl;870 std::cerr << "Redirecting log target to: " << logfile_ << std::endl;
871 if (m_logfile.size() != 0) {871 if (logfile_.size() != 0) {
872 //TODO(unknown): (very small) memory leak of 1 ofstream;872 //TODO(unknown): (very small) memory leak of 1 ofstream;
873 //swaw the buffers (internally) of the file and wout873 //swaw the buffers (internally) of the file and wout
874 std::ofstream * widelands_out = new std::ofstream(m_logfile.c_str());874 std::ofstream * widelands_out = new std::ofstream(logfile_.c_str());
875 std::streambuf * logbuf = widelands_out->rdbuf();875 std::streambuf * logbuf = widelands_out->rdbuf();
876 wout.rdbuf(logbuf);876 wout.rdbuf(logbuf);
877 }877 }
878 m_commandline.erase("logfile");878 commandline_.erase("logfile");
879 }879 }
880 if (m_commandline.count("nosound")) {880 if (commandline_.count("nosound")) {
881 g_sound_handler.nosound_ = true;881 g_sound_handler.nosound_ = true;
882 m_commandline.erase("nosound");882 commandline_.erase("nosound");
883 }883 }
884 if (m_commandline.count("nozip")) {884 if (commandline_.count("nozip")) {
885 g_options.pull_section("global").create_val("nozip", "true");885 g_options.pull_section("global").create_val("nozip", "true");
886 m_commandline.erase("nozip");886 commandline_.erase("nozip");
887 }887 }
888888
889 if (m_commandline.count("datadir")) {889 if (commandline_.count("datadir")) {
890 m_datadir = m_commandline["datadir"];890 datadir_ = commandline_["datadir"];
891 m_commandline.erase("datadir");891 commandline_.erase("datadir");
892 } else {892 } else {
893 m_datadir = is_absolute_path(INSTALL_DATADIR) ?893 datadir_ = is_absolute_path(INSTALL_DATADIR) ?
894 INSTALL_DATADIR :894 INSTALL_DATADIR :
895 get_executable_directory() + INSTALL_DATADIR;895 get_executable_directory() + INSTALL_DATADIR;
896 }896 }
897 if (!is_absolute_path(m_datadir)) {897 if (!is_absolute_path(datadir_)) {
898 m_datadir = absolute_path_if_not_windows(FileSystem::get_working_directory() +898 datadir_ = absolute_path_if_not_windows(FileSystem::get_working_directory() +
899 FileSystem::file_separator() + m_datadir);899 FileSystem::file_separator() + datadir_);
900 }900 }
901901
902 if (m_commandline.count("verbose")) {902 if (commandline_.count("verbose")) {
903 g_verbose = true;903 g_verbose = true;
904904
905 m_commandline.erase("verbose");905 commandline_.erase("verbose");
906 }906 }
907907
908 if (m_commandline.count("editor")) {908 if (commandline_.count("editor")) {
909 m_filename = m_commandline["editor"];909 filename_ = commandline_["editor"];
910 if (m_filename.size() && *m_filename.rbegin() == '/')910 if (filename_.size() && *filename_.rbegin() == '/')
911 m_filename.erase(m_filename.size() - 1);911 filename_.erase(filename_.size() - 1);
912 m_game_type = EDITOR;912 game_type_ = EDITOR;
913 m_commandline.erase("editor");913 commandline_.erase("editor");
914 }914 }
915915
916 if (m_commandline.count("replay")) {916 if (commandline_.count("replay")) {
917 if (m_game_type != NONE)917 if (game_type_ != NONE)
918 throw wexception("replay can not be combined with other actions");918 throw wexception("replay can not be combined with other actions");
919 m_filename = m_commandline["replay"];919 filename_ = commandline_["replay"];
920 if (m_filename.size() && *m_filename.rbegin() == '/')920 if (filename_.size() && *filename_.rbegin() == '/')
921 m_filename.erase(m_filename.size() - 1);921 filename_.erase(filename_.size() - 1);
922 m_game_type = REPLAY;922 game_type_ = REPLAY;
923 m_commandline.erase("replay");923 commandline_.erase("replay");
924 }924 }
925925
926 if (m_commandline.count("loadgame")) {926 if (commandline_.count("loadgame")) {
927 if (m_game_type != NONE)927 if (game_type_ != NONE)
928 throw wexception("loadgame can not be combined with other actions");928 throw wexception("loadgame can not be combined with other actions");
929 m_filename = m_commandline["loadgame"];929 filename_ = commandline_["loadgame"];
930 if (m_filename.empty())930 if (filename_.empty())
931 throw wexception("empty value of command line parameter --loadgame");931 throw wexception("empty value of command line parameter --loadgame");
932 if (*m_filename.rbegin() == '/')932 if (*filename_.rbegin() == '/')
933 m_filename.erase(m_filename.size() - 1);933 filename_.erase(filename_.size() - 1);
934 m_game_type = LOADGAME;934 game_type_ = LOADGAME;
935 m_commandline.erase("loadgame");935 commandline_.erase("loadgame");
936 }936 }
937937
938 if (m_commandline.count("scenario")) {938 if (commandline_.count("scenario")) {
939 if (m_game_type != NONE)939 if (game_type_ != NONE)
940 throw wexception("scenario can not be combined with other actions");940 throw wexception("scenario can not be combined with other actions");
941 m_filename = m_commandline["scenario"];941 filename_ = commandline_["scenario"];
942 if (m_filename.empty())942 if (filename_.empty())
943 throw wexception("empty value of command line parameter --scenario");943 throw wexception("empty value of command line parameter --scenario");
944 if (*m_filename.rbegin() == '/')944 if (*filename_.rbegin() == '/')
945 m_filename.erase(m_filename.size() - 1);945 filename_.erase(filename_.size() - 1);
946 m_game_type = SCENARIO;946 game_type_ = SCENARIO;
947 m_commandline.erase("scenario");947 commandline_.erase("scenario");
948 }948 }
949 if (m_commandline.count("dedicated")) {949 if (commandline_.count("dedicated")) {
950 if (m_game_type != NONE)950 if (game_type_ != NONE)
951 throw wexception("dedicated can not be combined with other actions");951 throw wexception("dedicated can not be combined with other actions");
952 m_filename = m_commandline["dedicated"];952 filename_ = commandline_["dedicated"];
953 if (m_filename.empty())953 if (filename_.empty())
954 throw wexception("empty value of commandline parameter --dedicated");954 throw wexception("empty value of commandline parameter --dedicated");
955 if (*m_filename.rbegin() == '/')955 if (*filename_.rbegin() == '/')
956 m_filename.erase(m_filename.size() - 1);956 filename_.erase(filename_.size() - 1);
957 m_game_type = INTERNET;957 game_type_ = INTERNET;
958 m_commandline.erase("dedicated");958 commandline_.erase("dedicated");
959 }959 }
960 if (m_commandline.count("script")) {960 if (commandline_.count("script")) {
961 m_script_to_run = m_commandline["script"];961 script_to_run_ = commandline_["script"];
962 if (m_script_to_run.empty())962 if (script_to_run_.empty())
963 throw wexception("empty value of command line parameter --script");963 throw wexception("empty value of command line parameter --script");
964 if (*m_script_to_run.rbegin() == '/')964 if (*script_to_run_.rbegin() == '/')
965 m_script_to_run.erase(m_script_to_run.size() - 1);965 script_to_run_.erase(script_to_run_.size() - 1);
966 m_commandline.erase("script");966 commandline_.erase("script");
967 }967 }
968968
969 //If it hasn't been handled yet it's probably an attempt to969 //If it hasn't been handled yet it's probably an attempt to
@@ -972,10 +972,10 @@
972 //will be taken care of (==ignored) when saving the options972 //will be taken care of (==ignored) when saving the options
973973
974 const std::map<std::string, std::string>::const_iterator commandline_end =974 const std::map<std::string, std::string>::const_iterator commandline_end =
975 m_commandline.end();975 commandline_.end();
976 for976 for
977 (std::map<std::string, std::string>::const_iterator it =977 (std::map<std::string, std::string>::const_iterator it =
978 m_commandline.begin();978 commandline_.begin();
979 it != commandline_end;979 it != commandline_end;
980 ++it)980 ++it)
981 {981 {
@@ -986,7 +986,7 @@
986 (it->first.c_str(), it->second.c_str());986 (it->first.c_str(), it->second.c_str());
987 }987 }
988988
989 if (m_commandline.count("help") || m_commandline.count("version")) {989 if (commandline_.count("help") || commandline_.count("version")) {
990 init_language();990 init_language();
991 throw ParameterError(); //no message on purpose991 throw ParameterError(); //no message on purpose
992 }992 }
@@ -1057,7 +1057,7 @@
1057 break;1057 break;
1058 }1058 }
1059 case FullscreenMenuBase::MenuTarget::kEditor:1059 case FullscreenMenuBase::MenuTarget::kEditor:
1060 EditorInteractive::run_editor(m_filename, m_script_to_run);1060 EditorInteractive::run_editor(filename_, script_to_run_);
1061 break;1061 break;
1062 default:1062 default:
1063 case FullscreenMenuBase::MenuTarget::kExit:1063 case FullscreenMenuBase::MenuTarget::kExit:
@@ -1376,13 +1376,13 @@
1376void WLApplication::replay()1376void WLApplication::replay()
1377{1377{
1378 Widelands::Game game;1378 Widelands::Game game;
1379 if (m_filename.empty()) {1379 if (filename_.empty()) {
1380 SinglePlayerGameSettingsProvider sp;1380 SinglePlayerGameSettingsProvider sp;
1381 FullscreenMenuLoadGame rm(game, &sp, nullptr, true);1381 FullscreenMenuLoadGame rm(game, &sp, nullptr, true);
1382 if (rm.run<FullscreenMenuBase::MenuTarget>() == FullscreenMenuBase::MenuTarget::kBack)1382 if (rm.run<FullscreenMenuBase::MenuTarget>() == FullscreenMenuBase::MenuTarget::kBack)
1383 return;1383 return;
13841384
1385 m_filename = rm.filename();1385 filename_ = rm.filename();
1386 }1386 }
13871387
1388 try {1388 try {
@@ -1396,7 +1396,7 @@
1396 game.set_ibase1396 game.set_ibase
1397 (new InteractiveSpectator(game, g_options.pull_section("global")));1397 (new InteractiveSpectator(game, g_options.pull_section("global")));
1398 game.set_write_replay(false);1398 game.set_write_replay(false);
1399 ReplayGameController rgc(game, m_filename);1399 ReplayGameController rgc(game, filename_);
14001400
1401 game.save_handler().set_allow_saving(false);1401 game.save_handler().set_allow_saving(false);
14021402
@@ -1404,10 +1404,10 @@
1404 } catch (const std::exception & e) {1404 } catch (const std::exception & e) {
1405 log("Fatal Exception: %s\n", e.what());1405 log("Fatal Exception: %s\n", e.what());
1406 emergency_save(game);1406 emergency_save(game);
1407 m_filename.clear();1407 filename_.clear();
1408 throw;1408 throw;
1409 }1409 }
1410 m_filename.clear();1410 filename_.clear();
1411}1411}
14121412
14131413
@@ -1483,7 +1483,7 @@
1483 memset(&tfile, 0, sizeof(tm));1483 memset(&tfile, 0, sizeof(tm));
14841484
1485 tfile.tm_mday = atoi(timestr.substr(8, 2).c_str());1485 tfile.tm_mday = atoi(timestr.substr(8, 2).c_str());
1486 tfile.tm_mon = atoi(timestr.substr(5, 2).c_str()) - 1;1486 tfile.tm_mon = atoi(timestr.substr(5, 2).c_str()) - 1;
1487 tfile.tm_year = atoi(timestr.substr(0, 4).c_str()) - 1900;1487 tfile.tm_year = atoi(timestr.substr(0, 4).c_str()) - 1900;
14881488
1489 double tdiff = std::difftime(tnow, mktime(&tfile)) / 86400;1489 double tdiff = std::difftime(tnow, mktime(&tfile)) / 86400;
@@ -1527,6 +1527,6 @@
1527 /* No buffering */1527 /* No buffering */
1528 setbuf(stderr, nullptr);1528 setbuf(stderr, nullptr);
15291529
1530 m_redirected_stdio = true;1530 redirected_stdio_ = true;
1531 return true;1531 return true;
1532}1532}
15331533
=== modified file 'src/wlapplication.h'
--- src/wlapplication.h 2016-01-09 15:27:05 +0000
+++ src/wlapplication.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2006-2012, 2015 by the Widelands Development Team2 * Copyright (C) 2006-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -140,7 +140,7 @@
140 void run();140 void run();
141141
142 /// \warning true if an external entity wants us to quit142 /// \warning true if an external entity wants us to quit
143 bool should_die() const {return m_should_die;}143 bool should_die() const {return should_die_;}
144144
145 /// Get the state of the current KeyBoard Button145 /// Get the state of the current KeyBoard Button
146 /// \warning This function doesn't check for dumbness146 /// \warning This function doesn't check for dumbness
@@ -151,16 +151,16 @@
151 void set_input_grab(bool grab);151 void set_input_grab(bool grab);
152152
153 /// The mouse's current coordinates153 /// The mouse's current coordinates
154 Point get_mouse_position() const {return m_mouse_position;}154 Point get_mouse_position() const {return mouse_position_;}
155 //155 //
156 /// Find out whether the mouse is currently pressed156 /// Find out whether the mouse is currently pressed
157 bool is_mouse_pressed() const {return SDL_GetMouseState(nullptr, nullptr); }157 bool is_mouse_pressed() const {return SDL_GetMouseState(nullptr, nullptr); }
158158
159 /// Swap left and right mouse key?159 /// Swap left and right mouse key?
160 void set_mouse_swap(const bool swap) {m_mouse_swapped = swap;}160 void set_mouse_swap(const bool swap) {mouse_swapped_ = swap;}
161161
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)
163 void set_mouse_lock(const bool locked) {m_mouse_locked = locked;}163 void set_mouse_lock(const bool locked) {mouse_locked_ = locked;}
164 //@}164 //@}
165165
166166
@@ -209,47 +209,47 @@
209 /**209 /**
210 * The commandline, conveniently repackaged.210 * The commandline, conveniently repackaged.
211 */211 */
212 std::map<std::string, std::string> m_commandline;212 std::map<std::string, std::string> commandline_;
213213
214 std::string m_filename;214 std::string filename_;
215215
216 /// Script to be run after the game was started with --editor,216 /// Script to be run after the game was started with --editor,
217 /// --scenario or --loadgame.217 /// --scenario or --loadgame.
218 std::string m_script_to_run;218 std::string script_to_run_;
219219
220 //Log all output to this file if set, otherwise use cout220 //Log all output to this file if set, otherwise use cout
221 std::string m_logfile;221 std::string logfile_;
222222
223 GameType m_game_type;223 GameType game_type_;
224224
225 ///True if left and right mouse button should be swapped225 ///True if left and right mouse button should be swapped
226 bool m_mouse_swapped;226 bool mouse_swapped_;
227227
228 /// When apple is involved, the middle mouse button is sometimes send, even228 /// When apple is involved, the middle mouse button is sometimes send, even
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.
230 bool m_faking_middle_mouse_button;230 bool faking_middle_mouse_button_;
231231
232 ///The current position of the mouse pointer232 ///The current position of the mouse pointer
233 Point m_mouse_position;233 Point mouse_position_;
234234
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:
236 ///instead, the map will be scrolled236 ///instead, the map will be scrolled
237 bool m_mouse_locked;237 bool mouse_locked_;
238238
239 ///If the mouse needs to be moved in warp_mouse(), this Point is239 ///If the mouse needs to be moved in warp_mouse(), this Point is
240 ///used to cancel the resulting SDL_MouseMotionEvent.240 ///used to cancel the resulting SDL_MouseMotionEvent.
241 Point m_mouse_compensate_warp;241 Point mouse_compensate_warp_;
242242
243 ///true if an external entity wants us to quit243 ///true if an external entity wants us to quit
244 bool m_should_die;244 bool should_die_;
245245
246 std::string m_homedir;246 std::string homedir_;
247247
248 /// flag indicating if stdout and stderr have been redirected248 /// flag indicating if stdout and stderr have been redirected
249 bool m_redirected_stdio;249 bool redirected_stdio_;
250250
251 /// Absolute path to the data directory.251 /// Absolute path to the data directory.
252 std::string m_datadir;252 std::string datadir_;
253253
254 ///Holds this process' one and only instance of WLApplication, if it was254 ///Holds this process' one and only instance of WLApplication, if it was
255 ///created already. nullptr otherwise.255 ///created already. nullptr otherwise.
256256
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc 2016-01-10 11:36:05 +0000
+++ src/wui/buildingwindow.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -55,27 +55,27 @@
55 (&parent, "building_window",55 (&parent, "building_window",
56 0, 0, Width, 0,56 0, 0, Width, 0,
57 b.descr().descname()),57 b.descr().descname()),
58 m_registry(registry),58 registry_(registry),
59 m_building (b),59 building_ (b),
60 m_workarea_overlay_id(0),60 workarea_overlay_id_(0),
61 m_avoid_fastclick(false)61 avoid_fastclick_(false)
62{62{
63 delete m_registry;63 delete registry_;
64 m_registry = this;64 registry_ = this;
6565
66 m_capscache_player_number = 0;66 capscache_player_number_ = 0;
67 m_capsbuttons = nullptr;67 capsbuttons_ = nullptr;
68 m_capscache = 0;68 capscache_ = 0;
69 m_caps_setup = false;69 caps_setup_ = false;
70 m_toggle_workarea = nullptr;70 toggle_workarea_ = nullptr;
7171
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);
7373
74 m_tabs = new UI::TabPanel(vbox, 0, 0, nullptr);74 tabs_ = new UI::TabPanel(vbox, 0, 0, nullptr);
75 vbox->add(m_tabs, UI::Box::AlignLeft, true);75 vbox->add(tabs_, UI::Box::AlignLeft, true);
7676
77 m_capsbuttons = new UI::Box(vbox, 0, 0, UI::Box::Horizontal);77 capsbuttons_ = new UI::Box(vbox, 0, 0, UI::Box::Horizontal);
78 vbox->add(m_capsbuttons, UI::Box::AlignLeft, true);78 vbox->add(capsbuttons_, UI::Box::AlignLeft, true);
79 // actually create buttons on the first call to think(),79 // actually create buttons on the first call to think(),
80 // so that overriding create_capsbuttons() works80 // so that overriding create_capsbuttons() works
8181
@@ -86,7 +86,7 @@
86 show_workarea();86 show_workarea();
8787
88 // Title for construction site88 // Title for construction site
89 if (upcast(Widelands::ConstructionSite, csite, &m_building)) {89 if (upcast(Widelands::ConstructionSite, csite, &building_)) {
90 // Show name in parenthesis as it may take all width already90 // Show name in parenthesis as it may take all width already
91 const std::string title = (boost::format("(%s)") % csite->building().descname()).str();91 const std::string title = (boost::format("(%s)") % csite->building().descname()).str();
92 set_title(title);92 set_title(title);
@@ -96,10 +96,10 @@
9696
97BuildingWindow::~BuildingWindow()97BuildingWindow::~BuildingWindow()
98{98{
99 if (m_workarea_overlay_id) {99 if (workarea_overlay_id_) {
100 igbase().mutable_field_overlay_manager()->remove_overlay(m_workarea_overlay_id);100 igbase().mutable_field_overlay_manager()->remove_overlay(workarea_overlay_id_);
101 }101 }
102 m_registry = nullptr;102 registry_ = nullptr;
103}103}
104104
105namespace Widelands {class BuildingDescr;}105namespace Widelands {class BuildingDescr;}
@@ -138,18 +138,18 @@
138 die();138 die();
139139
140 if140 if
141 (!m_caps_setup141 (!caps_setup_
142 ||142 ||
143 m_capscache_player_number != igbase().player_number()143 capscache_player_number_ != igbase().player_number()
144 ||144 ||
145 building().get_playercaps() != m_capscache)145 building().get_playercaps() != capscache_)
146 {146 {
147 m_capsbuttons->free_children();147 capsbuttons_->free_children();
148 create_capsbuttons(m_capsbuttons);148 create_capsbuttons(capsbuttons_);
149 move_out_of_the_way();149 move_out_of_the_way();
150 if (!m_avoid_fastclick)150 if (!avoid_fastclick_)
151 warp_mouse_to_fastclick_panel();151 warp_mouse_to_fastclick_panel();
152 m_caps_setup = true;152 caps_setup_ = true;
153 }153 }
154154
155155
@@ -165,8 +165,8 @@
165 */165 */
166void BuildingWindow::create_capsbuttons(UI::Box * capsbuttons)166void BuildingWindow::create_capsbuttons(UI::Box * capsbuttons)
167{167{
168 m_capscache = building().get_playercaps();168 capscache_ = building().get_playercaps();
169 m_capscache_player_number = igbase().player_number();169 capscache_player_number_ = igbase().player_number();
170170
171 const Widelands::Player & owner = building().owner();171 const Widelands::Player & owner = building().owner();
172 const Widelands::PlayerNumber owner_number = owner.player_number();172 const Widelands::PlayerNumber owner_number = owner.player_number();
@@ -176,7 +176,7 @@
176 bool requires_destruction_separator = false;176 bool requires_destruction_separator = false;
177 if (can_act) {177 if (can_act) {
178 // Check if this is a port building and if yes show expedition button178 // Check if this is a port building and if yes show expedition button
179 if (upcast(Widelands::Warehouse const, warehouse, &m_building)) {179 if (upcast(Widelands::Warehouse const, warehouse, &building_)) {
180 if (Widelands::PortDock * pd = warehouse->get_portdock()) {180 if (Widelands::PortDock * pd = warehouse->get_portdock()) {
181 if (pd->expedition_started()) {181 if (pd->expedition_started()) {
182 UI::Button * expeditionbtn =182 UI::Button * expeditionbtn =
@@ -202,7 +202,7 @@
202 }202 }
203 }203 }
204 else204 else
205 if (upcast(const Widelands::ProductionSite, productionsite, &m_building)) {205 if (upcast(const Widelands::ProductionSite, productionsite, &building_)) {
206 if (!is_a(Widelands::MilitarySite, productionsite)) {206 if (!is_a(Widelands::MilitarySite, productionsite)) {
207 const bool is_stopped = productionsite->is_stopped();207 const bool is_stopped = productionsite->is_stopped();
208 UI::Button * stopbtn =208 UI::Button * stopbtn =
@@ -227,9 +227,9 @@
227 }227 }
228 } // upcast to productionsite228 } // upcast to productionsite
229229
230 if (m_capscache & Widelands::Building::PCap_Enhancable) {230 if (capscache_ & Widelands::Building::PCap_Enhancable) {
231 const Widelands::DescriptionIndex & enhancement =231 const Widelands::DescriptionIndex & enhancement =
232 m_building.descr().enhancement();232 building_.descr().enhancement();
233 const Widelands::TribeDescr & tribe = owner.tribe();233 const Widelands::TribeDescr & tribe = owner.tribe();
234 if (owner.is_building_type_allowed(enhancement)) {234 if (owner.is_building_type_allowed(enhancement)) {
235 const Widelands::BuildingDescr & building_descr =235 const Widelands::BuildingDescr & building_descr =
@@ -256,7 +256,7 @@
256 }256 }
257 }257 }
258258
259 if (m_capscache & Widelands::Building::PCap_Bulldoze) {259 if (capscache_ & Widelands::Building::PCap_Bulldoze) {
260 UI::Button * destroybtn =260 UI::Button * destroybtn =
261 new UI::Button261 new UI::Button
262 (capsbuttons, "destroy", 0, 0, 34, 34,262 (capsbuttons, "destroy", 0, 0, 34, 34,
@@ -272,9 +272,9 @@
272 requires_destruction_separator = true;272 requires_destruction_separator = true;
273 }273 }
274274
275 if (m_capscache & Widelands::Building::PCap_Dismantle) {275 if (capscache_ & Widelands::Building::PCap_Dismantle) {
276 std::map<Widelands::DescriptionIndex, uint8_t> wares;276 std::map<Widelands::DescriptionIndex, uint8_t> wares;
277 Widelands::DismantleSite::count_returned_wares(&m_building, wares);277 Widelands::DismantleSite::count_returned_wares(&building_, wares);
278 UI::Button * dismantlebtn =278 UI::Button * dismantlebtn =
279 new UI::Button279 new UI::Button
280 (capsbuttons, "dismantle", 0, 0, 34, 34,280 (capsbuttons, "dismantle", 0, 0, 34, 34,
@@ -301,24 +301,24 @@
301301
302 if (can_see) {302 if (can_see) {
303 WorkareaInfo wa_info;303 WorkareaInfo wa_info;
304 if (upcast(Widelands::ConstructionSite, csite, &m_building)) {304 if (upcast(Widelands::ConstructionSite, csite, &building_)) {
305 wa_info = csite->building().m_workarea_info;305 wa_info = csite->building().m_workarea_info;
306 } else {306 } else {
307 wa_info = m_building.descr().m_workarea_info;307 wa_info = building_.descr().m_workarea_info;
308 }308 }
309 if (!wa_info.empty()) {309 if (!wa_info.empty()) {
310 m_toggle_workarea = new UI::Button310 toggle_workarea_ = new UI::Button
311 (capsbuttons, "workarea",311 (capsbuttons, "workarea",
312 0, 0, 34, 34,312 0, 0, 34, 34,
313 g_gr->images().get("pics/but4.png"),313 g_gr->images().get("pics/but4.png"),
314 g_gr->images().get("pics/workarea123.png"),314 g_gr->images().get("pics/workarea123.png"),
315 _("Hide work area"));315 _("Hide work area"));
316 m_toggle_workarea->sigclicked.connect316 toggle_workarea_->sigclicked.connect
317 (boost::bind(&BuildingWindow::toggle_workarea, boost::ref(*this)));317 (boost::bind(&BuildingWindow::toggle_workarea, boost::ref(*this)));
318318
319 capsbuttons->add(m_toggle_workarea, UI::Box::AlignCenter);319 capsbuttons->add(toggle_workarea_, UI::Box::AlignCenter);
320 configure_workarea_button();320 configure_workarea_button();
321 set_fastclick_panel(m_toggle_workarea);321 set_fastclick_panel(toggle_workarea_);
322 }322 }
323323
324 if (igbase().get_display_flag(InteractiveBase::dfDebug)) {324 if (igbase().get_display_flag(InteractiveBase::dfDebug)) {
@@ -358,10 +358,10 @@
358 _("Help"));358 _("Help"));
359359
360 UI::UniqueWindow::Registry& registry =360 UI::UniqueWindow::Registry& registry =
361 igbase().unique_windows().get_registry(m_building.descr().name() + "_help");361 igbase().unique_windows().get_registry(building_.descr().name() + "_help");
362 registry.open_window = [this, &registry] {362 registry.open_window = [this, &registry] {
363 new UI::BuildingHelpWindow(363 new UI::BuildingHelpWindow(
364 &igbase(), registry, m_building.descr(), m_building.owner().tribe(), &igbase().egbase().lua());364 &igbase(), registry, building_.descr(), building_.owner().tribe(), &igbase().egbase().lua());
365 };365 };
366366
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)));
@@ -377,11 +377,11 @@
377void BuildingWindow::act_bulldoze()377void BuildingWindow::act_bulldoze()
378{378{
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)) {
380 if (m_building.get_playercaps() & Widelands::Building::PCap_Bulldoze)380 if (building_.get_playercaps() & Widelands::Building::PCap_Bulldoze)
381 igbase().game().send_player_bulldoze(m_building);381 igbase().game().send_player_bulldoze(building_);
382 }382 }
383 else {383 else {
384 show_bulldoze_confirm(dynamic_cast<InteractivePlayer&>(igbase()), m_building);384 show_bulldoze_confirm(dynamic_cast<InteractivePlayer&>(igbase()), building_);
385 }385 }
386}386}
387387
@@ -393,11 +393,11 @@
393void BuildingWindow::act_dismantle()393void BuildingWindow::act_dismantle()
394{394{
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)) {
396 if (m_building.get_playercaps() & Widelands::Building::PCap_Dismantle)396 if (building_.get_playercaps() & Widelands::Building::PCap_Dismantle)
397 igbase().game().send_player_dismantle(m_building);397 igbase().game().send_player_dismantle(building_);
398 }398 }
399 else {399 else {
400 show_dismantle_confirm(dynamic_cast<InteractivePlayer&>(igbase()), m_building);400 show_dismantle_confirm(dynamic_cast<InteractivePlayer&>(igbase()), building_);
401 }401 }
402}402}
403403
@@ -407,8 +407,8 @@
407===============407===============
408*/408*/
409void BuildingWindow::act_start_stop() {409void BuildingWindow::act_start_stop() {
410 if (dynamic_cast<const Widelands::ProductionSite *>(&m_building))410 if (dynamic_cast<const Widelands::ProductionSite *>(&building_))
411 igbase().game().send_player_start_stop_building (m_building);411 igbase().game().send_player_start_stop_building (building_);
412412
413 die();413 die();
414}414}
@@ -420,9 +420,9 @@
420===============420===============
421*/421*/
422void BuildingWindow::act_start_or_cancel_expedition() {422void BuildingWindow::act_start_or_cancel_expedition() {
423 if (upcast(Widelands::Warehouse const, warehouse, &m_building))423 if (upcast(Widelands::Warehouse const, warehouse, &building_))
424 if (warehouse->get_portdock())424 if (warehouse->get_portdock())
425 igbase().game().send_player_start_or_cancel_expedition(m_building);425 igbase().game().send_player_start_or_cancel_expedition(building_);
426426
427 // No need to die here - as soon as the request is handled, the UI will get updated by the portdock427 // No need to die here - as soon as the request is handled, the UI will get updated by the portdock
428 //die();428 //die();
@@ -436,13 +436,13 @@
436void BuildingWindow::act_enhance(Widelands::DescriptionIndex id)436void BuildingWindow::act_enhance(Widelands::DescriptionIndex id)
437{437{
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)) {
439 if (m_building.get_playercaps() & Widelands::Building::PCap_Enhancable)439 if (building_.get_playercaps() & Widelands::Building::PCap_Enhancable)
440 igbase().game().send_player_enhance_building(m_building, id);440 igbase().game().send_player_enhance_building(building_, id);
441 }441 }
442 else {442 else {
443 show_enhance_confirm443 show_enhance_confirm
444 (dynamic_cast<InteractivePlayer&>(igbase()),444 (dynamic_cast<InteractivePlayer&>(igbase()),
445 m_building,445 building_,
446 id);446 id);
447 }447 }
448}448}
@@ -456,7 +456,7 @@
456{456{
457 show_field_debug457 show_field_debug
458 (igbase(),458 (igbase(),
459 igbase().game().map().get_fcoords(m_building.get_position()));459 igbase().game().map().get_fcoords(building_.get_position()));
460}460}
461461
462/**462/**
@@ -464,19 +464,19 @@
464 */464 */
465void BuildingWindow::show_workarea()465void BuildingWindow::show_workarea()
466{466{
467 if (m_workarea_overlay_id) {467 if (workarea_overlay_id_) {
468 return; // already shown, nothing to be done468 return; // already shown, nothing to be done
469 }469 }
470 WorkareaInfo workarea_info;470 WorkareaInfo workarea_info;
471 if (upcast(Widelands::ConstructionSite, csite, &m_building)) {471 if (upcast(Widelands::ConstructionSite, csite, &building_)) {
472 workarea_info = csite->building().m_workarea_info;472 workarea_info = csite->building().m_workarea_info;
473 } else {473 } else {
474 workarea_info = m_building.descr().m_workarea_info;474 workarea_info = building_.descr().m_workarea_info;
475 }475 }
476 if (workarea_info.empty()) {476 if (workarea_info.empty()) {
477 return;477 return;
478 }478 }
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());
480480
481 configure_workarea_button();481 configure_workarea_button();
482}482}
@@ -486,33 +486,33 @@
486 */486 */
487void BuildingWindow::hide_workarea()487void BuildingWindow::hide_workarea()
488{488{
489 if (m_workarea_overlay_id) {489 if (workarea_overlay_id_) {
490 igbase().hide_work_area(m_workarea_overlay_id);490 igbase().hide_work_area(workarea_overlay_id_);
491 m_workarea_overlay_id = 0;491 workarea_overlay_id_ = 0;
492492
493 configure_workarea_button();493 configure_workarea_button();
494 }494 }
495}495}
496496
497/**497/**
498 * Sets the perm_pressed state and the tooltip.498 * Sets the perpressed_ state and the tooltip.
499 */499 */
500void BuildingWindow::configure_workarea_button()500void BuildingWindow::configure_workarea_button()
501{501{
502 if (m_toggle_workarea) {502 if (toggle_workarea_) {
503 if (m_workarea_overlay_id) {503 if (workarea_overlay_id_) {
504 m_toggle_workarea->set_tooltip(_("Hide work area"));504 toggle_workarea_->set_tooltip(_("Hide work area"));
505 m_toggle_workarea->set_perm_pressed(true);505 toggle_workarea_->set_perm_pressed(true);
506 } else {506 } else {
507 m_toggle_workarea->set_tooltip(_("Show work area"));507 toggle_workarea_->set_tooltip(_("Show work area"));
508 m_toggle_workarea->set_perm_pressed(false);508 toggle_workarea_->set_perm_pressed(false);
509 }509 }
510 }510 }
511}511}
512512
513513
514void BuildingWindow::toggle_workarea() {514void BuildingWindow::toggle_workarea() {
515 if (m_workarea_overlay_id) {515 if (workarea_overlay_id_) {
516 hide_workarea();516 hide_workarea();
517 } else {517 } else {
518 show_workarea();518 show_workarea();
519519
=== modified file 'src/wui/buildingwindow.h'
--- src/wui/buildingwindow.h 2016-01-07 12:47:17 +0000
+++ src/wui/buildingwindow.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2010, 2012 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -45,7 +45,7 @@
4545
46 virtual ~BuildingWindow();46 virtual ~BuildingWindow();
4747
48 Widelands::Building & building() {return m_building;}48 Widelands::Building & building() {return building_;}
4949
50 InteractiveGameBase & igbase() const {50 InteractiveGameBase & igbase() const {
51 return dynamic_cast<InteractiveGameBase&>(*get_parent());51 return dynamic_cast<InteractiveGameBase&>(*get_parent());
@@ -53,10 +53,10 @@
5353
54 void draw(RenderTarget &) override;54 void draw(RenderTarget &) override;
55 void think() override;55 void think() override;
56 void set_avoid_fastclick(bool afc) {m_avoid_fastclick = afc;}56 void set_avoid_fastclick(bool afc) {avoid_fastclick_ = afc;}
5757
58protected:58protected:
59 UI::TabPanel * get_tabs() {return m_tabs;}59 UI::TabPanel * get_tabs() {return tabs_;}
6060
61 void act_bulldoze();61 void act_bulldoze();
62 void act_dismantle();62 void act_dismantle();
@@ -75,23 +75,23 @@
7575
76 virtual void create_capsbuttons(UI::Box * buttons);76 virtual void create_capsbuttons(UI::Box * buttons);
7777
78 UI::Window * & m_registry;78 UI::Window * & registry_;
7979
80private:80private:
81 Widelands::Building& m_building;81 Widelands::Building& building_;
8282
83 UI::TabPanel * m_tabs;83 UI::TabPanel * tabs_;
8484
85 UI::Box * m_capsbuttons; ///< \ref UI::Box that contains capabilities buttons85 UI::Box * capsbuttons_; ///< \ref UI::Box that contains capabilities buttons
86 UI::Button * m_toggle_workarea;86 UI::Button * toggle_workarea_;
8787
88 // capabilities that were last used in setting up the caps panel88 // capabilities that were last used in setting up the caps panel
89 uint32_t m_capscache;89 uint32_t capscache_;
90 Widelands::PlayerNumber m_capscache_player_number;90 Widelands::PlayerNumber capscache_player_number_;
91 bool m_caps_setup;91 bool caps_setup_;
9292
93 FieldOverlayManager::OverlayId m_workarea_overlay_id;93 FieldOverlayManager::OverlayId workarea_overlay_id_;
94 bool m_avoid_fastclick;94 bool avoid_fastclick_;
95};95};
9696
97#endif // end of include guard: WL_WUI_BUILDINGWINDOW_H97#endif // end of include guard: WL_WUI_BUILDINGWINDOW_H
9898
=== modified file 'src/wui/debugconsole.cc'
--- src/wui/debugconsole.cc 2014-09-20 09:37:47 +0000
+++ src/wui/debugconsole.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2008-2009 by the Widelands Development Team2 * Copyright (C) 2008-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -136,7 +136,7 @@
136 // This check is an evil hack to account for the singleton-nature136 // This check is an evil hack to account for the singleton-nature
137 // of the Console137 // of the Console
138 if (this != &g_console) {138 if (this != &g_console) {
139 for (const auto& command : m_commands) {139 for (const auto& command : commands_) {
140 g_console.commands.erase(command);140 g_console.commands.erase(command);
141 }141 }
142 }142 }
@@ -145,7 +145,7 @@
145void Handler::addCommand(const std::string & cmd, const HandlerFn & fun)145void Handler::addCommand(const std::string & cmd, const HandlerFn & fun)
146{146{
147 g_console.commands[cmd] = fun;147 g_console.commands[cmd] = fun;
148 m_commands.push_back(cmd);148 commands_.push_back(cmd);
149}149}
150150
151void Handler::setDefaultCommand(const HandlerFn & fun)151void Handler::setDefaultCommand(const HandlerFn & fun)
152152
=== modified file 'src/wui/debugconsole.h'
--- src/wui/debugconsole.h 2014-09-19 09:07:14 +0000
+++ src/wui/debugconsole.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2008-2010 by the Widelands Development Team2 * Copyright (C) 2008-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -60,7 +60,7 @@
60 void setDefaultCommand(const HandlerFn &);60 void setDefaultCommand(const HandlerFn &);
6161
62private:62private:
63 std::vector<std::string> m_commands;63 std::vector<std::string> commands_;
64};64};
6565
66/**66/**
6767
=== modified file 'src/wui/edge_overlay_manager.cc'
--- src/wui/edge_overlay_manager.cc 2015-03-29 18:07:45 +0000
+++ src/wui/edge_overlay_manager.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2006-2015 by the Widelands Development Team2 * Copyright (C) 2006-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -19,21 +19,21 @@
1919
20#include "wui/edge_overlay_manager.h"20#include "wui/edge_overlay_manager.h"
2121
22EdgeOverlayManager::EdgeOverlayManager() : m_current_overlay_id(0) {22EdgeOverlayManager::EdgeOverlayManager() : current_overlay_id_(0) {
23}23}
2424
25EdgeOverlayManager::OverlayId EdgeOverlayManager::next_overlay_id() {25EdgeOverlayManager::OverlayId EdgeOverlayManager::next_overlay_id() {
26 ++m_current_overlay_id;26 ++current_overlay_id_;
27 return m_current_overlay_id;27 return current_overlay_id_;
28}28}
2929
30void EdgeOverlayManager::register_overlay30void EdgeOverlayManager::register_overlay
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)
32{32{
33 const RegisteredRoadOverlays overlay = {overlay_id, where};33 const RegisteredRoadOverlays overlay = {overlay_id, where};
34 RegisteredRoadOverlaysMap::iterator it = m_overlays.find(c);34 RegisteredRoadOverlaysMap::iterator it = overlays_.find(c);
35 if (it == m_overlays.end())35 if (it == overlays_.end())
36 m_overlays.insert36 overlays_.insert
37 (std::pair<const Widelands::Coords,37 (std::pair<const Widelands::Coords,
38 RegisteredRoadOverlays>(c, overlay));38 RegisteredRoadOverlays>(c, overlay));
39 else39 else
@@ -41,25 +41,25 @@
41}41}
4242
43void EdgeOverlayManager::remove_overlay(const Widelands::Coords c) {43void EdgeOverlayManager::remove_overlay(const Widelands::Coords c) {
44 const RegisteredRoadOverlaysMap::iterator it = m_overlays.find(c);44 const RegisteredRoadOverlaysMap::iterator it = overlays_.find(c);
45 if (it != m_overlays.end())45 if (it != overlays_.end())
46 m_overlays.erase(it);46 overlays_.erase(it);
47}47}
4848
49void EdgeOverlayManager::remove_overlay(OverlayId const overlay_id) {49void EdgeOverlayManager::remove_overlay(OverlayId const overlay_id) {
50 RegisteredRoadOverlaysMap::iterator it = m_overlays.begin();50 RegisteredRoadOverlaysMap::iterator it = overlays_.begin();
51 const RegisteredRoadOverlaysMap::const_iterator end =51 const RegisteredRoadOverlaysMap::const_iterator end =
52 m_overlays.end();52 overlays_.end();
53 while (it != end)53 while (it != end)
54 if (it->second.overlay_id == overlay_id)54 if (it->second.overlay_id == overlay_id)
55 m_overlays.erase(it++); // Necessary!55 overlays_.erase(it++); // Necessary!
56 else56 else
57 ++it;57 ++it;
58}58}
5959
60uint8_t EdgeOverlayManager::get_overlay(const Widelands::Coords c) const {60uint8_t EdgeOverlayManager::get_overlay(const Widelands::Coords c) const {
61 RegisteredRoadOverlaysMap::const_iterator const it = m_overlays.find(c);61 RegisteredRoadOverlaysMap::const_iterator const it = overlays_.find(c);
62 if (it != m_overlays.end())62 if (it != overlays_.end())
63 return it->second.where;63 return it->second.where;
64 return 0;64 return 0;
65}65}
6666
=== modified file 'src/wui/edge_overlay_manager.h'
--- src/wui/edge_overlay_manager.h 2015-03-29 18:07:45 +0000
+++ src/wui/edge_overlay_manager.h 2016-01-24 20:25:45 +0000
@@ -54,8 +54,8 @@
54 using RegisteredRoadOverlaysMap =54 using RegisteredRoadOverlaysMap =
55 std::map<const Widelands::Coords, RegisteredRoadOverlays, Widelands::Coords::OrderingFunctor>;55 std::map<const Widelands::Coords, RegisteredRoadOverlays, Widelands::Coords::OrderingFunctor>;
5656
57 OverlayId m_current_overlay_id;57 OverlayId current_overlay_id_;
58 RegisteredRoadOverlaysMap m_overlays;58 RegisteredRoadOverlaysMap overlays_;
5959
60 DISALLOW_COPY_AND_ASSIGN(EdgeOverlayManager);60 DISALLOW_COPY_AND_ASSIGN(EdgeOverlayManager);
61};61};
6262
=== modified file 'src/wui/field_overlay_manager.cc'
--- src/wui/field_overlay_manager.cc 2016-01-15 19:48:47 +0000
+++ src/wui/field_overlay_manager.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2008, 2010-2011, 2013 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -26,8 +26,8 @@
26#include "graphic/graphic.h"26#include "graphic/graphic.h"
27#include "logic/field.h"27#include "logic/field.h"
2828
29FieldOverlayManager::FieldOverlayManager() : m_current_overlay_id(0) {29FieldOverlayManager::FieldOverlayManager() : current_overlay_id_(0) {
30 OverlayInfo * buildhelp_info = m_buildhelp_infos;30 OverlayInfo * buildhelp_info = buildhelp_infos_;
31 const char * filenames[] = {31 const char * filenames[] = {
32 "pics/set_flag.png",32 "pics/set_flag.png",
33 "pics/small.png",33 "pics/small.png",
@@ -55,16 +55,16 @@
55}55}
5656
57bool FieldOverlayManager::buildhelp() const {57bool FieldOverlayManager::buildhelp() const {
58 return m_buildhelp;58 return buildhelp_;
59}59}
6060
61void FieldOverlayManager::show_buildhelp(const bool value) {61void FieldOverlayManager::show_buildhelp(const bool value) {
62 m_buildhelp = value;62 buildhelp_ = value;
63}63}
6464
65void FieldOverlayManager::get_overlays(Widelands::FCoords const c,65void FieldOverlayManager::get_overlays(Widelands::FCoords const c,
66 std::vector<OverlayInfo>* result) const {66 std::vector<OverlayInfo>* result) const {
67 const RegisteredOverlaysMap & overlay_map = m_overlays[Widelands::TCoords<>::None];67 const RegisteredOverlaysMap & overlay_map = overlays_[Widelands::TCoords<>::None];
68 RegisteredOverlaysMap::const_iterator it = overlay_map.lower_bound(c);68 RegisteredOverlaysMap::const_iterator it = overlay_map.lower_bound(c);
6969
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) {
@@ -72,10 +72,10 @@
72 ++it;72 ++it;
73 }73 }
7474
75 if (m_buildhelp) {75 if (buildhelp_) {
76 int buildhelp_overlay_index = get_buildhelp_overlay(c);76 int buildhelp_overlay_index = get_buildhelp_overlay(c);
77 if (buildhelp_overlay_index < Widelands::Field::Buildhelp_None) {77 if (buildhelp_overlay_index < Widelands::Field::Buildhelp_None) {
78 result->emplace_back(m_buildhelp_infos[buildhelp_overlay_index]);78 result->emplace_back(buildhelp_infos_[buildhelp_overlay_index]);
79 }79 }
80 }80 }
8181
@@ -90,7 +90,7 @@
90 assert(c.t == Widelands::TCoords<>::D || c.t == Widelands::TCoords<>::R);90 assert(c.t == Widelands::TCoords<>::D || c.t == Widelands::TCoords<>::R);
9191
9292
93 const RegisteredOverlaysMap & overlay_map = m_overlays[c.t];93 const RegisteredOverlaysMap & overlay_map = overlays_[c.t];
94 RegisteredOverlaysMap::const_iterator it = overlay_map.lower_bound(c);94 RegisteredOverlaysMap::const_iterator it = overlay_map.lower_bound(c);
95 while (it != overlay_map.end() && it->first == c) {95 while (it != overlay_map.end() && it->first == c) {
96 result->emplace_back(it->second.pic, it->second.hotspot);96 result->emplace_back(it->second.pic, it->second.hotspot);
@@ -100,7 +100,7 @@
100100
101int FieldOverlayManager::get_buildhelp_overlay(const Widelands::FCoords& fc) const {101int FieldOverlayManager::get_buildhelp_overlay(const Widelands::FCoords& fc) const {
102 Widelands::NodeCaps const caps =102 Widelands::NodeCaps const caps =
103 m_callback ? static_cast<Widelands::NodeCaps>(m_callback(fc)) : fc.field->nodecaps();103 callback_ ? static_cast<Widelands::NodeCaps>(callback_(fc)) : fc.field->nodecaps();
104104
105 const int value = caps & Widelands::BUILDCAPS_MINE ?105 const int value = caps & Widelands::BUILDCAPS_MINE ?
106 Widelands::Field::Buildhelp_Mine :106 Widelands::Field::Buildhelp_Mine :
@@ -130,7 +130,7 @@
130 hotspot = Point(pic->width() / 2, pic->height() / 2);130 hotspot = Point(pic->width() / 2, pic->height() / 2);
131 }131 }
132132
133 RegisteredOverlaysMap & overlay_map = m_overlays[c.t];133 RegisteredOverlaysMap & overlay_map = overlays_[c.t];
134 for134 for
135 (RegisteredOverlaysMap::iterator it = overlay_map.find(c);135 (RegisteredOverlaysMap::iterator it = overlay_map.find(c);
136 it != overlay_map.end() && it->first == c;136 it != overlay_map.end() && it->first == c;
@@ -180,7 +180,7 @@
180void FieldOverlayManager::remove_overlay(Widelands::TCoords<> const c, const Image* pic) {180void FieldOverlayManager::remove_overlay(Widelands::TCoords<> const c, const Image* pic) {
181 assert(c.t <= 2);181 assert(c.t <= 2);
182182
183 RegisteredOverlaysMap & overlay_map = m_overlays[c.t];183 RegisteredOverlaysMap & overlay_map = overlays_[c.t];
184184
185 if (overlay_map.count(c)) {185 if (overlay_map.count(c)) {
186 RegisteredOverlaysMap::iterator it = overlay_map.lower_bound(c);186 RegisteredOverlaysMap::iterator it = overlay_map.lower_bound(c);
@@ -196,8 +196,8 @@
196}196}
197197
198void FieldOverlayManager::remove_overlay(const OverlayId overlay_id) {198void FieldOverlayManager::remove_overlay(const OverlayId overlay_id) {
199 const RegisteredOverlaysMap * const overlays_end = m_overlays + 3;199 const RegisteredOverlaysMap * const overlays_end = overlays_ + 3;
200 for (RegisteredOverlaysMap * j = m_overlays; j != overlays_end; ++j)200 for (RegisteredOverlaysMap * j = overlays_; j != overlays_end; ++j)
201 for (RegisteredOverlaysMap::iterator it = j->begin(); it != j->end();) {201 for (RegisteredOverlaysMap::iterator it = j->begin(); it != j->end();) {
202 it->second.overlay_ids.erase(overlay_id);202 it->second.overlay_ids.erase(overlay_id);
203 if (it->second.overlay_ids.empty())203 if (it->second.overlay_ids.empty())
@@ -208,16 +208,16 @@
208}208}
209209
210void FieldOverlayManager::remove_all_overlays() {210void FieldOverlayManager::remove_all_overlays() {
211 m_overlays[0].clear();211 overlays_[0].clear();
212 m_overlays[1].clear();212 overlays_[1].clear();
213 m_overlays[2].clear();213 overlays_[2].clear();
214}214}
215215
216void FieldOverlayManager::register_overlay_callback_function(CallbackFn function) {216void FieldOverlayManager::register_overlay_callback_function(CallbackFn function) {
217 m_callback = function;217 callback_ = function;
218}218}
219219
220FieldOverlayManager::OverlayId FieldOverlayManager::next_overlay_id() {220FieldOverlayManager::OverlayId FieldOverlayManager::next_overlay_id() {
221 ++m_current_overlay_id;221 ++current_overlay_id_;
222 return m_current_overlay_id;222 return current_overlay_id_;
223}223}
224224
=== modified file 'src/wui/field_overlay_manager.h'
--- src/wui/field_overlay_manager.h 2016-01-15 19:48:47 +0000
+++ src/wui/field_overlay_manager.h 2016-01-24 20:25:45 +0000
@@ -126,19 +126,19 @@
126 RegisteredOverlays,126 RegisteredOverlays,
127 Widelands::Coords::OrderingFunctor>;127 Widelands::Coords::OrderingFunctor>;
128128
129 // Returns the index into m_buildhelp_infos for the correct fieldcaps for129 // Returns the index into buildhelp_infos_ for the correct fieldcaps for
130 // 'fc' according to the current 'm_callback'.130 // 'fc' according to the current 'callback_'.
131 int get_buildhelp_overlay(const Widelands::FCoords& fc) const;131 int get_buildhelp_overlay(const Widelands::FCoords& fc) const;
132132
133 // indexed by TCoords<>::TriangleIndex133 // indexed by TCoords<>::TriangleIndex
134 RegisteredOverlaysMap m_overlays[3];134 RegisteredOverlaysMap overlays_[3];
135135
136 OverlayInfo m_buildhelp_infos[Widelands::Field::Buildhelp_None];136 OverlayInfo buildhelp_infos_[Widelands::Field::Buildhelp_None];
137 bool m_buildhelp;137 bool buildhelp_;
138138
139 // this callback is used to define where overlays are drawn.139 // this callback is used to define where overlays are drawn.
140 CallbackFn m_callback;140 CallbackFn callback_;
141 OverlayId m_current_overlay_id;141 OverlayId current_overlay_id_;
142};142};
143143
144#endif // end of include guard: WL_WUI_FIELD_OVERLAY_MANAGER_H144#endif // end of include guard: WL_WUI_FIELD_OVERLAY_MANAGER_H
145145
=== modified file 'src/wui/game_chat_menu.cc'
--- src/wui/game_chat_menu.cc 2014-09-20 09:37:47 +0000
+++ src/wui/game_chat_menu.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2008, 2011 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -36,17 +36,17 @@
36 const std::string & title)36 const std::string & title)
37:37:
38UI::UniqueWindow(parent, "chat", &registry, 440, 235, title),38UI::UniqueWindow(parent, "chat", &registry, 440, 235, title),
39m_chat(this, 5, 5, get_inner_w() - 10, get_inner_h() - 10, chat)39chat_(this, 5, 5, get_inner_w() - 10, get_inner_h() - 10, chat)
40{40{
41 if (get_usedefaultpos())41 if (get_usedefaultpos())
42 center_to_parent();42 center_to_parent();
4343
44 m_close_on_send = false;44 close_on_send_ = false;
4545
46 m_chat.sent.connect(boost::bind(&GameChatMenu::acknowledge, this));46 chat_.sent.connect(boost::bind(&GameChatMenu::acknowledge, this));
47 m_chat.aborted.connect(boost::bind(&GameChatMenu::acknowledge, this));47 chat_.aborted.connect(boost::bind(&GameChatMenu::acknowledge, this));
4848
49 enter_chat_message(m_close_on_send);49 enter_chat_message(close_on_send_);
50}50}
5151
52GameChatMenu* GameChatMenu::create_chat_console(52GameChatMenu* GameChatMenu::create_chat_console(
@@ -67,13 +67,13 @@
6767
68void GameChatMenu::enter_chat_message(bool close_on_send)68void GameChatMenu::enter_chat_message(bool close_on_send)
69{69{
70 m_chat.focus_edit();70 chat_.focus_edit();
71 m_close_on_send = close_on_send;71 close_on_send_ = close_on_send;
72}72}
7373
7474
75void GameChatMenu::acknowledge()75void GameChatMenu::acknowledge()
76{76{
77 if (m_close_on_send)77 if (close_on_send_)
78 die();78 die();
79}79}
8080
=== modified file 'src/wui/game_chat_menu.h'
--- src/wui/game_chat_menu.h 2014-07-05 16:41:51 +0000
+++ src/wui/game_chat_menu.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006, 2008 by the Widelands Development Team2 * Copyright (C) 2002-2016, 2008 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -50,8 +50,8 @@
50private:50private:
51 GameChatMenu(UI::Panel *, UI::UniqueWindow::Registry &, ChatProvider &, const std::string & title);51 GameChatMenu(UI::Panel *, UI::UniqueWindow::Registry &, ChatProvider &, const std::string & title);
52 void acknowledge();52 void acknowledge();
53 GameChatPanel m_chat;53 GameChatPanel chat_;
54 bool m_close_on_send;54 bool close_on_send_;
55};55};
5656
57#endif // end of include guard: WL_WUI_GAME_CHAT_MENU_H57#endif // end of include guard: WL_WUI_GAME_CHAT_MENU_H
5858
=== modified file 'src/wui/game_main_menu.cc'
--- src/wui/game_main_menu.cc 2014-10-11 09:11:29 +0000
+++ src/wui/game_main_menu.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006, 2008 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -37,8 +37,8 @@
37 InteractivePlayer::GameMainMenuWindows & windows)37 InteractivePlayer::GameMainMenuWindows & windows)
38:38:
39UI::UniqueWindow(&plr, "main_menu", &registry, 180, 55, _("Statistics Menu")),39UI::UniqueWindow(&plr, "main_menu", &registry, 180, 55, _("Statistics Menu")),
40m_player (plr),40player_ (plr),
41m_windows (windows),41windows_ (windows),
42general_stats42general_stats
43 (this, "general_stats",43 (this, "general_stats",
44 posx(0, 4), posy(0, 3), buttonw(4), buttonh(1),44 posx(0, 4), posy(0, 3), buttonw(4), buttonh(1),
@@ -65,13 +65,13 @@
65 _("Stock"))65 _("Stock"))
66{66{
67 general_stats.sigclicked.connect67 general_stats.sigclicked.connect
68 (boost::bind(&GeneralStatisticsMenu::Registry::toggle, boost::ref(m_windows.general_stats)));68 (boost::bind(&GeneralStatisticsMenu::Registry::toggle, boost::ref(windows_.general_stats)));
69 ware_stats.sigclicked.connect69 ware_stats.sigclicked.connect
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)));
71 building_stats.sigclicked.connect71 building_stats.sigclicked.connect
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)));
73 stock.sigclicked.connect73 stock.sigclicked.connect
74 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.stock)));74 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(windows_.stock)));
7575
76#define INIT_BTN_HOOKS(registry, btn) \76#define INIT_BTN_HOOKS(registry, btn) \
77 assert (!registry.on_create); \77 assert (!registry.on_create); \
@@ -80,19 +80,19 @@
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); \
81 if (registry.window) btn.set_perm_pressed(true); \81 if (registry.window) btn.set_perm_pressed(true); \
8282
83 INIT_BTN_HOOKS(m_windows.general_stats, general_stats)83 INIT_BTN_HOOKS(windows_.general_stats, general_stats)
84 INIT_BTN_HOOKS(m_windows.ware_stats, ware_stats)84 INIT_BTN_HOOKS(windows_.ware_stats, ware_stats)
85 INIT_BTN_HOOKS(m_windows.building_stats, building_stats)85 INIT_BTN_HOOKS(windows_.building_stats, building_stats)
86 INIT_BTN_HOOKS(m_windows.stock, stock)86 INIT_BTN_HOOKS(windows_.stock, stock)
8787
88 m_windows.general_stats.open_window = [this] {88 windows_.general_stats.open_window = [this] {
89 new GeneralStatisticsMenu(m_player, m_windows.general_stats);89 new GeneralStatisticsMenu(player_, windows_.general_stats);
90 };90 };
91 m_windows.ware_stats.open_window = [this] {91 windows_.ware_stats.open_window = [this] {
92 new WareStatisticsMenu(m_player, m_windows.ware_stats);92 new WareStatisticsMenu(player_, windows_.ware_stats);
93 };93 };
94 m_windows.building_stats.open_window = [this] {94 windows_.building_stats.open_window = [this] {
95 new BuildingStatisticsMenu(m_player, m_windows.building_stats);95 new BuildingStatisticsMenu(player_, windows_.building_stats);
96 };96 };
9797
98 if (get_usedefaultpos())98 if (get_usedefaultpos())
@@ -109,8 +109,8 @@
109 registry.on_create = 0; \109 registry.on_create = 0; \
110 registry.on_delete = 0;110 registry.on_delete = 0;
111111
112 DEINIT_BTN_HOOKS(m_windows.general_stats, general_stats)112 DEINIT_BTN_HOOKS(windows_.general_stats, general_stats)
113 DEINIT_BTN_HOOKS(m_windows.ware_stats, ware_stats)113 DEINIT_BTN_HOOKS(windows_.ware_stats, ware_stats)
114 DEINIT_BTN_HOOKS(m_windows.building_stats, building_stats)114 DEINIT_BTN_HOOKS(windows_.building_stats, building_stats)
115 DEINIT_BTN_HOOKS(m_windows.stock, stock)115 DEINIT_BTN_HOOKS(windows_.stock, stock)
116}116}
117117
=== modified file 'src/wui/game_main_menu.h'
--- src/wui/game_main_menu.h 2014-09-10 16:57:31 +0000
+++ src/wui/game_main_menu.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006, 2008 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -33,8 +33,8 @@
33 ~GameMainMenu();33 ~GameMainMenu();
3434
35private:35private:
36 InteractivePlayer & m_player;36 InteractivePlayer & player_;
37 InteractivePlayer::GameMainMenuWindows & m_windows;37 InteractivePlayer::GameMainMenuWindows & windows_;
38 UI::Button general_stats;38 UI::Button general_stats;
39 UI::Button ware_stats;39 UI::Button ware_stats;
40 UI::Button building_stats;40 UI::Button building_stats;
4141
=== modified file 'src/wui/game_main_menu_save_game.cc'
--- src/wui/game_main_menu_save_game.cc 2015-11-01 10:11:56 +0000
+++ src/wui/game_main_menu_save_game.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2008, 2010-2013 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -59,31 +59,31 @@
59 UI::UniqueWindow59 UI::UniqueWindow
60 (&parent, "save_game", &registry,60 (&parent, "save_game", &registry,
61 WINDOW_WIDTH, WINDOW_HEIGHT, _("Save Game")),61 WINDOW_WIDTH, WINDOW_HEIGHT, _("Save Game")),
62 m_ls (this, HSPACING, VSPACING, LIST_WIDTH, LIST_HEIGHT),62 ls_ (this, HSPACING, VSPACING, LIST_WIDTH, LIST_HEIGHT),
63 m_name_label63 name_label_
64 (this, DESCRIPTION_X, 5, 0, 20, _("Map Name:"), UI::Align_CenterLeft),64 (this, DESCRIPTION_X, 5, 0, 20, _("Map Name:"), UI::Align_CenterLeft),
65 m_mapname65 mapname_
66 (this, DESCRIPTION_X, 20, 0, 20, " ", UI::Align_CenterLeft),66 (this, DESCRIPTION_X, 20, 0, 20, " ", UI::Align_CenterLeft),
67 m_gametime_label67 gametime_label_
68 (this, DESCRIPTION_X, 45, 0, 20, _("Game Time:"), UI::Align_CenterLeft),68 (this, DESCRIPTION_X, 45, 0, 20, _("Game Time:"), UI::Align_CenterLeft),
69 m_gametime69 gametime_
70 (this, DESCRIPTION_X, 60, 0, 20, " ", UI::Align_CenterLeft),70 (this, DESCRIPTION_X, 60, 0, 20, " ", UI::Align_CenterLeft),
71 m_players_label71 players_label_
72 (this, DESCRIPTION_X, 85, 0, 20, " ", UI::Align_CenterLeft),72 (this, DESCRIPTION_X, 85, 0, 20, " ", UI::Align_CenterLeft),
73 m_win_condition_label73 win_condition_label_
74 (this, DESCRIPTION_X, 110, 0, 20, _("Win condition:"), UI::Align_CenterLeft),74 (this, DESCRIPTION_X, 110, 0, 20, _("Win condition:"), UI::Align_CenterLeft),
75 m_win_condition75 win_condition_
76 (this, DESCRIPTION_X, 125, 0, 20, " ", UI::Align_CenterLeft),76 (this, DESCRIPTION_X, 125, 0, 20, " ", UI::Align_CenterLeft),
77 m_curdir(SaveHandler::get_base_dir())77 curdir_(SaveHandler::get_base_dir())
78{78{
79 m_editbox =79 editbox_ =
80 new UI::EditBox80 new UI::EditBox
81 (this, HSPACING, EDITBOX_Y, LIST_WIDTH, EDITBOX_HEIGHT,81 (this, HSPACING, EDITBOX_Y, LIST_WIDTH, EDITBOX_HEIGHT,
82 g_gr->images().get("pics/but1.png"));82 g_gr->images().get("pics/but1.png"));
83 m_editbox->changed.connect(boost::bind(&GameMainMenuSaveGame::edit_box_changed, this));83 editbox_->changed.connect(boost::bind(&GameMainMenuSaveGame::edit_box_changed, this));
84 m_editbox->ok.connect(boost::bind(&GameMainMenuSaveGame::ok, this));84 editbox_->ok.connect(boost::bind(&GameMainMenuSaveGame::ok, this));
8585
86 m_button_ok =86 button_ok_ =
87 new UI::Button87 new UI::Button
88 (this, "ok",88 (this, "ok",
89 DESCRIPTION_X, OK_Y, DESCRIPTION_WIDTH, BUTTON_HEIGHT,89 DESCRIPTION_X, OK_Y, DESCRIPTION_WIDTH, BUTTON_HEIGHT,
@@ -91,7 +91,7 @@
91 _("OK"),91 _("OK"),
92 std::string(),92 std::string(),
93 false);93 false);
94 m_button_ok->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::ok, this));94 button_ok_->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::ok, this));
9595
96 UI::Button * cancelbtn =96 UI::Button * cancelbtn =
97 new UI::Button97 new UI::Button
@@ -109,8 +109,8 @@
109 _("Delete"));109 _("Delete"));
110 deletebtn->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::delete_clicked, this));110 deletebtn->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::delete_clicked, this));
111111
112 m_ls.selected.connect(boost::bind(&GameMainMenuSaveGame::selected, this, _1));112 ls_.selected.connect(boost::bind(&GameMainMenuSaveGame::selected, this, _1));
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));
114114
115 fill_list();115 fill_list();
116116
@@ -125,21 +125,21 @@
125 {125 {
126 //Try to translate the map name.126 //Try to translate the map name.
127 i18n::Textdomain td("maps");127 i18n::Textdomain td("maps");
128 m_mapname.set_text(_(parent.game().get_map()->get_name()));128 mapname_.set_text(_(parent.game().get_map()->get_name()));
129 }129 }
130 uint32_t gametime = parent.game().get_gametime();130 uint32_t gametime = parent.game().get_gametime();
131 m_gametime.set_text(gametimestring(gametime));131 gametime_.set_text(gametimestring(gametime));
132132
133 int player_nr = parent.game().player_manager()->get_number_of_players();133 int player_nr = parent.game().player_manager()->get_number_of_players();
134 m_players_label.set_text(134 players_label_.set_text(
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());
136 {136 {
137 i18n::Textdomain td("win_conditions");137 i18n::Textdomain td("win_conditions");
138 m_win_condition.set_text(_(parent.game().get_win_condition_displayname()));138 win_condition_.set_text(_(parent.game().get_win_condition_displayname()));
139 }139 }
140 }140 }
141141
142 m_editbox->focus();142 editbox_->focus();
143 pause_game(true);143 pause_game(true);
144}144}
145145
@@ -148,35 +148,35 @@
148 * called when a item is selected148 * called when a item is selected
149 */149 */
150void GameMainMenuSaveGame::selected(uint32_t) {150void GameMainMenuSaveGame::selected(uint32_t) {
151 const std::string & name = m_ls.get_selected();151 const std::string & name = ls_.get_selected();
152152
153 Widelands::GameLoader gl(name, igbase().game());153 Widelands::GameLoader gl(name, igbase().game());
154 Widelands::GamePreloadPacket gpdp;154 Widelands::GamePreloadPacket gpdp;
155 gl.preload_game(gpdp); // This has worked before, no problem155 gl.preload_game(gpdp); // This has worked before, no problem
156 {156 {
157 m_editbox->set_text(FileSystem::filename_without_ext(name.c_str()));157 editbox_->set_text(FileSystem::filename_without_ext(name.c_str()));
158 }158 }
159 m_button_ok->set_enabled(true);159 button_ok_->set_enabled(true);
160160
161 //Try to translate the map name.161 //Try to translate the map name.
162 {162 {
163 i18n::Textdomain td("maps");163 i18n::Textdomain td("maps");
164 m_mapname.set_text(_(gpdp.get_mapname()));164 mapname_.set_text(_(gpdp.get_mapname()));
165 }165 }
166166
167 uint32_t gametime = gpdp.get_gametime();167 uint32_t gametime = gpdp.get_gametime();
168 m_gametime.set_text(gametimestring(gametime));168 gametime_.set_text(gametimestring(gametime));
169169
170 if (gpdp.get_number_of_players() > 0) {170 if (gpdp.get_number_of_players() > 0) {
171 const std::string text =171 const std::string text =
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()))
173 % static_cast<unsigned int>(gpdp.get_number_of_players())).str();173 % static_cast<unsigned int>(gpdp.get_number_of_players())).str();
174 m_players_label.set_text(text);174 players_label_.set_text(text);
175 } else {175 } else {
176 // Keep label empty176 // Keep label empty
177 m_players_label.set_text("");177 players_label_.set_text("");
178 }178 }
179 m_win_condition.set_text(gpdp.get_win_condition());179 win_condition_.set_text(gpdp.get_win_condition());
180}180}
181181
182/**182/**
@@ -190,11 +190,11 @@
190 * fill the file list190 * fill the file list
191 */191 */
192void GameMainMenuSaveGame::fill_list() {192void GameMainMenuSaveGame::fill_list() {
193 m_ls.clear();193 ls_.clear();
194 FilenameSet gamefiles;194 FilenameSet gamefiles;
195195
196 // Fill it with all files we find.196 // Fill it with all files we find.
197 gamefiles = g_fs->list_directory(m_curdir);197 gamefiles = g_fs->list_directory(curdir_);
198198
199 Widelands::GamePreloadPacket gpdp;199 Widelands::GamePreloadPacket gpdp;
200200
@@ -208,17 +208,17 @@
208 try {208 try {
209 Widelands::GameLoader gl(name, igbase().game());209 Widelands::GameLoader gl(name, igbase().game());
210 gl.preload_game(gpdp);210 gl.preload_game(gpdp);
211 m_ls.add(FileSystem::filename_without_ext(name), name);211 ls_.add(FileSystem::filename_without_ext(name), name);
212 } catch (const WException &) {} // we simply skip illegal entries212 } catch (const WException &) {} // we simply skip illegal entries
213 }213 }
214}214}
215215
216void GameMainMenuSaveGame::select_by_name(std::string name)216void GameMainMenuSaveGame::select_by_name(std::string name)
217{217{
218 for (uint32_t idx = 0; idx < m_ls.size(); idx++) {218 for (uint32_t idx = 0; idx < ls_.size(); idx++) {
219 const std::string val = m_ls[idx];219 const std::string val = ls_[idx];
220 if (name == val) {220 if (name == val) {
221 m_ls.select(idx);221 ls_.select(idx);
222 return;222 return;
223 }223 }
224 }224 }
@@ -228,7 +228,7 @@
228 * The editbox was changed. Enable ok button228 * The editbox was changed. Enable ok button
229 */229 */
230void GameMainMenuSaveGame::edit_box_changed() {230void GameMainMenuSaveGame::edit_box_changed() {
231 m_button_ok->set_enabled(m_editbox->text().size());231 button_ok_->set_enabled(editbox_->text().size());
232}232}
233233
234static void dosave234static void dosave
@@ -260,7 +260,7 @@
260 (boost::format(_("A file with the name ‘%s’ already exists. Overwrite?"))260 (boost::format(_("A file with the name ‘%s’ already exists. Overwrite?"))
261 % FileSystem::fs_filename(filename.c_str())).str(),261 % FileSystem::fs_filename(filename.c_str())).str(),
262 MBoxType::kOkCancel),262 MBoxType::kOkCancel),
263 m_filename(filename)263 filename_(filename)
264 {}264 {}
265265
266 GameMainMenuSaveGame & menu_save_game() {266 GameMainMenuSaveGame & menu_save_game() {
@@ -270,8 +270,8 @@
270270
271 void clicked_ok() override271 void clicked_ok() override
272 {272 {
273 g_fs->fs_unlink(m_filename);273 g_fs->fs_unlink(filename_);
274 dosave(menu_save_game().igbase(), m_filename);274 dosave(menu_save_game().igbase(), filename_);
275 menu_save_game().die();275 menu_save_game().die();
276 }276 }
277277
@@ -281,7 +281,7 @@
281 }281 }
282282
283private:283private:
284 std::string const m_filename;284 std::string const filename_;
285};285};
286286
287/**287/**
@@ -289,12 +289,12 @@
289 */289 */
290void GameMainMenuSaveGame::ok()290void GameMainMenuSaveGame::ok()
291{291{
292 if (m_editbox->text().empty())292 if (editbox_->text().empty())
293 return;293 return;
294294
295 std::string const complete_filename =295 std::string const complete_filename =
296 igbase().game().save_handler().create_file_name296 igbase().game().save_handler().create_file_name
297 (m_curdir, m_editbox->text());297 (curdir_, editbox_->text());
298298
299 // Check if file exists. If it does, show a warning.299 // Check if file exists. If it does, show a warning.
300 if (g_fs->file_exists(complete_filename)) {300 if (g_fs->file_exists(complete_filename)) {
@@ -324,12 +324,12 @@
324 (boost::format(_("Do you really want to delete the file %s?")) %324 (boost::format(_("Do you really want to delete the file %s?")) %
325 FileSystem::fs_filename(filename.c_str())),325 FileSystem::fs_filename(filename.c_str())),
326 MBoxType::kOkCancel),326 MBoxType::kOkCancel),
327 m_filename(filename)327 filename_(filename)
328 {}328 {}
329329
330 void clicked_ok() override330 void clicked_ok() override
331 {331 {
332 g_fs->fs_unlink(m_filename);332 g_fs->fs_unlink(filename_);
333 dynamic_cast<GameMainMenuSaveGame&>(*get_parent()).fill_list();333 dynamic_cast<GameMainMenuSaveGame&>(*get_parent()).fill_list();
334 die();334 die();
335 }335 }
@@ -340,7 +340,7 @@
340 }340 }
341341
342private:342private:
343 std::string const m_filename;343 std::string const filename_;
344};344};
345345
346346
@@ -351,7 +351,7 @@
351{351{
352 std::string const complete_filename =352 std::string const complete_filename =
353 igbase().game().save_handler().create_file_name353 igbase().game().save_handler().create_file_name
354 (m_curdir, m_editbox->text());354 (curdir_, editbox_->text());
355355
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.
357 if (g_fs->file_exists(complete_filename))357 if (g_fs->file_exists(complete_filename))
358358
=== modified file 'src/wui/game_main_menu_save_game.h'
--- src/wui/game_main_menu_save_game.h 2014-11-28 16:40:55 +0000
+++ src/wui/game_main_menu_save_game.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006, 2008-2013 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -51,15 +51,15 @@
51 bool save_game(std::string);51 bool save_game(std::string);
52 void pause_game(bool paused);52 void pause_game(bool paused);
5353
54 UI::Listselect<std::string> m_ls;54 UI::Listselect<std::string> ls_;
55 UI::EditBox * m_editbox;55 UI::EditBox * editbox_;
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_,
57 m_win_condition_label, m_win_condition;57 win_condition_label_, win_condition_;
58 UI::Button * m_button_ok;58 UI::Button * button_ok_;
59 std::string m_curdir;59 std::string curdir_;
60 std::string m_parentdir;60 std::string parentdir_;
61 std::string m_filename;61 std::string filename_;
62 bool m_overwrite;62 bool overwrite_;
63};63};
6464
65#endif // end of include guard: WL_WUI_GAME_MAIN_MENU_SAVE_GAME_H65#endif // end of include guard: WL_WUI_GAME_MAIN_MENU_SAVE_GAME_H
6666
=== modified file 'src/wui/game_message_menu.cc'
--- src/wui/game_message_menu.cc 2016-01-18 19:35:25 +0000
+++ src/wui/game_message_menu.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -79,7 +79,7 @@
79 list->focus();79 list->focus();
8080
81 // Buttons for message types81 // Buttons for message types
82 m_geologistsbtn =82 geologistsbtn_ =
83 new UI::Button83 new UI::Button
84 (this, "filter_geologists_messages",84 (this, "filter_geologists_messages",
85 kPadding, kPadding, kButtonSize, kButtonSize,85 kPadding, kPadding, kButtonSize, kButtonSize,
@@ -87,10 +87,10 @@
87 g_gr->images().get("pics/menu_geologist.png"),87 g_gr->images().get("pics/menu_geologist.png"),
88 "",88 "",
89 true);89 true);
90 m_geologistsbtn->sigclicked.connect90 geologistsbtn_->sigclicked.connect
91 (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kGeologists));91 (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kGeologists));
9292
93 m_economybtn =93 economybtn_ =
94 new UI::Button94 new UI::Button
95 (this, "filter_economy_messages",95 (this, "filter_economy_messages",
96 2 * kPadding + kButtonSize, kPadding, kButtonSize, kButtonSize,96 2 * kPadding + kButtonSize, kPadding, kButtonSize, kButtonSize,
@@ -98,10 +98,10 @@
98 g_gr->images().get("pics/genstats_nrwares.png"),98 g_gr->images().get("pics/genstats_nrwares.png"),
99 "",99 "",
100 true);100 true);
101 m_economybtn->sigclicked.connect101 economybtn_->sigclicked.connect
102 (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kEconomy));102 (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kEconomy));
103103
104 m_seafaringbtn =104 seafaringbtn_ =
105 new UI::Button105 new UI::Button
106 (this, "filter_seafaring_messages",106 (this, "filter_seafaring_messages",
107 3 * kPadding + 2 * kButtonSize, kPadding, kButtonSize, kButtonSize,107 3 * kPadding + 2 * kButtonSize, kPadding, kButtonSize, kButtonSize,
@@ -109,10 +109,10 @@
109 g_gr->images().get("pics/start_expedition.png"),109 g_gr->images().get("pics/start_expedition.png"),
110 "",110 "",
111 true);111 true);
112 m_seafaringbtn->sigclicked.connect112 seafaringbtn_->sigclicked.connect
113 (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kSeafaring));113 (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kSeafaring));
114114
115 m_warfarebtn =115 warfarebtn_ =
116 new UI::Button116 new UI::Button
117 (this, "filter_warfare_messages",117 (this, "filter_warfare_messages",
118 4 * kPadding + 3 * kButtonSize, kPadding, kButtonSize, kButtonSize,118 4 * kPadding + 3 * kButtonSize, kPadding, kButtonSize, kButtonSize,
@@ -120,10 +120,10 @@
120 g_gr->images().get("pics/messages_warfare.png"),120 g_gr->images().get("pics/messages_warfare.png"),
121 "",121 "",
122 true);122 true);
123 m_warfarebtn->sigclicked.connect123 warfarebtn_->sigclicked.connect
124 (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kWarfare));124 (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kWarfare));
125125
126 m_scenariobtn =126 scenariobtn_ =
127 new UI::Button127 new UI::Button
128 (this, "filter_scenario_messages",128 (this, "filter_scenario_messages",
129 5 * kPadding + 4 * kButtonSize, kPadding, kButtonSize, kButtonSize,129 5 * kPadding + 4 * kButtonSize, kPadding, kButtonSize, kButtonSize,
@@ -131,14 +131,14 @@
131 g_gr->images().get("pics/menu_objectives.png"),131 g_gr->images().get("pics/menu_objectives.png"),
132 "",132 "",
133 true);133 true);
134 m_scenariobtn->sigclicked.connect134 scenariobtn_->sigclicked.connect
135 (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kScenario));135 (boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kScenario));
136136
137 m_message_filter = Widelands::Message::Type::kAllMessages;137 message_filter_ = Widelands::Message::Type::kAllMessages;
138 set_filter_messages_tooltips();138 set_filter_messages_tooltips();
139 // End: Buttons for message types139 // End: Buttons for message types
140140
141 m_archivebtn =141 archivebtn_ =
142 new UI::Button142 new UI::Button
143 (this, "archive_or_restore_selected_messages",143 (this, "archive_or_restore_selected_messages",
144 kPadding, kWindowHeight - kPadding - kButtonSize, kButtonSize, kButtonSize,144 kPadding, kWindowHeight - kPadding - kButtonSize, kButtonSize, kButtonSize,
@@ -148,26 +148,26 @@
148 (boost::format(_("Del: %s"))148 (boost::format(_("Del: %s"))
149 /** TRANSLATORS: Tooltip in the messages window */149 /** TRANSLATORS: Tooltip in the messages window */
150 % _("Archive selected message")).str());150 % _("Archive selected message")).str());
151 m_archivebtn->sigclicked.connect151 archivebtn_->sigclicked.connect
152 (boost::bind(&GameMessageMenu::archive_or_restore, this));152 (boost::bind(&GameMessageMenu::archive_or_restore, this));
153153
154 m_togglemodebtn =154 togglemodebtn_ =
155 new UI::Button155 new UI::Button
156 (this, "toggle_between_inbox_or_archive",156 (this, "toggle_between_inbox_or_archive",
157 m_archivebtn->get_x() + m_archivebtn->get_w() + kPadding,157 archivebtn_->get_x() + archivebtn_->get_w() + kPadding,
158 m_archivebtn->get_y(),158 archivebtn_->get_y(),
159 kButtonSize,159 kButtonSize,
160 kButtonSize,160 kButtonSize,
161 g_gr->images().get("pics/but2.png"),161 g_gr->images().get("pics/but2.png"),
162 g_gr->images().get("pics/message_archived.png"),162 g_gr->images().get("pics/message_archived.png"),
163 _("Show Archive"));163 _("Show Archive"));
164 m_togglemodebtn->sigclicked.connect164 togglemodebtn_->sigclicked.connect
165 (boost::bind(&GameMessageMenu::toggle_mode, this));165 (boost::bind(&GameMessageMenu::toggle_mode, this));
166166
167 m_centerviewbtn =167 centerviewbtn_ =
168 new UI::Button168 new UI::Button
169 (this, "center_main_mapview_on_location",169 (this, "center_main_mapview_on_location",
170 kWindowWidth - kPadding - kButtonSize, m_archivebtn->get_y(), kButtonSize, kButtonSize,170 kWindowWidth - kPadding - kButtonSize, archivebtn_->get_y(), kButtonSize, kButtonSize,
171 g_gr->images().get("pics/but2.png"),171 g_gr->images().get("pics/but2.png"),
172 g_gr->images().get("pics/menu_goto.png"),172 g_gr->images().get("pics/menu_goto.png"),
173 /** TRANSLATORS: %s is a tooltip, G is the corresponding hotkey */173 /** TRANSLATORS: %s is a tooltip, G is the corresponding hotkey */
@@ -175,7 +175,7 @@
175 /** TRANSLATORS: Tooltip in the messages window */175 /** TRANSLATORS: Tooltip in the messages window */
176 % _("Center main mapview on location")).str(),176 % _("Center main mapview on location")).str(),
177 false);177 false);
178 m_centerviewbtn->sigclicked.connect(boost::bind(&GameMessageMenu::center_view, this));178 centerviewbtn_->sigclicked.connect(boost::bind(&GameMessageMenu::center_view, this));
179179
180 if (get_usedefaultpos())180 if (get_usedefaultpos())
181 center_to_parent();181 center_to_parent();
@@ -298,8 +298,8 @@
298 // Update messages in the list and remove messages298 // Update messages in the list and remove messages
299 // that should no longer be shown299 // that should no longer be shown
300 for (uint32_t j = list->size(); j; --j) {300 for (uint32_t j = list->size(); j; --j) {
301 MessageId m_id((*list)[j - 1]);301 MessageId id_((*list)[j - 1]);
302 if (Message const * const message = mq[m_id]) {302 if (Message const * const message = mq[id_]) {
303 if ((mode == Archive) != (message->status() == Message::Status::kArchived)) {303 if ((mode == Archive) != (message->status() == Message::Status::kArchived)) {
304 list->remove(j - 1);304 list->remove(j - 1);
305 } else {305 } else {
@@ -325,11 +325,11 @@
325 }325 }
326326
327 // Filter message type327 // Filter message type
328 if (m_message_filter != Message::Type::kAllMessages) {328 if (message_filter_ != Message::Type::kAllMessages) {
329 for (uint32_t j = list->size(); j; --j) {329 for (uint32_t j = list->size(); j; --j) {
330 MessageId m_id((*list)[j - 1]);330 MessageId id_((*list)[j - 1]);
331 if (Message const * const message = mq[m_id]) {331 if (Message const * const message = mq[id_]) {
332 if (message->message_type_category() != m_message_filter) {332 if (message->message_type_category() != message_filter_) {
333 list->remove(j - 1);333 list->remove(j - 1);
334 }334 }
335 }335 }
@@ -343,7 +343,7 @@
343 // be a solution without this extra update().343 // be a solution without this extra update().
344 list->update();344 list->update();
345 } else {345 } else {
346 m_centerviewbtn->set_enabled(false);346 centerviewbtn_->set_enabled(false);
347 message_body.set_text(std::string());347 message_body.set_text(std::string());
348 }348 }
349}349}
@@ -376,7 +376,7 @@
376 (*new Widelands::CmdMessageSetStatusRead376 (*new Widelands::CmdMessageSetStatusRead
377 (game.get_gametime(), player.player_number(), id));377 (game.get_gametime(), player.player_number(), id));
378 }378 }
379 m_centerviewbtn->set_enabled(message->position());379 centerviewbtn_->set_enabled(message->position());
380380
381 message_body.set_text(381 message_body.set_text(
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>"
@@ -386,7 +386,7 @@
386 return;386 return;
387 }387 }
388 }388 }
389 m_centerviewbtn->set_enabled(false);389 centerviewbtn_->set_enabled(false);
390 message_body.set_text(std::string());390 message_body.set_text(std::string());
391}391}
392392
@@ -394,7 +394,7 @@
394 * a message was double clicked394 * a message was double clicked
395 */395 */
396void GameMessageMenu::double_clicked(uint32_t const /* t */) {396void GameMessageMenu::double_clicked(uint32_t const /* t */) {
397 if (m_centerviewbtn->enabled()) center_view();397 if (centerviewbtn_->enabled()) center_view();
398}398}
399399
400/**400/**
@@ -406,7 +406,7 @@
406 switch (code.sym) {406 switch (code.sym) {
407 // Don't forget to change the tooltips if any of these get reassigned407 // Don't forget to change the tooltips if any of these get reassigned
408 case SDLK_g:408 case SDLK_g:
409 if (m_centerviewbtn->enabled())409 if (centerviewbtn_->enabled())
410 center_view();410 center_view();
411 return true;411 return true;
412 case SDLK_0:412 case SDLK_0:
@@ -495,19 +495,19 @@
495void GameMessageMenu::filter_messages(Widelands::Message::Type const msgtype) {495void GameMessageMenu::filter_messages(Widelands::Message::Type const msgtype) {
496 switch (msgtype) {496 switch (msgtype) {
497 case Widelands::Message::Type::kGeologists:497 case Widelands::Message::Type::kGeologists:
498 toggle_filter_messages_button(*m_geologistsbtn, msgtype);498 toggle_filter_messages_button(*geologistsbtn_, msgtype);
499 break;499 break;
500 case Widelands::Message::Type::kEconomy:500 case Widelands::Message::Type::kEconomy:
501 toggle_filter_messages_button(*m_economybtn, msgtype);501 toggle_filter_messages_button(*economybtn_, msgtype);
502 break;502 break;
503 case Widelands::Message::Type::kSeafaring:503 case Widelands::Message::Type::kSeafaring:
504 toggle_filter_messages_button(*m_seafaringbtn, msgtype);504 toggle_filter_messages_button(*seafaringbtn_, msgtype);
505 break;505 break;
506 case Widelands::Message::Type::kWarfare:506 case Widelands::Message::Type::kWarfare:
507 toggle_filter_messages_button(*m_warfarebtn, msgtype);507 toggle_filter_messages_button(*warfarebtn_, msgtype);
508 break;508 break;
509 case Widelands::Message::Type::kScenario:509 case Widelands::Message::Type::kScenario:
510 toggle_filter_messages_button(*m_scenariobtn, msgtype);510 toggle_filter_messages_button(*scenariobtn_, msgtype);
511 break;511 break;
512512
513 case Widelands::Message::Type::kNoMessages:513 case Widelands::Message::Type::kNoMessages:
@@ -523,12 +523,12 @@
523 case Widelands::Message::Type::kWarfareSiteLost:523 case Widelands::Message::Type::kWarfareSiteLost:
524 case Widelands::Message::Type::kWarfareUnderAttack:524 case Widelands::Message::Type::kWarfareUnderAttack:
525 set_filter_messages_tooltips();525 set_filter_messages_tooltips();
526 m_message_filter = Widelands::Message::Type::kAllMessages;526 message_filter_ = Widelands::Message::Type::kAllMessages;
527 m_geologistsbtn->set_perm_pressed(false);527 geologistsbtn_->set_perm_pressed(false);
528 m_economybtn->set_perm_pressed(false);528 economybtn_ ->set_perm_pressed(false);
529 m_seafaringbtn->set_perm_pressed(false);529 seafaringbtn_ ->set_perm_pressed(false);
530 m_warfarebtn->set_perm_pressed(false);530 warfarebtn_ ->set_perm_pressed(false);
531 m_scenariobtn->set_perm_pressed(false);531 scenariobtn_ ->set_perm_pressed(false);
532 break;532 break;
533 }533 }
534 think();534 think();
@@ -541,15 +541,15 @@
541 set_filter_messages_tooltips();541 set_filter_messages_tooltips();
542 if (button.get_perm_pressed()) {542 if (button.get_perm_pressed()) {
543 button.set_perm_pressed(false);543 button.set_perm_pressed(false);
544 m_message_filter = Widelands::Message::Type::kAllMessages;544 message_filter_ = Widelands::Message::Type::kAllMessages;
545 } else {545 } else {
546 m_geologistsbtn->set_perm_pressed(false);546 geologistsbtn_->set_perm_pressed(false);
547 m_economybtn->set_perm_pressed(false);547 economybtn_->set_perm_pressed(false);
548 m_seafaringbtn->set_perm_pressed(false);548 seafaringbtn_->set_perm_pressed(false);
549 m_warfarebtn->set_perm_pressed(false);549 warfarebtn_->set_perm_pressed(false);
550 m_scenariobtn->set_perm_pressed(false);550 scenariobtn_->set_perm_pressed(false);
551 button.set_perm_pressed(true);551 button.set_perm_pressed(true);
552 m_message_filter = msgtype;552 message_filter_ = msgtype;
553 /** TRANSLATORS: %1% is a tooltip, %2% is the corresponding hotkey */553 /** TRANSLATORS: %1% is a tooltip, %2% is the corresponding hotkey */
554 button.set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))554 button.set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
555 /** TRANSLATORS: Tooltip in the messages window */555 /** TRANSLATORS: Tooltip in the messages window */
@@ -562,23 +562,23 @@
562 * Helper for filter_messages562 * Helper for filter_messages
563 */563 */
564void GameMessageMenu::set_filter_messages_tooltips() {564void GameMessageMenu::set_filter_messages_tooltips() {
565 m_geologistsbtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))565 geologistsbtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
566 /** TRANSLATORS: Tooltip in the messages window */566 /** TRANSLATORS: Tooltip in the messages window */
567 % _("Show geologists' messages only")567 % _("Show geologists' messages only")
568 % "1").str());568 % "1").str());
569 m_economybtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))569 economybtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
570 /** TRANSLATORS: Tooltip in the messages window */570 /** TRANSLATORS: Tooltip in the messages window */
571 % _("Show economy messages only")571 % _("Show economy messages only")
572 % "2").str());572 % "2").str());
573 m_seafaringbtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))573 seafaringbtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
574 /** TRANSLATORS: Tooltip in the messages window */574 /** TRANSLATORS: Tooltip in the messages window */
575 % _("Show seafaring messages only")575 % _("Show seafaring messages only")
576 % "3").str());576 % "3").str());
577 m_warfarebtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))577 warfarebtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
578 /** TRANSLATORS: Tooltip in the messages window */578 /** TRANSLATORS: Tooltip in the messages window */
579 % _("Show warfare messages only")579 % _("Show warfare messages only")
580 % "4").str());580 % "4").str());
581 m_scenariobtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))581 scenariobtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
582 /** TRANSLATORS: Tooltip in the messages window */582 /** TRANSLATORS: Tooltip in the messages window */
583 % _("Show scenario messages only")583 % _("Show scenario messages only")
584 % "5").str());584 % "5").str());
@@ -626,24 +626,24 @@
626 case Inbox:626 case Inbox:
627 mode = Archive;627 mode = Archive;
628 set_title(_("Messages: Archive"));628 set_title(_("Messages: Archive"));
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"));
630 /** TRANSLATORS: %s is a tooltip, Del is the corresponding hotkey */630 /** TRANSLATORS: %s is a tooltip, Del is the corresponding hotkey */
631 m_archivebtn->set_tooltip((boost::format(_("Del: %s"))631 archivebtn_->set_tooltip((boost::format(_("Del: %s"))
632 /** TRANSLATORS: Tooltip in the messages window */632 /** TRANSLATORS: Tooltip in the messages window */
633 % _("Restore selected message")).str());633 % _("Restore selected message")).str());
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"));
635 m_togglemodebtn->set_tooltip(_("Show Inbox"));635 togglemodebtn_->set_tooltip(_("Show Inbox"));
636 break;636 break;
637 case Archive:637 case Archive:
638 mode = Inbox;638 mode = Inbox;
639 set_title(_("Messages: Inbox"));639 set_title(_("Messages: Inbox"));
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"));
641 /** TRANSLATORS: %s is a tooltip, Del is the corresponding hotkey */641 /** TRANSLATORS: %s is a tooltip, Del is the corresponding hotkey */
642 m_archivebtn->set_tooltip((boost::format(_("Del: %s"))642 archivebtn_->set_tooltip((boost::format(_("Del: %s"))
643 /** TRANSLATORS: Tooltip in the messages window */643 /** TRANSLATORS: Tooltip in the messages window */
644 % _("Archive selected message")).str());644 % _("Archive selected message")).str());
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"));
646 m_togglemodebtn->set_tooltip(_("Show Archive"));646 togglemodebtn_->set_tooltip(_("Show Archive"));
647 break;647 break;
648 }648 }
649}649}
650650
=== modified file 'src/wui/game_message_menu.h'
--- src/wui/game_message_menu.h 2015-09-11 06:24:02 +0000
+++ src/wui/game_message_menu.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -70,17 +70,17 @@
7070
71 UI::Table<uintptr_t> * list;71 UI::Table<uintptr_t> * list;
72 UI::MultilineTextarea message_body;72 UI::MultilineTextarea message_body;
73 UI::Button * m_archivebtn;73 UI::Button * archivebtn_;
74 UI::Button * m_togglemodebtn;74 UI::Button * togglemodebtn_;
75 UI::Button * m_centerviewbtn;75 UI::Button * centerviewbtn_;
76 Mode mode;76 Mode mode;
77 // Buttons for message types77 // Buttons for message types
78 UI::Button * m_geologistsbtn;78 UI::Button * geologistsbtn_;
79 UI::Button * m_economybtn;79 UI::Button * economybtn_;
80 UI::Button * m_seafaringbtn;80 UI::Button * seafaringbtn_;
81 UI::Button * m_warfarebtn;81 UI::Button * warfarebtn_;
82 UI::Button * m_scenariobtn;82 UI::Button * scenariobtn_;
83 Widelands::Message::Type m_message_filter;83 Widelands::Message::Type message_filter_;
84};84};
8585
86#endif // end of include guard: WL_WUI_GAME_MESSAGE_MENU_H86#endif // end of include guard: WL_WUI_GAME_MESSAGE_MENU_H
8787
=== modified file 'src/wui/game_summary.cc'
--- src/wui/game_summary.cc 2016-01-17 08:29:59 +0000
+++ src/wui/game_summary.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2007-2008 by the Widelands Development Team2 * Copyright (C) 2007-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -41,82 +41,82 @@
41GameSummaryScreen::GameSummaryScreen41GameSummaryScreen::GameSummaryScreen
42 (InteractiveGameBase * parent, UI::UniqueWindow::Registry * r)42 (InteractiveGameBase * parent, UI::UniqueWindow::Registry * r)
43: UI::UniqueWindow(parent, "game_summary", r, 0, 0, _("Game over")),43: UI::UniqueWindow(parent, "game_summary", r, 0, 0, _("Game over")),
44m_game(parent->game())44game_(parent->game())
45{45{
46 // Init boxes46 // Init boxes
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);
48 m_title_area = new UI::Textarea(vbox, "", UI::Align_HCenter);48 title_area_ = new UI::Textarea(vbox, "", UI::Align_HCenter);
49 vbox->add(m_title_area, UI::Box::AlignCenter);49 vbox->add(title_area_, UI::Box::AlignCenter);
50 vbox->add_space(PADDING);50 vbox->add_space(PADDING);
5151
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);
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);
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());
55 hbox1->add_space(PADDING);55 hbox1->add_space(PADDING);
56 hbox1->add(m_players_table, UI::Box::AlignTop);56 hbox1->add(players_table_, UI::Box::AlignTop);
57 hbox1->add_space(PADDING);57 hbox1->add_space(PADDING);
5858
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);
60 m_info_area_label = new UI::Textarea(info_box, _("Player info:"));60 info_area_label_ = new UI::Textarea(info_box, _("Player info:"));
61 info_box->add(m_info_area_label, UI::Box::AlignLeft);61 info_box->add(info_area_label_, UI::Box::AlignLeft);
62 m_info_area = new UI::MultilineTextarea(62 info_area_ = new UI::MultilineTextarea(
63 info_box, 0, 0, 130,63 info_box, 0, 0, 130,
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),
65 "");65 "");
66 info_box->add(m_info_area, UI::Box::AlignLeft, true);66 info_box->add(info_area_, UI::Box::AlignLeft, true);
67 info_box->add_space(PADDING);67 info_box->add_space(PADDING);
68 hbox1->add(info_box, UI::Box::AlignTop);68 hbox1->add(info_box, UI::Box::AlignTop);
69 hbox1->add_space(PADDING);69 hbox1->add_space(PADDING);
70 vbox->add(hbox1, UI::Box::AlignLeft);70 vbox->add(hbox1, UI::Box::AlignLeft);
7171
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);
7373
74 bottom_box->add_space(PADDING);74 bottobox_->add_space(PADDING);
7575
76 m_gametime_label = new UI::Textarea(bottom_box, _("Elapsed time:"));76 gametime_label_ = new UI::Textarea(bottobox_, _("Elapsed time:"));
77 bottom_box->add(m_gametime_label, UI::Box::AlignCenter);77 bottobox_->add(gametime_label_, UI::Box::AlignCenter);
78 bottom_box->add_space(PADDING);78 bottobox_->add_space(PADDING);
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()));
80 bottom_box->add(m_gametime_value, UI::Box::AlignCenter);80 bottobox_->add(gametime_value_, UI::Box::AlignCenter);
8181
82 bottom_box->add_inf_space();82 bottobox_->add_inf_space();
8383
84 m_continue_button = new UI::Button84 continue_button_ = new UI::Button
85 (bottom_box, "continue_button",85 (bottobox_, "continue_button",
86 0, 0, 35, 35,86 0, 0, 35, 35,
87 g_gr->images().get("pics/but4.png"),87 g_gr->images().get("pics/but4.png"),
88 g_gr->images().get("pics/continue.png"),88 g_gr->images().get("pics/continue.png"),
89 _("Continue playing"));89 _("Continue playing"));
90 bottom_box->add(m_continue_button, UI::Box::AlignCenter);90 bottobox_->add(continue_button_, UI::Box::AlignCenter);
91 bottom_box->add_space(PADDING);91 bottobox_->add_space(PADDING);
92 m_stop_button = new UI::Button92 stop_button_ = new UI::Button
93 (bottom_box, "stop_button",93 (bottobox_, "stop_button",
94 0, 0, 35, 35,94 0, 0, 35, 35,
95 g_gr->images().get("pics/but4.png"),95 g_gr->images().get("pics/but4.png"),
96 g_gr->images().get("pics/menu_exit_game.png"),96 g_gr->images().get("pics/menu_exit_game.png"),
97 _("Exit Game"));97 _("Exit Game"));
98 bottom_box->add(m_stop_button, UI::Box::AlignCenter);98 bottobox_->add(stop_button_, UI::Box::AlignCenter);
99 bottom_box->add_space(PADDING);99 bottobox_->add_space(PADDING);
100100
101 vbox->add(bottom_box, UI::Box::AlignLeft, true);101 vbox->add(bottobox_, UI::Box::AlignLeft, true);
102 vbox->add_space(PADDING);102 vbox->add_space(PADDING);
103 set_center_panel(vbox);103 set_center_panel(vbox);
104104
105 // Prepare table105 // Prepare table
106 m_players_table->add_column(150, _("Player"));106 players_table_->add_column(150, _("Player"));
107 m_players_table->add_column(80, _("Team"), "", UI::Align_HCenter);107 players_table_->add_column(80, _("Team"), "", UI::Align_HCenter);
108 m_players_table->add_column(100, _("Status"), "", UI::Align_HCenter);108 players_table_->add_column(100, _("Status"), "", UI::Align_HCenter);
109 m_players_table->add_column(100, _("Time"));109 players_table_->add_column(100, _("Time"));
110110
111 // Prepare Elements111 // Prepare Elements
112 m_title_area->set_textstyle(UI::TextStyle::ui_big());112 title_area_->set_textstyle(UI::TextStyle::ui_big());
113113
114 // Connections114 // Connections
115 m_continue_button->sigclicked.connect115 continue_button_->sigclicked.connect
116 (boost::bind(&GameSummaryScreen::continue_clicked, this));116 (boost::bind(&GameSummaryScreen::continue_clicked, this));
117 m_stop_button->sigclicked.connect117 stop_button_->sigclicked.connect
118 (boost::bind(&GameSummaryScreen::stop_clicked, this));118 (boost::bind(&GameSummaryScreen::stop_clicked, this));
119 m_players_table->selected.connect119 players_table_->selected.connect
120 (boost::bind(&GameSummaryScreen::player_selected, this, _1));120 (boost::bind(&GameSummaryScreen::player_selected, this, _1));
121121
122 // Window122 // Window
@@ -140,12 +140,12 @@
140void GameSummaryScreen::fill_data()140void GameSummaryScreen::fill_data()
141{141{
142 std::vector<Widelands::PlayerEndStatus> players_status142 std::vector<Widelands::PlayerEndStatus> players_status
143 = m_game.player_manager()->get_players_end_status();143 = game_.player_manager()->get_players_end_status();
144 bool local_in_game = false;144 bool local_in_game = false;
145 bool local_won = false;145 bool local_won = false;
146 Widelands::Player* single_won = nullptr;146 Widelands::Player* single_won = nullptr;
147 uint8_t team_won = 0;147 uint8_t teawon_ = 0;
148 InteractivePlayer* ipl = m_game.get_ipl();148 InteractivePlayer* ipl = game_.get_ipl();
149 //this defines a row to be selected, current player,149 //this defines a row to be selected, current player,
150 //if not then the first line150 //if not then the first line
151 uint32_t current_player_position = 0;151 uint32_t current_player_position = 0;
@@ -157,8 +157,8 @@
157 local_won = pes.result == Widelands::PlayerEndResult::PLAYER_WON;157 local_won = pes.result == Widelands::PlayerEndResult::PLAYER_WON;
158 current_player_position = i;158 current_player_position = i;
159 }159 }
160 Widelands::Player* p = m_game.get_player(pes.player);160 Widelands::Player* p = game_.get_player(pes.player);
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);
162 // Player name & pic162 // Player name & pic
163 std::string pic_path =163 std::string pic_path =
164 (boost::format("pics/genstats_enable_plr_0%|1$u|.png")164 (boost::format("pics/genstats_enable_plr_0%|1$u|.png")
@@ -166,10 +166,10 @@
166 const Image* pic = g_gr->images().get(pic_path);166 const Image* pic = g_gr->images().get(pic_path);
167 te.set_picture(0, pic, p->get_name());167 te.set_picture(0, pic, p->get_name());
168 // Team168 // Team
169 std::string team_str =169 std::string teastr_ =
170 (boost::format("%|1$u|")170 (boost::format("%|1$u|")
171 % static_cast<unsigned int>(p->team_number())).str();171 % static_cast<unsigned int>(p->team_number())).str();
172 te.set_string(1, team_str);172 te.set_string(1, teastr_);
173 // Status173 // Status
174 std::string stat_str;174 std::string stat_str;
175 switch (pes.result) {175 switch (pes.result) {
@@ -183,7 +183,7 @@
183 if (!single_won) {183 if (!single_won) {
184 single_won = p;184 single_won = p;
185 } else {185 } else {
186 team_won = p->team_number();186 teawon_ = p->team_number();
187 }187 }
188 break;188 break;
189 case Widelands::PlayerEndResult::PLAYER_RESIGNED:189 case Widelands::PlayerEndResult::PLAYER_RESIGNED:
@@ -203,24 +203,24 @@
203203
204 if (local_in_game) {204 if (local_in_game) {
205 if (local_won) {205 if (local_won) {
206 m_title_area->set_text(_("You won!"));206 title_area_->set_text(_("You won!"));
207 } else {207 } else {
208 m_title_area->set_text(_("You lost."));208 title_area_->set_text(_("You lost."));
209 }209 }
210 } else {210 } else {
211 if (team_won <= 0) {211 if (teawon_ <= 0) {
212 assert(single_won);212 assert(single_won);
213 m_title_area->set_text213 title_area_->set_text
214 ((boost::format(_("%s won!")) % single_won->get_name()).str());214 ((boost::format(_("%s won!")) % single_won->get_name()).str());
215 } else {215 } else {
216 m_title_area->set_text216 title_area_->set_text
217 ((boost::format(_("Team %|1$u| won!"))217 ((boost::format(_("Team %|1$u| won!"))
218 % static_cast<unsigned int>(team_won)).str());218 % static_cast<unsigned int>(teawon_)).str());
219 }219 }
220 }220 }
221 m_players_table->update();221 players_table_->update();
222 if (!players_status.empty()) {222 if (!players_status.empty()) {
223 m_players_table->select(current_player_position);223 players_table_->select(current_player_position);
224 }224 }
225}225}
226226
@@ -231,17 +231,17 @@
231231
232void GameSummaryScreen::stop_clicked()232void GameSummaryScreen::stop_clicked()
233{233{
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);
235}235}
236236
237void GameSummaryScreen::player_selected(uint32_t entry_index)237void GameSummaryScreen::player_selected(uint32_t entry_index)
238{238{
239 const uintptr_t selected_player_index = (*m_players_table)[entry_index];239 const uintptr_t selected_player_index = (*players_table_)[entry_index];
240 const Widelands::PlayerEndStatus& player_status =240 const Widelands::PlayerEndStatus& player_status =
241 m_game.player_manager()->get_players_end_status()[selected_player_index];241 game_.player_manager()->get_players_end_status()[selected_player_index];
242242
243 std::string info_str = parse_player_info(player_status.info);243 std::string info_str = parse_player_info(player_status.info);
244 m_info_area->set_text(info_str);244 info_area_->set_text(info_str);
245 layout();245 layout();
246}246}
247247
248248
=== modified file 'src/wui/game_summary.h'
--- src/wui/game_summary.h 2015-03-21 14:11:39 +0000
+++ src/wui/game_summary.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2007-2008 by the Widelands Development Team2 * Copyright (C) 2007-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -47,15 +47,15 @@
47 void player_selected(uint32_t idx);47 void player_selected(uint32_t idx);
48 std::string parse_player_info(std::string info);48 std::string parse_player_info(std::string info);
4949
50 Widelands::Game & m_game;50 Widelands::Game & game_;
51 UI::Textarea * m_title_area;51 UI::Textarea * title_area_;
52 UI::Textarea * m_gametime_label;52 UI::Textarea * gametime_label_;
53 UI::Textarea * m_gametime_value;53 UI::Textarea * gametime_value_;
54 UI::Textarea * m_info_area_label;54 UI::Textarea * info_area_label_;
55 UI::MultilineTextarea * m_info_area;55 UI::MultilineTextarea * info_area_;
56 UI::Button * m_continue_button;56 UI::Button * continue_button_;
57 UI::Button * m_stop_button;57 UI::Button * stop_button_;
58 UI::Table<uintptr_t const> * m_players_table;58 UI::Table<uintptr_t const> * players_table_;
59};59};
6060
61#endif // end of include guard: WL_WUI_GAME_SUMMARY_H61#endif // end of include guard: WL_WUI_GAME_SUMMARY_H
6262
=== modified file 'src/wui/game_tips.cc'
--- src/wui/game_tips.cc 2014-11-27 12:02:08 +0000
+++ src/wui/game_tips.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2007-2008, 2010 by the Widelands Development Team2 * Copyright (C) 2007-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -33,11 +33,11 @@
33GameTips::GameTips33GameTips::GameTips
34 (UI::ProgressWindow & progressWindow, const std::vector<std::string>& names)34 (UI::ProgressWindow & progressWindow, const std::vector<std::string>& names)
35:35:
36m_lastUpdated (0),36lastUpdated_ (0),
37m_updateAfter (0),37updateAfter_ (0),
38m_progressWindow(progressWindow),38progressWindow_(progressWindow),
39m_registered (false),39registered_ (false),
40m_lastTip (0)40lastTip_ (0)
41{41{
42 // Loading texts-locals, for translating the tips42 // Loading texts-locals, for translating the tips
43 i18n::Textdomain textdomain("texts");43 i18n::Textdomain textdomain("texts");
@@ -45,11 +45,11 @@
45 for (uint8_t i = 0; i < names.size(); ++i)45 for (uint8_t i = 0; i < names.size(); ++i)
46 load_tips(names[i]);46 load_tips(names[i]);
4747
48 if (!m_tips.empty()) {48 if (!tips_.empty()) {
49 // add visualization only if any tips are loaded49 // add visualization only if any tips are loaded
50 m_progressWindow.add_visualization(this);50 progressWindow_.add_visualization(this);
51 m_registered = true;51 registered_ = true;
52 m_lastTip = m_tips.size();52 lastTip_ = tips_.size();
53 }53 }
54}54}
5555
@@ -71,7 +71,7 @@
71 Tip tip;71 Tip tip;
72 tip.text = text;72 tip.text = text;
73 tip.interval = s->get_int("sec", DEFAULT_INTERVAL);73 tip.interval = s->get_int("sec", DEFAULT_INTERVAL);
74 m_tips.push_back (tip);74 tips_.push_back (tip);
75 }75 }
76 } catch (std::exception &) {76 } catch (std::exception &) {
77 // just ignore - tips do not impact game77 // just ignore - tips do not impact game
@@ -81,24 +81,24 @@
8181
82void GameTips::update(bool repaint) {82void GameTips::update(bool repaint) {
83 uint8_t ticks = SDL_GetTicks();83 uint8_t ticks = SDL_GetTicks();
84 if (ticks >= (m_lastUpdated + m_updateAfter)) {84 if (ticks >= (lastUpdated_ + updateAfter_)) {
85 const uint32_t next = rand() % m_tips.size();85 const uint32_t next = rand() % tips_.size();
86 if (next == m_lastTip)86 if (next == lastTip_)
87 m_lastTip = (next + 1) % m_tips.size();87 lastTip_ = (next + 1) % tips_.size();
88 else88 else
89 m_lastTip = next;89 lastTip_ = next;
90 show_tip(next);90 show_tip(next);
91 m_lastUpdated = SDL_GetTicks();91 lastUpdated_ = SDL_GetTicks();
92 m_updateAfter = m_tips[next].interval * 1000;92 updateAfter_ = tips_[next].interval * 1000;
93 } else if (repaint) {93 } else if (repaint) {
94 show_tip(m_lastTip);94 show_tip(lastTip_);
95 }95 }
96}96}
9797
98void GameTips::stop() {98void GameTips::stop() {
99 if (m_registered) {99 if (registered_) {
100 m_progressWindow.remove_visualization(this);100 progressWindow_.remove_visualization(this);
101 m_registered = false;101 registered_ = false;
102 }102 }
103}103}
104104
@@ -117,7 +117,7 @@
117 rt.blit(pt, pic_background);117 rt.blit(pt, pic_background);
118118
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);
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);
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);
122122
123 g_gr->update();123 g_gr->update();
124124
=== modified file 'src/wui/game_tips.h'
--- src/wui/game_tips.h 2014-07-26 10:43:23 +0000
+++ src/wui/game_tips.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2007-2008 by the Widelands Development Team2 * Copyright (C) 2007-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -43,13 +43,13 @@
43 void load_tips(std::string);43 void load_tips(std::string);
44 void show_tip(int32_t index);44 void show_tip(int32_t index);
4545
46 uint32_t m_lastUpdated;46 uint32_t lastUpdated_;
47 uint32_t m_updateAfter;47 uint32_t updateAfter_;
48 UI::ProgressWindow & m_progressWindow;48 UI::ProgressWindow & progressWindow_;
49 bool m_registered;49 bool registered_;
50 uint32_t m_lastTip;50 uint32_t lastTip_;
5151
52 std::vector<Tip> m_tips;52 std::vector<Tip> tips_;
53};53};
5454
55#endif // end of include guard: WL_WUI_GAME_TIPS_H55#endif // end of include guard: WL_WUI_GAME_TIPS_H
5656
=== modified file 'src/wui/gamechatpanel.cc'
--- src/wui/gamechatpanel.cc 2014-09-20 09:37:47 +0000
+++ src/wui/gamechatpanel.cc 2016-01-24 20:25:45 +0000
@@ -33,7 +33,7 @@
33 ChatProvider & chat)33 ChatProvider & chat)
34 :34 :
35 UI::Panel(parent, x, y, w, h),35 UI::Panel(parent, x, y, w, h),
36 m_chat (chat),36 chat_ (chat),
37 chatbox (this, 0, 0, w, h - 25, "", UI::Align_Left, 1),37 chatbox (this, 0, 0, w, h - 25, "", UI::Align_Left, 1),
38 editbox (this, 0, h - 20, w, 20),38 editbox (this, 0, h - 20, w, 20),
39 chat_message_counter(std::numeric_limits<uint32_t>::max())39 chat_message_counter(std::numeric_limits<uint32_t>::max())
@@ -57,7 +57,7 @@
57 */57 */
58void GameChatPanel::recalculate()58void GameChatPanel::recalculate()
59{59{
60 const std::vector<ChatMessage> msgs = m_chat.get_messages();60 const std::vector<ChatMessage> msgs = chat_.get_messages();
6161
62 std::string str = "<rt>";62 std::string str = "<rt>";
63 for (uint32_t i = 0; i < msgs.size(); ++i) {63 for (uint32_t i = 0; i < msgs.size(); ++i) {
@@ -75,7 +75,7 @@
75 // Note: if many messages arrive simultaneously,75 // Note: if many messages arrive simultaneously,
76 // the latest is a system message and some others76 // the latest is a system message and some others
77 // are not, then this act wrong!77 // are not, then this act wrong!
78 if (!msgs.back().sender.empty() && !m_chat.sound_off())78 if (!msgs.back().sender.empty() && !chat_.sound_off())
79 {79 {
80 // The latest message is not a system message80 // The latest message is not a system message
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())
@@ -104,7 +104,7 @@
104 const std::string & str = editbox.text();104 const std::string & str = editbox.text();
105105
106 if (str.size())106 if (str.size())
107 m_chat.send(str);107 chat_.send(str);
108108
109 editbox.set_text("");109 editbox.set_text("");
110 sent();110 sent();
111111
=== modified file 'src/wui/gamechatpanel.h'
--- src/wui/gamechatpanel.h 2014-09-20 09:37:47 +0000
+++ src/wui/gamechatpanel.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2008-2011 by the Widelands Development Team2 * Copyright (C) 2008-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -54,7 +54,7 @@
54 void key_enter();54 void key_enter();
55 void key_escape();55 void key_escape();
5656
57 ChatProvider & m_chat;57 ChatProvider & chat_;
58 UI::MultilineTextarea chatbox;58 UI::MultilineTextarea chatbox;
59 UI::EditBox editbox;59 UI::EditBox editbox;
60 uint32_t chat_message_counter;60 uint32_t chat_message_counter;
6161
=== modified file 'src/wui/general_statistics_menu.cc'
--- src/wui/general_statistics_menu.cc 2015-11-28 22:29:26 +0000
+++ src/wui/general_statistics_menu.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -52,21 +52,21 @@
52UI::UniqueWindow52UI::UniqueWindow
53 (&parent, "statistics_menu", &registry,53 (&parent, "statistics_menu", &registry,
54 440, 400, _("General Statistics")),54 440, 400, _("General Statistics")),
55m_my_registry (&registry),55 my_registry_ (&registry),
56m_box (this, 0, 0, UI::Box::Vertical, 0, 0, 5),56 box_ (this, 0, 0, UI::Box::Vertical, 0, 0, 5),
57m_plot (&m_box, 0, 0, 430, PLOT_HEIGHT),57 plot_ (&box_, 0, 0, 430, PLOT_HEIGHT),
58m_selected_information(0)58 selected_information_(0)
59{59{
60 assert (m_my_registry);60 assert (my_registry_);
6161
62 m_selected_information = m_my_registry->selected_information;62 selected_information_ = my_registry_->selected_information;
6363
64 set_center_panel(&m_box);64 set_center_panel(&box_);
65 m_box.set_border(5, 5, 5, 5);65 box_.set_border(5, 5, 5, 5);
6666
67 // Setup plot data67 // Setup plot data
68 m_plot.set_sample_rate(STATISTICS_SAMPLE_TIME);68 plot_.set_sample_rate(STATISTICS_SAMPLE_TIME);
69 m_plot.set_plotmode(WuiPlotArea::PLOTMODE_ABSOLUTE);69 plot_.set_plotmode(WuiPlotArea::PLOTMODE_ABSOLUTE);
70 Game & game = *parent.get_game();70 Game & game = *parent.get_game();
71 const Game::GeneralStatsVector & genstats =71 const Game::GeneralStatsVector & genstats =
72 game.get_general_statistics();72 game.get_general_statistics();
@@ -74,14 +74,14 @@
74 general_statistics_size = genstats.size();74 general_statistics_size = genstats.size();
7575
76 // Is there a hook dataset?76 // Is there a hook dataset?
77 m_ndatasets = NR_BASE_DATASETS;77 ndatasets_ = NR_BASE_DATASETS;
78 std::unique_ptr<LuaTable> hook = game.lua().get_hook("custom_statistic");78 std::unique_ptr<LuaTable> hook = game.lua().get_hook("custom_statistic");
79 std::string cs_name, cs_pic;79 std::string cs_name, cs_pic;
80 if (hook) {80 if (hook) {
81 hook->do_not_warn_about_unaccessed_keys();81 hook->do_not_warn_about_unaccessed_keys();
82 cs_name = hook->get_string("name");82 cs_name = hook->get_string("name");
83 cs_pic = hook->get_string("pic");83 cs_pic = hook->get_string("pic");
84 m_ndatasets++;84 ndatasets_++;
85 }85 }
8686
87 for87 for
@@ -90,56 +90,56 @@
90 ++i)90 ++i)
91 {91 {
92 const RGBColor & color = Player::Colors[i];92 const RGBColor & color = Player::Colors[i];
93 m_plot.register_plot_data93 plot_.register_plot_data
94 (i * m_ndatasets + 0, &genstats[i].land_size,94 (i * ndatasets_ + 0, &genstats[i].land_size,
95 color);95 color);
96 m_plot.register_plot_data96 plot_.register_plot_data
97 (i * m_ndatasets + 1, &genstats[i].nr_workers,97 (i * ndatasets_ + 1, &genstats[i].nr_workers,
98 color);98 color);
99 m_plot.register_plot_data99 plot_.register_plot_data
100 (i * m_ndatasets + 2, &genstats[i].nr_buildings,100 (i * ndatasets_ + 2, &genstats[i].nr_buildings,
101 color);101 color);
102 m_plot.register_plot_data102 plot_.register_plot_data
103 (i * m_ndatasets + 3, &genstats[i].nr_wares,103 (i * ndatasets_ + 3, &genstats[i].nr_wares,
104 color);104 color);
105 m_plot.register_plot_data105 plot_.register_plot_data
106 (i * m_ndatasets + 4, &genstats[i].productivity,106 (i * ndatasets_ + 4, &genstats[i].productivity,
107 color);107 color);
108 m_plot.register_plot_data108 plot_.register_plot_data
109 (i * m_ndatasets + 5, &genstats[i].nr_casualties,109 (i * ndatasets_ + 5, &genstats[i].nr_casualties,
110 color);110 color);
111 m_plot.register_plot_data111 plot_.register_plot_data
112 (i * m_ndatasets + 6, &genstats[i].nr_kills,112 (i * ndatasets_ + 6, &genstats[i].nr_kills,
113 color);113 color);
114 m_plot.register_plot_data114 plot_.register_plot_data
115 (i * m_ndatasets + 7, &genstats[i].nr_msites_lost,115 (i * ndatasets_ + 7, &genstats[i].nr_msites_lost,
116 color);116 color);
117 m_plot.register_plot_data117 plot_.register_plot_data
118 (i * m_ndatasets + 8, &genstats[i].nr_msites_defeated,118 (i * ndatasets_ + 8, &genstats[i].nr_msites_defeated,
119 color);119 color);
120 m_plot.register_plot_data120 plot_.register_plot_data
121 (i * m_ndatasets + 9, &genstats[i].nr_civil_blds_lost,121 (i * ndatasets_ + 9, &genstats[i].nr_civil_blds_lost,
122 color);122 color);
123 m_plot.register_plot_data123 plot_.register_plot_data
124 (i * m_ndatasets + 10, &genstats[i].miltary_strength,124 (i * ndatasets_ + 10, &genstats[i].miltary_strength,
125 color);125 color);
126 if (hook) {126 if (hook) {
127 m_plot.register_plot_data127 plot_.register_plot_data
128 (i * m_ndatasets + 11, &genstats[i].custom_statistic,128 (i * ndatasets_ + 11, &genstats[i].custom_statistic,
129 color);129 color);
130 }130 }
131 if (game.get_player(i + 1)) // Show area plot131 if (game.get_player(i + 1)) // Show area plot
132 m_plot.show_plot132 plot_.show_plot
133 (i * m_ndatasets + m_selected_information,133 (i * ndatasets_ + selected_information_,
134 m_my_registry->selected_players[i]);134 my_registry_->selected_players[i]);
135 }135 }
136136
137 m_plot.set_time(m_my_registry->time);137 plot_.set_time(my_registry_->time);
138138
139 // Setup Widgets139 // Setup Widgets
140 m_box.add(&m_plot, UI::Box::AlignTop);140 box_.add(&plot_, UI::Box::AlignTop);
141141
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);
143143
144 uint32_t plr_in_game = 0;144 uint32_t plr_in_game = 0;
145 PlayerNumber const nr_players = game.map().get_nrplayers();145 PlayerNumber const nr_players = game.map().get_nrplayers();
@@ -157,21 +157,21 @@
157 player->get_name().c_str());157 player->get_name().c_str());
158 cb.sigclicked.connect158 cb.sigclicked.connect
159 (boost::bind(&GeneralStatisticsMenu::cb_changed_to, this, p));159 (boost::bind(&GeneralStatisticsMenu::cb_changed_to, this, p));
160 cb.set_perm_pressed(m_my_registry->selected_players[p - 1]);160 cb.set_perm_pressed(my_registry_->selected_players[p - 1]);
161161
162 m_cbs[p - 1] = &cb;162 cbs_[p - 1] = &cb;
163163
164 hbox1->add(&cb, UI::Box::AlignLeft, false, true);164 hbox1->add(&cb, UI::Box::AlignLeft, false, true);
165 } else // player nr p does not exist165 } else // player nr p does not exist
166 m_cbs[p - 1] = nullptr;166 cbs_[p - 1] = nullptr;
167167
168 m_box.add(hbox1, UI::Box::AlignTop, true);168 box_.add(hbox1, UI::Box::AlignTop, true);
169169
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);
171171
172 UI::Radiobutton * btn;172 UI::Radiobutton * btn;
173173
174 m_radiogroup.add_button174 radiogroup_.add_button
175 (hbox2,175 (hbox2,
176 Point(0, 0),176 Point(0, 0),
177 g_gr->images().get("pics/genstats_landsize.png"),177 g_gr->images().get("pics/genstats_landsize.png"),
@@ -179,7 +179,7 @@
179 &btn);179 &btn);
180 hbox2->add(btn, UI::Box::AlignLeft, false, true);180 hbox2->add(btn, UI::Box::AlignLeft, false, true);
181181
182 m_radiogroup.add_button182 radiogroup_.add_button
183 (hbox2,183 (hbox2,
184 Point(0, 0),184 Point(0, 0),
185 g_gr->images().get("pics/genstats_nrworkers.png"),185 g_gr->images().get("pics/genstats_nrworkers.png"),
@@ -187,7 +187,7 @@
187 &btn);187 &btn);
188 hbox2->add(btn, UI::Box::AlignLeft, false, true);188 hbox2->add(btn, UI::Box::AlignLeft, false, true);
189189
190 m_radiogroup.add_button190 radiogroup_.add_button
191 (hbox2,191 (hbox2,
192 Point(0, 0),192 Point(0, 0),
193 g_gr->images().get("pics/genstats_nrbuildings.png"),193 g_gr->images().get("pics/genstats_nrbuildings.png"),
@@ -195,7 +195,7 @@
195 &btn);195 &btn);
196 hbox2->add(btn, UI::Box::AlignLeft, false, true);196 hbox2->add(btn, UI::Box::AlignLeft, false, true);
197197
198 m_radiogroup.add_button198 radiogroup_.add_button
199 (hbox2,199 (hbox2,
200 Point(0, 0),200 Point(0, 0),
201 g_gr->images().get("pics/genstats_nrwares.png"),201 g_gr->images().get("pics/genstats_nrwares.png"),
@@ -203,7 +203,7 @@
203 &btn);203 &btn);
204 hbox2->add(btn, UI::Box::AlignLeft, false, true);204 hbox2->add(btn, UI::Box::AlignLeft, false, true);
205205
206 m_radiogroup.add_button206 radiogroup_.add_button
207 (hbox2,207 (hbox2,
208 Point(0, 0),208 Point(0, 0),
209 g_gr->images().get("pics/genstats_productivity.png"),209 g_gr->images().get("pics/genstats_productivity.png"),
@@ -211,7 +211,7 @@
211 &btn);211 &btn);
212 hbox2->add(btn, UI::Box::AlignLeft, false, true);212 hbox2->add(btn, UI::Box::AlignLeft, false, true);
213213
214 m_radiogroup.add_button214 radiogroup_.add_button
215 (hbox2,215 (hbox2,
216 Point(0, 0),216 Point(0, 0),
217 g_gr->images().get("pics/genstats_casualties.png"),217 g_gr->images().get("pics/genstats_casualties.png"),
@@ -219,7 +219,7 @@
219 &btn);219 &btn);
220 hbox2->add(btn, UI::Box::AlignLeft, false, true);220 hbox2->add(btn, UI::Box::AlignLeft, false, true);
221221
222 m_radiogroup.add_button222 radiogroup_.add_button
223 (hbox2,223 (hbox2,
224 Point(0, 0),224 Point(0, 0),
225 g_gr->images().get("pics/genstats_kills.png"),225 g_gr->images().get("pics/genstats_kills.png"),
@@ -227,7 +227,7 @@
227 &btn);227 &btn);
228 hbox2->add(btn, UI::Box::AlignLeft, false, true);228 hbox2->add(btn, UI::Box::AlignLeft, false, true);
229229
230 m_radiogroup.add_button230 radiogroup_.add_button
231 (hbox2,231 (hbox2,
232 Point(0, 0),232 Point(0, 0),
233 g_gr->images().get("pics/genstats_msites_lost.png"),233 g_gr->images().get("pics/genstats_msites_lost.png"),
@@ -235,7 +235,7 @@
235 &btn);235 &btn);
236 hbox2->add(btn, UI::Box::AlignLeft, false, true);236 hbox2->add(btn, UI::Box::AlignLeft, false, true);
237237
238 m_radiogroup.add_button238 radiogroup_.add_button
239 (hbox2,239 (hbox2,
240 Point(0, 0),240 Point(0, 0),
241 g_gr->images().get("pics/genstats_msites_defeated.png"),241 g_gr->images().get("pics/genstats_msites_defeated.png"),
@@ -243,7 +243,7 @@
243 &btn);243 &btn);
244 hbox2->add(btn, UI::Box::AlignLeft, false, true);244 hbox2->add(btn, UI::Box::AlignLeft, false, true);
245245
246 m_radiogroup.add_button246 radiogroup_.add_button
247 (hbox2,247 (hbox2,
248 Point(0, 0),248 Point(0, 0),
249 g_gr->images().get("pics/genstats_civil_blds_lost.png"),249 g_gr->images().get("pics/genstats_civil_blds_lost.png"),
@@ -251,7 +251,7 @@
251 &btn);251 &btn);
252 hbox2->add(btn, UI::Box::AlignLeft, false, true);252 hbox2->add(btn, UI::Box::AlignLeft, false, true);
253253
254 m_radiogroup.add_button254 radiogroup_.add_button
255 (hbox2,255 (hbox2,
256 Point(0, 0),256 Point(0, 0),
257 g_gr->images().get("pics/genstats_militarystrength.png"),257 g_gr->images().get("pics/genstats_militarystrength.png"),
@@ -260,7 +260,7 @@
260 hbox2->add(btn, UI::Box::AlignLeft, false, true);260 hbox2->add(btn, UI::Box::AlignLeft, false, true);
261261
262 if (hook) {262 if (hook) {
263 m_radiogroup.add_button263 radiogroup_.add_button
264 (hbox2,264 (hbox2,
265 Point(0, 0),265 Point(0, 0),
266 g_gr->images().get(cs_pic),266 g_gr->images().get(cs_pic),
@@ -269,15 +269,15 @@
269 hbox2->add(btn, UI::Box::AlignLeft, false, true);269 hbox2->add(btn, UI::Box::AlignLeft, false, true);
270 }270 }
271271
272 m_radiogroup.set_state(m_selected_information);272 radiogroup_.set_state(selected_information_);
273 m_radiogroup.changedto.connect273 radiogroup_.changedto.connect
274 (boost::bind(&GeneralStatisticsMenu::radiogroup_changed, this, _1));274 (boost::bind(&GeneralStatisticsMenu::radiogroup_changed, this, _1));
275275
276 m_box.add(hbox2, UI::Box::AlignTop, true);276 box_.add(hbox2, UI::Box::AlignTop, true);
277277
278 m_box.add278 box_.add
279 (new WuiPlotAreaSlider279 (new WuiPlotAreaSlider
280 (&m_box, m_plot, 0, 0, 100, 45,280 (&box_, plot_, 0, 0, 100, 45,
281 g_gr->images().get("pics/but1.png"))281 g_gr->images().get("pics/but1.png"))
282 , UI::Box::AlignTop282 , UI::Box::AlignTop
283 , true);283 , true);
@@ -288,11 +288,11 @@
288 Game & game = dynamic_cast<InteractiveGameBase&>(*get_parent()).game();288 Game & game = dynamic_cast<InteractiveGameBase&>(*get_parent()).game();
289 if (game.is_loaded()) {289 if (game.is_loaded()) {
290 // Save informations for recreation, if window is reopened290 // Save informations for recreation, if window is reopened
291 m_my_registry->selected_information = m_selected_information;291 my_registry_->selected_information = selected_information_;
292 m_my_registry->time = m_plot.get_time();292 my_registry_->time = plot_.get_time();
293 PlayerNumber const nr_players = game.map().get_nrplayers();293 PlayerNumber const nr_players = game.map().get_nrplayers();
294 iterate_players_existing_novar(p, nr_players, game) {294 iterate_players_existing_novar(p, nr_players, game) {
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();
296 }296 }
297 }297 }
298}298}
@@ -310,11 +310,11 @@
310void GeneralStatisticsMenu::cb_changed_to(int32_t const id)310void GeneralStatisticsMenu::cb_changed_to(int32_t const id)
311{311{
312 // This represents our player number312 // This represents our player number
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());
314314
315 m_plot.show_plot315 plot_.show_plot
316 ((id - 1) * m_ndatasets + m_selected_information,316 ((id - 1) * ndatasets_ + selected_information_,
317 m_cbs[id - 1]->get_perm_pressed());317 cbs_[id - 1]->get_perm_pressed());
318}318}
319319
320/*320/*
@@ -325,11 +325,11 @@
325 dynamic_cast<InteractiveGameBase&>(*get_parent()).game()325 dynamic_cast<InteractiveGameBase&>(*get_parent()).game()
326 .get_general_statistics().size();326 .get_general_statistics().size();
327 for (uint32_t i = 0; i < statistics_size; ++i)327 for (uint32_t i = 0; i < statistics_size; ++i)
328 if (m_cbs[i]) {328 if (cbs_[i]) {
329 m_plot.show_plot329 plot_.show_plot
330 (i * m_ndatasets + id, m_cbs[i]->get_perm_pressed());330 (i * ndatasets_ + id, cbs_[i]->get_perm_pressed());
331 m_plot.show_plot331 plot_.show_plot
332 (i * m_ndatasets + m_selected_information, false);332 (i * ndatasets_ + selected_information_, false);
333 }333 }
334 m_selected_information = id;334 selected_information_ = id;
335}335}
336336
=== modified file 'src/wui/general_statistics_menu.h'
--- src/wui/general_statistics_menu.h 2014-09-10 13:03:40 +0000
+++ src/wui/general_statistics_menu.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -53,13 +53,13 @@
53 virtual ~GeneralStatisticsMenu();53 virtual ~GeneralStatisticsMenu();
5454
55private:55private:
56 Registry * m_my_registry;56 Registry * my_registry_;
57 UI::Box m_box;57 UI::Box box_;
58 WuiPlotArea m_plot;58 WuiPlotArea plot_;
59 UI::Radiogroup m_radiogroup;59 UI::Radiogroup radiogroup_;
60 int32_t m_selected_information;60 int32_t selected_information_;
61 UI::Button * m_cbs[MAX_PLAYERS];61 UI::Button * cbs_[MAX_PLAYERS];
62 uint32_t m_ndatasets;62 uint32_t ndatasets_;
6363
64 void clicked_help();64 void clicked_help();
65 void cb_changed_to(int32_t);65 void cb_changed_to(int32_t);
6666
=== modified file 'src/wui/interactive_gamebase.cc'
--- src/wui/interactive_gamebase.cc 2016-01-16 15:57:31 +0000
+++ src/wui/interactive_gamebase.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2007-2011 by the Widelands Development Team2 * Copyright (C) 2007-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -52,25 +52,25 @@
52 :52 :
53 InteractiveBase(_game, global_s),53 InteractiveBase(_game, global_s),
54 chat_provider_(nullptr),54 chat_provider_(nullptr),
55 m_building_census_format55 building_census_format_
56 (global_s.get_string("building_census_format", "%N")),56 (global_s.get_string("building_census_format", "%N")),
57 m_building_statistics_format57 building_statistics_format_
58 (global_s.get_string("building_statistics_format", "%t")),58 (global_s.get_string("building_statistics_format", "%t")),
59 m_building_tooltip_format59 building_tooltip_format_
60 (global_s.get_string("building_tooltip_format", "%r")),60 (global_s.get_string("building_tooltip_format", "%r")),
61 m_chatenabled(chatenabled),61 chatenabled_(chatenabled),
62 m_multiplayer(multiplayer),62 multiplayer_(multiplayer),
63 m_playertype(pt),63 playertype_(pt),
6464
65#define INIT_BTN(picture, name, tooltip) \65#define INIT_BTN(picture, name, tooltip) \
66 TOOLBAR_BUTTON_COMMON_PARAMETERS(name), \66 TOOLBAR_BUTTON_COMMON_PARAMETERS(name), \
67 g_gr->images().get("pics/" picture ".png"), \67 g_gr->images().get("pics/" picture ".png"), \
68 tooltip \68 tooltip \
6969
70 m_toggle_buildhelp70 toggle_buildhelp_
71 (INIT_BTN("menu_toggle_buildhelp", "buildhelp", _("Show Building Spaces (on/off)")))71 (INIT_BTN("menu_toggle_buildhelp", "buildhelp", _("Show Building Spaces (on/off)")))
72{72{
73 m_toggle_buildhelp.sigclicked.connect(boost::bind(&InteractiveGameBase::toggle_buildhelp, this));73 toggle_buildhelp_.sigclicked.connect(boost::bind(&InteractiveGameBase::toggle_buildhelp, this));
74}74}
7575
76/// \return a pointer to the running \ref Game instance.76/// \return a pointer to the running \ref Game instance.
@@ -90,7 +90,7 @@
90 chat_provider_ = &chat;90 chat_provider_ = &chat;
91 chat_overlay_->set_chat_provider(chat);91 chat_overlay_->set_chat_provider(chat);
9292
93 m_chatenabled = true;93 chatenabled_ = true;
94}94}
9595
96ChatProvider * InteractiveGameBase::get_chat_provider()96ChatProvider * InteractiveGameBase::get_chat_provider()
@@ -137,7 +137,7 @@
137 Widelands::Map & map = egbase().map();137 Widelands::Map & map = egbase().map();
138 auto* overlay_manager = mutable_field_overlay_manager();138 auto* overlay_manager = mutable_field_overlay_manager();
139 show_buildhelp(false);139 show_buildhelp(false);
140 m_toggle_buildhelp.set_perm_pressed(buildhelp());140 toggle_buildhelp_.set_perm_pressed(buildhelp());
141141
142 overlay_manager->register_overlay_callback_function142 overlay_manager->register_overlay_callback_function
143 (boost::bind(&InteractiveGameBase::calculate_buildcaps, this, _1));143 (boost::bind(&InteractiveGameBase::calculate_buildcaps, this, _1));
@@ -147,14 +147,14 @@
147 map.recalc_whole_map(egbase().world());147 map.recalc_whole_map(egbase().world());
148148
149 // Close game-relevant UI windows (but keep main menu open)149 // Close game-relevant UI windows (but keep main menu open)
150 delete m_fieldaction.window;150 delete fieldaction_.window;
151 m_fieldaction.window = nullptr;151 fieldaction_.window = nullptr;
152152
153 hide_minimap();153 hide_minimap();
154}154}
155155
156void InteractiveGameBase::on_buildhelp_changed(const bool value) {156void InteractiveGameBase::on_buildhelp_changed(const bool value) {
157 m_toggle_buildhelp.set_perm_pressed(value);157 toggle_buildhelp_.set_perm_pressed(value);
158}158}
159159
160/**160/**
@@ -188,10 +188,10 @@
188void InteractiveGameBase::show_game_summary()188void InteractiveGameBase::show_game_summary()
189{189{
190 game().game_controller()->set_desired_speed(0);190 game().game_controller()->set_desired_speed(0);
191 if (m_game_summary.window) {191 if (game_summary_.window) {
192 m_game_summary.window->set_visible(true);192 game_summary_.window->set_visible(true);
193 m_game_summary.window->think();193 game_summary_.window->think();
194 return;194 return;
195 }195 }
196 new GameSummaryScreen(this, &m_game_summary);196 new GameSummaryScreen(this, &game_summary_);
197}197}
198198
=== modified file 'src/wui/interactive_gamebase.h'
--- src/wui/interactive_gamebase.h 2016-01-16 15:57:31 +0000
+++ src/wui/interactive_gamebase.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2003, 2006-2013 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -62,13 +62,13 @@
6262
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.
64 const std::string & building_census_format () const {64 const std::string & building_census_format () const {
65 return m_building_census_format;65 return building_census_format_;
66 }66 }
67 const std::string & building_statistics_format () const {67 const std::string & building_statistics_format () const {
68 return m_building_statistics_format;68 return building_statistics_format_;
69 }69 }
70 const std::string & building_tooltip_format () const {70 const std::string & building_tooltip_format () const {
71 return m_building_tooltip_format;71 return building_tooltip_format_;
72 }72 }
7373
74 virtual bool can_see(Widelands::PlayerNumber) const = 0;74 virtual bool can_see(Widelands::PlayerNumber) const = 0;
@@ -76,11 +76,11 @@
76 virtual Widelands::PlayerNumber player_number() const = 0;76 virtual Widelands::PlayerNumber player_number() const = 0;
7777
78 virtual void node_action() = 0;78 virtual void node_action() = 0;
79 const PlayerType & get_playertype()const {return m_playertype;}79 const PlayerType & get_playertype()const {return playertype_;}
80 void set_playertype(const PlayerType & pt) {m_playertype = pt;}80 void set_playertype(const PlayerType & pt) {playertype_ = pt;}
8181
82 bool try_show_ship_window();82 bool try_show_ship_window();
83 bool is_multiplayer() {return m_multiplayer;}83 bool is_multiplayer() {return multiplayer_;}
8484
85 void show_game_summary();85 void show_game_summary();
86 void postload() override;86 void postload() override;
@@ -90,18 +90,18 @@
90 void draw_overlay(RenderTarget &) override;90 void draw_overlay(RenderTarget &) override;
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;
9292
93 GameMainMenuWindows m_mainm_windows;93 GameMainMenuWindows main_windows_;
94 ChatProvider * chat_provider_;94 ChatProvider * chat_provider_;
95 std::string m_building_census_format;95 std::string building_census_format_;
96 std::string m_building_statistics_format;96 std::string building_statistics_format_;
97 std::string m_building_tooltip_format;97 std::string building_tooltip_format_;
98 bool m_chatenabled;98 bool chatenabled_;
99 bool m_multiplayer;99 bool multiplayer_;
100 PlayerType m_playertype;100 PlayerType playertype_;
101 UI::UniqueWindow::Registry m_fieldaction;101 UI::UniqueWindow::Registry fieldaction_;
102 UI::UniqueWindow::Registry m_game_summary;102 UI::UniqueWindow::Registry game_summary_;
103103
104 UI::Button m_toggle_buildhelp;104 UI::Button toggle_buildhelp_;
105105
106private:106private:
107 void on_buildhelp_changed(const bool value) override;107 void on_buildhelp_changed(const bool value) override;
108108
=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc 2016-01-16 15:57:31 +0000
+++ src/wui/interactive_player.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -66,8 +66,8 @@
66 bool const multiplayer)66 bool const multiplayer)
67 :67 :
68 InteractiveGameBase (_game, global_s, NONE, multiplayer, multiplayer),68 InteractiveGameBase (_game, global_s, NONE, multiplayer, multiplayer),
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)),
70 m_flag_to_connect(Widelands::Coords::null()),70 flag_to_connect_(Widelands::Coords::null()),
7171
72// Chat is different, as chat_provider_ needs to be checked when toggling72// Chat is different, as chat_provider_ needs to be checked when toggling
73// Minimap is different as it warps and stuff73// Minimap is different as it warps and stuff
@@ -84,59 +84,59 @@
84 tooltip \84 tooltip \
8585
8686
87m_toggle_chat87toggle_chat_
88 (INIT_BTN_this88 (INIT_BTN_this
89 ("menu_chat", "chat", _("Chat"))),89 ("menu_chat", "chat", _("Chat"))),
90m_toggle_options_menu90toggle_options_menu_
91 (INIT_BTN91 (INIT_BTN
92 ("menu_options_menu", "options_menu", _("Options"))),92 ("menu_options_menu", "options_menu", _("Options"))),
93m_toggle_statistics_menu93toggle_statistics_menu_
94 (INIT_BTN94 (INIT_BTN
95 ("menu_toggle_menu", "statistics_menu", _("Statistics"))),95 ("menu_toggle_menu", "statistics_menu", _("Statistics"))),
96m_toggle_objectives96toggle_objectives_
97 (INIT_BTN97 (INIT_BTN
98 ("menu_objectives", "objectives", _("Objectives"))),98 ("menu_objectives", "objectives", _("Objectives"))),
99m_toggle_minimap99toggle_minimap_
100 (INIT_BTN_this100 (INIT_BTN_this
101 ("menu_toggle_minimap", "minimap", _("Minimap"))),101 ("menu_toggle_minimap", "minimap", _("Minimap"))),
102m_toggle_message_menu102toggle_message_menu_
103 (INIT_BTN103 (INIT_BTN
104 ("menu_toggle_oldmessage_menu", "messages", _("Messages"))),104 ("menu_toggle_oldmessage_menu", "messages", _("Messages"))),
105m_toggle_help105toggle_help_
106 (INIT_BTN106 (INIT_BTN
107 ("menu_help", "help", _("Tribal Encyclopedia")))107 ("menu_help", "help", _("Tribal Encyclopedia")))
108108
109{109{
110 m_toggle_chat.sigclicked.connect110 toggle_chat_.sigclicked.connect
111 (boost::bind(&InteractivePlayer::toggle_chat, this));111 (boost::bind(&InteractivePlayer::toggle_chat, this));
112 m_toggle_options_menu.sigclicked.connect112 toggle_options_menu_.sigclicked.connect
113 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_options)));113 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(options_)));
114 m_toggle_statistics_menu.sigclicked.connect114 toggle_statistics_menu_.sigclicked.connect
115 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_statisticsmenu)));115 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(statisticsmenu_)));
116 m_toggle_objectives.sigclicked.connect116 toggle_objectives_.sigclicked.connect
117 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_objectives)));117 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(objectives_)));
118 m_toggle_minimap.sigclicked.connect118 toggle_minimap_.sigclicked.connect
119 (boost::bind(&InteractivePlayer::toggle_minimap, this));119 (boost::bind(&InteractivePlayer::toggle_minimap, this));
120 m_toggle_message_menu.sigclicked.connect120 toggle_message_menu_.sigclicked.connect
121 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_message_menu)));121 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(message_menu_)));
122 m_toggle_help.sigclicked.connect122 toggle_help_.sigclicked.connect
123 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_encyclopedia)));123 (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(encyclopedia_)));
124124
125 // TODO(unknown): instead of making unneeded buttons invisible after generation,125 // TODO(unknown): instead of making unneeded buttons invisible after generation,
126 // they should not at all be generated. -> implement more dynamic toolbar UI126 // they should not at all be generated. -> implement more dynamic toolbar UI
127 toolbar_.add(&m_toggle_options_menu, UI::Box::AlignLeft);127 toolbar_.add(&toggle_options_menu_, UI::Box::AlignLeft);
128 toolbar_.add(&m_toggle_statistics_menu, UI::Box::AlignLeft);128 toolbar_.add(&toggle_statistics_menu_, UI::Box::AlignLeft);
129 toolbar_.add(&m_toggle_minimap, UI::Box::AlignLeft);129 toolbar_.add(&toggle_minimap_, UI::Box::AlignLeft);
130 toolbar_.add(&m_toggle_buildhelp, UI::Box::AlignLeft);130 toolbar_.add(&toggle_buildhelp_, UI::Box::AlignLeft);
131 if (multiplayer) {131 if (multiplayer) {
132 toolbar_.add(&m_toggle_chat, UI::Box::AlignLeft);132 toolbar_.add(&toggle_chat_, UI::Box::AlignLeft);
133 m_toggle_chat.set_visible(false);133 toggle_chat_.set_visible(false);
134 m_toggle_chat.set_enabled(false);134 toggle_chat_.set_enabled(false);
135 }135 }
136136
137 toolbar_.add(&m_toggle_help, UI::Box::AlignLeft);137 toolbar_.add(&toggle_help_, UI::Box::AlignLeft);
138 toolbar_.add(&m_toggle_objectives, UI::Box::AlignLeft);138 toolbar_.add(&toggle_objectives_, UI::Box::AlignLeft);
139 toolbar_.add(&m_toggle_message_menu, UI::Box::AlignLeft);139 toolbar_.add(&toggle_message_menu_, UI::Box::AlignLeft);
140140
141 set_player_number(plyn);141 set_player_number(plyn);
142 fieldclicked.connect(boost::bind(&InteractivePlayer::node_action, this));142 fieldclicked.connect(boost::bind(&InteractivePlayer::node_action, this));
@@ -148,22 +148,22 @@
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); \
149 if (registry.window) btn.set_perm_pressed(true); \149 if (registry.window) btn.set_perm_pressed(true); \
150150
151 INIT_BTN_HOOKS(m_chat, m_toggle_chat)151 INIT_BTN_HOOKS(chat_, toggle_chat_)
152 INIT_BTN_HOOKS(m_options, m_toggle_options_menu)152 INIT_BTN_HOOKS(options_, toggle_options_menu_)
153 INIT_BTN_HOOKS(m_statisticsmenu, m_toggle_statistics_menu)153 INIT_BTN_HOOKS(statisticsmenu_, toggle_statistics_menu_)
154 INIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap)154 INIT_BTN_HOOKS(minimap_registry(), toggle_minimap_)
155 INIT_BTN_HOOKS(m_objectives, m_toggle_objectives)155 INIT_BTN_HOOKS(objectives_, toggle_objectives_)
156 INIT_BTN_HOOKS(m_encyclopedia, m_toggle_help)156 INIT_BTN_HOOKS(encyclopedia_, toggle_help_)
157 INIT_BTN_HOOKS(m_message_menu, m_toggle_message_menu)157 INIT_BTN_HOOKS(message_menu_, toggle_message_menu_)
158158
159 m_encyclopedia.open_window = [this] {new EncyclopediaWindow(*this, m_encyclopedia);};159 encyclopedia_.open_window = [this] {new EncyclopediaWindow(*this, encyclopedia_);};
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_);};
161 m_statisticsmenu.open_window = [this] {161 statisticsmenu_.open_window = [this] {
162 new GameMainMenu(*this, m_statisticsmenu, m_mainm_windows);162 new GameMainMenu(*this, statisticsmenu_, main_windows_);
163 };163 };
164 m_objectives.open_window = [this] {new GameObjectivesMenu(this, m_objectives);};164 objectives_.open_window = [this] {new GameObjectivesMenu(this, objectives_);};
165 m_message_menu.open_window = [this] {new GameMessageMenu(*this, m_message_menu);};165 message_menu_.open_window = [this] {new GameMessageMenu(*this, message_menu_);};
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);};
167167
168#ifndef NDEBUG // only in debug builds168#ifndef NDEBUG // only in debug builds
169 addCommand169 addCommand
@@ -177,46 +177,46 @@
177 registry.on_create = 0; \177 registry.on_create = 0; \
178 registry.on_delete = 0;178 registry.on_delete = 0;
179179
180 DEINIT_BTN_HOOKS(m_chat, m_toggle_chat)180 DEINIT_BTN_HOOKS(chat_, toggle_chat_)
181 DEINIT_BTN_HOOKS(m_options, m_toggle_options_menu)181 DEINIT_BTN_HOOKS(options_, toggle_options_menu_)
182 DEINIT_BTN_HOOKS(m_statisticsmenu, m_toggle_statistics_menu)182 DEINIT_BTN_HOOKS(statisticsmenu_, toggle_statistics_menu_)
183 DEINIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap)183 DEINIT_BTN_HOOKS(minimap_registry(), toggle_minimap_)
184 DEINIT_BTN_HOOKS(m_objectives, m_toggle_objectives)184 DEINIT_BTN_HOOKS(objectives_, toggle_objectives_)
185 DEINIT_BTN_HOOKS(m_encyclopedia, m_toggle_help)185 DEINIT_BTN_HOOKS(encyclopedia_, toggle_help_)
186 DEINIT_BTN_HOOKS(m_message_menu, m_toggle_message_menu)186 DEINIT_BTN_HOOKS(message_menu_, toggle_message_menu_)
187}187}
188188
189void InteractivePlayer::think()189void InteractivePlayer::think()
190{190{
191 InteractiveBase::think();191 InteractiveBase::think();
192192
193 if (m_flag_to_connect) {193 if (flag_to_connect_) {
194 Widelands::Field & field = egbase().map()[m_flag_to_connect];194 Widelands::Field & field = egbase().map()[flag_to_connect_];
195 if (upcast(Widelands::Flag const, flag, field.get_immovable())) {195 if (upcast(Widelands::Flag const, flag, field.get_immovable())) {
196 if (!flag->has_road() && !is_building_road())196 if (!flag->has_road() && !is_building_road())
197 if (m_auto_roadbuild_mode) {197 if (auto_roadbuild_mode_) {
198 // There might be a fieldaction window open, showing a button198 // There might be a fieldaction window open, showing a button
199 // for roadbuilding. If that dialog remains open so that the199 // for roadbuilding. If that dialog remains open so that the
200 // button is clicked, we would enter roadbuilding mode while200 // button is clicked, we would enter roadbuilding mode while
201 // we are already in roadbuilding mode from the call below.201 // we are already in roadbuilding mode from the call below.
202 // That is not allowed. Therefore we must delete the202 // That is not allowed. Therefore we must delete the
203 // fieldaction window before entering roadbuilding mode here.203 // fieldaction window before entering roadbuilding mode here.
204 delete m_fieldaction.window;204 delete fieldaction_.window;
205 m_fieldaction.window = nullptr;205 fieldaction_.window = nullptr;
206 warp_mouse_to_node(m_flag_to_connect);206 warp_mouse_to_node(flag_to_connect_);
207 set_sel_pos207 set_sel_pos
208 (Widelands::NodeAndTriangle<>208 (Widelands::NodeAndTriangle<>
209 (m_flag_to_connect,209 (flag_to_connect_,
210 Widelands::TCoords<>210 Widelands::TCoords<>
211 (m_flag_to_connect, Widelands::TCoords<>::D)));211 (flag_to_connect_, Widelands::TCoords<>::D)));
212 start_build_road(m_flag_to_connect, field.get_owned_by());212 start_build_road(flag_to_connect_, field.get_owned_by());
213 }213 }
214 m_flag_to_connect = Widelands::Coords::null();214 flag_to_connect_ = Widelands::Coords::null();
215 }215 }
216 }216 }
217 if (is_multiplayer()) {217 if (is_multiplayer()) {
218 m_toggle_chat.set_visible(m_chatenabled);218 toggle_chat_.set_visible(chatenabled_);
219 m_toggle_chat.set_enabled(m_chatenabled);219 toggle_chat_.set_enabled(chatenabled_);
220 }220 }
221 {221 {
222 char const * msg_icon = "pics/menu_toggle_oldmessage_menu.png";222 char const * msg_icon = "pics/menu_toggle_oldmessage_menu.png";
@@ -230,8 +230,8 @@
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)) %
231 nr_new_messages).str();231 nr_new_messages).str();
232 }232 }
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));
234 m_toggle_message_menu.set_tooltip(msg_tooltip);234 toggle_message_menu_.set_tooltip(msg_tooltip);
235 }235 }
236}236}
237237
@@ -239,18 +239,18 @@
239void InteractivePlayer::popup_message239void InteractivePlayer::popup_message
240 (Widelands::MessageId const id, const Widelands::Message & message)240 (Widelands::MessageId const id, const Widelands::Message & message)
241{241{
242 m_message_menu.create();242 message_menu_.create();
243 dynamic_cast<GameMessageMenu&>(*m_message_menu.window)243 dynamic_cast<GameMessageMenu&>(*message_menu_.window)
244 .show_new_message(id, message);244 .show_new_message(id, message);
245}245}
246246
247247
248// Toolbar button callback functions.248// Toolbar button callback functions.
249void InteractivePlayer::toggle_chat() {249void InteractivePlayer::toggle_chat() {
250 if (m_chat.window)250 if (chat_.window)
251 delete m_chat.window;251 delete chat_.window;
252 else if (chat_provider_)252 else if (chat_provider_)
253 GameChatMenu::create_chat_console(this, m_chat, *chat_provider_);253 GameChatMenu::create_chat_console(this, chat_, *chat_provider_);
254}254}
255255
256bool InteractivePlayer::can_see(Widelands::PlayerNumber const p) const256bool InteractivePlayer::can_see(Widelands::PlayerNumber const p) const
@@ -263,7 +263,7 @@
263}263}
264Widelands::PlayerNumber InteractivePlayer::player_number() const264Widelands::PlayerNumber InteractivePlayer::player_number() const
265{265{
266 return m_player_number;266 return player_number_;
267}267}
268268
269int32_t InteractivePlayer::calculate_buildcaps(const Widelands::TCoords<Widelands::FCoords> c) {269int32_t InteractivePlayer::calculate_buildcaps(const Widelands::TCoords<Widelands::FCoords> c) {
@@ -289,7 +289,7 @@
289 }289 }
290290
291 // everything else can bring up the temporary dialog291 // everything else can bring up the temporary dialog
292 show_field_action(this, get_player(), &m_fieldaction);292 show_field_action(this, get_player(), &fieldaction_);
293 }293 }
294}294}
295295
@@ -315,7 +315,7 @@
315 return true;315 return true;
316316
317 case SDLK_i:317 case SDLK_i:
318 m_mainm_windows.stock.toggle();318 main_windows_.stock.toggle();
319 return true;319 return true;
320320
321 case SDLK_m:321 case SDLK_m:
@@ -323,11 +323,11 @@
323 return true;323 return true;
324324
325 case SDLK_n:325 case SDLK_n:
326 m_message_menu.toggle();326 message_menu_.toggle();
327 return true;327 return true;
328328
329 case SDLK_o:329 case SDLK_o:
330 m_objectives.toggle();330 objectives_.toggle();
331 return true;331 return true;
332332
333 case SDLK_c:333 case SDLK_c:
@@ -335,16 +335,16 @@
335 return true;335 return true;
336336
337 case SDLK_b:337 case SDLK_b:
338 if (m_mainm_windows.building_stats.window == nullptr) {338 if (main_windows_.building_stats.window == nullptr) {
339 new BuildingStatisticsMenu(*this, m_mainm_windows.building_stats);339 new BuildingStatisticsMenu(*this, main_windows_.building_stats);
340 } else {340 } else {
341 m_mainm_windows.building_stats.toggle();341 main_windows_.building_stats.toggle();
342 }342 }
343 return true;343 return true;
344344
345 case SDLK_s:345 case SDLK_s:
346 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL))346 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL))
347 new GameMainMenuSaveGame(*this, m_mainm_windows.savegame);347 new GameMainMenuSaveGame(*this, main_windows_.savegame);
348 else348 else
349 set_display_flag349 set_display_flag
350 (dfShowStatistics, !get_display_flag(dfShowStatistics));350 (dfShowStatistics, !get_display_flag(dfShowStatistics));
@@ -355,16 +355,16 @@
355 break;355 break;
356 /* no break */356 /* no break */
357 case SDLK_HOME:357 case SDLK_HOME:
358 move_view_to(game().map().get_starting_pos(m_player_number));358 move_view_to(game().map().get_starting_pos(player_number_));
359 return true;359 return true;
360360
361 case SDLK_KP_ENTER:361 case SDLK_KP_ENTER:
362 case SDLK_RETURN:362 case SDLK_RETURN:
363 if (!chat_provider_ | !m_chatenabled || !is_multiplayer())363 if (!chat_provider_ | !chatenabled_ || !is_multiplayer())
364 break;364 break;
365365
366 if (!m_chat.window)366 if (!chat_.window)
367 GameChatMenu::create_chat_console(this, m_chat, *chat_provider_);367 GameChatMenu::create_chat_console(this, chat_, *chat_provider_);
368368
369 return true;369 return true;
370 default:370 default:
@@ -380,7 +380,7 @@
380 * player380 * player
381 */381 */
382void InteractivePlayer::set_player_number(uint32_t const n) {382void InteractivePlayer::set_player_number(uint32_t const n) {
383 m_player_number = n;383 player_number_ = n;
384}384}
385385
386386
@@ -404,10 +404,10 @@
404 }404 }
405405
406 DebugConsole::write(406 DebugConsole::write(
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));
408 m_player_number = n;408 player_number_ = n;
409409
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) {
411 dynamic_cast<BuildingStatisticsMenu&>(*building_statistics_window).update();411 dynamic_cast<BuildingStatisticsMenu&>(*building_statistics_window).update();
412 }412 }
413}413}
414414
=== modified file 'src/wui/interactive_player.h'
--- src/wui/interactive_player.h 2015-11-01 10:11:56 +0000
+++ src/wui/interactive_player.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2003, 2006-2010 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -63,11 +63,11 @@
63 bool handle_key(bool down, SDL_Keysym) override;63 bool handle_key(bool down, SDL_Keysym) override;
6464
65 Widelands::Player & player() const {65 Widelands::Player & player() const {
66 return game().player(m_player_number);66 return game().player(player_number_);
67 }67 }
68 Widelands::Player * get_player() const override {68 Widelands::Player * get_player() const override {
69 assert(&game());69 assert(&game());
70 return game().get_player(m_player_number);70 return game().get_player(player_number_);
71 }71 }
7272
73 // for savegames73 // for savegames
@@ -78,7 +78,7 @@
78 void think() override;78 void think() override;
7979
80 void set_flag_to_connect(Widelands::Coords const location) {80 void set_flag_to_connect(Widelands::Coords const location) {
81 m_flag_to_connect = location;81 flag_to_connect_ = location;
82 }82 }
8383
84 void popup_message(Widelands::MessageId, const Widelands::Message &);84 void popup_message(Widelands::MessageId, const Widelands::Message &);
@@ -87,24 +87,24 @@
87private:87private:
88 void cmdSwitchPlayer(const std::vector<std::string> & args);88 void cmdSwitchPlayer(const std::vector<std::string> & args);
8989
90 Widelands::PlayerNumber m_player_number;90 Widelands::PlayerNumber player_number_;
91 bool m_auto_roadbuild_mode;91 bool auto_roadbuild_mode_;
92 Widelands::Coords m_flag_to_connect;92 Widelands::Coords flag_to_connect_;
9393
94 UI::Button m_toggle_chat;94 UI::Button toggle_chat_;
95 UI::Button m_toggle_options_menu;95 UI::Button toggle_options_menu_;
96 UI::Button m_toggle_statistics_menu;96 UI::Button toggle_statistics_menu_;
97 UI::Button m_toggle_objectives;97 UI::Button toggle_objectives_;
98 UI::Button m_toggle_minimap;98 UI::Button toggle_minimap_;
99 UI::Button m_toggle_message_menu;99 UI::Button toggle_message_menu_;
100 UI::Button m_toggle_help;100 UI::Button toggle_help_;
101101
102 UI::UniqueWindow::Registry m_chat;102 UI::UniqueWindow::Registry chat_;
103 UI::UniqueWindow::Registry m_options;103 UI::UniqueWindow::Registry options_;
104 UI::UniqueWindow::Registry m_statisticsmenu;104 UI::UniqueWindow::Registry statisticsmenu_;
105 UI::UniqueWindow::Registry m_objectives;105 UI::UniqueWindow::Registry objectives_;
106 UI::UniqueWindow::Registry m_encyclopedia;106 UI::UniqueWindow::Registry encyclopedia_;
107 UI::UniqueWindow::Registry m_message_menu;107 UI::UniqueWindow::Registry message_menu_;
108};108};
109109
110110
111111
=== modified file 'src/wui/interactive_spectator.cc'
--- src/wui/interactive_spectator.cc 2016-01-16 15:57:31 +0000
+++ src/wui/interactive_spectator.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2007-2011 by the Widelands Development Team2 * Copyright (C) 2007-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -49,49 +49,49 @@
49 g_gr->images().get("pics/" picture ".png"), \49 g_gr->images().get("pics/" picture ".png"), \
50 tooltip \50 tooltip \
5151
52 m_toggle_chat52 toggle_chat_
53 (INIT_BTN("menu_chat", "chat", _("Chat"))),53 (INIT_BTN("menu_chat", "chat", _("Chat"))),
54 m_exit54 exit_
55 (INIT_BTN("menu_exit_game", "exit_replay", _("Exit Replay"))),55 (INIT_BTN("menu_exit_game", "exit_replay", _("Exit Replay"))),
56 m_save56 save_
57 (INIT_BTN("menu_save_game", "save_game", _("Save Game"))),57 (INIT_BTN("menu_save_game", "save_game", _("Save Game"))),
58 m_toggle_options_menu58 toggle_options_menu_
59 (INIT_BTN("menu_options_menu", "options_menu", _("Options"))),59 (INIT_BTN("menu_options_menu", "options_menu", _("Options"))),
60 m_toggle_statistics60 toggle_statistics_
61 (INIT_BTN("menu_general_stats", "general_stats", _("Statistics"))),61 (INIT_BTN("menu_general_stats", "general_stats", _("Statistics"))),
62 m_toggle_minimap62 toggle_minimap_
63 (INIT_BTN("menu_toggle_minimap", "minimap", _("Minimap")))63 (INIT_BTN("menu_toggle_minimap", "minimap", _("Minimap")))
64{64{
65 m_toggle_chat.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_chat, this));65 toggle_chat_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_chat, this));
66 m_exit.sigclicked.connect(boost::bind(&InteractiveSpectator::exit_btn, this));66 exit_.sigclicked.connect(boost::bind(&InteractiveSpectator::exit_btn, this));
67 m_save.sigclicked.connect(boost::bind(&InteractiveSpectator::save_btn, this));67 save_.sigclicked.connect(boost::bind(&InteractiveSpectator::save_btn, this));
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));
69 m_toggle_statistics.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_statistics, this));69 toggle_statistics_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_statistics, this));
70 m_toggle_minimap.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_minimap, this));70 toggle_minimap_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_minimap, this));
7171
72 toolbar_.set_layout_toplevel(true);72 toolbar_.set_layout_toplevel(true);
73 if (!is_multiplayer()) {73 if (!is_multiplayer()) {
74 toolbar_.add(&m_exit, UI::Box::AlignLeft);74 toolbar_.add(&exit_, UI::Box::AlignLeft);
75 toolbar_.add(&m_save, UI::Box::AlignLeft);75 toolbar_.add(&save_, UI::Box::AlignLeft);
76 } else76 } else
77 toolbar_.add(&m_toggle_options_menu, UI::Box::AlignLeft);77 toolbar_.add(&toggle_options_menu_, UI::Box::AlignLeft);
78 toolbar_.add(&m_toggle_statistics, UI::Box::AlignLeft);78 toolbar_.add(&toggle_statistics_, UI::Box::AlignLeft);
79 toolbar_.add(&m_toggle_minimap, UI::Box::AlignLeft);79 toolbar_.add(&toggle_minimap_, UI::Box::AlignLeft);
80 toolbar_.add(&m_toggle_buildhelp, UI::Box::AlignLeft);80 toolbar_.add(&toggle_buildhelp_, UI::Box::AlignLeft);
81 toolbar_.add(&m_toggle_chat, UI::Box::AlignLeft);81 toolbar_.add(&toggle_chat_, UI::Box::AlignLeft);
8282
83 // TODO(unknown): instead of making unneeded buttons invisible after generation,83 // TODO(unknown): instead of making unneeded buttons invisible after generation,
84 // they should not at all be generated. -> implement more dynamic toolbar UI84 // they should not at all be generated. -> implement more dynamic toolbar UI
85 if (is_multiplayer()) {85 if (is_multiplayer()) {
86 m_exit.set_visible(false);86 exit_.set_visible(false);
87 m_exit.set_enabled(false);87 exit_.set_enabled(false);
88 m_save.set_visible(false);88 save_.set_visible(false);
89 m_save.set_enabled(false);89 save_.set_enabled(false);
90 } else {90 } else {
91 m_toggle_chat.set_visible(false);91 toggle_chat_.set_visible(false);
92 m_toggle_chat.set_enabled(false);92 toggle_chat_.set_enabled(false);
93 m_toggle_options_menu.set_visible(false);93 toggle_options_menu_.set_visible(false);
94 m_toggle_options_menu.set_enabled(false);94 toggle_options_menu_.set_enabled(false);
95 }95 }
9696
97 adjust_toolbar_position();97 adjust_toolbar_position();
@@ -99,17 +99,17 @@
99 // Setup all screen elements99 // Setup all screen elements
100 fieldclicked.connect(boost::bind(&InteractiveSpectator::node_action, this));100 fieldclicked.connect(boost::bind(&InteractiveSpectator::node_action, this));
101101
102#define INIT_BTN_HOOKS(registry, btn) \102#define INIT_BTN_HOOKS(registry, btn) \
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); \
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); \
105 if (registry.window) \105 if (registry.window) \
106 btn.set_perm_pressed(true);106 btn.set_perm_pressed(true);
107107
108 INIT_BTN_HOOKS(m_chat, m_toggle_chat)108 INIT_BTN_HOOKS(chat_, toggle_chat_)
109 INIT_BTN_HOOKS(m_options, m_toggle_options_menu)109 INIT_BTN_HOOKS(options_, toggle_options_menu_)
110 INIT_BTN_HOOKS(m_mainm_windows.general_stats, m_toggle_statistics)110 INIT_BTN_HOOKS(main_windows_.general_stats, toggle_statistics_)
111 INIT_BTN_HOOKS(m_mainm_windows.savegame, m_save)111 INIT_BTN_HOOKS(main_windows_.savegame, save_)
112 INIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap)112 INIT_BTN_HOOKS(minimap_registry(), toggle_minimap_)
113113
114}114}
115115
@@ -119,15 +119,15 @@
119 // buttons. The assertions are safeguards in case somewhere else in the119 // buttons. The assertions are safeguards in case somewhere else in the
120 // code someone would overwrite our hooks.120 // code someone would overwrite our hooks.
121121
122#define DEINIT_BTN_HOOKS(registry, btn) \122#define DEINIT_BTN_HOOKS(registry, btn) \
123 registry.on_create = 0; \123 registry.on_create = 0; \
124 registry.on_delete = 0;124 registry.on_delete = 0;
125125
126 DEINIT_BTN_HOOKS(m_chat, m_toggle_chat)126 DEINIT_BTN_HOOKS(chat_, toggle_chat_)
127 DEINIT_BTN_HOOKS(m_options, m_toggle_options_menu)127 DEINIT_BTN_HOOKS(options_, toggle_options_menu_)
128 DEINIT_BTN_HOOKS(m_mainm_windows.general_stats, m_toggle_statistics)128 DEINIT_BTN_HOOKS(main_windows_.general_stats, toggle_statistics_)
129 DEINIT_BTN_HOOKS(m_mainm_windows.savegame, m_save)129 DEINIT_BTN_HOOKS(main_windows_.savegame, save_)
130 DEINIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap)130 DEINIT_BTN_HOOKS(minimap_registry(), toggle_minimap_)
131}131}
132132
133133
@@ -160,10 +160,10 @@
160// Toolbar button callback functions.160// Toolbar button callback functions.
161void InteractiveSpectator::toggle_chat()161void InteractiveSpectator::toggle_chat()
162{162{
163 if (m_chat.window)163 if (chat_.window)
164 delete m_chat.window;164 delete chat_.window;
165 else if (chat_provider_)165 else if (chat_provider_)
166 GameChatMenu::create_chat_console(this, m_chat, *chat_provider_);166 GameChatMenu::create_chat_console(this, chat_, *chat_provider_);
167}167}
168168
169169
@@ -181,10 +181,10 @@
181 if (is_multiplayer()) {181 if (is_multiplayer()) {
182 return;182 return;
183 }183 }
184 if (m_mainm_windows.savegame.window)184 if (main_windows_.savegame.window)
185 delete m_mainm_windows.savegame.window;185 delete main_windows_.savegame.window;
186 else {186 else {
187 new GameMainMenuSaveGame(*this, m_mainm_windows.savegame);187 new GameMainMenuSaveGame(*this, main_windows_.savegame);
188 }188 }
189}189}
190190
@@ -193,18 +193,18 @@
193 if (!is_multiplayer()) {193 if (!is_multiplayer()) {
194 return;194 return;
195 }195 }
196 if (m_options.window)196 if (options_.window)
197 delete m_options.window;197 delete options_.window;
198 else198 else
199 new GameOptionsMenu(*this, m_options, m_mainm_windows);199 new GameOptionsMenu(*this, options_, main_windows_);
200}200}
201201
202202
203void InteractiveSpectator::toggle_statistics() {203void InteractiveSpectator::toggle_statistics() {
204 if (m_mainm_windows.general_stats.window)204 if (main_windows_.general_stats.window)
205 delete m_mainm_windows.general_stats.window;205 delete main_windows_.general_stats.window;
206 else206 else
207 new GeneralStatisticsMenu(*this, m_mainm_windows.general_stats);207 new GeneralStatisticsMenu(*this, main_windows_.general_stats);
208}208}
209209
210210
@@ -237,7 +237,7 @@
237 return;237 return;
238238
239 // everything else can bring up the temporary dialog239 // everything else can bring up the temporary dialog
240 show_field_action(this, nullptr, &m_fieldaction);240 show_field_action(this, nullptr, &fieldaction_);
241}241}
242242
243243
@@ -262,7 +262,7 @@
262262
263 case SDLK_s:263 case SDLK_s:
264 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {264 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
265 new GameMainMenuSaveGame(*this, m_mainm_windows.savegame);265 new GameMainMenuSaveGame(*this, main_windows_.savegame);
266 } else266 } else
267 set_display_flag267 set_display_flag
268 (dfShowStatistics, !get_display_flag(dfShowStatistics));268 (dfShowStatistics, !get_display_flag(dfShowStatistics));
@@ -270,13 +270,13 @@
270270
271 case SDLK_RETURN:271 case SDLK_RETURN:
272 case SDLK_KP_ENTER:272 case SDLK_KP_ENTER:
273 if (!chat_provider_ | !m_chatenabled)273 if (!chat_provider_ | !chatenabled_)
274 break;274 break;
275275
276 if (!m_chat.window)276 if (!chat_.window)
277 GameChatMenu::create_chat_console(this, m_chat, *chat_provider_);277 GameChatMenu::create_chat_console(this, chat_, *chat_provider_);
278278
279 dynamic_cast<GameChatMenu*>(m_chat.window)->enter_chat_message();279 dynamic_cast<GameChatMenu*>(chat_.window)->enter_chat_message();
280 return true;280 return true;
281281
282 default:282 default:
283283
=== modified file 'src/wui/interactive_spectator.h'
--- src/wui/interactive_spectator.h 2015-11-01 10:11:56 +0000
+++ src/wui/interactive_spectator.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2003, 2006-2008 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -58,16 +58,16 @@
58 void node_action() override;58 void node_action() override;
5959
60private:60private:
61 UI::Button m_toggle_chat;61 UI::Button toggle_chat_;
62 UI::Button m_exit;62 UI::Button exit_;
63 UI::Button m_save;63 UI::Button save_;
64 UI::Button m_toggle_options_menu;64 UI::Button toggle_options_menu_;
65 UI::Button m_toggle_statistics;65 UI::Button toggle_statistics_;
66 UI::Button m_toggle_minimap;66 UI::Button toggle_minimap_;
6767
6868
69 UI::UniqueWindow::Registry m_chat;69 UI::UniqueWindow::Registry chat_;
70 UI::UniqueWindow::Registry m_options;70 UI::UniqueWindow::Registry options_;
71};71};
7272
7373
7474
=== modified file 'src/wui/itemwaresdisplay.cc'
--- src/wui/itemwaresdisplay.cc 2016-01-17 19:54:32 +0000
+++ src/wui/itemwaresdisplay.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2011, 2013 by the Widelands Development Team2 * Copyright (C) 2011-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -40,9 +40,9 @@
40 */40 */
41ItemWaresDisplay::ItemWaresDisplay(Panel * parent, const Widelands::Player & gplayer) :41ItemWaresDisplay::ItemWaresDisplay(Panel * parent, const Widelands::Player & gplayer) :
42 Panel(parent, 0, 0, 0, 0),42 Panel(parent, 0, 0, 0, 0),
43 m_player(gplayer),43 player_(gplayer),
44 m_capacity(0),44 capacity_(0),
45 m_items_per_row(IWD_DefaultItemsPerRow)45 items_per_row_(IWD_DefaultItemsPerRow)
46{46{
47 set_desired_size(2 * IWD_HBorder, 2 * IWD_VBorder);47 set_desired_size(2 * IWD_HBorder, 2 * IWD_VBorder);
48}48}
@@ -52,8 +52,8 @@
52 */52 */
53void ItemWaresDisplay::clear()53void ItemWaresDisplay::clear()
54{54{
55 if (!m_items.empty()) {55 if (!items_.empty()) {
56 m_items.clear();56 items_.clear();
57 update();57 update();
58 }58 }
59}59}
@@ -66,8 +66,8 @@
66 */66 */
67void ItemWaresDisplay::set_capacity(uint32_t cap)67void ItemWaresDisplay::set_capacity(uint32_t cap)
68{68{
69 if (cap != m_capacity) {69 if (cap != capacity_) {
70 m_capacity = cap;70 capacity_ = cap;
71 recalc_desired_size();71 recalc_desired_size();
72 }72 }
73}73}
@@ -77,16 +77,16 @@
77 */77 */
78void ItemWaresDisplay::set_items_per_row(uint32_t nr)78void ItemWaresDisplay::set_items_per_row(uint32_t nr)
79{79{
80 if (nr != m_items_per_row) {80 if (nr != items_per_row_) {
81 m_items_per_row = nr;81 items_per_row_ = nr;
82 recalc_desired_size();82 recalc_desired_size();
83 }83 }
84}84}
8585
86void ItemWaresDisplay::recalc_desired_size()86void ItemWaresDisplay::recalc_desired_size()
87{87{
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_;
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_;
9090
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);
92}92}
@@ -99,7 +99,7 @@
99 Item it;99 Item it;
100 it.worker = worker;100 it.worker = worker;
101 it.index = index;101 it.index = index;
102 m_items.push_back(it);102 items_.push_back(it);
103 update();103 update();
104}104}
105105
@@ -109,10 +109,10 @@
109109
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));
111111
112 for (uint32_t idx = 0; idx < m_items.size(); ++idx) {112 for (uint32_t idx = 0; idx < items_.size(); ++idx) {
113 const Item & it = m_items[idx];113 const Item & it = items_[idx];
114 uint32_t row = idx / m_items_per_row;114 uint32_t row = idx / items_per_row_;
115 uint32_t col = idx % m_items_per_row;115 uint32_t col = idx % items_per_row_;
116116
117 uint32_t x = IWD_HBorder / 2 + col * IWD_ItemWidth;117 uint32_t x = IWD_HBorder / 2 + col * IWD_ItemWidth;
118 uint32_t y = IWD_VBorder + row * IWD_ItemHeight;118 uint32_t y = IWD_VBorder + row * IWD_ItemHeight;
119119
=== modified file 'src/wui/itemwaresdisplay.h'
--- src/wui/itemwaresdisplay.h 2015-11-11 09:52:55 +0000
+++ src/wui/itemwaresdisplay.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2011 by the Widelands Development Team2 * Copyright (C) 2011-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -36,12 +36,12 @@
36struct ItemWaresDisplay : UI::Panel {36struct ItemWaresDisplay : UI::Panel {
37 ItemWaresDisplay(UI::Panel * parent, const Widelands::Player & player);37 ItemWaresDisplay(UI::Panel * parent, const Widelands::Player & player);
3838
39 const Widelands::Player & player() const {return m_player;}39 const Widelands::Player & player() const {return player_;}
4040
41 uint32_t capacity() const {return m_capacity;}41 uint32_t capacity() const {return capacity_;}
42 void set_capacity(uint32_t cap);42 void set_capacity(uint32_t cap);
4343
44 uint32_t items_per_row() const {return m_items_per_row;}44 uint32_t items_per_row() const {return items_per_row_;}
45 void set_items_per_row(uint32_t nr);45 void set_items_per_row(uint32_t nr);
4646
47 void clear();47 void clear();
@@ -57,10 +57,10 @@
5757
58 void recalc_desired_size();58 void recalc_desired_size();
5959
60 const Widelands::Player & m_player;60 const Widelands::Player & player_;
61 uint32_t m_capacity;61 uint32_t capacity_;
62 uint32_t m_items_per_row;62 uint32_t items_per_row_;
63 std::vector<Item> m_items;63 std::vector<Item> items_;
64};64};
6565
66#endif // end of include guard: WL_WUI_ITEMWARESDISPLAY_H66#endif // end of include guard: WL_WUI_ITEMWARESDISPLAY_H
6767
=== modified file 'src/wui/mapdata.h'
--- src/wui/mapdata.h 2016-01-17 08:29:59 +0000
+++ src/wui/mapdata.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002, 2006-2009, 2011, 2014-2015 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -36,8 +36,8 @@
36 * Author data for a map or scenario.36 * Author data for a map or scenario.
37 */37 */
38struct MapAuthorData {38struct MapAuthorData {
39 const std::string& get_names() const {return m_names;}39 const std::string& get_names() const {return names_;}
40 size_t get_number() const {return m_number;}40 size_t get_number() const {return number_;}
4141
42 // Parses author list string into localized contatenated list42 // Parses author list string into localized contatenated list
43 // string. Use , as list separator and no whitespaces between43 // string. Use , as list separator and no whitespaces between
@@ -45,13 +45,13 @@
45 MapAuthorData(const std::string& author_list) {45 MapAuthorData(const std::string& author_list) {
46 std::vector<std::string> authors;46 std::vector<std::string> authors;
47 boost::split(authors, author_list, boost::is_any_of(","));47 boost::split(authors, author_list, boost::is_any_of(","));
48 m_names = i18n::localize_list(authors, i18n::ConcatenateWith::AMPERSAND);48 names_ = i18n::localize_list(authors, i18n::ConcatenateWith::AMPERSAND);
49 m_number = authors.size();49 number_ = authors.size();
50 }50 }
5151
52private:52private:
53 std::string m_names;53 std::string names_;
54 size_t m_number;54 size_t number_;
55};55};
5656
57/**57/**
5858
=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc 2015-03-29 18:07:45 +0000
+++ src/wui/mapview.cc 2016-01-24 20:25:45 +0000
@@ -33,10 +33,10 @@
33MapView::MapView(33MapView::MapView(
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)
35 : UI::Panel(parent, x, y, w, h),35 : UI::Panel(parent, x, y, w, h),
36 m_renderer(new GameRenderer()),36 renderer_(new GameRenderer()),
37 m_intbase(player),37 intbase_(player),
38 m_viewpoint(Point(0, 0)),38 viewpoint_(Point(0, 0)),
39 m_dragging(false) {39 dragging_(false) {
40}40}
4141
42MapView::~MapView()42MapView::~MapView()
@@ -50,7 +50,7 @@
50 const Widelands::Map & map = intbase().egbase().map();50 const Widelands::Map & map = intbase().egbase().map();
51 Point p;51 Point p;
52 MapviewPixelFunctions::get_save_pix(map, c, p.x, p.y);52 MapviewPixelFunctions::get_save_pix(map, c, p.x, p.y);
53 p -= m_viewpoint;53 p -= viewpoint_;
5454
55 // If the user has scrolled the node outside the viewable area, he most55 // If the user has scrolled the node outside the viewable area, he most
56 // surely doesn't want to jump there.56 // surely doesn't want to jump there.
@@ -86,15 +86,15 @@
86 }86 }
8787
88 if (upcast(InteractivePlayer const, interactive_player, &intbase())) {88 if (upcast(InteractivePlayer const, interactive_player, &intbase())) {
89 m_renderer->rendermap(dst, egbase, m_viewpoint, interactive_player->player());89 renderer_->rendermap(dst, egbase, viewpoint_, interactive_player->player());
90 } else {90 } else {
91 m_renderer->rendermap(dst, egbase, m_viewpoint);91 renderer_->rendermap(dst, egbase, viewpoint_);
92 }92 }
93}93}
9494
95void MapView::set_changeview(const MapView::ChangeViewFn & fn)95void MapView::set_changeview(const MapView::ChangeViewFn & fn)
96{96{
97 m_changeview = fn;97 changeview_ = fn;
98}98}
9999
100/*100/*
@@ -104,22 +104,22 @@
104*/104*/
105void MapView::set_viewpoint(Point vp, bool jump)105void MapView::set_viewpoint(Point vp, bool jump)
106{106{
107 if (vp == m_viewpoint)107 if (vp == viewpoint_)
108 return;108 return;
109109
110 MapviewPixelFunctions::normalize_pix(intbase().egbase().map(), vp);110 MapviewPixelFunctions::normalize_pix(intbase().egbase().map(), vp);
111 m_viewpoint = vp;111 viewpoint_ = vp;
112112
113 if (m_changeview)113 if (changeview_)
114 m_changeview(vp, jump);114 changeview_(vp, jump);
115 changeview(m_viewpoint.x, m_viewpoint.y);115 changeview(viewpoint_.x, viewpoint_.y);
116}116}
117117
118118
119void MapView::stop_dragging() {119void MapView::stop_dragging() {
120 WLApplication::get()->set_mouse_lock(false);120 WLApplication::get()->set_mouse_lock(false);
121 grab_mouse(false);121 grab_mouse(false);
122 m_dragging = false;122 dragging_ = false;
123}123}
124124
125/**125/**
@@ -138,7 +138,7 @@
138138
139 fieldclicked();139 fieldclicked();
140 } else if (btn == SDL_BUTTON_RIGHT) {140 } else if (btn == SDL_BUTTON_RIGHT) {
141 m_dragging = true;141 dragging_ = true;
142 grab_mouse(true);142 grab_mouse(true);
143 WLApplication::get()->set_mouse_lock(true);143 WLApplication::get()->set_mouse_lock(true);
144 }144 }
@@ -146,7 +146,7 @@
146}146}
147bool MapView::handle_mouserelease(const uint8_t btn, int32_t, int32_t)147bool MapView::handle_mouserelease(const uint8_t btn, int32_t, int32_t)
148{148{
149 if (btn == SDL_BUTTON_RIGHT && m_dragging)149 if (btn == SDL_BUTTON_RIGHT && dragging_)
150 stop_dragging();150 stop_dragging();
151 return true;151 return true;
152}152}
@@ -160,7 +160,7 @@
160bool MapView::handle_mousemove160bool MapView::handle_mousemove
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)
162{162{
163 if (m_dragging) {163 if (dragging_) {
164 if (state & SDL_BUTTON(SDL_BUTTON_RIGHT))164 if (state & SDL_BUTTON(SDL_BUTTON_RIGHT))
165 set_rel_viewpoint(Point(xdiff, ydiff), false);165 set_rel_viewpoint(Point(xdiff, ydiff), false);
166 else stop_dragging();166 else stop_dragging();
@@ -183,8 +183,8 @@
183===============183===============
184*/184*/
185void MapView::track_sel(Point m) {185void MapView::track_sel(Point m) {
186 m += m_viewpoint;186 m += viewpoint_;
187 m_intbase.set_sel_pos187 intbase_.set_sel_pos
188 (MapviewPixelFunctions::calc_node_and_triangle188 (MapviewPixelFunctions::calc_node_and_triangle
189 (intbase().egbase().map(), m.x, m.y));189 (intbase().egbase().map(), m.x, m.y));
190}190}
191191
=== modified file 'src/wui/mapview.h'
--- src/wui/mapview.h 2014-11-13 08:25:45 +0000
+++ src/wui/mapview.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -63,10 +63,10 @@
63 void warp_mouse_to_node(Widelands::Coords);63 void warp_mouse_to_node(Widelands::Coords);
6464
65 void set_viewpoint(Point vp, bool jump);65 void set_viewpoint(Point vp, bool jump);
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);}
6767
68 Point get_viewpoint() const {return m_viewpoint;}68 Point get_viewpoint() const {return viewpoint_;}
69 bool is_dragging() const {return m_dragging;}69 bool is_dragging() const {return dragging_;}
7070
71 // Drawing71 // Drawing
72 void draw(RenderTarget &) override;72 void draw(RenderTarget &) override;
@@ -80,16 +80,16 @@
80 void track_sel(Point m);80 void track_sel(Point m);
8181
82protected:82protected:
83 InteractiveBase & intbase() const {return m_intbase;}83 InteractiveBase & intbase() const {return intbase_;}
8484
85private:85private:
86 void stop_dragging();86 void stop_dragging();
8787
88 std::unique_ptr<GameRenderer> m_renderer;88 std::unique_ptr<GameRenderer> renderer_;
89 InteractiveBase & m_intbase;89 InteractiveBase & intbase_;
90 ChangeViewFn m_changeview;90 ChangeViewFn changeview_;
91 Point m_viewpoint;91 Point viewpoint_;
92 bool m_dragging;92 bool dragging_;
93};93};
9494
9595
9696
=== modified file 'src/wui/minimap.cc'
--- src/wui/minimap.cc 2015-11-28 11:04:12 +0000
+++ src/wui/minimap.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -36,11 +36,11 @@
36 InteractiveBase & ibase)36 InteractiveBase & ibase)
37:37:
38 UI::Panel (&parent, x, y, 10, 10),38 UI::Panel (&parent, x, y, 10, 10),
39 m_ibase (ibase),39 ibase_ (ibase),
40 m_viewx (0),40 viewx_ (0),
41 m_viewy (0),41 viewy_ (0),
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")),
43 m_flags (flags)43 flags_ (flags)
44{}44{}
4545
4646
@@ -52,8 +52,8 @@
52 */52 */
53void MiniMap::View::set_view_pos(const int32_t x, const int32_t y)53void MiniMap::View::set_view_pos(const int32_t x, const int32_t y)
54{54{
55 m_viewx = x / TRIANGLE_WIDTH;55 viewx_ = x / TRIANGLE_WIDTH;
56 m_viewy = y / TRIANGLE_HEIGHT;56 viewy_ = y / TRIANGLE_HEIGHT;
5757
58 update();58 update();
59}59}
@@ -62,12 +62,12 @@
62void MiniMap::View::draw(RenderTarget & dst)62void MiniMap::View::draw(RenderTarget & dst)
63{63{
64 minimap_image_ =64 minimap_image_ =
65 draw_minimap(m_ibase.egbase(),65 draw_minimap(ibase_.egbase(),
66 m_ibase.get_player(),66 ibase_.get_player(),
67 (*m_flags) & (MiniMapLayer::Zoom2) ?67 (*flags_) & (MiniMapLayer::Zoom2) ?
68 Point((m_viewx - get_w() / 4), (m_viewy - get_h() / 4)) :68 Point((viewx_ - get_w() / 4), (viewy_ - get_h() / 4)) :
69 Point((m_viewx - get_w() / 2), (m_viewy - get_h() / 2)),69 Point((viewx_ - get_w() / 2), (viewy_ - get_h() / 2)),
70 *m_flags | MiniMapLayer::ViewWindow);70 *flags_ | MiniMapLayer::ViewWindow);
71 dst.blit(Point(), minimap_image_.get());71 dst.blit(Point(), minimap_image_.get());
72}72}
7373
@@ -83,15 +83,15 @@
8383
84 // calculates the coordinates corresponding to the mouse position84 // calculates the coordinates corresponding to the mouse position
85 Widelands::Coords c;85 Widelands::Coords c;
86 if (*m_flags & MiniMapLayer::Zoom2)86 if (*flags_ & MiniMapLayer::Zoom2)
87 c = Widelands::Coords87 c = Widelands::Coords
88 (m_viewx + 1 - (get_w() / 2 - x) / 2,88 (viewx_ + 1 - (get_w() / 2 - x) / 2,
89 m_viewy + 1 - (get_h() / 2 - y) / 2);89 viewy_ + 1 - (get_h() / 2 - y) / 2);
90 else90 else
91 c = Widelands::Coords91 c = Widelands::Coords
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);
9393
94 m_ibase.egbase().map().normalize_coords(c);94 ibase_.egbase().map().normalize_coords(c);
9595
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);
9797
@@ -102,7 +102,7 @@
102}102}
103103
104void MiniMap::View::set_zoom(int32_t z) {104void MiniMap::View::set_zoom(int32_t z) {
105 const Widelands::Map & map = m_ibase.egbase().map();105 const Widelands::Map & map = ibase_.egbase().map();
106 set_size((map.get_width() * z), (map.get_height()) * z);106 set_size((map.get_width() * z), (map.get_height()) * z);
107}107}
108108
@@ -129,52 +129,52 @@
129inline uint32_t MiniMap::number_of_buttons_per_row() const {return 3;}129inline uint32_t MiniMap::number_of_buttons_per_row() const {return 3;}
130inline uint32_t MiniMap::number_of_button_rows () const {return 2;}130inline uint32_t MiniMap::number_of_button_rows () const {return 2;}
131inline uint32_t MiniMap::but_w () const {131inline uint32_t MiniMap::but_w () const {
132 return m_view.get_w() / number_of_buttons_per_row();132 return view_.get_w() / number_of_buttons_per_row();
133}133}
134inline uint32_t MiniMap::but_h () const {return 20;}134inline uint32_t MiniMap::but_h () const {return 20;}
135MiniMap::MiniMap(InteractiveBase & ibase, Registry * const registry)135MiniMap::MiniMap(InteractiveBase & ibase, Registry * const registry)
136:136:
137 UI::UniqueWindow(&ibase, "minimap", registry, 0, 0, _("Map")),137 UI::UniqueWindow(&ibase, "minimap", registry, 0, 0, _("Map")),
138 m_view(*this, &registry->flags, 0, 0, 0, 0, ibase),138 view_(*this, &registry->flags, 0, 0, 0, 0, ibase),
139139
140 button_terrn140 button_terrn
141 (this, "terrain",141 (this, "terrain",
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(),
143 g_gr->images().get("pics/but0.png"),143 g_gr->images().get("pics/but0.png"),
144 g_gr->images().get("pics/button_terrn.png"),144 g_gr->images().get("pics/button_terrn.png"),
145 _("Terrain"),145 _("Terrain"),
146 true, false, true),146 true, false, true),
147 button_owner147 button_owner
148 (this, "owner",148 (this, "owner",
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(),
150 g_gr->images().get("pics/but0.png"),150 g_gr->images().get("pics/but0.png"),
151 g_gr->images().get("pics/button_owner.png"),151 g_gr->images().get("pics/button_owner.png"),
152 _("Owner"),152 _("Owner"),
153 true, false, true),153 true, false, true),
154 button_flags154 button_flags
155 (this, "flags",155 (this, "flags",
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(),
157 g_gr->images().get("pics/but0.png"),157 g_gr->images().get("pics/but0.png"),
158 g_gr->images().get("pics/button_flags.png"),158 g_gr->images().get("pics/button_flags.png"),
159 _("Flags"),159 _("Flags"),
160 true, false, true),160 true, false, true),
161 button_roads161 button_roads
162 (this, "roads",162 (this, "roads",
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(),
164 g_gr->images().get("pics/but0.png"),164 g_gr->images().get("pics/but0.png"),
165 g_gr->images().get("pics/button_roads.png"),165 g_gr->images().get("pics/button_roads.png"),
166 _("Roads"),166 _("Roads"),
167 true, false, true),167 true, false, true),
168 button_bldns168 button_bldns
169 (this, "buildings",169 (this, "buildings",
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(),
171 g_gr->images().get("pics/but0.png"),171 g_gr->images().get("pics/but0.png"),
172 g_gr->images().get("pics/button_bldns.png"),172 g_gr->images().get("pics/button_bldns.png"),
173 _("Buildings"),173 _("Buildings"),
174 true, false, true),174 true, false, true),
175 button_zoom175 button_zoom
176 (this, "zoom",176 (this, "zoom",
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(),
178 g_gr->images().get("pics/but0.png"),178 g_gr->images().get("pics/but0.png"),
179 g_gr->images().get("pics/button_zoom.png"),179 g_gr->images().get("pics/button_zoom.png"),
180 _("Zoom"),180 _("Zoom"),
@@ -198,37 +198,37 @@
198198
199199
200void MiniMap::toggle(MiniMapLayer const button) {200void MiniMap::toggle(MiniMapLayer const button) {
201 *m_view.m_flags = MiniMapLayer(*m_view.m_flags ^ button);201 *view_.flags_ = MiniMapLayer(*view_.flags_ ^ button);
202 if (button == MiniMapLayer::Zoom2)202 if (button == MiniMapLayer::Zoom2)
203 resize();203 resize();
204 update_button_permpressed();204 update_button_permpressed();
205}205}
206206
207void MiniMap::resize() {207void MiniMap::resize() {
208 m_view.set_zoom(*m_view.m_flags & MiniMapLayer::Zoom2 ? 2 : 1);208 view_.set_zoom(*view_.flags_ & MiniMapLayer::Zoom2 ? 2 : 1);
209 set_inner_size209 set_inner_size
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());
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));
212 button_terrn.set_size(but_w(), but_h());212 button_terrn.set_size(but_w(), but_h());
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));
214 button_owner.set_size(but_w(), but_h());214 button_owner.set_size(but_w(), but_h());
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));
216 button_flags.set_size(but_w(), but_h());216 button_flags.set_size(but_w(), but_h());
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));
218 button_roads.set_size(but_w(), but_h());218 button_roads.set_size(but_w(), but_h());
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));
220 button_bldns.set_size(but_w(), but_h());220 button_bldns.set_size(but_w(), but_h());
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));
222 button_zoom .set_size(but_w(), but_h());222 button_zoom .set_size(but_w(), but_h());
223 move_inside_parent();223 move_inside_parent();
224}224}
225225
226// Makes the buttons reflect the selected layers226// Makes the buttons reflect the selected layers
227void MiniMap::update_button_permpressed() {227void MiniMap::update_button_permpressed() {
228 button_terrn.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Terrain);228 button_terrn.set_perm_pressed(*view_.flags_ & MiniMapLayer::Terrain);
229 button_owner.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Owner);229 button_owner.set_perm_pressed(*view_.flags_ & MiniMapLayer::Owner);
230 button_flags.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Flag);230 button_flags.set_perm_pressed(*view_.flags_ & MiniMapLayer::Flag);
231 button_roads.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Road);231 button_roads.set_perm_pressed(*view_.flags_ & MiniMapLayer::Road);
232 button_bldns.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Building);232 button_bldns.set_perm_pressed(*view_.flags_ & MiniMapLayer::Building);
233 button_zoom .set_perm_pressed(*m_view.m_flags & MiniMapLayer::Zoom2);233 button_zoom .set_perm_pressed(*view_.flags_ & MiniMapLayer::Zoom2);
234}234}
235235
=== modified file 'src/wui/minimap.h'
--- src/wui/minimap.h 2015-02-20 07:45:49 +0000
+++ src/wui/minimap.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team2 * Copyright (C) 2002-20116 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -46,7 +46,7 @@
46 boost::signals2::signal<void (int32_t, int32_t)> warpview;46 boost::signals2::signal<void (int32_t, int32_t)> warpview;
4747
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) {
49 m_view.set_view_pos(x, y);49 view_.set_view_pos(x, y);
50 }50 }
5151
52private:52private:
@@ -79,16 +79,16 @@
79 void set_zoom(int32_t z);79 void set_zoom(int32_t z);
8080
81 private:81 private:
82 InteractiveBase & m_ibase;82 InteractiveBase & ibase_;
83 int32_t m_viewx, m_viewy;83 int32_t viewx_, viewy_;
84 const Image* m_pic_map_spot;84 const Image* pic_map_spot_;
8585
86 // This needs to be owned since it will be rendered by the RenderQueue86 // This needs to be owned since it will be rendered by the RenderQueue
87 // later, so it must be valid for the whole frame.87 // later, so it must be valid for the whole frame.
88 std::unique_ptr<Texture> minimap_image_;88 std::unique_ptr<Texture> minimap_image_;
8989
90 public:90 public:
91 MiniMapLayer* m_flags;91 MiniMapLayer* flags_;
92 };92 };
9393
94 uint32_t number_of_buttons_per_row() const;94 uint32_t number_of_buttons_per_row() const;
@@ -96,7 +96,7 @@
96 uint32_t but_w () const;96 uint32_t but_w () const;
97 uint32_t but_h () const;97 uint32_t but_h () const;
9898
99 View m_view;99 View view_;
100 UI::Button button_terrn;100 UI::Button button_terrn;
101 UI::Button button_owner;101 UI::Button button_owner;
102 UI::Button button_flags;102 UI::Button button_flags;
103103
=== modified file 'src/wui/multiplayersetupgroup.cc'
--- src/wui/multiplayersetupgroup.cc 2015-12-11 19:06:50 +0000
+++ src/wui/multiplayersetupgroup.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2010-2011 by the Widelands Development Team2 * Copyright (C) 2010-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -51,8 +51,8 @@
51 type_icon(nullptr),51 type_icon(nullptr),
52 type(nullptr),52 type(nullptr),
53 s(settings),53 s(settings),
54 m_id(id),54 id_(id),
55 m_save(-2)55 save_(-2)
56 {56 {
57 set_size(w, h);57 set_size(w, h);
58 name = new UI::Textarea58 name = new UI::Textarea
@@ -81,7 +81,7 @@
8181
82 /// Switch human players and spectator82 /// Switch human players and spectator
83 void toggle_type() {83 void toggle_type() {
84 UserSettings us = s->settings().users.at(m_id);84 UserSettings us = s->settings().users.at(id_);
85 int16_t p = us.position;85 int16_t p = us.position;
86 if (p == UserSettings::none())86 if (p == UserSettings::none())
87 p = -1;87 p = -1;
@@ -101,7 +101,7 @@
101101
102 /// Care about visibility and current values102 /// Care about visibility and current values
103 void refresh() {103 void refresh() {
104 UserSettings us = s->settings().users.at(m_id);104 UserSettings us = s->settings().users.at(id_);
105 if (us.position == UserSettings::not_connected()) {105 if (us.position == UserSettings::not_connected()) {
106 std::string free_i18n = _("free");106 std::string free_i18n = _("free");
107 std::string free_text =107 std::string free_text =
@@ -113,7 +113,7 @@
113 type_icon->set_visible(false);113 type_icon->set_visible(false);
114 } else {114 } else {
115 name->set_text(us.name);115 name->set_text(us.name);
116 if (m_save != us.position) {116 if (save_ != us.position) {
117 std::string pic;117 std::string pic;
118 std::string temp_tooltip;118 std::string temp_tooltip;
119 if (us.position < UserSettings::highest_playernum()) {119 if (us.position < UserSettings::highest_playernum()) {
@@ -127,7 +127,7 @@
127 }127 }
128128
129 // Either Button if changeable OR text if not129 // Either Button if changeable OR text if not
130 if (m_id == s->settings().usernum) {130 if (id_ == s->settings().usernum) {
131 type->set_pic(g_gr->images().get(pic));131 type->set_pic(g_gr->images().get(pic));
132 type->set_tooltip(temp_tooltip);132 type->set_tooltip(temp_tooltip);
133 type->set_visible(true);133 type->set_visible(true);
@@ -136,7 +136,7 @@
136 type_icon->set_tooltip(temp_tooltip);136 type_icon->set_tooltip(temp_tooltip);
137 type_icon->set_visible(true);137 type_icon->set_visible(true);
138 }138 }
139 m_save = us.position;139 save_ = us.position;
140 }140 }
141 }141 }
142 }142 }
@@ -145,8 +145,8 @@
145 UI::Icon * type_icon;145 UI::Icon * type_icon;
146 UI::Button * type;146 UI::Button * type;
147 GameSettingsProvider * const s;147 GameSettingsProvider * const s;
148 uint8_t const m_id;148 uint8_t const id_;
149 int16_t m_save; // saved position to check rewrite need.149 int16_t save_; // saved position to check rewrite need.
150};150};
151151
152struct MultiPlayerPlayerGroup : public UI::Box {152struct MultiPlayerPlayerGroup : public UI::Box {
@@ -165,9 +165,9 @@
165 init(nullptr),165 init(nullptr),
166 s(settings),166 s(settings),
167 n(npsb),167 n(npsb),
168 m_id(id),168 id_(id),
169 m_tribepics(tp),169 tribepics_(tp),
170 m_tribenames(tn)170 tribenames_(tn)
171 {171 {
172 set_size(w, h);172 set_size(w, h);
173173
@@ -217,42 +217,42 @@
217217
218 /// Toggle through the types218 /// Toggle through the types
219 void toggle_type() {219 void toggle_type() {
220 n->toggle_type(m_id);220 n->toggle_type(id_);
221 }221 }
222222
223 /// Toggle through the tribes + handle shared in players223 /// Toggle through the tribes + handle shared in players
224 void toggle_tribe() {224 void toggle_tribe() {
225 n->toggle_tribe(m_id);225 n->toggle_tribe(id_);
226 }226 }
227227
228 /// Toggle through the initializations228 /// Toggle through the initializations
229 void toggle_init() {229 void toggle_init() {
230 n->toggle_init(m_id);230 n->toggle_init(id_);
231 }231 }
232232
233 /// Toggle through the teams233 /// Toggle through the teams
234 void toggle_team() {234 void toggle_team() {
235 n->toggle_team(m_id);235 n->toggle_team(id_);
236 }236 }
237237
238 /// Refresh all user interfaces238 /// Refresh all user interfaces
239 void refresh() {239 void refresh() {
240 const GameSettings & settings = s->settings();240 const GameSettings & settings = s->settings();
241241
242 if (m_id >= settings.players.size()) {242 if (id_ >= settings.players.size()) {
243 set_visible(false);243 set_visible(false);
244 return;244 return;
245 }245 }
246246
247 n->refresh(m_id);247 n->refresh(id_);
248248
249 set_visible(true);249 set_visible(true);
250250
251 const PlayerSettings & player_setting = settings.players[m_id];251 const PlayerSettings & player_setting = settings.players[id_];
252 bool typeaccess = s->can_change_player_state(m_id);252 bool typeaccess = s->can_change_player_state(id_);
253 bool tribeaccess = s->can_change_player_tribe(m_id);253 bool tribeaccess = s->can_change_player_tribe(id_);
254 bool const initaccess = s->can_change_player_init(m_id);254 bool const initaccess = s->can_change_player_init(id_);
255 bool teamaccess = s->can_change_player_team(m_id);255 bool teamaccess = s->can_change_player_team(id_);
256256
257 type->set_enabled(typeaccess);257 type->set_enabled(typeaccess);
258 if (player_setting.state == PlayerSettings::stateClosed) {258 if (player_setting.state == PlayerSettings::stateClosed) {
@@ -320,21 +320,21 @@
320 type->set_pic(g_gr->images().get(pic));320 type->set_pic(g_gr->images().get(pic));
321 if (player_setting.random_tribe) {321 if (player_setting.random_tribe) {
322 std::string random = pgettext("tribe", "Random");322 std::string random = pgettext("tribe", "Random");
323 if (!m_tribenames["random"].size())323 if (!tribenames_["random"].size())
324 m_tribepics[random] = g_gr->images().get("pics/random.png");324 tribepics_[random] = g_gr->images().get("pics/random.png");
325 tribe->set_tooltip(random.c_str());325 tribe->set_tooltip(random.c_str());
326 tribe->set_pic(m_tribepics[random]);326 tribe->set_pic(tribepics_[random]);
327 } else {327 } else {
328 if (!m_tribenames[player_setting.tribe].size()) {328 if (!tribenames_[player_setting.tribe].size()) {
329 // get tribes name and picture329 // get tribes name and picture
330 i18n::Textdomain td("tribes");330 i18n::Textdomain td("tribes");
331 for (const TribeBasicInfo& tribeinfo : settings.tribes) {331 for (const TribeBasicInfo& tribeinfo : settings.tribes) {
332 m_tribenames[tribeinfo.name] = _(tribeinfo.descname);332 tribenames_[tribeinfo.name] = _(tribeinfo.descname);
333 m_tribepics[tribeinfo.name] = g_gr->images().get(tribeinfo.icon);333 tribepics_[tribeinfo.name] = g_gr->images().get(tribeinfo.icon);
334 }334 }
335 }335 }
336 tribe->set_tooltip(m_tribenames[player_setting.tribe].c_str());336 tribe->set_tooltip(tribenames_[player_setting.tribe].c_str());
337 tribe->set_pic(m_tribepics[player_setting.tribe]);337 tribe->set_pic(tribepics_[player_setting.tribe]);
338 }338 }
339 tribe->set_flat(false);339 tribe->set_flat(false);
340340
@@ -375,9 +375,9 @@
375 UI::Button * team;375 UI::Button * team;
376 GameSettingsProvider * const s;376 GameSettingsProvider * const s;
377 NetworkPlayerSettingsBackend * const n;377 NetworkPlayerSettingsBackend * const n;
378 uint8_t const m_id;378 uint8_t const id_;
379 std::map<std::string, const Image* > & m_tribepics;379 std::map<std::string, const Image* > & tribepics_;
380 std::map<std::string, std::string> & m_tribenames;380 std::map<std::string, std::string> & tribenames_;
381};381};
382382
383MultiPlayerSetupGroup::MultiPlayerSetupGroup383MultiPlayerSetupGroup::MultiPlayerSetupGroup
@@ -392,9 +392,9 @@
392npsb(new NetworkPlayerSettingsBackend(s)),392npsb(new NetworkPlayerSettingsBackend(s)),
393clientbox(this, 0, buth, UI::Box::Vertical, w / 3, h - buth),393clientbox(this, 0, buth, UI::Box::Vertical, w / 3, h - buth),
394playerbox(this, w * 6 / 15, buth, UI::Box::Vertical, w * 9 / 15, h - buth),394playerbox(this, w * 6 / 15, buth, UI::Box::Vertical, w * 9 / 15, h - buth),
395m_buth(buth),395buth_(buth),
396m_fsize(fsize),396fsize_(fsize),
397m_fname(fname)397fname_(fname)
398{398{
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));
400400
@@ -462,7 +462,7 @@
462 (&playerbox, i,462 (&playerbox, i,
463 0, 0, playerbox.get_w(), buth,463 0, 0, playerbox.get_w(), buth,
464 s, npsb.get(),464 s, npsb.get(),
465 m_tribepics, m_tribenames);465 tribepics_, tribenames_);
466 playerbox.add(multi_player_player_groups.at(i), 1);466 playerbox.add(multi_player_player_groups.at(i), 1);
467 }467 }
468 refresh();468 refresh();
@@ -488,7 +488,7 @@
488 for (uint32_t i = 0; i < settings.users.size(); ++i) {488 for (uint32_t i = 0; i < settings.users.size(); ++i) {
489 if (!multi_player_client_groups.at(i)) {489 if (!multi_player_client_groups.at(i)) {
490 multi_player_client_groups.at(i) = new MultiPlayerClientGroup(490 multi_player_client_groups.at(i) = new MultiPlayerClientGroup(
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_));
492 clientbox.add(&*multi_player_client_groups.at(i), 1);492 clientbox.add(&*multi_player_client_groups.at(i), 1);
493 }493 }
494 multi_player_client_groups.at(i)->refresh();494 multi_player_client_groups.at(i)->refresh();
495495
=== modified file 'src/wui/multiplayersetupgroup.h'
--- src/wui/multiplayersetupgroup.h 2015-01-21 21:21:46 +0000
+++ src/wui/multiplayersetupgroup.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2010 by the Widelands Development Team2 * Copyright (C) 2010-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -64,11 +64,11 @@
64 UI::Box clientbox, playerbox;64 UI::Box clientbox, playerbox;
65 std::vector<UI::Textarea *> labels;65 std::vector<UI::Textarea *> labels;
6666
67 uint32_t m_buth, m_fsize;67 uint32_t buth_, fsize_;
68 std::string m_fname;68 std::string fname_;
6969
70 std::map<std::string, const Image* > m_tribepics;70 std::map<std::string, const Image* > tribepics_;
71 std::map<std::string, std::string> m_tribenames;71 std::map<std::string, std::string> tribenames_;
72};72};
7373
7474
7575
=== modified file 'src/wui/playerdescrgroup.cc'
--- src/wui/playerdescrgroup.cc 2016-01-17 09:54:31 +0000
+++ src/wui/playerdescrgroup.cc 2016-01-24 20:25:45 +0000
@@ -180,16 +180,16 @@
180 d->btnPlayerType->set_title(title);180 d->btnPlayerType->set_title(title);
181181
182 TribeBasicInfo info = Widelands::Tribes::tribeinfo(player.tribe);182 TribeBasicInfo info = Widelands::Tribes::tribeinfo(player.tribe);
183 if (!m_tribenames[player.tribe].size()) {183 if (!tribenames_[player.tribe].size()) {
184 // Tribe's localized name184 // Tribe's localized name
185 m_tribenames[player.tribe] = info.descname;185 tribenames_[player.tribe] = info.descname;
186 }186 }
187 if (player.random_tribe) {187 if (player.random_tribe) {
188 d->btnPlayerTribe->set_title(pgettext("tribe", "Random"));188 d->btnPlayerTribe->set_title(pgettext("tribe", "Random"));
189 d->btnPlayerTribe->set_tooltip(_("The tribe will be set at random."));189 d->btnPlayerTribe->set_tooltip(_("The tribe will be set at random."));
190 } else {190 } else {
191 i18n::Textdomain td("tribes");191 i18n::Textdomain td("tribes");
192 d->btnPlayerTribe->set_title(_(m_tribenames[player.tribe]));192 d->btnPlayerTribe->set_title(_(tribenames_[player.tribe]));
193 d->btnPlayerTribe->set_tooltip(info.tooltip);193 d->btnPlayerTribe->set_tooltip(info.tooltip);
194 }194 }
195195
196196
=== modified file 'src/wui/playerdescrgroup.h'
--- src/wui/playerdescrgroup.h 2014-12-06 12:22:35 +0000
+++ src/wui/playerdescrgroup.h 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002, 2006, 2008, 2010 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -55,7 +55,7 @@
55 void toggle_playerteam();55 void toggle_playerteam();
5656
57 PlayerDescriptionGroupImpl * d;57 PlayerDescriptionGroupImpl * d;
58 std::map<std::string, std::string> m_tribenames;58 std::map<std::string, std::string> tribenames_;
59};59};
6060
6161
6262
=== modified file 'src/wui/plot_area.cc'
--- src/wui/plot_area.cc 2016-01-18 19:35:25 +0000
+++ src/wui/plot_area.cc 2016-01-24 20:25:45 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2008-2013 by the Widelands Development Team2 * Copyright (C) 2002-2016 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -247,10 +247,10 @@
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)
248:248:
249UI::Panel (parent, x, y, w, h),249UI::Panel (parent, x, y, w, h),
250m_plotmode(PLOTMODE_ABSOLUTE),250plotmode_(PLOTMODE_ABSOLUTE),
251m_sample_rate(0),251sample_rate_(0),
252m_time (TIME_GAME),252time_ (TIME_GAME),
253m_game_time_id(0)253game_time_id_(0)
254{}254{}
255255
256256
@@ -258,15 +258,15 @@
258 uint32_t game_time = 0;258 uint32_t game_time = 0;
259259
260 // Find running time of the game, based on the plot data260 // Find running time of the game, based on the plot data
261 for (uint32_t plot = 0; plot < m_plotdata.size(); ++plot)261 for (uint32_t plot = 0; plot < plotdata_.size(); ++plot)
262 if (game_time < m_plotdata[plot].dataset->size() * m_sample_rate)262 if (game_time < plotdata_[plot].dataset->size() * sample_rate_)
263 game_time = m_plotdata[plot].dataset->size() * m_sample_rate;263 game_time = plotdata_[plot].dataset->size() * sample_rate_;
264 return game_time;264 return game_time;
265}265}
266266
267std::vector<std::string> WuiPlotArea::get_labels() {267std::vector<std::string> WuiPlotArea::get_labels() {
268 std::vector<std::string> labels;268 std::vector<std::string> labels;
269 for (int32_t i = 0; i < m_game_time_id; i++) {269 for (int32_t i = 0; i < game_time_id_; i++) {
270 UNIT unit = get_suggested_unit(time_in_ms[i]);270 UNIT unit = get_suggested_unit(time_in_ms[i]);
271 uint32_t val = ms_to_unit(unit, time_in_ms[i]);271 uint32_t val = ms_to_unit(unit, time_in_ms[i]);
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());
@@ -276,7 +276,7 @@
276}276}
277277
278uint32_t WuiPlotArea::get_plot_time() {278uint32_t WuiPlotArea::get_plot_time() {
279 if (m_time == TIME_GAME) {279 if (time_ == TIME_GAME) {
280 // Start with the game time280 // Start with the game time
281 uint32_t time_ms = get_game_time();281 uint32_t time_ms = get_game_time();
282282
@@ -297,7 +297,7 @@
297 }297 }
298 return time_ms;298 return time_ms;
299 } else {299 } else {
300 return time_in_ms[m_time];300 return time_in_ms[time_];
301 }301 }
302}302}
303303
@@ -316,8 +316,8 @@
316 uint32_t i;316 uint32_t i;
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++) {
318 }318 }
319 m_game_time_id = i;319 game_time_id_ = i;
320 return m_game_time_id;320 return game_time_id_;
321}321}
322322
323/*323/*
@@ -331,22 +331,22 @@
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);
332332
333 // How many do we take together when relative ploting333 // How many do we take together when relative ploting
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_);
335335
336 uint32_t max = 0;336 uint32_t max = 0;
337 // Find the maximum value.337 // Find the maximum value.
338 if (m_plotmode == PLOTMODE_ABSOLUTE) {338 if (plotmode_ == PLOTMODE_ABSOLUTE) {
339 for (uint32_t i = 0; i < m_plotdata.size(); ++i)339 for (uint32_t i = 0; i < plotdata_.size(); ++i)
340 if (m_plotdata[i].showplot) {340 if (plotdata_[i].showplot) {
341 for (uint32_t l = 0; l < m_plotdata[i].dataset->size(); ++l)
342 if (max < (*m_plotdata[i].dataset)[l])
343 max = (*m_plotdata[i].dataset)[l];
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to status/vote changes: