widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #05549
[Merge] lp:~klaus-halfmann/widelands/bug-1395278-wui into lp:widelands
Klaus Halfmann has proposed merging lp:~klaus-halfmann/widelands/bug-1395278-wui into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1395278 in widelands: "Consolidate naming of member variables"
https://bugs.launchpad.net/widelands/+bug/1395278
For more details, see:
https://code.launchpad.net/~klaus-halfmann/widelands/bug-1395278-wui/+merge/283747
Migration from m_... to ..._ mostly in wui
--
Your team Widelands Developers is requested to review the proposed merge of lp:~klaus-halfmann/widelands/bug-1395278-wui into lp:widelands.
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006-2009 by the Widelands Development Team
+ * Copyright (C) 2004-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +23,7 @@
ComputerPlayer::ComputerPlayer
(Widelands::Game & g, Widelands::PlayerNumber const pid)
- : m_game(g), m_player_number(pid)
+ : game_(g), player_number_(pid)
{
}
=== 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:17:30 +0000
@@ -42,8 +42,8 @@
virtual void think () = 0;
- Widelands::Game & game() const {return m_game;}
- Widelands::PlayerNumber player_number() {return m_player_number;}
+ Widelands::Game & game() const {return game_;}
+ Widelands::PlayerNumber player_number() {return player_number_;}
/**
* Interface to a concrete implementation, used to instantiate AIs.
@@ -71,8 +71,8 @@
static const Implementation * get_implementation(const std::string & name);
private:
- Widelands::Game & m_game;
- Widelands::PlayerNumber const m_player_number;
+ Widelands::Game & game_;
+ Widelands::PlayerNumber const player_number_;
DISALLOW_COPY_AND_ASSIGN(ComputerPlayer);
};
=== 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:17:30 +0000
@@ -143,7 +143,7 @@
void resize_ware_orders(size_t maxLength);
- const std::vector<std::string>& get_ship_names() const {return ship_names_;};
+ const std::vector<std::string>& get_ship_names() const {return ship_names_;}
private:
// Helper function for adding a special worker type (carriers etc.)
=== 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:17:30 +0000
@@ -138,7 +138,7 @@
/// Data that are used and managed by AI. They are here to have it saved as a port of player's data
struct AiPersistentState {
- AiPersistentState() : initialized(0){};
+ AiPersistentState() : initialized(0){}
//was initialized
uint8_t initialized;
@@ -159,7 +159,7 @@
AiPersistentState* get_mutable_ai_persistent_state(){
return &ai_data;
- };
+ }
/// Per-player field information.
struct Field {
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2016-01-17 09:55:27 +0000
+++ src/wlapplication.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2015 by the Widelands Development Team
+ * Copyright (C) 2006-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -179,12 +179,12 @@
void WLApplication::setup_homedir() {
//If we don't have a home directory don't do anything
- if (m_homedir.size()) {
+ if (homedir_.size()) {
//assume some dir exists
try {
- log ("Set home directory: %s\n", m_homedir.c_str());
+ log ("Set home directory: %s\n", homedir_.c_str());
- std::unique_ptr<FileSystem> home(new RealFSImpl(m_homedir));
+ std::unique_ptr<FileSystem> home(new RealFSImpl(homedir_));
home->ensure_directory_exists(".");
g_fs->set_home_file_system(home.release());
} catch (const std::exception & e) {
@@ -232,40 +232,40 @@
* \param argv Array of command line arguments
*/
WLApplication::WLApplication(int const argc, char const * const * const argv) :
-m_commandline (std::map<std::string, std::string>()),
-m_game_type (NONE),
-m_mouse_swapped (false),
-m_faking_middle_mouse_button(false),
-m_mouse_position (0, 0),
-m_mouse_locked (0),
-m_mouse_compensate_warp(0, 0),
-m_should_die (false),
+commandline_ (std::map<std::string, std::string>()),
+game_type_ (NONE),
+mouse_swapped_ (false),
+faking_middle_mouse_button_(false),
+mouse_position_ (0, 0),
+mouse_locked_ (0),
+mouse_compensate_warp_(0, 0),
+should_die_ (false),
#ifdef _WIN32
-m_homedir(FileSystem::get_homedir() + "\\.widelands"),
+homedir_(FileSystem::get_homedir() + "\\.widelands"),
#else
-m_homedir(FileSystem::get_homedir() + "/.widelands"),
+homedir_(FileSystem::get_homedir() + "/.widelands"),
#endif
-m_redirected_stdio(false)
+redirected_stdio_(false)
{
g_fs = new LayeredFileSystem();
parse_commandline(argc, argv); //throws ParameterError, handled by main.cc
- if (m_commandline.count("homedir")) {
- log ("Adding home directory: %s\n", m_commandline["homedir"].c_str());
- m_homedir = m_commandline["homedir"];
- m_commandline.erase("homedir");
+ if (commandline_.count("homedir")) {
+ log ("Adding home directory: %s\n", commandline_["homedir"].c_str());
+ homedir_ = commandline_["homedir"];
+ commandline_.erase("homedir");
}
#ifdef REDIRECT_OUTPUT
if (!redirect_output())
- redirect_output(m_homedir);
+ redirect_output(homedir_);
#endif
setup_homedir();
init_settings();
- log("Adding directory: %s\n", m_datadir.c_str());
- g_fs->add_file_system(&FileSystem::create(m_datadir));
+ log("Adding directory: %s\n", datadir_.c_str());
+ g_fs->add_file_system(&FileSystem::create(datadir_));
init_language(); // search paths must already be set up
changedir_on_mac();
@@ -334,7 +334,7 @@
delete g_fs;
g_fs = nullptr;
- if (m_redirected_stdio)
+ if (redirected_stdio_)
{
std::cout.flush();
fclose(stdout);
@@ -356,15 +356,15 @@
// This also grabs the mouse cursor if so desired.
refresh_graphics();
- if (m_game_type == EDITOR) {
+ if (game_type_ == EDITOR) {
g_sound_handler.start_music("ingame");
- EditorInteractive::run_editor(m_filename, m_script_to_run);
- } else if (m_game_type == REPLAY) {
+ EditorInteractive::run_editor(filename_, script_to_run_);
+ } else if (game_type_ == REPLAY) {
replay();
- } else if (m_game_type == LOADGAME) {
+ } else if (game_type_ == LOADGAME) {
Widelands::Game game;
try {
- game.run_load_game(m_filename.c_str(), m_script_to_run);
+ game.run_load_game(filename_.c_str(), script_to_run_);
} catch (const Widelands::GameDataError & e) {
log("Game not loaded: Game data error: %s\n", e.what());
} catch (const std::exception & e) {
@@ -372,10 +372,10 @@
emergency_save(game);
throw;
}
- } else if (m_game_type == SCENARIO) {
+ } else if (game_type_ == SCENARIO) {
Widelands::Game game;
try {
- game.run_splayer_scenario_direct(m_filename.c_str(), m_script_to_run);
+ game.run_splayer_scenario_direct(filename_.c_str(), script_to_run_);
} catch (const Widelands::GameDataError & e) {
log("Scenario not started: Game data error: %s\n", e.what());
} catch (const std::exception & e) {
@@ -383,7 +383,7 @@
emergency_save(game);
throw;
}
- } else if (m_game_type == INTERNET) {
+ } else if (game_type_ == INTERNET) {
Widelands::Game game;
try {
// disable sound completely
@@ -421,13 +421,13 @@
// Load the requested map
Widelands::Map map;
- map.set_filename(m_filename);
- std::unique_ptr<Widelands::MapLoader> ml = map.get_correct_loader(m_filename);
+ map.set_filename(filename_);
+ std::unique_ptr<Widelands::MapLoader> ml = map.get_correct_loader(filename_);
if (!ml) {
throw WLWarning
("Unsupported format",
"Widelands could not load the file \"%s\". The file format seems to be incompatible.",
- m_filename.c_str());
+ filename_.c_str());
}
ml->preload_map(true);
@@ -479,15 +479,15 @@
// settings are invisible to the rest of the code
switch (ev.type) {
case SDL_MOUSEMOTION:
- ev.motion.xrel += m_mouse_compensate_warp.x;
- ev.motion.yrel += m_mouse_compensate_warp.y;
- m_mouse_compensate_warp = Point(0, 0);
-
- if (m_mouse_locked) {
- warp_mouse(m_mouse_position);
-
- ev.motion.x = m_mouse_position.x;
- ev.motion.y = m_mouse_position.y;
+ ev.motion.xrel += mouse_compensate_warp_.x;
+ ev.motion.yrel += mouse_compensate_warp_.y;
+ mouse_compensate_warp_ = Point(0, 0);
+
+ if (mouse_locked_) {
+ warp_mouse(mouse_position_);
+
+ ev.motion.x = mouse_position_.x;
+ ev.motion.y = mouse_position_.y;
}
break;
@@ -509,7 +509,7 @@
case SDLK_F10:
// exits the game.
if (ctrl) {
- m_should_die = true;
+ should_die_ = true;
}
return true;
@@ -579,7 +579,7 @@
}
break;
case SDL_MOUSEMOTION:
- m_mouse_position = Point(ev.motion.x, ev.motion.y);
+ mouse_position_ = Point(ev.motion.x, ev.motion.y);
if ((ev.motion.xrel || ev.motion.yrel) && cb && cb->mouse_move)
cb->mouse_move
@@ -588,7 +588,7 @@
ev.motion.xrel, ev.motion.yrel);
break;
case SDL_QUIT:
- m_should_die = true;
+ should_die_ = true;
break;
default:;
}
@@ -601,7 +601,7 @@
void WLApplication::_handle_mousebutton
(SDL_Event & ev, InputCallback const * cb)
{
- if (m_mouse_swapped) {
+ if (mouse_swapped_) {
switch (ev.button.button) {
case SDL_BUTTON_LEFT:
ev.button.button = SDL_BUTTON_RIGHT;
@@ -625,7 +625,7 @@
(get_key_state(SDL_SCANCODE_LALT) || get_key_state(SDL_SCANCODE_RALT)))
{
ev.button.button = SDL_BUTTON_LEFT;
- m_faking_middle_mouse_button = true;
+ faking_middle_mouse_button_ = true;
}
#endif
@@ -633,9 +633,9 @@
cb->mouse_press(ev.button.button, ev.button.x, ev.button.y);
else if (ev.type == SDL_MOUSEBUTTONUP) {
if (cb && cb->mouse_release) {
- if (ev.button.button == SDL_BUTTON_MIDDLE && m_faking_middle_mouse_button) {
+ if (ev.button.button == SDL_BUTTON_MIDDLE && faking_middle_mouse_button_) {
cb->mouse_release(SDL_BUTTON_LEFT, ev.button.x, ev.button.y);
- m_faking_middle_mouse_button = false;
+ faking_middle_mouse_button_ = false;
}
cb->mouse_release(ev.button.button, ev.button.x, ev.button.y);
}
@@ -646,18 +646,18 @@
/// Instantaneously move the mouse cursor without creating a motion event.
///
/// SDL_WarpMouseInWindow() *will* create a mousemotion event, which we do not want.
-/// As a workaround, we store the delta in m_mouse_compensate_warp and use that to
+/// As a workaround, we store the delta in mouse_compensate_warp_ and use that to
/// eliminate the motion event in poll_event()
///
/// \param position The new mouse position
void WLApplication::warp_mouse(const Point position)
{
- m_mouse_position = position;
+ mouse_position_ = position;
Point cur_position;
SDL_GetMouseState(&cur_position.x, &cur_position.y);
if (cur_position != position) {
- m_mouse_compensate_warp += cur_position - position;
+ mouse_compensate_warp_ += cur_position - position;
SDL_Window* sdl_window = g_gr->get_sdlwindow();
if (sdl_window) {
SDL_WarpMouseInWindow(sdl_window, position.x, position.y);
@@ -688,7 +688,7 @@
if (sdl_window) {
SDL_SetWindowGrab(sdl_window, SDL_FALSE);
}
- warp_mouse(m_mouse_position); //TODO(unknown): is this redundant?
+ warp_mouse(mouse_position_); //TODO(unknown): is this redundant?
}
}
@@ -767,7 +767,7 @@
// Initialize locale and grab "widelands" textdomain
i18n::init_locale();
- i18n::set_localedir(m_datadir + "/locale");
+ i18n::set_localedir(datadir_ + "/locale");
i18n::grab_textdomain("widelands");
// Set locale corresponding to selected language
@@ -852,12 +852,12 @@
opt.erase(pos, opt.size() - pos);
}
- m_commandline[opt] = value;
+ commandline_[opt] = value;
}
}
/**
- * Parse the command line given in m_commandline
+ * Parse the command line given in commandline_
*
* \return false if there were errors during parsing \e or if "--help"
* was given,
@@ -865,105 +865,105 @@
*/
void WLApplication::handle_commandline_parameters()
{
- if (m_commandline.count("logfile")) {
- m_logfile = m_commandline["logfile"];
- std::cerr << "Redirecting log target to: " << m_logfile << std::endl;
- if (m_logfile.size() != 0) {
+ if (commandline_.count("logfile")) {
+ logfile_ = commandline_["logfile"];
+ std::cerr << "Redirecting log target to: " << logfile_ << std::endl;
+ if (logfile_.size() != 0) {
//TODO(unknown): (very small) memory leak of 1 ofstream;
//swaw the buffers (internally) of the file and wout
- std::ofstream * widelands_out = new std::ofstream(m_logfile.c_str());
+ std::ofstream * widelands_out = new std::ofstream(logfile_.c_str());
std::streambuf * logbuf = widelands_out->rdbuf();
wout.rdbuf(logbuf);
}
- m_commandline.erase("logfile");
+ commandline_.erase("logfile");
}
- if (m_commandline.count("nosound")) {
+ if (commandline_.count("nosound")) {
g_sound_handler.nosound_ = true;
- m_commandline.erase("nosound");
+ commandline_.erase("nosound");
}
- if (m_commandline.count("nozip")) {
+ if (commandline_.count("nozip")) {
g_options.pull_section("global").create_val("nozip", "true");
- m_commandline.erase("nozip");
+ commandline_.erase("nozip");
}
- if (m_commandline.count("datadir")) {
- m_datadir = m_commandline["datadir"];
- m_commandline.erase("datadir");
+ if (commandline_.count("datadir")) {
+ datadir_ = commandline_["datadir"];
+ commandline_.erase("datadir");
} else {
- m_datadir = is_absolute_path(INSTALL_DATADIR) ?
+ datadir_ = is_absolute_path(INSTALL_DATADIR) ?
INSTALL_DATADIR :
get_executable_directory() + INSTALL_DATADIR;
}
- if (!is_absolute_path(m_datadir)) {
- m_datadir = absolute_path_if_not_windows(FileSystem::get_working_directory() +
- FileSystem::file_separator() + m_datadir);
+ if (!is_absolute_path(datadir_)) {
+ datadir_ = absolute_path_if_not_windows(FileSystem::get_working_directory() +
+ FileSystem::file_separator() + datadir_);
}
- if (m_commandline.count("verbose")) {
+ if (commandline_.count("verbose")) {
g_verbose = true;
- m_commandline.erase("verbose");
- }
-
- if (m_commandline.count("editor")) {
- m_filename = m_commandline["editor"];
- if (m_filename.size() && *m_filename.rbegin() == '/')
- m_filename.erase(m_filename.size() - 1);
- m_game_type = EDITOR;
- m_commandline.erase("editor");
- }
-
- if (m_commandline.count("replay")) {
- if (m_game_type != NONE)
+ commandline_.erase("verbose");
+ }
+
+ if (commandline_.count("editor")) {
+ filename_ = commandline_["editor"];
+ if (filename_.size() && *filename_.rbegin() == '/')
+ filename_.erase(filename_.size() - 1);
+ game_type_ = EDITOR;
+ commandline_.erase("editor");
+ }
+
+ if (commandline_.count("replay")) {
+ if (game_type_ != NONE)
throw wexception("replay can not be combined with other actions");
- m_filename = m_commandline["replay"];
- if (m_filename.size() && *m_filename.rbegin() == '/')
- m_filename.erase(m_filename.size() - 1);
- m_game_type = REPLAY;
- m_commandline.erase("replay");
+ filename_ = commandline_["replay"];
+ if (filename_.size() && *filename_.rbegin() == '/')
+ filename_.erase(filename_.size() - 1);
+ game_type_ = REPLAY;
+ commandline_.erase("replay");
}
- if (m_commandline.count("loadgame")) {
- if (m_game_type != NONE)
+ if (commandline_.count("loadgame")) {
+ if (game_type_ != NONE)
throw wexception("loadgame can not be combined with other actions");
- m_filename = m_commandline["loadgame"];
- if (m_filename.empty())
+ filename_ = commandline_["loadgame"];
+ if (filename_.empty())
throw wexception("empty value of command line parameter --loadgame");
- if (*m_filename.rbegin() == '/')
- m_filename.erase(m_filename.size() - 1);
- m_game_type = LOADGAME;
- m_commandline.erase("loadgame");
+ if (*filename_.rbegin() == '/')
+ filename_.erase(filename_.size() - 1);
+ game_type_ = LOADGAME;
+ commandline_.erase("loadgame");
}
- if (m_commandline.count("scenario")) {
- if (m_game_type != NONE)
+ if (commandline_.count("scenario")) {
+ if (game_type_ != NONE)
throw wexception("scenario can not be combined with other actions");
- m_filename = m_commandline["scenario"];
- if (m_filename.empty())
+ filename_ = commandline_["scenario"];
+ if (filename_.empty())
throw wexception("empty value of command line parameter --scenario");
- if (*m_filename.rbegin() == '/')
- m_filename.erase(m_filename.size() - 1);
- m_game_type = SCENARIO;
- m_commandline.erase("scenario");
+ if (*filename_.rbegin() == '/')
+ filename_.erase(filename_.size() - 1);
+ game_type_ = SCENARIO;
+ commandline_.erase("scenario");
}
- if (m_commandline.count("dedicated")) {
- if (m_game_type != NONE)
+ if (commandline_.count("dedicated")) {
+ if (game_type_ != NONE)
throw wexception("dedicated can not be combined with other actions");
- m_filename = m_commandline["dedicated"];
- if (m_filename.empty())
+ filename_ = commandline_["dedicated"];
+ if (filename_.empty())
throw wexception("empty value of commandline parameter --dedicated");
- if (*m_filename.rbegin() == '/')
- m_filename.erase(m_filename.size() - 1);
- m_game_type = INTERNET;
- m_commandline.erase("dedicated");
+ if (*filename_.rbegin() == '/')
+ filename_.erase(filename_.size() - 1);
+ game_type_ = INTERNET;
+ commandline_.erase("dedicated");
}
- if (m_commandline.count("script")) {
- m_script_to_run = m_commandline["script"];
- if (m_script_to_run.empty())
+ if (commandline_.count("script")) {
+ script_to_run_ = commandline_["script"];
+ if (script_to_run_.empty())
throw wexception("empty value of command line parameter --script");
- if (*m_script_to_run.rbegin() == '/')
- m_script_to_run.erase(m_script_to_run.size() - 1);
- m_commandline.erase("script");
+ if (*script_to_run_.rbegin() == '/')
+ script_to_run_.erase(script_to_run_.size() - 1);
+ commandline_.erase("script");
}
//If it hasn't been handled yet it's probably an attempt to
@@ -972,10 +972,10 @@
//will be taken care of (==ignored) when saving the options
const std::map<std::string, std::string>::const_iterator commandline_end =
- m_commandline.end();
+ commandline_.end();
for
(std::map<std::string, std::string>::const_iterator it =
- m_commandline.begin();
+ commandline_.begin();
it != commandline_end;
++it)
{
@@ -986,7 +986,7 @@
(it->first.c_str(), it->second.c_str());
}
- if (m_commandline.count("help") || m_commandline.count("version")) {
+ if (commandline_.count("help") || commandline_.count("version")) {
init_language();
throw ParameterError(); //no message on purpose
}
@@ -1057,7 +1057,7 @@
break;
}
case FullscreenMenuBase::MenuTarget::kEditor:
- EditorInteractive::run_editor(m_filename, m_script_to_run);
+ EditorInteractive::run_editor(filename_, script_to_run_);
break;
default:
case FullscreenMenuBase::MenuTarget::kExit:
@@ -1376,13 +1376,13 @@
void WLApplication::replay()
{
Widelands::Game game;
- if (m_filename.empty()) {
+ if (filename_.empty()) {
SinglePlayerGameSettingsProvider sp;
FullscreenMenuLoadGame rm(game, &sp, nullptr, true);
if (rm.run<FullscreenMenuBase::MenuTarget>() == FullscreenMenuBase::MenuTarget::kBack)
return;
- m_filename = rm.filename();
+ filename_ = rm.filename();
}
try {
@@ -1396,7 +1396,7 @@
game.set_ibase
(new InteractiveSpectator(game, g_options.pull_section("global")));
game.set_write_replay(false);
- ReplayGameController rgc(game, m_filename);
+ ReplayGameController rgc(game, filename_);
game.save_handler().set_allow_saving(false);
@@ -1404,10 +1404,10 @@
} catch (const std::exception & e) {
log("Fatal Exception: %s\n", e.what());
emergency_save(game);
- m_filename.clear();
+ filename_.clear();
throw;
}
- m_filename.clear();
+ filename_.clear();
}
@@ -1483,7 +1483,7 @@
memset(&tfile, 0, sizeof(tm));
tfile.tm_mday = atoi(timestr.substr(8, 2).c_str());
- tfile.tm_mon = atoi(timestr.substr(5, 2).c_str()) - 1;
+ tfile.tm_mon = atoi(timestr.substr(5, 2).c_str()) - 1;
tfile.tm_year = atoi(timestr.substr(0, 4).c_str()) - 1900;
double tdiff = std::difftime(tnow, mktime(&tfile)) / 86400;
@@ -1527,6 +1527,6 @@
/* No buffering */
setbuf(stderr, nullptr);
- m_redirected_stdio = true;
+ redirected_stdio_ = true;
return true;
}
=== modified file 'src/wlapplication.h'
--- src/wlapplication.h 2016-01-09 15:27:05 +0000
+++ src/wlapplication.h 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2012, 2015 by the Widelands Development Team
+ * Copyright (C) 2006-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -140,7 +140,7 @@
void run();
/// \warning true if an external entity wants us to quit
- bool should_die() const {return m_should_die;}
+ bool should_die() const {return should_die_;}
/// Get the state of the current KeyBoard Button
/// \warning This function doesn't check for dumbness
@@ -151,16 +151,16 @@
void set_input_grab(bool grab);
/// The mouse's current coordinates
- Point get_mouse_position() const {return m_mouse_position;}
+ Point get_mouse_position() const {return mouse_position_;}
//
/// Find out whether the mouse is currently pressed
bool is_mouse_pressed() const {return SDL_GetMouseState(nullptr, nullptr); }
/// Swap left and right mouse key?
- void set_mouse_swap(const bool swap) {m_mouse_swapped = swap;}
+ void set_mouse_swap(const bool swap) {mouse_swapped_ = swap;}
/// Lock the mouse cursor into place (e.g., for scrolling the map)
- void set_mouse_lock(const bool locked) {m_mouse_locked = locked;}
+ void set_mouse_lock(const bool locked) {mouse_locked_ = locked;}
//@}
@@ -209,47 +209,47 @@
/**
* The commandline, conveniently repackaged.
*/
- std::map<std::string, std::string> m_commandline;
+ std::map<std::string, std::string> commandline_;
- std::string m_filename;
+ std::string filename_;
/// Script to be run after the game was started with --editor,
/// --scenario or --loadgame.
- std::string m_script_to_run;
+ std::string script_to_run_;
//Log all output to this file if set, otherwise use cout
- std::string m_logfile;
+ std::string logfile_;
- GameType m_game_type;
+ GameType game_type_;
///True if left and right mouse button should be swapped
- bool m_mouse_swapped;
+ bool mouse_swapped_;
/// When apple is involved, the middle mouse button is sometimes send, even
/// if it wasn't pressed. We try to revert this and this helps.
- bool m_faking_middle_mouse_button;
+ bool faking_middle_mouse_button_;
///The current position of the mouse pointer
- Point m_mouse_position;
+ Point mouse_position_;
///If true, the mouse cursor will \e not move with a mousemotion event:
///instead, the map will be scrolled
- bool m_mouse_locked;
+ bool mouse_locked_;
///If the mouse needs to be moved in warp_mouse(), this Point is
///used to cancel the resulting SDL_MouseMotionEvent.
- Point m_mouse_compensate_warp;
+ Point mouse_compensate_warp_;
///true if an external entity wants us to quit
- bool m_should_die;
+ bool should_die_;
- std::string m_homedir;
+ std::string homedir_;
/// flag indicating if stdout and stderr have been redirected
- bool m_redirected_stdio;
+ bool redirected_stdio_;
/// Absolute path to the data directory.
- std::string m_datadir;
+ std::string datadir_;
///Holds this process' one and only instance of WLApplication, if it was
///created already. nullptr otherwise.
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -55,27 +55,27 @@
(&parent, "building_window",
0, 0, Width, 0,
b.descr().descname()),
- m_registry(registry),
- m_building (b),
- m_workarea_overlay_id(0),
- m_avoid_fastclick(false)
+ registry_(registry),
+ building_ (b),
+ workarea_overlay_id_(0),
+ avoid_fastclick_(false)
{
- delete m_registry;
- m_registry = this;
+ delete registry_;
+ registry_ = this;
- m_capscache_player_number = 0;
- m_capsbuttons = nullptr;
- m_capscache = 0;
- m_caps_setup = false;
- m_toggle_workarea = nullptr;
+ capscache_player_number_ = 0;
+ capsbuttons_ = nullptr;
+ capscache_ = 0;
+ caps_setup_ = false;
+ toggle_workarea_ = nullptr;
UI::Box * vbox = new UI::Box(this, 0, 0, UI::Box::Vertical);
- m_tabs = new UI::TabPanel(vbox, 0, 0, nullptr);
- vbox->add(m_tabs, UI::Box::AlignLeft, true);
+ tabs_ = new UI::TabPanel(vbox, 0, 0, nullptr);
+ vbox->add(tabs_, UI::Box::AlignLeft, true);
- m_capsbuttons = new UI::Box(vbox, 0, 0, UI::Box::Horizontal);
- vbox->add(m_capsbuttons, UI::Box::AlignLeft, true);
+ capsbuttons_ = new UI::Box(vbox, 0, 0, UI::Box::Horizontal);
+ vbox->add(capsbuttons_, UI::Box::AlignLeft, true);
// actually create buttons on the first call to think(),
// so that overriding create_capsbuttons() works
@@ -86,7 +86,7 @@
show_workarea();
// Title for construction site
- if (upcast(Widelands::ConstructionSite, csite, &m_building)) {
+ if (upcast(Widelands::ConstructionSite, csite, &building_)) {
// Show name in parenthesis as it may take all width already
const std::string title = (boost::format("(%s)") % csite->building().descname()).str();
set_title(title);
@@ -96,10 +96,10 @@
BuildingWindow::~BuildingWindow()
{
- if (m_workarea_overlay_id) {
- igbase().mutable_field_overlay_manager()->remove_overlay(m_workarea_overlay_id);
+ if (workarea_overlay_id_) {
+ igbase().mutable_field_overlay_manager()->remove_overlay(workarea_overlay_id_);
}
- m_registry = nullptr;
+ registry_ = nullptr;
}
namespace Widelands {class BuildingDescr;}
@@ -138,18 +138,18 @@
die();
if
- (!m_caps_setup
- ||
- m_capscache_player_number != igbase().player_number()
- ||
- building().get_playercaps() != m_capscache)
+ (!caps_setup_
+ ||
+ capscache_player_number_ != igbase().player_number()
+ ||
+ building().get_playercaps() != capscache_)
{
- m_capsbuttons->free_children();
- create_capsbuttons(m_capsbuttons);
+ capsbuttons_->free_children();
+ create_capsbuttons(capsbuttons_);
move_out_of_the_way();
- if (!m_avoid_fastclick)
+ if (!avoid_fastclick_)
warp_mouse_to_fastclick_panel();
- m_caps_setup = true;
+ caps_setup_ = true;
}
@@ -165,8 +165,8 @@
*/
void BuildingWindow::create_capsbuttons(UI::Box * capsbuttons)
{
- m_capscache = building().get_playercaps();
- m_capscache_player_number = igbase().player_number();
+ capscache_ = building().get_playercaps();
+ capscache_player_number_ = igbase().player_number();
const Widelands::Player & owner = building().owner();
const Widelands::PlayerNumber owner_number = owner.player_number();
@@ -176,7 +176,7 @@
bool requires_destruction_separator = false;
if (can_act) {
// Check if this is a port building and if yes show expedition button
- if (upcast(Widelands::Warehouse const, warehouse, &m_building)) {
+ if (upcast(Widelands::Warehouse const, warehouse, &building_)) {
if (Widelands::PortDock * pd = warehouse->get_portdock()) {
if (pd->expedition_started()) {
UI::Button * expeditionbtn =
@@ -202,7 +202,7 @@
}
}
else
- if (upcast(const Widelands::ProductionSite, productionsite, &m_building)) {
+ if (upcast(const Widelands::ProductionSite, productionsite, &building_)) {
if (!is_a(Widelands::MilitarySite, productionsite)) {
const bool is_stopped = productionsite->is_stopped();
UI::Button * stopbtn =
@@ -227,9 +227,9 @@
}
} // upcast to productionsite
- if (m_capscache & Widelands::Building::PCap_Enhancable) {
+ if (capscache_ & Widelands::Building::PCap_Enhancable) {
const Widelands::DescriptionIndex & enhancement =
- m_building.descr().enhancement();
+ building_.descr().enhancement();
const Widelands::TribeDescr & tribe = owner.tribe();
if (owner.is_building_type_allowed(enhancement)) {
const Widelands::BuildingDescr & building_descr =
@@ -256,7 +256,7 @@
}
}
- if (m_capscache & Widelands::Building::PCap_Bulldoze) {
+ if (capscache_ & Widelands::Building::PCap_Bulldoze) {
UI::Button * destroybtn =
new UI::Button
(capsbuttons, "destroy", 0, 0, 34, 34,
@@ -272,9 +272,9 @@
requires_destruction_separator = true;
}
- if (m_capscache & Widelands::Building::PCap_Dismantle) {
+ if (capscache_ & Widelands::Building::PCap_Dismantle) {
std::map<Widelands::DescriptionIndex, uint8_t> wares;
- Widelands::DismantleSite::count_returned_wares(&m_building, wares);
+ Widelands::DismantleSite::count_returned_wares(&building_, wares);
UI::Button * dismantlebtn =
new UI::Button
(capsbuttons, "dismantle", 0, 0, 34, 34,
@@ -301,24 +301,24 @@
if (can_see) {
WorkareaInfo wa_info;
- if (upcast(Widelands::ConstructionSite, csite, &m_building)) {
+ if (upcast(Widelands::ConstructionSite, csite, &building_)) {
wa_info = csite->building().m_workarea_info;
} else {
- wa_info = m_building.descr().m_workarea_info;
+ wa_info = building_.descr().m_workarea_info;
}
if (!wa_info.empty()) {
- m_toggle_workarea = new UI::Button
+ toggle_workarea_ = new UI::Button
(capsbuttons, "workarea",
0, 0, 34, 34,
g_gr->images().get("pics/but4.png"),
g_gr->images().get("pics/workarea123.png"),
_("Hide work area"));
- m_toggle_workarea->sigclicked.connect
+ toggle_workarea_->sigclicked.connect
(boost::bind(&BuildingWindow::toggle_workarea, boost::ref(*this)));
- capsbuttons->add(m_toggle_workarea, UI::Box::AlignCenter);
+ capsbuttons->add(toggle_workarea_, UI::Box::AlignCenter);
configure_workarea_button();
- set_fastclick_panel(m_toggle_workarea);
+ set_fastclick_panel(toggle_workarea_);
}
if (igbase().get_display_flag(InteractiveBase::dfDebug)) {
@@ -358,10 +358,10 @@
_("Help"));
UI::UniqueWindow::Registry& registry =
- igbase().unique_windows().get_registry(m_building.descr().name() + "_help");
+ igbase().unique_windows().get_registry(building_.descr().name() + "_help");
registry.open_window = [this, ®istry] {
new UI::BuildingHelpWindow(
- &igbase(), registry, m_building.descr(), m_building.owner().tribe(), &igbase().egbase().lua());
+ &igbase(), registry, building_.descr(), building_.owner().tribe(), &igbase().egbase().lua());
};
helpbtn->sigclicked.connect(boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(registry)));
@@ -377,11 +377,11 @@
void BuildingWindow::act_bulldoze()
{
if (get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL)) {
- if (m_building.get_playercaps() & Widelands::Building::PCap_Bulldoze)
- igbase().game().send_player_bulldoze(m_building);
+ if (building_.get_playercaps() & Widelands::Building::PCap_Bulldoze)
+ igbase().game().send_player_bulldoze(building_);
}
else {
- show_bulldoze_confirm(dynamic_cast<InteractivePlayer&>(igbase()), m_building);
+ show_bulldoze_confirm(dynamic_cast<InteractivePlayer&>(igbase()), building_);
}
}
@@ -393,11 +393,11 @@
void BuildingWindow::act_dismantle()
{
if (get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL)) {
- if (m_building.get_playercaps() & Widelands::Building::PCap_Dismantle)
- igbase().game().send_player_dismantle(m_building);
+ if (building_.get_playercaps() & Widelands::Building::PCap_Dismantle)
+ igbase().game().send_player_dismantle(building_);
}
else {
- show_dismantle_confirm(dynamic_cast<InteractivePlayer&>(igbase()), m_building);
+ show_dismantle_confirm(dynamic_cast<InteractivePlayer&>(igbase()), building_);
}
}
@@ -407,8 +407,8 @@
===============
*/
void BuildingWindow::act_start_stop() {
- if (dynamic_cast<const Widelands::ProductionSite *>(&m_building))
- igbase().game().send_player_start_stop_building (m_building);
+ if (dynamic_cast<const Widelands::ProductionSite *>(&building_))
+ igbase().game().send_player_start_stop_building (building_);
die();
}
@@ -420,9 +420,9 @@
===============
*/
void BuildingWindow::act_start_or_cancel_expedition() {
- if (upcast(Widelands::Warehouse const, warehouse, &m_building))
+ if (upcast(Widelands::Warehouse const, warehouse, &building_))
if (warehouse->get_portdock())
- igbase().game().send_player_start_or_cancel_expedition(m_building);
+ igbase().game().send_player_start_or_cancel_expedition(building_);
// No need to die here - as soon as the request is handled, the UI will get updated by the portdock
//die();
@@ -436,13 +436,13 @@
void BuildingWindow::act_enhance(Widelands::DescriptionIndex id)
{
if (get_key_state(SDL_SCANCODE_LCTRL) || get_key_state(SDL_SCANCODE_RCTRL)) {
- if (m_building.get_playercaps() & Widelands::Building::PCap_Enhancable)
- igbase().game().send_player_enhance_building(m_building, id);
+ if (building_.get_playercaps() & Widelands::Building::PCap_Enhancable)
+ igbase().game().send_player_enhance_building(building_, id);
}
else {
show_enhance_confirm
(dynamic_cast<InteractivePlayer&>(igbase()),
- m_building,
+ building_,
id);
}
}
@@ -456,7 +456,7 @@
{
show_field_debug
(igbase(),
- igbase().game().map().get_fcoords(m_building.get_position()));
+ igbase().game().map().get_fcoords(building_.get_position()));
}
/**
@@ -464,19 +464,19 @@
*/
void BuildingWindow::show_workarea()
{
- if (m_workarea_overlay_id) {
+ if (workarea_overlay_id_) {
return; // already shown, nothing to be done
}
WorkareaInfo workarea_info;
- if (upcast(Widelands::ConstructionSite, csite, &m_building)) {
+ if (upcast(Widelands::ConstructionSite, csite, &building_)) {
workarea_info = csite->building().m_workarea_info;
} else {
- workarea_info = m_building.descr().m_workarea_info;
+ workarea_info = building_.descr().m_workarea_info;
}
if (workarea_info.empty()) {
return;
}
- m_workarea_overlay_id = igbase().show_work_area(workarea_info, m_building.get_position());
+ workarea_overlay_id_ = igbase().show_work_area(workarea_info, building_.get_position());
configure_workarea_button();
}
@@ -486,33 +486,33 @@
*/
void BuildingWindow::hide_workarea()
{
- if (m_workarea_overlay_id) {
- igbase().hide_work_area(m_workarea_overlay_id);
- m_workarea_overlay_id = 0;
+ if (workarea_overlay_id_) {
+ igbase().hide_work_area(workarea_overlay_id_);
+ workarea_overlay_id_ = 0;
configure_workarea_button();
}
}
/**
- * Sets the perm_pressed state and the tooltip.
+ * Sets the perpressed_ state and the tooltip.
*/
void BuildingWindow::configure_workarea_button()
{
- if (m_toggle_workarea) {
- if (m_workarea_overlay_id) {
- m_toggle_workarea->set_tooltip(_("Hide work area"));
- m_toggle_workarea->set_perm_pressed(true);
+ if (toggle_workarea_) {
+ if (workarea_overlay_id_) {
+ toggle_workarea_->set_tooltip(_("Hide work area"));
+ toggle_workarea_->set_perm_pressed(true);
} else {
- m_toggle_workarea->set_tooltip(_("Show work area"));
- m_toggle_workarea->set_perm_pressed(false);
+ toggle_workarea_->set_tooltip(_("Show work area"));
+ toggle_workarea_->set_perm_pressed(false);
}
}
}
void BuildingWindow::toggle_workarea() {
- if (m_workarea_overlay_id) {
+ if (workarea_overlay_id_) {
hide_workarea();
} else {
show_workarea();
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2010, 2012 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -45,7 +45,7 @@
virtual ~BuildingWindow();
- Widelands::Building & building() {return m_building;}
+ Widelands::Building & building() {return building_;}
InteractiveGameBase & igbase() const {
return dynamic_cast<InteractiveGameBase&>(*get_parent());
@@ -53,10 +53,10 @@
void draw(RenderTarget &) override;
void think() override;
- void set_avoid_fastclick(bool afc) {m_avoid_fastclick = afc;}
+ void set_avoid_fastclick(bool afc) {avoid_fastclick_ = afc;}
protected:
- UI::TabPanel * get_tabs() {return m_tabs;}
+ UI::TabPanel * get_tabs() {return tabs_;}
void act_bulldoze();
void act_dismantle();
@@ -75,23 +75,23 @@
virtual void create_capsbuttons(UI::Box * buttons);
- UI::Window * & m_registry;
+ UI::Window * & registry_;
private:
- Widelands::Building& m_building;
-
- UI::TabPanel * m_tabs;
-
- UI::Box * m_capsbuttons; ///< \ref UI::Box that contains capabilities buttons
- UI::Button * m_toggle_workarea;
+ Widelands::Building& building_;
+
+ UI::TabPanel * tabs_;
+
+ UI::Box * capsbuttons_; ///< \ref UI::Box that contains capabilities buttons
+ UI::Button * toggle_workarea_;
// capabilities that were last used in setting up the caps panel
- uint32_t m_capscache;
- Widelands::PlayerNumber m_capscache_player_number;
- bool m_caps_setup;
+ uint32_t capscache_;
+ Widelands::PlayerNumber capscache_player_number_;
+ bool caps_setup_;
- FieldOverlayManager::OverlayId m_workarea_overlay_id;
- bool m_avoid_fastclick;
+ FieldOverlayManager::OverlayId workarea_overlay_id_;
+ bool avoid_fastclick_;
};
#endif // end of include guard: WL_WUI_BUILDINGWINDOW_H
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2009 by the Widelands Development Team
+ * Copyright (C) 2008-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -136,7 +136,7 @@
// This check is an evil hack to account for the singleton-nature
// of the Console
if (this != &g_console) {
- for (const auto& command : m_commands) {
+ for (const auto& command : commands_) {
g_console.commands.erase(command);
}
}
@@ -145,7 +145,7 @@
void Handler::addCommand(const std::string & cmd, const HandlerFn & fun)
{
g_console.commands[cmd] = fun;
- m_commands.push_back(cmd);
+ commands_.push_back(cmd);
}
void Handler::setDefaultCommand(const HandlerFn & fun)
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2010 by the Widelands Development Team
+ * Copyright (C) 2008-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -60,7 +60,7 @@
void setDefaultCommand(const HandlerFn &);
private:
- std::vector<std::string> m_commands;
+ std::vector<std::string> commands_;
};
/**
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2015 by the Widelands Development Team
+ * Copyright (C) 2006-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -19,21 +19,21 @@
#include "wui/edge_overlay_manager.h"
-EdgeOverlayManager::EdgeOverlayManager() : m_current_overlay_id(0) {
+EdgeOverlayManager::EdgeOverlayManager() : current_overlay_id_(0) {
}
EdgeOverlayManager::OverlayId EdgeOverlayManager::next_overlay_id() {
- ++m_current_overlay_id;
- return m_current_overlay_id;
+ ++current_overlay_id_;
+ return current_overlay_id_;
}
void EdgeOverlayManager::register_overlay
(Widelands::Coords const c, uint8_t const where, OverlayId const overlay_id)
{
const RegisteredRoadOverlays overlay = {overlay_id, where};
- RegisteredRoadOverlaysMap::iterator it = m_overlays.find(c);
- if (it == m_overlays.end())
- m_overlays.insert
+ RegisteredRoadOverlaysMap::iterator it = overlays_.find(c);
+ if (it == overlays_.end())
+ overlays_.insert
(std::pair<const Widelands::Coords,
RegisteredRoadOverlays>(c, overlay));
else
@@ -41,25 +41,25 @@
}
void EdgeOverlayManager::remove_overlay(const Widelands::Coords c) {
- const RegisteredRoadOverlaysMap::iterator it = m_overlays.find(c);
- if (it != m_overlays.end())
- m_overlays.erase(it);
+ const RegisteredRoadOverlaysMap::iterator it = overlays_.find(c);
+ if (it != overlays_.end())
+ overlays_.erase(it);
}
void EdgeOverlayManager::remove_overlay(OverlayId const overlay_id) {
- RegisteredRoadOverlaysMap::iterator it = m_overlays.begin();
+ RegisteredRoadOverlaysMap::iterator it = overlays_.begin();
const RegisteredRoadOverlaysMap::const_iterator end =
- m_overlays.end();
+ overlays_.end();
while (it != end)
if (it->second.overlay_id == overlay_id)
- m_overlays.erase(it++); // Necessary!
+ overlays_.erase(it++); // Necessary!
else
++it;
}
uint8_t EdgeOverlayManager::get_overlay(const Widelands::Coords c) const {
- RegisteredRoadOverlaysMap::const_iterator const it = m_overlays.find(c);
- if (it != m_overlays.end())
+ RegisteredRoadOverlaysMap::const_iterator const it = overlays_.find(c);
+ if (it != overlays_.end())
return it->second.where;
return 0;
}
=== 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:17:30 +0000
@@ -54,8 +54,8 @@
using RegisteredRoadOverlaysMap =
std::map<const Widelands::Coords, RegisteredRoadOverlays, Widelands::Coords::OrderingFunctor>;
- OverlayId m_current_overlay_id;
- RegisteredRoadOverlaysMap m_overlays;
+ OverlayId current_overlay_id_;
+ RegisteredRoadOverlaysMap overlays_;
DISALLOW_COPY_AND_ASSIGN(EdgeOverlayManager);
};
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008, 2010-2011, 2013 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -26,8 +26,8 @@
#include "graphic/graphic.h"
#include "logic/field.h"
-FieldOverlayManager::FieldOverlayManager() : m_current_overlay_id(0) {
- OverlayInfo * buildhelp_info = m_buildhelp_infos;
+FieldOverlayManager::FieldOverlayManager() : current_overlay_id_(0) {
+ OverlayInfo * buildhelp_info = buildhelp_infos_;
const char * filenames[] = {
"pics/set_flag.png",
"pics/small.png",
@@ -55,16 +55,16 @@
}
bool FieldOverlayManager::buildhelp() const {
- return m_buildhelp;
+ return buildhelp_;
}
void FieldOverlayManager::show_buildhelp(const bool value) {
- m_buildhelp = value;
+ buildhelp_ = value;
}
void FieldOverlayManager::get_overlays(Widelands::FCoords const c,
std::vector<OverlayInfo>* result) const {
- const RegisteredOverlaysMap & overlay_map = m_overlays[Widelands::TCoords<>::None];
+ const RegisteredOverlaysMap & overlay_map = overlays_[Widelands::TCoords<>::None];
RegisteredOverlaysMap::const_iterator it = overlay_map.lower_bound(c);
while (it != overlay_map.end() && it->first == c && it->second.level <= kLevelForBuildHelp) {
@@ -72,10 +72,10 @@
++it;
}
- if (m_buildhelp) {
+ if (buildhelp_) {
int buildhelp_overlay_index = get_buildhelp_overlay(c);
if (buildhelp_overlay_index < Widelands::Field::Buildhelp_None) {
- result->emplace_back(m_buildhelp_infos[buildhelp_overlay_index]);
+ result->emplace_back(buildhelp_infos_[buildhelp_overlay_index]);
}
}
@@ -90,7 +90,7 @@
assert(c.t == Widelands::TCoords<>::D || c.t == Widelands::TCoords<>::R);
- const RegisteredOverlaysMap & overlay_map = m_overlays[c.t];
+ const RegisteredOverlaysMap & overlay_map = overlays_[c.t];
RegisteredOverlaysMap::const_iterator it = overlay_map.lower_bound(c);
while (it != overlay_map.end() && it->first == c) {
result->emplace_back(it->second.pic, it->second.hotspot);
@@ -100,7 +100,7 @@
int FieldOverlayManager::get_buildhelp_overlay(const Widelands::FCoords& fc) const {
Widelands::NodeCaps const caps =
- m_callback ? static_cast<Widelands::NodeCaps>(m_callback(fc)) : fc.field->nodecaps();
+ callback_ ? static_cast<Widelands::NodeCaps>(callback_(fc)) : fc.field->nodecaps();
const int value = caps & Widelands::BUILDCAPS_MINE ?
Widelands::Field::Buildhelp_Mine :
@@ -130,7 +130,7 @@
hotspot = Point(pic->width() / 2, pic->height() / 2);
}
- RegisteredOverlaysMap & overlay_map = m_overlays[c.t];
+ RegisteredOverlaysMap & overlay_map = overlays_[c.t];
for
(RegisteredOverlaysMap::iterator it = overlay_map.find(c);
it != overlay_map.end() && it->first == c;
@@ -180,7 +180,7 @@
void FieldOverlayManager::remove_overlay(Widelands::TCoords<> const c, const Image* pic) {
assert(c.t <= 2);
- RegisteredOverlaysMap & overlay_map = m_overlays[c.t];
+ RegisteredOverlaysMap & overlay_map = overlays_[c.t];
if (overlay_map.count(c)) {
RegisteredOverlaysMap::iterator it = overlay_map.lower_bound(c);
@@ -196,8 +196,8 @@
}
void FieldOverlayManager::remove_overlay(const OverlayId overlay_id) {
- const RegisteredOverlaysMap * const overlays_end = m_overlays + 3;
- for (RegisteredOverlaysMap * j = m_overlays; j != overlays_end; ++j)
+ const RegisteredOverlaysMap * const overlays_end = overlays_ + 3;
+ for (RegisteredOverlaysMap * j = overlays_; j != overlays_end; ++j)
for (RegisteredOverlaysMap::iterator it = j->begin(); it != j->end();) {
it->second.overlay_ids.erase(overlay_id);
if (it->second.overlay_ids.empty())
@@ -208,16 +208,16 @@
}
void FieldOverlayManager::remove_all_overlays() {
- m_overlays[0].clear();
- m_overlays[1].clear();
- m_overlays[2].clear();
+ overlays_[0].clear();
+ overlays_[1].clear();
+ overlays_[2].clear();
}
void FieldOverlayManager::register_overlay_callback_function(CallbackFn function) {
- m_callback = function;
+ callback_ = function;
}
FieldOverlayManager::OverlayId FieldOverlayManager::next_overlay_id() {
- ++m_current_overlay_id;
- return m_current_overlay_id;
+ ++current_overlay_id_;
+ return current_overlay_id_;
}
=== 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:17:30 +0000
@@ -126,19 +126,19 @@
RegisteredOverlays,
Widelands::Coords::OrderingFunctor>;
- // Returns the index into m_buildhelp_infos for the correct fieldcaps for
- // 'fc' according to the current 'm_callback'.
+ // Returns the index into buildhelp_infos_ for the correct fieldcaps for
+ // 'fc' according to the current 'callback_'.
int get_buildhelp_overlay(const Widelands::FCoords& fc) const;
// indexed by TCoords<>::TriangleIndex
- RegisteredOverlaysMap m_overlays[3];
+ RegisteredOverlaysMap overlays_[3];
- OverlayInfo m_buildhelp_infos[Widelands::Field::Buildhelp_None];
- bool m_buildhelp;
+ OverlayInfo buildhelp_infos_[Widelands::Field::Buildhelp_None];
+ bool buildhelp_;
// this callback is used to define where overlays are drawn.
- CallbackFn m_callback;
- OverlayId m_current_overlay_id;
+ CallbackFn callback_;
+ OverlayId current_overlay_id_;
};
#endif // end of include guard: WL_WUI_FIELD_OVERLAY_MANAGER_H
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008, 2011 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -36,17 +36,17 @@
const std::string & title)
:
UI::UniqueWindow(parent, "chat", ®istry, 440, 235, title),
-m_chat(this, 5, 5, get_inner_w() - 10, get_inner_h() - 10, chat)
+chat_(this, 5, 5, get_inner_w() - 10, get_inner_h() - 10, chat)
{
if (get_usedefaultpos())
center_to_parent();
- m_close_on_send = false;
-
- m_chat.sent.connect(boost::bind(&GameChatMenu::acknowledge, this));
- m_chat.aborted.connect(boost::bind(&GameChatMenu::acknowledge, this));
-
- enter_chat_message(m_close_on_send);
+ close_on_send_ = false;
+
+ chat_.sent.connect(boost::bind(&GameChatMenu::acknowledge, this));
+ chat_.aborted.connect(boost::bind(&GameChatMenu::acknowledge, this));
+
+ enter_chat_message(close_on_send_);
}
GameChatMenu* GameChatMenu::create_chat_console(
@@ -67,13 +67,13 @@
void GameChatMenu::enter_chat_message(bool close_on_send)
{
- m_chat.focus_edit();
- m_close_on_send = close_on_send;
+ chat_.focus_edit();
+ close_on_send_ = close_on_send;
}
void GameChatMenu::acknowledge()
{
- if (m_close_on_send)
+ if (close_on_send_)
die();
}
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008 by the Widelands Development Team
+ * Copyright (C) 2002-2016, 2008 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -50,8 +50,8 @@
private:
GameChatMenu(UI::Panel *, UI::UniqueWindow::Registry &, ChatProvider &, const std::string & title);
void acknowledge();
- GameChatPanel m_chat;
- bool m_close_on_send;
+ GameChatPanel chat_;
+ bool close_on_send_;
};
#endif // end of include guard: WL_WUI_GAME_CHAT_MENU_H
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -37,8 +37,8 @@
InteractivePlayer::GameMainMenuWindows & windows)
:
UI::UniqueWindow(&plr, "main_menu", ®istry, 180, 55, _("Statistics Menu")),
-m_player (plr),
-m_windows (windows),
+player_ (plr),
+windows_ (windows),
general_stats
(this, "general_stats",
posx(0, 4), posy(0, 3), buttonw(4), buttonh(1),
@@ -65,13 +65,13 @@
_("Stock"))
{
general_stats.sigclicked.connect
- (boost::bind(&GeneralStatisticsMenu::Registry::toggle, boost::ref(m_windows.general_stats)));
+ (boost::bind(&GeneralStatisticsMenu::Registry::toggle, boost::ref(windows_.general_stats)));
ware_stats.sigclicked.connect
- (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.ware_stats)));
+ (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(windows_.ware_stats)));
building_stats.sigclicked.connect
- (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.building_stats)));
+ (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(windows_.building_stats)));
stock.sigclicked.connect
- (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.stock)));
+ (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(windows_.stock)));
#define INIT_BTN_HOOKS(registry, btn) \
assert (!registry.on_create); \
@@ -80,19 +80,19 @@
registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \
if (registry.window) btn.set_perm_pressed(true); \
- INIT_BTN_HOOKS(m_windows.general_stats, general_stats)
- INIT_BTN_HOOKS(m_windows.ware_stats, ware_stats)
- INIT_BTN_HOOKS(m_windows.building_stats, building_stats)
- INIT_BTN_HOOKS(m_windows.stock, stock)
+ INIT_BTN_HOOKS(windows_.general_stats, general_stats)
+ INIT_BTN_HOOKS(windows_.ware_stats, ware_stats)
+ INIT_BTN_HOOKS(windows_.building_stats, building_stats)
+ INIT_BTN_HOOKS(windows_.stock, stock)
- m_windows.general_stats.open_window = [this] {
- new GeneralStatisticsMenu(m_player, m_windows.general_stats);
- };
- m_windows.ware_stats.open_window = [this] {
- new WareStatisticsMenu(m_player, m_windows.ware_stats);
- };
- m_windows.building_stats.open_window = [this] {
- new BuildingStatisticsMenu(m_player, m_windows.building_stats);
+ windows_.general_stats.open_window = [this] {
+ new GeneralStatisticsMenu(player_, windows_.general_stats);
+ };
+ windows_.ware_stats.open_window = [this] {
+ new WareStatisticsMenu(player_, windows_.ware_stats);
+ };
+ windows_.building_stats.open_window = [this] {
+ new BuildingStatisticsMenu(player_, windows_.building_stats);
};
if (get_usedefaultpos())
@@ -109,8 +109,8 @@
registry.on_create = 0; \
registry.on_delete = 0;
- DEINIT_BTN_HOOKS(m_windows.general_stats, general_stats)
- DEINIT_BTN_HOOKS(m_windows.ware_stats, ware_stats)
- DEINIT_BTN_HOOKS(m_windows.building_stats, building_stats)
- DEINIT_BTN_HOOKS(m_windows.stock, stock)
+ DEINIT_BTN_HOOKS(windows_.general_stats, general_stats)
+ DEINIT_BTN_HOOKS(windows_.ware_stats, ware_stats)
+ DEINIT_BTN_HOOKS(windows_.building_stats, building_stats)
+ DEINIT_BTN_HOOKS(windows_.stock, stock)
}
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -33,8 +33,8 @@
~GameMainMenu();
private:
- InteractivePlayer & m_player;
- InteractivePlayer::GameMainMenuWindows & m_windows;
+ InteractivePlayer & player_;
+ InteractivePlayer::GameMainMenuWindows & windows_;
UI::Button general_stats;
UI::Button ware_stats;
UI::Button building_stats;
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008, 2010-2013 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -59,31 +59,31 @@
UI::UniqueWindow
(&parent, "save_game", ®istry,
WINDOW_WIDTH, WINDOW_HEIGHT, _("Save Game")),
- m_ls (this, HSPACING, VSPACING, LIST_WIDTH, LIST_HEIGHT),
- m_name_label
+ ls_ (this, HSPACING, VSPACING, LIST_WIDTH, LIST_HEIGHT),
+ name_label_
(this, DESCRIPTION_X, 5, 0, 20, _("Map Name:"), UI::Align_CenterLeft),
- m_mapname
+ mapname_
(this, DESCRIPTION_X, 20, 0, 20, " ", UI::Align_CenterLeft),
- m_gametime_label
+ gametime_label_
(this, DESCRIPTION_X, 45, 0, 20, _("Game Time:"), UI::Align_CenterLeft),
- m_gametime
+ gametime_
(this, DESCRIPTION_X, 60, 0, 20, " ", UI::Align_CenterLeft),
- m_players_label
+ players_label_
(this, DESCRIPTION_X, 85, 0, 20, " ", UI::Align_CenterLeft),
- m_win_condition_label
+ win_condition_label_
(this, DESCRIPTION_X, 110, 0, 20, _("Win condition:"), UI::Align_CenterLeft),
- m_win_condition
+ win_condition_
(this, DESCRIPTION_X, 125, 0, 20, " ", UI::Align_CenterLeft),
- m_curdir(SaveHandler::get_base_dir())
+ curdir_(SaveHandler::get_base_dir())
{
- m_editbox =
+ editbox_ =
new UI::EditBox
(this, HSPACING, EDITBOX_Y, LIST_WIDTH, EDITBOX_HEIGHT,
g_gr->images().get("pics/but1.png"));
- m_editbox->changed.connect(boost::bind(&GameMainMenuSaveGame::edit_box_changed, this));
- m_editbox->ok.connect(boost::bind(&GameMainMenuSaveGame::ok, this));
+ editbox_->changed.connect(boost::bind(&GameMainMenuSaveGame::edit_box_changed, this));
+ editbox_->ok.connect(boost::bind(&GameMainMenuSaveGame::ok, this));
- m_button_ok =
+ button_ok_ =
new UI::Button
(this, "ok",
DESCRIPTION_X, OK_Y, DESCRIPTION_WIDTH, BUTTON_HEIGHT,
@@ -91,7 +91,7 @@
_("OK"),
std::string(),
false);
- m_button_ok->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::ok, this));
+ button_ok_->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::ok, this));
UI::Button * cancelbtn =
new UI::Button
@@ -109,8 +109,8 @@
_("Delete"));
deletebtn->sigclicked.connect(boost::bind(&GameMainMenuSaveGame::delete_clicked, this));
- m_ls.selected.connect(boost::bind(&GameMainMenuSaveGame::selected, this, _1));
- m_ls.double_clicked.connect(boost::bind(&GameMainMenuSaveGame::double_clicked, this, _1));
+ ls_.selected.connect(boost::bind(&GameMainMenuSaveGame::selected, this, _1));
+ ls_.double_clicked.connect(boost::bind(&GameMainMenuSaveGame::double_clicked, this, _1));
fill_list();
@@ -125,21 +125,21 @@
{
//Try to translate the map name.
i18n::Textdomain td("maps");
- m_mapname.set_text(_(parent.game().get_map()->get_name()));
+ mapname_.set_text(_(parent.game().get_map()->get_name()));
}
uint32_t gametime = parent.game().get_gametime();
- m_gametime.set_text(gametimestring(gametime));
+ gametime_.set_text(gametimestring(gametime));
int player_nr = parent.game().player_manager()->get_number_of_players();
- m_players_label.set_text(
+ players_label_.set_text(
(boost::format(ngettext("%i player", "%i players", player_nr)) % player_nr).str());
{
i18n::Textdomain td("win_conditions");
- m_win_condition.set_text(_(parent.game().get_win_condition_displayname()));
+ win_condition_.set_text(_(parent.game().get_win_condition_displayname()));
}
}
- m_editbox->focus();
+ editbox_->focus();
pause_game(true);
}
@@ -148,35 +148,35 @@
* called when a item is selected
*/
void GameMainMenuSaveGame::selected(uint32_t) {
- const std::string & name = m_ls.get_selected();
+ const std::string & name = ls_.get_selected();
Widelands::GameLoader gl(name, igbase().game());
Widelands::GamePreloadPacket gpdp;
gl.preload_game(gpdp); // This has worked before, no problem
{
- m_editbox->set_text(FileSystem::filename_without_ext(name.c_str()));
+ editbox_->set_text(FileSystem::filename_without_ext(name.c_str()));
}
- m_button_ok->set_enabled(true);
+ button_ok_->set_enabled(true);
//Try to translate the map name.
{
i18n::Textdomain td("maps");
- m_mapname.set_text(_(gpdp.get_mapname()));
+ mapname_.set_text(_(gpdp.get_mapname()));
}
uint32_t gametime = gpdp.get_gametime();
- m_gametime.set_text(gametimestring(gametime));
+ gametime_.set_text(gametimestring(gametime));
if (gpdp.get_number_of_players() > 0) {
const std::string text =
(boost::format(ngettext("%u Player", "%u Players", gpdp.get_number_of_players()))
% static_cast<unsigned int>(gpdp.get_number_of_players())).str();
- m_players_label.set_text(text);
+ players_label_.set_text(text);
} else {
// Keep label empty
- m_players_label.set_text("");
+ players_label_.set_text("");
}
- m_win_condition.set_text(gpdp.get_win_condition());
+ win_condition_.set_text(gpdp.get_win_condition());
}
/**
@@ -190,11 +190,11 @@
* fill the file list
*/
void GameMainMenuSaveGame::fill_list() {
- m_ls.clear();
+ ls_.clear();
FilenameSet gamefiles;
// Fill it with all files we find.
- gamefiles = g_fs->list_directory(m_curdir);
+ gamefiles = g_fs->list_directory(curdir_);
Widelands::GamePreloadPacket gpdp;
@@ -208,17 +208,17 @@
try {
Widelands::GameLoader gl(name, igbase().game());
gl.preload_game(gpdp);
- m_ls.add(FileSystem::filename_without_ext(name), name);
+ ls_.add(FileSystem::filename_without_ext(name), name);
} catch (const WException &) {} // we simply skip illegal entries
}
}
void GameMainMenuSaveGame::select_by_name(std::string name)
{
- for (uint32_t idx = 0; idx < m_ls.size(); idx++) {
- const std::string val = m_ls[idx];
+ for (uint32_t idx = 0; idx < ls_.size(); idx++) {
+ const std::string val = ls_[idx];
if (name == val) {
- m_ls.select(idx);
+ ls_.select(idx);
return;
}
}
@@ -228,7 +228,7 @@
* The editbox was changed. Enable ok button
*/
void GameMainMenuSaveGame::edit_box_changed() {
- m_button_ok->set_enabled(m_editbox->text().size());
+ button_ok_->set_enabled(editbox_->text().size());
}
static void dosave
@@ -260,7 +260,7 @@
(boost::format(_("A file with the name ‘%s’ already exists. Overwrite?"))
% FileSystem::fs_filename(filename.c_str())).str(),
MBoxType::kOkCancel),
- m_filename(filename)
+ filename_(filename)
{}
GameMainMenuSaveGame & menu_save_game() {
@@ -270,8 +270,8 @@
void clicked_ok() override
{
- g_fs->fs_unlink(m_filename);
- dosave(menu_save_game().igbase(), m_filename);
+ g_fs->fs_unlink(filename_);
+ dosave(menu_save_game().igbase(), filename_);
menu_save_game().die();
}
@@ -281,7 +281,7 @@
}
private:
- std::string const m_filename;
+ std::string const filename_;
};
/**
@@ -289,12 +289,12 @@
*/
void GameMainMenuSaveGame::ok()
{
- if (m_editbox->text().empty())
+ if (editbox_->text().empty())
return;
std::string const complete_filename =
igbase().game().save_handler().create_file_name
- (m_curdir, m_editbox->text());
+ (curdir_, editbox_->text());
// Check if file exists. If it does, show a warning.
if (g_fs->file_exists(complete_filename)) {
@@ -324,12 +324,12 @@
(boost::format(_("Do you really want to delete the file %s?")) %
FileSystem::fs_filename(filename.c_str())),
MBoxType::kOkCancel),
- m_filename(filename)
+ filename_(filename)
{}
void clicked_ok() override
{
- g_fs->fs_unlink(m_filename);
+ g_fs->fs_unlink(filename_);
dynamic_cast<GameMainMenuSaveGame&>(*get_parent()).fill_list();
die();
}
@@ -340,7 +340,7 @@
}
private:
- std::string const m_filename;
+ std::string const filename_;
};
@@ -351,7 +351,7 @@
{
std::string const complete_filename =
igbase().game().save_handler().create_file_name
- (m_curdir, m_editbox->text());
+ (curdir_, editbox_->text());
// Check if file exists. If it does, let the user confirm the deletion.
if (g_fs->file_exists(complete_filename))
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008-2013 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -51,15 +51,15 @@
bool save_game(std::string);
void pause_game(bool paused);
- UI::Listselect<std::string> m_ls;
- UI::EditBox * m_editbox;
- UI::Textarea m_name_label, m_mapname, m_gametime_label, m_gametime, m_players_label,
- m_win_condition_label, m_win_condition;
- UI::Button * m_button_ok;
- std::string m_curdir;
- std::string m_parentdir;
- std::string m_filename;
- bool m_overwrite;
+ UI::Listselect<std::string> ls_;
+ UI::EditBox * editbox_;
+ UI::Textarea name_label_, mapname_, gametime_label_, gametime_, players_label_,
+ win_condition_label_, win_condition_;
+ UI::Button * button_ok_;
+ std::string curdir_;
+ std::string parentdir_;
+ std::string filename_;
+ bool overwrite_;
};
#endif // end of include guard: WL_WUI_GAME_MAIN_MENU_SAVE_GAME_H
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -79,7 +79,7 @@
list->focus();
// Buttons for message types
- m_geologistsbtn =
+ geologistsbtn_ =
new UI::Button
(this, "filter_geologists_messages",
kPadding, kPadding, kButtonSize, kButtonSize,
@@ -87,10 +87,10 @@
g_gr->images().get("pics/menu_geologist.png"),
"",
true);
- m_geologistsbtn->sigclicked.connect
+ geologistsbtn_->sigclicked.connect
(boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kGeologists));
- m_economybtn =
+ economybtn_ =
new UI::Button
(this, "filter_economy_messages",
2 * kPadding + kButtonSize, kPadding, kButtonSize, kButtonSize,
@@ -98,10 +98,10 @@
g_gr->images().get("pics/genstats_nrwares.png"),
"",
true);
- m_economybtn->sigclicked.connect
+ economybtn_->sigclicked.connect
(boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kEconomy));
- m_seafaringbtn =
+ seafaringbtn_ =
new UI::Button
(this, "filter_seafaring_messages",
3 * kPadding + 2 * kButtonSize, kPadding, kButtonSize, kButtonSize,
@@ -109,10 +109,10 @@
g_gr->images().get("pics/start_expedition.png"),
"",
true);
- m_seafaringbtn->sigclicked.connect
+ seafaringbtn_->sigclicked.connect
(boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kSeafaring));
- m_warfarebtn =
+ warfarebtn_ =
new UI::Button
(this, "filter_warfare_messages",
4 * kPadding + 3 * kButtonSize, kPadding, kButtonSize, kButtonSize,
@@ -120,10 +120,10 @@
g_gr->images().get("pics/messages_warfare.png"),
"",
true);
- m_warfarebtn->sigclicked.connect
+ warfarebtn_->sigclicked.connect
(boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kWarfare));
- m_scenariobtn =
+ scenariobtn_ =
new UI::Button
(this, "filter_scenario_messages",
5 * kPadding + 4 * kButtonSize, kPadding, kButtonSize, kButtonSize,
@@ -131,14 +131,14 @@
g_gr->images().get("pics/menu_objectives.png"),
"",
true);
- m_scenariobtn->sigclicked.connect
+ scenariobtn_->sigclicked.connect
(boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kScenario));
- m_message_filter = Widelands::Message::Type::kAllMessages;
+ message_filter_ = Widelands::Message::Type::kAllMessages;
set_filter_messages_tooltips();
// End: Buttons for message types
- m_archivebtn =
+ archivebtn_ =
new UI::Button
(this, "archive_or_restore_selected_messages",
kPadding, kWindowHeight - kPadding - kButtonSize, kButtonSize, kButtonSize,
@@ -148,26 +148,26 @@
(boost::format(_("Del: %s"))
/** TRANSLATORS: Tooltip in the messages window */
% _("Archive selected message")).str());
- m_archivebtn->sigclicked.connect
+ archivebtn_->sigclicked.connect
(boost::bind(&GameMessageMenu::archive_or_restore, this));
- m_togglemodebtn =
+ togglemodebtn_ =
new UI::Button
(this, "toggle_between_inbox_or_archive",
- m_archivebtn->get_x() + m_archivebtn->get_w() + kPadding,
- m_archivebtn->get_y(),
+ archivebtn_->get_x() + archivebtn_->get_w() + kPadding,
+ archivebtn_->get_y(),
kButtonSize,
kButtonSize,
g_gr->images().get("pics/but2.png"),
g_gr->images().get("pics/message_archived.png"),
_("Show Archive"));
- m_togglemodebtn->sigclicked.connect
+ togglemodebtn_->sigclicked.connect
(boost::bind(&GameMessageMenu::toggle_mode, this));
- m_centerviewbtn =
+ centerviewbtn_ =
new UI::Button
(this, "center_main_mapview_on_location",
- kWindowWidth - kPadding - kButtonSize, m_archivebtn->get_y(), kButtonSize, kButtonSize,
+ kWindowWidth - kPadding - kButtonSize, archivebtn_->get_y(), kButtonSize, kButtonSize,
g_gr->images().get("pics/but2.png"),
g_gr->images().get("pics/menu_goto.png"),
/** TRANSLATORS: %s is a tooltip, G is the corresponding hotkey */
@@ -175,7 +175,7 @@
/** TRANSLATORS: Tooltip in the messages window */
% _("Center main mapview on location")).str(),
false);
- m_centerviewbtn->sigclicked.connect(boost::bind(&GameMessageMenu::center_view, this));
+ centerviewbtn_->sigclicked.connect(boost::bind(&GameMessageMenu::center_view, this));
if (get_usedefaultpos())
center_to_parent();
@@ -298,8 +298,8 @@
// Update messages in the list and remove messages
// that should no longer be shown
for (uint32_t j = list->size(); j; --j) {
- MessageId m_id((*list)[j - 1]);
- if (Message const * const message = mq[m_id]) {
+ MessageId id_((*list)[j - 1]);
+ if (Message const * const message = mq[id_]) {
if ((mode == Archive) != (message->status() == Message::Status::kArchived)) {
list->remove(j - 1);
} else {
@@ -325,11 +325,11 @@
}
// Filter message type
- if (m_message_filter != Message::Type::kAllMessages) {
+ if (message_filter_ != Message::Type::kAllMessages) {
for (uint32_t j = list->size(); j; --j) {
- MessageId m_id((*list)[j - 1]);
- if (Message const * const message = mq[m_id]) {
- if (message->message_type_category() != m_message_filter) {
+ MessageId id_((*list)[j - 1]);
+ if (Message const * const message = mq[id_]) {
+ if (message->message_type_category() != message_filter_) {
list->remove(j - 1);
}
}
@@ -343,7 +343,7 @@
// be a solution without this extra update().
list->update();
} else {
- m_centerviewbtn->set_enabled(false);
+ centerviewbtn_->set_enabled(false);
message_body.set_text(std::string());
}
}
@@ -376,7 +376,7 @@
(*new Widelands::CmdMessageSetStatusRead
(game.get_gametime(), player.player_number(), id));
}
- m_centerviewbtn->set_enabled(message->position());
+ centerviewbtn_->set_enabled(message->position());
message_body.set_text(
(boost::format("<rt><p font-size=18 font-weight=bold font-color=D1D1D1>%s<br></p>"
@@ -386,7 +386,7 @@
return;
}
}
- m_centerviewbtn->set_enabled(false);
+ centerviewbtn_->set_enabled(false);
message_body.set_text(std::string());
}
@@ -394,7 +394,7 @@
* a message was double clicked
*/
void GameMessageMenu::double_clicked(uint32_t const /* t */) {
- if (m_centerviewbtn->enabled()) center_view();
+ if (centerviewbtn_->enabled()) center_view();
}
/**
@@ -406,7 +406,7 @@
switch (code.sym) {
// Don't forget to change the tooltips if any of these get reassigned
case SDLK_g:
- if (m_centerviewbtn->enabled())
+ if (centerviewbtn_->enabled())
center_view();
return true;
case SDLK_0:
@@ -495,19 +495,19 @@
void GameMessageMenu::filter_messages(Widelands::Message::Type const msgtype) {
switch (msgtype) {
case Widelands::Message::Type::kGeologists:
- toggle_filter_messages_button(*m_geologistsbtn, msgtype);
+ toggle_filter_messages_button(*geologistsbtn_, msgtype);
break;
case Widelands::Message::Type::kEconomy:
- toggle_filter_messages_button(*m_economybtn, msgtype);
+ toggle_filter_messages_button(*economybtn_, msgtype);
break;
case Widelands::Message::Type::kSeafaring:
- toggle_filter_messages_button(*m_seafaringbtn, msgtype);
+ toggle_filter_messages_button(*seafaringbtn_, msgtype);
break;
case Widelands::Message::Type::kWarfare:
- toggle_filter_messages_button(*m_warfarebtn, msgtype);
+ toggle_filter_messages_button(*warfarebtn_, msgtype);
break;
case Widelands::Message::Type::kScenario:
- toggle_filter_messages_button(*m_scenariobtn, msgtype);
+ toggle_filter_messages_button(*scenariobtn_, msgtype);
break;
case Widelands::Message::Type::kNoMessages:
@@ -523,12 +523,12 @@
case Widelands::Message::Type::kWarfareSiteLost:
case Widelands::Message::Type::kWarfareUnderAttack:
set_filter_messages_tooltips();
- m_message_filter = Widelands::Message::Type::kAllMessages;
- m_geologistsbtn->set_perm_pressed(false);
- m_economybtn->set_perm_pressed(false);
- m_seafaringbtn->set_perm_pressed(false);
- m_warfarebtn->set_perm_pressed(false);
- m_scenariobtn->set_perm_pressed(false);
+ message_filter_ = Widelands::Message::Type::kAllMessages;
+ geologistsbtn_->set_perm_pressed(false);
+ economybtn_ ->set_perm_pressed(false);
+ seafaringbtn_ ->set_perm_pressed(false);
+ warfarebtn_ ->set_perm_pressed(false);
+ scenariobtn_ ->set_perm_pressed(false);
break;
}
think();
@@ -541,15 +541,15 @@
set_filter_messages_tooltips();
if (button.get_perm_pressed()) {
button.set_perm_pressed(false);
- m_message_filter = Widelands::Message::Type::kAllMessages;
+ message_filter_ = Widelands::Message::Type::kAllMessages;
} else {
- m_geologistsbtn->set_perm_pressed(false);
- m_economybtn->set_perm_pressed(false);
- m_seafaringbtn->set_perm_pressed(false);
- m_warfarebtn->set_perm_pressed(false);
- m_scenariobtn->set_perm_pressed(false);
+ geologistsbtn_->set_perm_pressed(false);
+ economybtn_->set_perm_pressed(false);
+ seafaringbtn_->set_perm_pressed(false);
+ warfarebtn_->set_perm_pressed(false);
+ scenariobtn_->set_perm_pressed(false);
button.set_perm_pressed(true);
- m_message_filter = msgtype;
+ message_filter_ = msgtype;
/** TRANSLATORS: %1% is a tooltip, %2% is the corresponding hotkey */
button.set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
/** TRANSLATORS: Tooltip in the messages window */
@@ -562,23 +562,23 @@
* Helper for filter_messages
*/
void GameMessageMenu::set_filter_messages_tooltips() {
- m_geologistsbtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
+ geologistsbtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
/** TRANSLATORS: Tooltip in the messages window */
% _("Show geologists' messages only")
% "1").str());
- m_economybtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
+ economybtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
/** TRANSLATORS: Tooltip in the messages window */
% _("Show economy messages only")
% "2").str());
- m_seafaringbtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
+ seafaringbtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
/** TRANSLATORS: Tooltip in the messages window */
% _("Show seafaring messages only")
% "3").str());
- m_warfarebtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
+ warfarebtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
/** TRANSLATORS: Tooltip in the messages window */
% _("Show warfare messages only")
% "4").str());
- m_scenariobtn->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
+ scenariobtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
/** TRANSLATORS: Tooltip in the messages window */
% _("Show scenario messages only")
% "5").str());
@@ -626,24 +626,24 @@
case Inbox:
mode = Archive;
set_title(_("Messages: Archive"));
- m_archivebtn->set_pic(g_gr->images().get("pics/message_restore.png"));
+ archivebtn_->set_pic(g_gr->images().get("pics/message_restore.png"));
/** TRANSLATORS: %s is a tooltip, Del is the corresponding hotkey */
- m_archivebtn->set_tooltip((boost::format(_("Del: %s"))
+ archivebtn_->set_tooltip((boost::format(_("Del: %s"))
/** TRANSLATORS: Tooltip in the messages window */
% _("Restore selected message")).str());
- m_togglemodebtn->set_pic(g_gr->images().get("pics/message_new.png"));
- m_togglemodebtn->set_tooltip(_("Show Inbox"));
+ togglemodebtn_->set_pic(g_gr->images().get("pics/message_new.png"));
+ togglemodebtn_->set_tooltip(_("Show Inbox"));
break;
case Archive:
mode = Inbox;
set_title(_("Messages: Inbox"));
- m_archivebtn->set_pic(g_gr->images().get("pics/message_archive.png"));
+ archivebtn_->set_pic(g_gr->images().get("pics/message_archive.png"));
/** TRANSLATORS: %s is a tooltip, Del is the corresponding hotkey */
- m_archivebtn->set_tooltip((boost::format(_("Del: %s"))
+ archivebtn_->set_tooltip((boost::format(_("Del: %s"))
/** TRANSLATORS: Tooltip in the messages window */
% _("Archive selected message")).str());
- m_togglemodebtn->set_pic(g_gr->images().get("pics/message_archived.png"));
- m_togglemodebtn->set_tooltip(_("Show Archive"));
+ togglemodebtn_->set_pic(g_gr->images().get("pics/message_archived.png"));
+ togglemodebtn_->set_tooltip(_("Show Archive"));
break;
}
}
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -70,17 +70,17 @@
UI::Table<uintptr_t> * list;
UI::MultilineTextarea message_body;
- UI::Button * m_archivebtn;
- UI::Button * m_togglemodebtn;
- UI::Button * m_centerviewbtn;
+ UI::Button * archivebtn_;
+ UI::Button * togglemodebtn_;
+ UI::Button * centerviewbtn_;
Mode mode;
// Buttons for message types
- UI::Button * m_geologistsbtn;
- UI::Button * m_economybtn;
- UI::Button * m_seafaringbtn;
- UI::Button * m_warfarebtn;
- UI::Button * m_scenariobtn;
- Widelands::Message::Type m_message_filter;
+ UI::Button * geologistsbtn_;
+ UI::Button * economybtn_;
+ UI::Button * seafaringbtn_;
+ UI::Button * warfarebtn_;
+ UI::Button * scenariobtn_;
+ Widelands::Message::Type message_filter_;
};
#endif // end of include guard: WL_WUI_GAME_MESSAGE_MENU_H
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008 by the Widelands Development Team
+ * Copyright (C) 2007-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -41,82 +41,82 @@
GameSummaryScreen::GameSummaryScreen
(InteractiveGameBase * parent, UI::UniqueWindow::Registry * r)
: UI::UniqueWindow(parent, "game_summary", r, 0, 0, _("Game over")),
-m_game(parent->game())
+game_(parent->game())
{
// Init boxes
UI::Box * vbox = new UI::Box(this, 0, 0, UI::Box::Vertical, 0, 0, PADDING);
- m_title_area = new UI::Textarea(vbox, "", UI::Align_HCenter);
- vbox->add(m_title_area, UI::Box::AlignCenter);
+ title_area_ = new UI::Textarea(vbox, "", UI::Align_HCenter);
+ vbox->add(title_area_, UI::Box::AlignCenter);
vbox->add_space(PADDING);
UI::Box * hbox1 = new UI::Box(this, 0, 0, UI::Box::Horizontal);
- m_players_table = new UI::Table<uintptr_t const>(hbox1, 0, 0, 0, 0);
- m_players_table->fit_height(m_game.player_manager()->get_players_end_status().size());
+ players_table_ = new UI::Table<uintptr_t const>(hbox1, 0, 0, 0, 0);
+ players_table_->fit_height(game_.player_manager()->get_players_end_status().size());
hbox1->add_space(PADDING);
- hbox1->add(m_players_table, UI::Box::AlignTop);
+ hbox1->add(players_table_, UI::Box::AlignTop);
hbox1->add_space(PADDING);
UI::Box * info_box = new UI::Box(hbox1, 0, 0, UI::Box::Vertical, 0, 0);
- m_info_area_label = new UI::Textarea(info_box, _("Player info:"));
- info_box->add(m_info_area_label, UI::Box::AlignLeft);
- m_info_area = new UI::MultilineTextarea(
+ info_area_label_ = new UI::Textarea(info_box, _("Player info:"));
+ info_box->add(info_area_label_, UI::Box::AlignLeft);
+ info_area_ = new UI::MultilineTextarea(
info_box, 0, 0, 130,
- std::max(130, m_players_table->get_h() - m_info_area_label->get_h() - PADDING),
+ std::max(130, players_table_->get_h() - info_area_label_->get_h() - PADDING),
"");
- info_box->add(m_info_area, UI::Box::AlignLeft, true);
+ info_box->add(info_area_, UI::Box::AlignLeft, true);
info_box->add_space(PADDING);
hbox1->add(info_box, UI::Box::AlignTop);
hbox1->add_space(PADDING);
vbox->add(hbox1, UI::Box::AlignLeft);
- UI::Box * bottom_box = new UI::Box(this, 0, 0, UI::Box::Horizontal);
-
- bottom_box->add_space(PADDING);
-
- m_gametime_label = new UI::Textarea(bottom_box, _("Elapsed time:"));
- bottom_box->add(m_gametime_label, UI::Box::AlignCenter);
- bottom_box->add_space(PADDING);
- m_gametime_value = new UI::Textarea(bottom_box, gametimestring(m_game.get_gametime()));
- bottom_box->add(m_gametime_value, UI::Box::AlignCenter);
-
- bottom_box->add_inf_space();
-
- m_continue_button = new UI::Button
- (bottom_box, "continue_button",
+ UI::Box * bottobox_ = new UI::Box(this, 0, 0, UI::Box::Horizontal);
+
+ bottobox_->add_space(PADDING);
+
+ gametime_label_ = new UI::Textarea(bottobox_, _("Elapsed time:"));
+ bottobox_->add(gametime_label_, UI::Box::AlignCenter);
+ bottobox_->add_space(PADDING);
+ gametime_value_ = new UI::Textarea(bottobox_, gametimestring(game_.get_gametime()));
+ bottobox_->add(gametime_value_, UI::Box::AlignCenter);
+
+ bottobox_->add_inf_space();
+
+ continue_button_ = new UI::Button
+ (bottobox_, "continue_button",
0, 0, 35, 35,
g_gr->images().get("pics/but4.png"),
g_gr->images().get("pics/continue.png"),
_("Continue playing"));
- bottom_box->add(m_continue_button, UI::Box::AlignCenter);
- bottom_box->add_space(PADDING);
- m_stop_button = new UI::Button
- (bottom_box, "stop_button",
+ bottobox_->add(continue_button_, UI::Box::AlignCenter);
+ bottobox_->add_space(PADDING);
+ stop_button_ = new UI::Button
+ (bottobox_, "stop_button",
0, 0, 35, 35,
g_gr->images().get("pics/but4.png"),
g_gr->images().get("pics/menu_exit_game.png"),
_("Exit Game"));
- bottom_box->add(m_stop_button, UI::Box::AlignCenter);
- bottom_box->add_space(PADDING);
+ bottobox_->add(stop_button_, UI::Box::AlignCenter);
+ bottobox_->add_space(PADDING);
- vbox->add(bottom_box, UI::Box::AlignLeft, true);
+ vbox->add(bottobox_, UI::Box::AlignLeft, true);
vbox->add_space(PADDING);
set_center_panel(vbox);
// Prepare table
- m_players_table->add_column(150, _("Player"));
- m_players_table->add_column(80, _("Team"), "", UI::Align_HCenter);
- m_players_table->add_column(100, _("Status"), "", UI::Align_HCenter);
- m_players_table->add_column(100, _("Time"));
+ players_table_->add_column(150, _("Player"));
+ players_table_->add_column(80, _("Team"), "", UI::Align_HCenter);
+ players_table_->add_column(100, _("Status"), "", UI::Align_HCenter);
+ players_table_->add_column(100, _("Time"));
// Prepare Elements
- m_title_area->set_textstyle(UI::TextStyle::ui_big());
+ title_area_->set_textstyle(UI::TextStyle::ui_big());
// Connections
- m_continue_button->sigclicked.connect
+ continue_button_->sigclicked.connect
(boost::bind(&GameSummaryScreen::continue_clicked, this));
- m_stop_button->sigclicked.connect
+ stop_button_->sigclicked.connect
(boost::bind(&GameSummaryScreen::stop_clicked, this));
- m_players_table->selected.connect
+ players_table_->selected.connect
(boost::bind(&GameSummaryScreen::player_selected, this, _1));
// Window
@@ -140,12 +140,12 @@
void GameSummaryScreen::fill_data()
{
std::vector<Widelands::PlayerEndStatus> players_status
- = m_game.player_manager()->get_players_end_status();
+ = game_.player_manager()->get_players_end_status();
bool local_in_game = false;
bool local_won = false;
Widelands::Player* single_won = nullptr;
- uint8_t team_won = 0;
- InteractivePlayer* ipl = m_game.get_ipl();
+ uint8_t teawon_ = 0;
+ InteractivePlayer* ipl = game_.get_ipl();
//this defines a row to be selected, current player,
//if not then the first line
uint32_t current_player_position = 0;
@@ -157,8 +157,8 @@
local_won = pes.result == Widelands::PlayerEndResult::PLAYER_WON;
current_player_position = i;
}
- Widelands::Player* p = m_game.get_player(pes.player);
- UI::Table<uintptr_t const>::EntryRecord & te = m_players_table->add(i);
+ Widelands::Player* p = game_.get_player(pes.player);
+ UI::Table<uintptr_t const>::EntryRecord & te = players_table_->add(i);
// Player name & pic
std::string pic_path =
(boost::format("pics/genstats_enable_plr_0%|1$u|.png")
@@ -166,10 +166,10 @@
const Image* pic = g_gr->images().get(pic_path);
te.set_picture(0, pic, p->get_name());
// Team
- std::string team_str =
+ std::string teastr_ =
(boost::format("%|1$u|")
% static_cast<unsigned int>(p->team_number())).str();
- te.set_string(1, team_str);
+ te.set_string(1, teastr_);
// Status
std::string stat_str;
switch (pes.result) {
@@ -183,7 +183,7 @@
if (!single_won) {
single_won = p;
} else {
- team_won = p->team_number();
+ teawon_ = p->team_number();
}
break;
case Widelands::PlayerEndResult::PLAYER_RESIGNED:
@@ -203,24 +203,24 @@
if (local_in_game) {
if (local_won) {
- m_title_area->set_text(_("You won!"));
+ title_area_->set_text(_("You won!"));
} else {
- m_title_area->set_text(_("You lost."));
+ title_area_->set_text(_("You lost."));
}
} else {
- if (team_won <= 0) {
+ if (teawon_ <= 0) {
assert(single_won);
- m_title_area->set_text
+ title_area_->set_text
((boost::format(_("%s won!")) % single_won->get_name()).str());
} else {
- m_title_area->set_text
+ title_area_->set_text
((boost::format(_("Team %|1$u| won!"))
- % static_cast<unsigned int>(team_won)).str());
+ % static_cast<unsigned int>(teawon_)).str());
}
}
- m_players_table->update();
+ players_table_->update();
if (!players_status.empty()) {
- m_players_table->select(current_player_position);
+ players_table_->select(current_player_position);
}
}
@@ -231,17 +231,17 @@
void GameSummaryScreen::stop_clicked()
{
- m_game.get_ibase()->end_modal<UI::Panel::Returncodes>(UI::Panel::Returncodes::kBack);
+ game_.get_ibase()->end_modal<UI::Panel::Returncodes>(UI::Panel::Returncodes::kBack);
}
void GameSummaryScreen::player_selected(uint32_t entry_index)
{
- const uintptr_t selected_player_index = (*m_players_table)[entry_index];
+ const uintptr_t selected_player_index = (*players_table_)[entry_index];
const Widelands::PlayerEndStatus& player_status =
- m_game.player_manager()->get_players_end_status()[selected_player_index];
+ game_.player_manager()->get_players_end_status()[selected_player_index];
std::string info_str = parse_player_info(player_status.info);
- m_info_area->set_text(info_str);
+ info_area_->set_text(info_str);
layout();
}
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008 by the Widelands Development Team
+ * Copyright (C) 2007-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -47,15 +47,15 @@
void player_selected(uint32_t idx);
std::string parse_player_info(std::string info);
- Widelands::Game & m_game;
- UI::Textarea * m_title_area;
- UI::Textarea * m_gametime_label;
- UI::Textarea * m_gametime_value;
- UI::Textarea * m_info_area_label;
- UI::MultilineTextarea * m_info_area;
- UI::Button * m_continue_button;
- UI::Button * m_stop_button;
- UI::Table<uintptr_t const> * m_players_table;
+ Widelands::Game & game_;
+ UI::Textarea * title_area_;
+ UI::Textarea * gametime_label_;
+ UI::Textarea * gametime_value_;
+ UI::Textarea * info_area_label_;
+ UI::MultilineTextarea * info_area_;
+ UI::Button * continue_button_;
+ UI::Button * stop_button_;
+ UI::Table<uintptr_t const> * players_table_;
};
#endif // end of include guard: WL_WUI_GAME_SUMMARY_H
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008, 2010 by the Widelands Development Team
+ * Copyright (C) 2007-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -33,11 +33,11 @@
GameTips::GameTips
(UI::ProgressWindow & progressWindow, const std::vector<std::string>& names)
:
-m_lastUpdated (0),
-m_updateAfter (0),
-m_progressWindow(progressWindow),
-m_registered (false),
-m_lastTip (0)
+lastUpdated_ (0),
+updateAfter_ (0),
+progressWindow_(progressWindow),
+registered_ (false),
+lastTip_ (0)
{
// Loading texts-locals, for translating the tips
i18n::Textdomain textdomain("texts");
@@ -45,11 +45,11 @@
for (uint8_t i = 0; i < names.size(); ++i)
load_tips(names[i]);
- if (!m_tips.empty()) {
+ if (!tips_.empty()) {
// add visualization only if any tips are loaded
- m_progressWindow.add_visualization(this);
- m_registered = true;
- m_lastTip = m_tips.size();
+ progressWindow_.add_visualization(this);
+ registered_ = true;
+ lastTip_ = tips_.size();
}
}
@@ -71,7 +71,7 @@
Tip tip;
tip.text = text;
tip.interval = s->get_int("sec", DEFAULT_INTERVAL);
- m_tips.push_back (tip);
+ tips_.push_back (tip);
}
} catch (std::exception &) {
// just ignore - tips do not impact game
@@ -81,24 +81,24 @@
void GameTips::update(bool repaint) {
uint8_t ticks = SDL_GetTicks();
- if (ticks >= (m_lastUpdated + m_updateAfter)) {
- const uint32_t next = rand() % m_tips.size();
- if (next == m_lastTip)
- m_lastTip = (next + 1) % m_tips.size();
+ if (ticks >= (lastUpdated_ + updateAfter_)) {
+ const uint32_t next = rand() % tips_.size();
+ if (next == lastTip_)
+ lastTip_ = (next + 1) % tips_.size();
else
- m_lastTip = next;
+ lastTip_ = next;
show_tip(next);
- m_lastUpdated = SDL_GetTicks();
- m_updateAfter = m_tips[next].interval * 1000;
+ lastUpdated_ = SDL_GetTicks();
+ updateAfter_ = tips_[next].interval * 1000;
} else if (repaint) {
- show_tip(m_lastTip);
+ show_tip(lastTip_);
}
}
void GameTips::stop() {
- if (m_registered) {
- m_progressWindow.remove_visualization(this);
- m_registered = false;
+ if (registered_) {
+ progressWindow_.remove_visualization(this);
+ registered_ = false;
}
}
@@ -117,7 +117,7 @@
rt.blit(pt, pic_background);
Point center(tips_area.x + tips_area.w / 2, tips_area.y + tips_area.h / 2);
- const Image* rendered_text = UI::g_fh1->render(as_game_tip(m_tips[index].text), tips_area.w);
+ const Image* rendered_text = UI::g_fh1->render(as_game_tip(tips_[index].text), tips_area.w);
rt.blit(center - Point(rendered_text->width() / 2, rendered_text->height() / 2), rendered_text);
g_gr->update();
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2008 by the Widelands Development Team
+ * Copyright (C) 2007-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -43,13 +43,13 @@
void load_tips(std::string);
void show_tip(int32_t index);
- uint32_t m_lastUpdated;
- uint32_t m_updateAfter;
- UI::ProgressWindow & m_progressWindow;
- bool m_registered;
- uint32_t m_lastTip;
+ uint32_t lastUpdated_;
+ uint32_t updateAfter_;
+ UI::ProgressWindow & progressWindow_;
+ bool registered_;
+ uint32_t lastTip_;
- std::vector<Tip> m_tips;
+ std::vector<Tip> tips_;
};
#endif // end of include guard: WL_WUI_GAME_TIPS_H
=== 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:17:30 +0000
@@ -33,7 +33,7 @@
ChatProvider & chat)
:
UI::Panel(parent, x, y, w, h),
- m_chat (chat),
+ chat_ (chat),
chatbox (this, 0, 0, w, h - 25, "", UI::Align_Left, 1),
editbox (this, 0, h - 20, w, 20),
chat_message_counter(std::numeric_limits<uint32_t>::max())
@@ -57,7 +57,7 @@
*/
void GameChatPanel::recalculate()
{
- const std::vector<ChatMessage> msgs = m_chat.get_messages();
+ const std::vector<ChatMessage> msgs = chat_.get_messages();
std::string str = "<rt>";
for (uint32_t i = 0; i < msgs.size(); ++i) {
@@ -75,7 +75,7 @@
// Note: if many messages arrive simultaneously,
// the latest is a system message and some others
// are not, then this act wrong!
- if (!msgs.back().sender.empty() && !m_chat.sound_off())
+ if (!msgs.back().sender.empty() && !chat_.sound_off())
{
// The latest message is not a system message
if (std::string::npos == msgs.back().sender.find("(IRC)") && chat_message_counter < msgs.size())
@@ -104,7 +104,7 @@
const std::string & str = editbox.text();
if (str.size())
- m_chat.send(str);
+ chat_.send(str);
editbox.set_text("");
sent();
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2011 by the Widelands Development Team
+ * Copyright (C) 2008-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -54,7 +54,7 @@
void key_enter();
void key_escape();
- ChatProvider & m_chat;
+ ChatProvider & chat_;
UI::MultilineTextarea chatbox;
UI::EditBox editbox;
uint32_t chat_message_counter;
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -52,21 +52,21 @@
UI::UniqueWindow
(&parent, "statistics_menu", ®istry,
440, 400, _("General Statistics")),
-m_my_registry (®istry),
-m_box (this, 0, 0, UI::Box::Vertical, 0, 0, 5),
-m_plot (&m_box, 0, 0, 430, PLOT_HEIGHT),
-m_selected_information(0)
+ my_registry_ (®istry),
+ box_ (this, 0, 0, UI::Box::Vertical, 0, 0, 5),
+ plot_ (&box_, 0, 0, 430, PLOT_HEIGHT),
+ selected_information_(0)
{
- assert (m_my_registry);
-
- m_selected_information = m_my_registry->selected_information;
-
- set_center_panel(&m_box);
- m_box.set_border(5, 5, 5, 5);
+ assert (my_registry_);
+
+ selected_information_ = my_registry_->selected_information;
+
+ set_center_panel(&box_);
+ box_.set_border(5, 5, 5, 5);
// Setup plot data
- m_plot.set_sample_rate(STATISTICS_SAMPLE_TIME);
- m_plot.set_plotmode(WuiPlotArea::PLOTMODE_ABSOLUTE);
+ plot_.set_sample_rate(STATISTICS_SAMPLE_TIME);
+ plot_.set_plotmode(WuiPlotArea::PLOTMODE_ABSOLUTE);
Game & game = *parent.get_game();
const Game::GeneralStatsVector & genstats =
game.get_general_statistics();
@@ -74,14 +74,14 @@
general_statistics_size = genstats.size();
// Is there a hook dataset?
- m_ndatasets = NR_BASE_DATASETS;
+ ndatasets_ = NR_BASE_DATASETS;
std::unique_ptr<LuaTable> hook = game.lua().get_hook("custom_statistic");
std::string cs_name, cs_pic;
if (hook) {
hook->do_not_warn_about_unaccessed_keys();
cs_name = hook->get_string("name");
cs_pic = hook->get_string("pic");
- m_ndatasets++;
+ ndatasets_++;
}
for
@@ -90,56 +90,56 @@
++i)
{
const RGBColor & color = Player::Colors[i];
- m_plot.register_plot_data
- (i * m_ndatasets + 0, &genstats[i].land_size,
- color);
- m_plot.register_plot_data
- (i * m_ndatasets + 1, &genstats[i].nr_workers,
- color);
- m_plot.register_plot_data
- (i * m_ndatasets + 2, &genstats[i].nr_buildings,
- color);
- m_plot.register_plot_data
- (i * m_ndatasets + 3, &genstats[i].nr_wares,
- color);
- m_plot.register_plot_data
- (i * m_ndatasets + 4, &genstats[i].productivity,
- color);
- m_plot.register_plot_data
- (i * m_ndatasets + 5, &genstats[i].nr_casualties,
- color);
- m_plot.register_plot_data
- (i * m_ndatasets + 6, &genstats[i].nr_kills,
- color);
- m_plot.register_plot_data
- (i * m_ndatasets + 7, &genstats[i].nr_msites_lost,
- color);
- m_plot.register_plot_data
- (i * m_ndatasets + 8, &genstats[i].nr_msites_defeated,
- color);
- m_plot.register_plot_data
- (i * m_ndatasets + 9, &genstats[i].nr_civil_blds_lost,
- color);
- m_plot.register_plot_data
- (i * m_ndatasets + 10, &genstats[i].miltary_strength,
+ plot_.register_plot_data
+ (i * ndatasets_ + 0, &genstats[i].land_size,
+ color);
+ plot_.register_plot_data
+ (i * ndatasets_ + 1, &genstats[i].nr_workers,
+ color);
+ plot_.register_plot_data
+ (i * ndatasets_ + 2, &genstats[i].nr_buildings,
+ color);
+ plot_.register_plot_data
+ (i * ndatasets_ + 3, &genstats[i].nr_wares,
+ color);
+ plot_.register_plot_data
+ (i * ndatasets_ + 4, &genstats[i].productivity,
+ color);
+ plot_.register_plot_data
+ (i * ndatasets_ + 5, &genstats[i].nr_casualties,
+ color);
+ plot_.register_plot_data
+ (i * ndatasets_ + 6, &genstats[i].nr_kills,
+ color);
+ plot_.register_plot_data
+ (i * ndatasets_ + 7, &genstats[i].nr_msites_lost,
+ color);
+ plot_.register_plot_data
+ (i * ndatasets_ + 8, &genstats[i].nr_msites_defeated,
+ color);
+ plot_.register_plot_data
+ (i * ndatasets_ + 9, &genstats[i].nr_civil_blds_lost,
+ color);
+ plot_.register_plot_data
+ (i * ndatasets_ + 10, &genstats[i].miltary_strength,
color);
if (hook) {
- m_plot.register_plot_data
- (i * m_ndatasets + 11, &genstats[i].custom_statistic,
+ plot_.register_plot_data
+ (i * ndatasets_ + 11, &genstats[i].custom_statistic,
color);
}
if (game.get_player(i + 1)) // Show area plot
- m_plot.show_plot
- (i * m_ndatasets + m_selected_information,
- m_my_registry->selected_players[i]);
+ plot_.show_plot
+ (i * ndatasets_ + selected_information_,
+ my_registry_->selected_players[i]);
}
- m_plot.set_time(m_my_registry->time);
+ plot_.set_time(my_registry_->time);
// Setup Widgets
- m_box.add(&m_plot, UI::Box::AlignTop);
+ box_.add(&plot_, UI::Box::AlignTop);
- UI::Box * hbox1 = new UI::Box(&m_box, 0, 0, UI::Box::Horizontal, 0, 0, 1);
+ UI::Box * hbox1 = new UI::Box(&box_, 0, 0, UI::Box::Horizontal, 0, 0, 1);
uint32_t plr_in_game = 0;
PlayerNumber const nr_players = game.map().get_nrplayers();
@@ -157,21 +157,21 @@
player->get_name().c_str());
cb.sigclicked.connect
(boost::bind(&GeneralStatisticsMenu::cb_changed_to, this, p));
- cb.set_perm_pressed(m_my_registry->selected_players[p - 1]);
+ cb.set_perm_pressed(my_registry_->selected_players[p - 1]);
- m_cbs[p - 1] = &cb;
+ cbs_[p - 1] = &cb;
hbox1->add(&cb, UI::Box::AlignLeft, false, true);
} else // player nr p does not exist
- m_cbs[p - 1] = nullptr;
-
- m_box.add(hbox1, UI::Box::AlignTop, true);
-
- UI::Box * hbox2 = new UI::Box(&m_box, 0, 0, UI::Box::Horizontal, 0, 0, 1);
+ cbs_[p - 1] = nullptr;
+
+ box_.add(hbox1, UI::Box::AlignTop, true);
+
+ UI::Box * hbox2 = new UI::Box(&box_, 0, 0, UI::Box::Horizontal, 0, 0, 1);
UI::Radiobutton * btn;
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_landsize.png"),
@@ -179,7 +179,7 @@
&btn);
hbox2->add(btn, UI::Box::AlignLeft, false, true);
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_nrworkers.png"),
@@ -187,7 +187,7 @@
&btn);
hbox2->add(btn, UI::Box::AlignLeft, false, true);
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_nrbuildings.png"),
@@ -195,7 +195,7 @@
&btn);
hbox2->add(btn, UI::Box::AlignLeft, false, true);
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_nrwares.png"),
@@ -203,7 +203,7 @@
&btn);
hbox2->add(btn, UI::Box::AlignLeft, false, true);
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_productivity.png"),
@@ -211,7 +211,7 @@
&btn);
hbox2->add(btn, UI::Box::AlignLeft, false, true);
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_casualties.png"),
@@ -219,7 +219,7 @@
&btn);
hbox2->add(btn, UI::Box::AlignLeft, false, true);
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_kills.png"),
@@ -227,7 +227,7 @@
&btn);
hbox2->add(btn, UI::Box::AlignLeft, false, true);
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_msites_lost.png"),
@@ -235,7 +235,7 @@
&btn);
hbox2->add(btn, UI::Box::AlignLeft, false, true);
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_msites_defeated.png"),
@@ -243,7 +243,7 @@
&btn);
hbox2->add(btn, UI::Box::AlignLeft, false, true);
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_civil_blds_lost.png"),
@@ -251,7 +251,7 @@
&btn);
hbox2->add(btn, UI::Box::AlignLeft, false, true);
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get("pics/genstats_militarystrength.png"),
@@ -260,7 +260,7 @@
hbox2->add(btn, UI::Box::AlignLeft, false, true);
if (hook) {
- m_radiogroup.add_button
+ radiogroup_.add_button
(hbox2,
Point(0, 0),
g_gr->images().get(cs_pic),
@@ -269,15 +269,15 @@
hbox2->add(btn, UI::Box::AlignLeft, false, true);
}
- m_radiogroup.set_state(m_selected_information);
- m_radiogroup.changedto.connect
+ radiogroup_.set_state(selected_information_);
+ radiogroup_.changedto.connect
(boost::bind(&GeneralStatisticsMenu::radiogroup_changed, this, _1));
- m_box.add(hbox2, UI::Box::AlignTop, true);
+ box_.add(hbox2, UI::Box::AlignTop, true);
- m_box.add
+ box_.add
(new WuiPlotAreaSlider
- (&m_box, m_plot, 0, 0, 100, 45,
+ (&box_, plot_, 0, 0, 100, 45,
g_gr->images().get("pics/but1.png"))
, UI::Box::AlignTop
, true);
@@ -288,11 +288,11 @@
Game & game = dynamic_cast<InteractiveGameBase&>(*get_parent()).game();
if (game.is_loaded()) {
// Save informations for recreation, if window is reopened
- m_my_registry->selected_information = m_selected_information;
- m_my_registry->time = m_plot.get_time();
+ my_registry_->selected_information = selected_information_;
+ my_registry_->time = plot_.get_time();
PlayerNumber const nr_players = game.map().get_nrplayers();
iterate_players_existing_novar(p, nr_players, game) {
- m_my_registry->selected_players[p - 1] = m_cbs[p - 1]->get_perm_pressed();
+ my_registry_->selected_players[p - 1] = cbs_[p - 1]->get_perm_pressed();
}
}
}
@@ -310,11 +310,11 @@
void GeneralStatisticsMenu::cb_changed_to(int32_t const id)
{
// This represents our player number
- m_cbs[id - 1]->set_perm_pressed(!m_cbs[id - 1]->get_perm_pressed());
+ cbs_[id - 1]->set_perm_pressed(!cbs_[id - 1]->get_perm_pressed());
- m_plot.show_plot
- ((id - 1) * m_ndatasets + m_selected_information,
- m_cbs[id - 1]->get_perm_pressed());
+ plot_.show_plot
+ ((id - 1) * ndatasets_ + selected_information_,
+ cbs_[id - 1]->get_perm_pressed());
}
/*
@@ -325,11 +325,11 @@
dynamic_cast<InteractiveGameBase&>(*get_parent()).game()
.get_general_statistics().size();
for (uint32_t i = 0; i < statistics_size; ++i)
- if (m_cbs[i]) {
- m_plot.show_plot
- (i * m_ndatasets + id, m_cbs[i]->get_perm_pressed());
- m_plot.show_plot
- (i * m_ndatasets + m_selected_information, false);
+ if (cbs_[i]) {
+ plot_.show_plot
+ (i * ndatasets_ + id, cbs_[i]->get_perm_pressed());
+ plot_.show_plot
+ (i * ndatasets_ + selected_information_, false);
}
- m_selected_information = id;
+ selected_information_ = id;
}
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -53,13 +53,13 @@
virtual ~GeneralStatisticsMenu();
private:
- Registry * m_my_registry;
- UI::Box m_box;
- WuiPlotArea m_plot;
- UI::Radiogroup m_radiogroup;
- int32_t m_selected_information;
- UI::Button * m_cbs[MAX_PLAYERS];
- uint32_t m_ndatasets;
+ Registry * my_registry_;
+ UI::Box box_;
+ WuiPlotArea plot_;
+ UI::Radiogroup radiogroup_;
+ int32_t selected_information_;
+ UI::Button * cbs_[MAX_PLAYERS];
+ uint32_t ndatasets_;
void clicked_help();
void cb_changed_to(int32_t);
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 by the Widelands Development Team
+ * Copyright (C) 2007-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -52,25 +52,25 @@
:
InteractiveBase(_game, global_s),
chat_provider_(nullptr),
- m_building_census_format
+ building_census_format_
(global_s.get_string("building_census_format", "%N")),
- m_building_statistics_format
+ building_statistics_format_
(global_s.get_string("building_statistics_format", "%t")),
- m_building_tooltip_format
+ building_tooltip_format_
(global_s.get_string("building_tooltip_format", "%r")),
- m_chatenabled(chatenabled),
- m_multiplayer(multiplayer),
- m_playertype(pt),
+ chatenabled_(chatenabled),
+ multiplayer_(multiplayer),
+ playertype_(pt),
#define INIT_BTN(picture, name, tooltip) \
TOOLBAR_BUTTON_COMMON_PARAMETERS(name), \
g_gr->images().get("pics/" picture ".png"), \
tooltip \
- m_toggle_buildhelp
+ toggle_buildhelp_
(INIT_BTN("menu_toggle_buildhelp", "buildhelp", _("Show Building Spaces (on/off)")))
{
- m_toggle_buildhelp.sigclicked.connect(boost::bind(&InteractiveGameBase::toggle_buildhelp, this));
+ toggle_buildhelp_.sigclicked.connect(boost::bind(&InteractiveGameBase::toggle_buildhelp, this));
}
/// \return a pointer to the running \ref Game instance.
@@ -90,7 +90,7 @@
chat_provider_ = &chat;
chat_overlay_->set_chat_provider(chat);
- m_chatenabled = true;
+ chatenabled_ = true;
}
ChatProvider * InteractiveGameBase::get_chat_provider()
@@ -137,7 +137,7 @@
Widelands::Map & map = egbase().map();
auto* overlay_manager = mutable_field_overlay_manager();
show_buildhelp(false);
- m_toggle_buildhelp.set_perm_pressed(buildhelp());
+ toggle_buildhelp_.set_perm_pressed(buildhelp());
overlay_manager->register_overlay_callback_function
(boost::bind(&InteractiveGameBase::calculate_buildcaps, this, _1));
@@ -147,14 +147,14 @@
map.recalc_whole_map(egbase().world());
// Close game-relevant UI windows (but keep main menu open)
- delete m_fieldaction.window;
- m_fieldaction.window = nullptr;
+ delete fieldaction_.window;
+ fieldaction_.window = nullptr;
hide_minimap();
}
void InteractiveGameBase::on_buildhelp_changed(const bool value) {
- m_toggle_buildhelp.set_perm_pressed(value);
+ toggle_buildhelp_.set_perm_pressed(value);
}
/**
@@ -188,10 +188,10 @@
void InteractiveGameBase::show_game_summary()
{
game().game_controller()->set_desired_speed(0);
- if (m_game_summary.window) {
- m_game_summary.window->set_visible(true);
- m_game_summary.window->think();
+ if (game_summary_.window) {
+ game_summary_.window->set_visible(true);
+ game_summary_.window->think();
return;
}
- new GameSummaryScreen(this, &m_game_summary);
+ new GameSummaryScreen(this, &game_summary_);
}
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2003, 2006-2013 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -62,13 +62,13 @@
// TODO(sirver): Remove the use of these methods as the strings are no longer configurable.
const std::string & building_census_format () const {
- return m_building_census_format;
+ return building_census_format_;
}
const std::string & building_statistics_format () const {
- return m_building_statistics_format;
+ return building_statistics_format_;
}
const std::string & building_tooltip_format () const {
- return m_building_tooltip_format;
+ return building_tooltip_format_;
}
virtual bool can_see(Widelands::PlayerNumber) const = 0;
@@ -76,11 +76,11 @@
virtual Widelands::PlayerNumber player_number() const = 0;
virtual void node_action() = 0;
- const PlayerType & get_playertype()const {return m_playertype;}
- void set_playertype(const PlayerType & pt) {m_playertype = pt;}
+ const PlayerType & get_playertype()const {return playertype_;}
+ void set_playertype(const PlayerType & pt) {playertype_ = pt;}
bool try_show_ship_window();
- bool is_multiplayer() {return m_multiplayer;}
+ bool is_multiplayer() {return multiplayer_;}
void show_game_summary();
void postload() override;
@@ -90,18 +90,18 @@
void draw_overlay(RenderTarget &) override;
virtual int32_t calculate_buildcaps(const Widelands::TCoords<Widelands::FCoords> c) = 0;
- GameMainMenuWindows m_mainm_windows;
+ GameMainMenuWindows main_windows_;
ChatProvider * chat_provider_;
- std::string m_building_census_format;
- std::string m_building_statistics_format;
- std::string m_building_tooltip_format;
- bool m_chatenabled;
- bool m_multiplayer;
- PlayerType m_playertype;
- UI::UniqueWindow::Registry m_fieldaction;
- UI::UniqueWindow::Registry m_game_summary;
+ std::string building_census_format_;
+ std::string building_statistics_format_;
+ std::string building_tooltip_format_;
+ bool chatenabled_;
+ bool multiplayer_;
+ PlayerType playertype_;
+ UI::UniqueWindow::Registry fieldaction_;
+ UI::UniqueWindow::Registry game_summary_;
- UI::Button m_toggle_buildhelp;
+ UI::Button toggle_buildhelp_;
private:
void on_buildhelp_changed(const bool value) override;
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -66,8 +66,8 @@
bool const multiplayer)
:
InteractiveGameBase (_game, global_s, NONE, multiplayer, multiplayer),
- m_auto_roadbuild_mode(global_s.get_bool("auto_roadbuild_mode", true)),
- m_flag_to_connect(Widelands::Coords::null()),
+ auto_roadbuild_mode_(global_s.get_bool("auto_roadbuild_mode", true)),
+ flag_to_connect_(Widelands::Coords::null()),
// Chat is different, as chat_provider_ needs to be checked when toggling
// Minimap is different as it warps and stuff
@@ -84,59 +84,59 @@
tooltip \
-m_toggle_chat
+toggle_chat_
(INIT_BTN_this
("menu_chat", "chat", _("Chat"))),
-m_toggle_options_menu
+toggle_options_menu_
(INIT_BTN
("menu_options_menu", "options_menu", _("Options"))),
-m_toggle_statistics_menu
+toggle_statistics_menu_
(INIT_BTN
("menu_toggle_menu", "statistics_menu", _("Statistics"))),
-m_toggle_objectives
+toggle_objectives_
(INIT_BTN
("menu_objectives", "objectives", _("Objectives"))),
-m_toggle_minimap
+toggle_minimap_
(INIT_BTN_this
("menu_toggle_minimap", "minimap", _("Minimap"))),
-m_toggle_message_menu
+toggle_message_menu_
(INIT_BTN
("menu_toggle_oldmessage_menu", "messages", _("Messages"))),
-m_toggle_help
+toggle_help_
(INIT_BTN
("menu_help", "help", _("Tribal Encyclopedia")))
{
- m_toggle_chat.sigclicked.connect
+ toggle_chat_.sigclicked.connect
(boost::bind(&InteractivePlayer::toggle_chat, this));
- m_toggle_options_menu.sigclicked.connect
- (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_options)));
- m_toggle_statistics_menu.sigclicked.connect
- (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_statisticsmenu)));
- m_toggle_objectives.sigclicked.connect
- (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_objectives)));
- m_toggle_minimap.sigclicked.connect
+ toggle_options_menu_.sigclicked.connect
+ (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(options_)));
+ toggle_statistics_menu_.sigclicked.connect
+ (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(statisticsmenu_)));
+ toggle_objectives_.sigclicked.connect
+ (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(objectives_)));
+ toggle_minimap_.sigclicked.connect
(boost::bind(&InteractivePlayer::toggle_minimap, this));
- m_toggle_message_menu.sigclicked.connect
- (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_message_menu)));
- m_toggle_help.sigclicked.connect
- (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_encyclopedia)));
+ toggle_message_menu_.sigclicked.connect
+ (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(message_menu_)));
+ toggle_help_.sigclicked.connect
+ (boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(encyclopedia_)));
// TODO(unknown): instead of making unneeded buttons invisible after generation,
// they should not at all be generated. -> implement more dynamic toolbar UI
- toolbar_.add(&m_toggle_options_menu, UI::Box::AlignLeft);
- toolbar_.add(&m_toggle_statistics_menu, UI::Box::AlignLeft);
- toolbar_.add(&m_toggle_minimap, UI::Box::AlignLeft);
- toolbar_.add(&m_toggle_buildhelp, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_options_menu_, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_statistics_menu_, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_minimap_, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_buildhelp_, UI::Box::AlignLeft);
if (multiplayer) {
- toolbar_.add(&m_toggle_chat, UI::Box::AlignLeft);
- m_toggle_chat.set_visible(false);
- m_toggle_chat.set_enabled(false);
+ toolbar_.add(&toggle_chat_, UI::Box::AlignLeft);
+ toggle_chat_.set_visible(false);
+ toggle_chat_.set_enabled(false);
}
- toolbar_.add(&m_toggle_help, UI::Box::AlignLeft);
- toolbar_.add(&m_toggle_objectives, UI::Box::AlignLeft);
- toolbar_.add(&m_toggle_message_menu, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_help_, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_objectives_, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_message_menu_, UI::Box::AlignLeft);
set_player_number(plyn);
fieldclicked.connect(boost::bind(&InteractivePlayer::node_action, this));
@@ -148,22 +148,22 @@
registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \
if (registry.window) btn.set_perm_pressed(true); \
- INIT_BTN_HOOKS(m_chat, m_toggle_chat)
- INIT_BTN_HOOKS(m_options, m_toggle_options_menu)
- INIT_BTN_HOOKS(m_statisticsmenu, m_toggle_statistics_menu)
- INIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap)
- INIT_BTN_HOOKS(m_objectives, m_toggle_objectives)
- INIT_BTN_HOOKS(m_encyclopedia, m_toggle_help)
- INIT_BTN_HOOKS(m_message_menu, m_toggle_message_menu)
+ INIT_BTN_HOOKS(chat_, toggle_chat_)
+ INIT_BTN_HOOKS(options_, toggle_options_menu_)
+ INIT_BTN_HOOKS(statisticsmenu_, toggle_statistics_menu_)
+ INIT_BTN_HOOKS(minimap_registry(), toggle_minimap_)
+ INIT_BTN_HOOKS(objectives_, toggle_objectives_)
+ INIT_BTN_HOOKS(encyclopedia_, toggle_help_)
+ INIT_BTN_HOOKS(message_menu_, toggle_message_menu_)
- m_encyclopedia.open_window = [this] {new EncyclopediaWindow(*this, m_encyclopedia);};
- m_options.open_window = [this] {new GameOptionsMenu(*this, m_options, m_mainm_windows);};
- m_statisticsmenu.open_window = [this] {
- new GameMainMenu(*this, m_statisticsmenu, m_mainm_windows);
+ encyclopedia_.open_window = [this] {new EncyclopediaWindow(*this, encyclopedia_);};
+ options_.open_window = [this] {new GameOptionsMenu(*this, options_, main_windows_);};
+ statisticsmenu_.open_window = [this] {
+ new GameMainMenu(*this, statisticsmenu_, main_windows_);
};
- m_objectives.open_window = [this] {new GameObjectivesMenu(this, m_objectives);};
- m_message_menu.open_window = [this] {new GameMessageMenu(*this, m_message_menu);};
- m_mainm_windows.stock.open_window = [this] {new StockMenu(*this, m_mainm_windows.stock);};
+ objectives_.open_window = [this] {new GameObjectivesMenu(this, objectives_);};
+ message_menu_.open_window = [this] {new GameMessageMenu(*this, message_menu_);};
+ main_windows_.stock.open_window = [this] {new StockMenu(*this, main_windows_.stock);};
#ifndef NDEBUG // only in debug builds
addCommand
@@ -177,46 +177,46 @@
registry.on_create = 0; \
registry.on_delete = 0;
- DEINIT_BTN_HOOKS(m_chat, m_toggle_chat)
- DEINIT_BTN_HOOKS(m_options, m_toggle_options_menu)
- DEINIT_BTN_HOOKS(m_statisticsmenu, m_toggle_statistics_menu)
- DEINIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap)
- DEINIT_BTN_HOOKS(m_objectives, m_toggle_objectives)
- DEINIT_BTN_HOOKS(m_encyclopedia, m_toggle_help)
- DEINIT_BTN_HOOKS(m_message_menu, m_toggle_message_menu)
+ DEINIT_BTN_HOOKS(chat_, toggle_chat_)
+ DEINIT_BTN_HOOKS(options_, toggle_options_menu_)
+ DEINIT_BTN_HOOKS(statisticsmenu_, toggle_statistics_menu_)
+ DEINIT_BTN_HOOKS(minimap_registry(), toggle_minimap_)
+ DEINIT_BTN_HOOKS(objectives_, toggle_objectives_)
+ DEINIT_BTN_HOOKS(encyclopedia_, toggle_help_)
+ DEINIT_BTN_HOOKS(message_menu_, toggle_message_menu_)
}
void InteractivePlayer::think()
{
InteractiveBase::think();
- if (m_flag_to_connect) {
- Widelands::Field & field = egbase().map()[m_flag_to_connect];
+ if (flag_to_connect_) {
+ Widelands::Field & field = egbase().map()[flag_to_connect_];
if (upcast(Widelands::Flag const, flag, field.get_immovable())) {
if (!flag->has_road() && !is_building_road())
- if (m_auto_roadbuild_mode) {
+ if (auto_roadbuild_mode_) {
// There might be a fieldaction window open, showing a button
// for roadbuilding. If that dialog remains open so that the
// button is clicked, we would enter roadbuilding mode while
// we are already in roadbuilding mode from the call below.
// That is not allowed. Therefore we must delete the
// fieldaction window before entering roadbuilding mode here.
- delete m_fieldaction.window;
- m_fieldaction.window = nullptr;
- warp_mouse_to_node(m_flag_to_connect);
+ delete fieldaction_.window;
+ fieldaction_.window = nullptr;
+ warp_mouse_to_node(flag_to_connect_);
set_sel_pos
(Widelands::NodeAndTriangle<>
- (m_flag_to_connect,
+ (flag_to_connect_,
Widelands::TCoords<>
- (m_flag_to_connect, Widelands::TCoords<>::D)));
- start_build_road(m_flag_to_connect, field.get_owned_by());
+ (flag_to_connect_, Widelands::TCoords<>::D)));
+ start_build_road(flag_to_connect_, field.get_owned_by());
}
- m_flag_to_connect = Widelands::Coords::null();
+ flag_to_connect_ = Widelands::Coords::null();
}
}
if (is_multiplayer()) {
- m_toggle_chat.set_visible(m_chatenabled);
- m_toggle_chat.set_enabled(m_chatenabled);
+ toggle_chat_.set_visible(chatenabled_);
+ toggle_chat_.set_enabled(chatenabled_);
}
{
char const * msg_icon = "pics/menu_toggle_oldmessage_menu.png";
@@ -230,8 +230,8 @@
(boost::format(ngettext("%u new message", "%u new messages", nr_new_messages)) %
nr_new_messages).str();
}
- m_toggle_message_menu.set_pic(g_gr->images().get(msg_icon));
- m_toggle_message_menu.set_tooltip(msg_tooltip);
+ toggle_message_menu_.set_pic(g_gr->images().get(msg_icon));
+ toggle_message_menu_.set_tooltip(msg_tooltip);
}
}
@@ -239,18 +239,18 @@
void InteractivePlayer::popup_message
(Widelands::MessageId const id, const Widelands::Message & message)
{
- m_message_menu.create();
- dynamic_cast<GameMessageMenu&>(*m_message_menu.window)
+ message_menu_.create();
+ dynamic_cast<GameMessageMenu&>(*message_menu_.window)
.show_new_message(id, message);
}
// Toolbar button callback functions.
void InteractivePlayer::toggle_chat() {
- if (m_chat.window)
- delete m_chat.window;
+ if (chat_.window)
+ delete chat_.window;
else if (chat_provider_)
- GameChatMenu::create_chat_console(this, m_chat, *chat_provider_);
+ GameChatMenu::create_chat_console(this, chat_, *chat_provider_);
}
bool InteractivePlayer::can_see(Widelands::PlayerNumber const p) const
@@ -263,7 +263,7 @@
}
Widelands::PlayerNumber InteractivePlayer::player_number() const
{
- return m_player_number;
+ return player_number_;
}
int32_t InteractivePlayer::calculate_buildcaps(const Widelands::TCoords<Widelands::FCoords> c) {
@@ -289,7 +289,7 @@
}
// everything else can bring up the temporary dialog
- show_field_action(this, get_player(), &m_fieldaction);
+ show_field_action(this, get_player(), &fieldaction_);
}
}
@@ -315,7 +315,7 @@
return true;
case SDLK_i:
- m_mainm_windows.stock.toggle();
+ main_windows_.stock.toggle();
return true;
case SDLK_m:
@@ -323,11 +323,11 @@
return true;
case SDLK_n:
- m_message_menu.toggle();
+ message_menu_.toggle();
return true;
case SDLK_o:
- m_objectives.toggle();
+ objectives_.toggle();
return true;
case SDLK_c:
@@ -335,16 +335,16 @@
return true;
case SDLK_b:
- if (m_mainm_windows.building_stats.window == nullptr) {
- new BuildingStatisticsMenu(*this, m_mainm_windows.building_stats);
+ if (main_windows_.building_stats.window == nullptr) {
+ new BuildingStatisticsMenu(*this, main_windows_.building_stats);
} else {
- m_mainm_windows.building_stats.toggle();
+ main_windows_.building_stats.toggle();
}
return true;
case SDLK_s:
if (code.mod & (KMOD_LCTRL | KMOD_RCTRL))
- new GameMainMenuSaveGame(*this, m_mainm_windows.savegame);
+ new GameMainMenuSaveGame(*this, main_windows_.savegame);
else
set_display_flag
(dfShowStatistics, !get_display_flag(dfShowStatistics));
@@ -355,16 +355,16 @@
break;
/* no break */
case SDLK_HOME:
- move_view_to(game().map().get_starting_pos(m_player_number));
+ move_view_to(game().map().get_starting_pos(player_number_));
return true;
case SDLK_KP_ENTER:
case SDLK_RETURN:
- if (!chat_provider_ | !m_chatenabled || !is_multiplayer())
+ if (!chat_provider_ | !chatenabled_ || !is_multiplayer())
break;
- if (!m_chat.window)
- GameChatMenu::create_chat_console(this, m_chat, *chat_provider_);
+ if (!chat_.window)
+ GameChatMenu::create_chat_console(this, chat_, *chat_provider_);
return true;
default:
@@ -380,7 +380,7 @@
* player
*/
void InteractivePlayer::set_player_number(uint32_t const n) {
- m_player_number = n;
+ player_number_ = n;
}
@@ -404,10 +404,10 @@
}
DebugConsole::write(
- str(boost::format("Switching from #%1% to #%2%.") % static_cast<int>(m_player_number) % n));
- m_player_number = n;
+ str(boost::format("Switching from #%1% to #%2%.") % static_cast<int>(player_number_) % n));
+ player_number_ = n;
- if (UI::UniqueWindow* const building_statistics_window = m_mainm_windows.building_stats.window) {
+ if (UI::UniqueWindow* const building_statistics_window = main_windows_.building_stats.window) {
dynamic_cast<BuildingStatisticsMenu&>(*building_statistics_window).update();
}
}
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2003, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -63,11 +63,11 @@
bool handle_key(bool down, SDL_Keysym) override;
Widelands::Player & player() const {
- return game().player(m_player_number);
+ return game().player(player_number_);
}
Widelands::Player * get_player() const override {
assert(&game());
- return game().get_player(m_player_number);
+ return game().get_player(player_number_);
}
// for savegames
@@ -78,7 +78,7 @@
void think() override;
void set_flag_to_connect(Widelands::Coords const location) {
- m_flag_to_connect = location;
+ flag_to_connect_ = location;
}
void popup_message(Widelands::MessageId, const Widelands::Message &);
@@ -87,24 +87,24 @@
private:
void cmdSwitchPlayer(const std::vector<std::string> & args);
- Widelands::PlayerNumber m_player_number;
- bool m_auto_roadbuild_mode;
- Widelands::Coords m_flag_to_connect;
-
- UI::Button m_toggle_chat;
- UI::Button m_toggle_options_menu;
- UI::Button m_toggle_statistics_menu;
- UI::Button m_toggle_objectives;
- UI::Button m_toggle_minimap;
- UI::Button m_toggle_message_menu;
- UI::Button m_toggle_help;
-
- UI::UniqueWindow::Registry m_chat;
- UI::UniqueWindow::Registry m_options;
- UI::UniqueWindow::Registry m_statisticsmenu;
- UI::UniqueWindow::Registry m_objectives;
- UI::UniqueWindow::Registry m_encyclopedia;
- UI::UniqueWindow::Registry m_message_menu;
+ Widelands::PlayerNumber player_number_;
+ bool auto_roadbuild_mode_;
+ Widelands::Coords flag_to_connect_;
+
+ UI::Button toggle_chat_;
+ UI::Button toggle_options_menu_;
+ UI::Button toggle_statistics_menu_;
+ UI::Button toggle_objectives_;
+ UI::Button toggle_minimap_;
+ UI::Button toggle_message_menu_;
+ UI::Button toggle_help_;
+
+ UI::UniqueWindow::Registry chat_;
+ UI::UniqueWindow::Registry options_;
+ UI::UniqueWindow::Registry statisticsmenu_;
+ UI::UniqueWindow::Registry objectives_;
+ UI::UniqueWindow::Registry encyclopedia_;
+ UI::UniqueWindow::Registry message_menu_;
};
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 by the Widelands Development Team
+ * Copyright (C) 2007-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -49,49 +49,49 @@
g_gr->images().get("pics/" picture ".png"), \
tooltip \
- m_toggle_chat
+ toggle_chat_
(INIT_BTN("menu_chat", "chat", _("Chat"))),
- m_exit
+ exit_
(INIT_BTN("menu_exit_game", "exit_replay", _("Exit Replay"))),
- m_save
+ save_
(INIT_BTN("menu_save_game", "save_game", _("Save Game"))),
- m_toggle_options_menu
+ toggle_options_menu_
(INIT_BTN("menu_options_menu", "options_menu", _("Options"))),
- m_toggle_statistics
+ toggle_statistics_
(INIT_BTN("menu_general_stats", "general_stats", _("Statistics"))),
- m_toggle_minimap
+ toggle_minimap_
(INIT_BTN("menu_toggle_minimap", "minimap", _("Minimap")))
{
- m_toggle_chat.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_chat, this));
- m_exit.sigclicked.connect(boost::bind(&InteractiveSpectator::exit_btn, this));
- m_save.sigclicked.connect(boost::bind(&InteractiveSpectator::save_btn, this));
- m_toggle_options_menu.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_options_menu, this));
- m_toggle_statistics.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_statistics, this));
- m_toggle_minimap.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_minimap, this));
+ toggle_chat_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_chat, this));
+ exit_.sigclicked.connect(boost::bind(&InteractiveSpectator::exit_btn, this));
+ save_.sigclicked.connect(boost::bind(&InteractiveSpectator::save_btn, this));
+ toggle_options_menu_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_options_menu, this));
+ toggle_statistics_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_statistics, this));
+ toggle_minimap_.sigclicked.connect(boost::bind(&InteractiveSpectator::toggle_minimap, this));
toolbar_.set_layout_toplevel(true);
if (!is_multiplayer()) {
- toolbar_.add(&m_exit, UI::Box::AlignLeft);
- toolbar_.add(&m_save, UI::Box::AlignLeft);
+ toolbar_.add(&exit_, UI::Box::AlignLeft);
+ toolbar_.add(&save_, UI::Box::AlignLeft);
} else
- toolbar_.add(&m_toggle_options_menu, UI::Box::AlignLeft);
- toolbar_.add(&m_toggle_statistics, UI::Box::AlignLeft);
- toolbar_.add(&m_toggle_minimap, UI::Box::AlignLeft);
- toolbar_.add(&m_toggle_buildhelp, UI::Box::AlignLeft);
- toolbar_.add(&m_toggle_chat, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_options_menu_, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_statistics_, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_minimap_, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_buildhelp_, UI::Box::AlignLeft);
+ toolbar_.add(&toggle_chat_, UI::Box::AlignLeft);
// TODO(unknown): instead of making unneeded buttons invisible after generation,
// they should not at all be generated. -> implement more dynamic toolbar UI
if (is_multiplayer()) {
- m_exit.set_visible(false);
- m_exit.set_enabled(false);
- m_save.set_visible(false);
- m_save.set_enabled(false);
+ exit_.set_visible(false);
+ exit_.set_enabled(false);
+ save_.set_visible(false);
+ save_.set_enabled(false);
} else {
- m_toggle_chat.set_visible(false);
- m_toggle_chat.set_enabled(false);
- m_toggle_options_menu.set_visible(false);
- m_toggle_options_menu.set_enabled(false);
+ toggle_chat_.set_visible(false);
+ toggle_chat_.set_enabled(false);
+ toggle_options_menu_.set_visible(false);
+ toggle_options_menu_.set_enabled(false);
}
adjust_toolbar_position();
@@ -99,17 +99,17 @@
// Setup all screen elements
fieldclicked.connect(boost::bind(&InteractiveSpectator::node_action, this));
-#define INIT_BTN_HOOKS(registry, btn) \
- registry.on_create = std::bind(&UI::Button::set_perm_pressed, &btn, true); \
- registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \
- if (registry.window) \
+#define INIT_BTN_HOOKS(registry, btn) \
+ registry.on_create = std::bind(&UI::Button::set_perm_pressed, &btn, true); \
+ registry.on_delete = std::bind(&UI::Button::set_perm_pressed, &btn, false); \
+ if (registry.window) \
btn.set_perm_pressed(true);
- INIT_BTN_HOOKS(m_chat, m_toggle_chat)
- INIT_BTN_HOOKS(m_options, m_toggle_options_menu)
- INIT_BTN_HOOKS(m_mainm_windows.general_stats, m_toggle_statistics)
- INIT_BTN_HOOKS(m_mainm_windows.savegame, m_save)
- INIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap)
+ INIT_BTN_HOOKS(chat_, toggle_chat_)
+ INIT_BTN_HOOKS(options_, toggle_options_menu_)
+ INIT_BTN_HOOKS(main_windows_.general_stats, toggle_statistics_)
+ INIT_BTN_HOOKS(main_windows_.savegame, save_)
+ INIT_BTN_HOOKS(minimap_registry(), toggle_minimap_)
}
@@ -119,15 +119,15 @@
// buttons. The assertions are safeguards in case somewhere else in the
// code someone would overwrite our hooks.
-#define DEINIT_BTN_HOOKS(registry, btn) \
- registry.on_create = 0; \
+#define DEINIT_BTN_HOOKS(registry, btn) \
+ registry.on_create = 0; \
registry.on_delete = 0;
- DEINIT_BTN_HOOKS(m_chat, m_toggle_chat)
- DEINIT_BTN_HOOKS(m_options, m_toggle_options_menu)
- DEINIT_BTN_HOOKS(m_mainm_windows.general_stats, m_toggle_statistics)
- DEINIT_BTN_HOOKS(m_mainm_windows.savegame, m_save)
- DEINIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap)
+ DEINIT_BTN_HOOKS(chat_, toggle_chat_)
+ DEINIT_BTN_HOOKS(options_, toggle_options_menu_)
+ DEINIT_BTN_HOOKS(main_windows_.general_stats, toggle_statistics_)
+ DEINIT_BTN_HOOKS(main_windows_.savegame, save_)
+ DEINIT_BTN_HOOKS(minimap_registry(), toggle_minimap_)
}
@@ -160,10 +160,10 @@
// Toolbar button callback functions.
void InteractiveSpectator::toggle_chat()
{
- if (m_chat.window)
- delete m_chat.window;
+ if (chat_.window)
+ delete chat_.window;
else if (chat_provider_)
- GameChatMenu::create_chat_console(this, m_chat, *chat_provider_);
+ GameChatMenu::create_chat_console(this, chat_, *chat_provider_);
}
@@ -181,10 +181,10 @@
if (is_multiplayer()) {
return;
}
- if (m_mainm_windows.savegame.window)
- delete m_mainm_windows.savegame.window;
+ if (main_windows_.savegame.window)
+ delete main_windows_.savegame.window;
else {
- new GameMainMenuSaveGame(*this, m_mainm_windows.savegame);
+ new GameMainMenuSaveGame(*this, main_windows_.savegame);
}
}
@@ -193,18 +193,18 @@
if (!is_multiplayer()) {
return;
}
- if (m_options.window)
- delete m_options.window;
+ if (options_.window)
+ delete options_.window;
else
- new GameOptionsMenu(*this, m_options, m_mainm_windows);
+ new GameOptionsMenu(*this, options_, main_windows_);
}
void InteractiveSpectator::toggle_statistics() {
- if (m_mainm_windows.general_stats.window)
- delete m_mainm_windows.general_stats.window;
+ if (main_windows_.general_stats.window)
+ delete main_windows_.general_stats.window;
else
- new GeneralStatisticsMenu(*this, m_mainm_windows.general_stats);
+ new GeneralStatisticsMenu(*this, main_windows_.general_stats);
}
@@ -237,7 +237,7 @@
return;
// everything else can bring up the temporary dialog
- show_field_action(this, nullptr, &m_fieldaction);
+ show_field_action(this, nullptr, &fieldaction_);
}
@@ -262,7 +262,7 @@
case SDLK_s:
if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
- new GameMainMenuSaveGame(*this, m_mainm_windows.savegame);
+ new GameMainMenuSaveGame(*this, main_windows_.savegame);
} else
set_display_flag
(dfShowStatistics, !get_display_flag(dfShowStatistics));
@@ -270,13 +270,13 @@
case SDLK_RETURN:
case SDLK_KP_ENTER:
- if (!chat_provider_ | !m_chatenabled)
+ if (!chat_provider_ | !chatenabled_)
break;
- if (!m_chat.window)
- GameChatMenu::create_chat_console(this, m_chat, *chat_provider_);
+ if (!chat_.window)
+ GameChatMenu::create_chat_console(this, chat_, *chat_provider_);
- dynamic_cast<GameChatMenu*>(m_chat.window)->enter_chat_message();
+ dynamic_cast<GameChatMenu*>(chat_.window)->enter_chat_message();
return true;
default:
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2003, 2006-2008 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -58,16 +58,16 @@
void node_action() override;
private:
- UI::Button m_toggle_chat;
- UI::Button m_exit;
- UI::Button m_save;
- UI::Button m_toggle_options_menu;
- UI::Button m_toggle_statistics;
- UI::Button m_toggle_minimap;
-
-
- UI::UniqueWindow::Registry m_chat;
- UI::UniqueWindow::Registry m_options;
+ UI::Button toggle_chat_;
+ UI::Button exit_;
+ UI::Button save_;
+ UI::Button toggle_options_menu_;
+ UI::Button toggle_statistics_;
+ UI::Button toggle_minimap_;
+
+
+ UI::UniqueWindow::Registry chat_;
+ UI::UniqueWindow::Registry options_;
};
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2013 by the Widelands Development Team
+ * Copyright (C) 2011-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -40,9 +40,9 @@
*/
ItemWaresDisplay::ItemWaresDisplay(Panel * parent, const Widelands::Player & gplayer) :
Panel(parent, 0, 0, 0, 0),
- m_player(gplayer),
- m_capacity(0),
- m_items_per_row(IWD_DefaultItemsPerRow)
+ player_(gplayer),
+ capacity_(0),
+ items_per_row_(IWD_DefaultItemsPerRow)
{
set_desired_size(2 * IWD_HBorder, 2 * IWD_VBorder);
}
@@ -52,8 +52,8 @@
*/
void ItemWaresDisplay::clear()
{
- if (!m_items.empty()) {
- m_items.clear();
+ if (!items_.empty()) {
+ items_.clear();
update();
}
}
@@ -66,8 +66,8 @@
*/
void ItemWaresDisplay::set_capacity(uint32_t cap)
{
- if (cap != m_capacity) {
- m_capacity = cap;
+ if (cap != capacity_) {
+ capacity_ = cap;
recalc_desired_size();
}
}
@@ -77,16 +77,16 @@
*/
void ItemWaresDisplay::set_items_per_row(uint32_t nr)
{
- if (nr != m_items_per_row) {
- m_items_per_row = nr;
+ if (nr != items_per_row_) {
+ items_per_row_ = nr;
recalc_desired_size();
}
}
void ItemWaresDisplay::recalc_desired_size()
{
- uint32_t nrrows = (m_capacity + m_items_per_row - 1) / m_items_per_row;
- uint32_t rowitems = m_capacity >= m_items_per_row ? m_items_per_row : m_capacity;
+ uint32_t nrrows = (capacity_ + items_per_row_ - 1) / items_per_row_;
+ uint32_t rowitems = capacity_ >= items_per_row_ ? items_per_row_ : capacity_;
set_desired_size(2 * IWD_HBorder + rowitems * IWD_ItemWidth, 2 * IWD_VBorder + nrrows * IWD_ItemHeight);
}
@@ -99,7 +99,7 @@
Item it;
it.worker = worker;
it.index = index;
- m_items.push_back(it);
+ items_.push_back(it);
update();
}
@@ -109,10 +109,10 @@
dst.fill_rect(Rect(Point(0, 0), get_w(), get_h()), RGBAColor(0, 0, 0, 0));
- for (uint32_t idx = 0; idx < m_items.size(); ++idx) {
- const Item & it = m_items[idx];
- uint32_t row = idx / m_items_per_row;
- uint32_t col = idx % m_items_per_row;
+ for (uint32_t idx = 0; idx < items_.size(); ++idx) {
+ const Item & it = items_[idx];
+ uint32_t row = idx / items_per_row_;
+ uint32_t col = idx % items_per_row_;
uint32_t x = IWD_HBorder / 2 + col * IWD_ItemWidth;
uint32_t y = IWD_VBorder + row * IWD_ItemHeight;
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 by the Widelands Development Team
+ * Copyright (C) 2011-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -36,12 +36,12 @@
struct ItemWaresDisplay : UI::Panel {
ItemWaresDisplay(UI::Panel * parent, const Widelands::Player & player);
- const Widelands::Player & player() const {return m_player;}
+ const Widelands::Player & player() const {return player_;}
- uint32_t capacity() const {return m_capacity;}
+ uint32_t capacity() const {return capacity_;}
void set_capacity(uint32_t cap);
- uint32_t items_per_row() const {return m_items_per_row;}
+ uint32_t items_per_row() const {return items_per_row_;}
void set_items_per_row(uint32_t nr);
void clear();
@@ -57,10 +57,10 @@
void recalc_desired_size();
- const Widelands::Player & m_player;
- uint32_t m_capacity;
- uint32_t m_items_per_row;
- std::vector<Item> m_items;
+ const Widelands::Player & player_;
+ uint32_t capacity_;
+ uint32_t items_per_row_;
+ std::vector<Item> items_;
};
#endif // end of include guard: WL_WUI_ITEMWARESDISPLAY_H
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006-2009, 2011, 2014-2015 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -36,8 +36,8 @@
* Author data for a map or scenario.
*/
struct MapAuthorData {
- const std::string& get_names() const {return m_names;}
- size_t get_number() const {return m_number;}
+ const std::string& get_names() const {return names_;}
+ size_t get_number() const {return number_;}
// Parses author list string into localized contatenated list
// string. Use , as list separator and no whitespaces between
@@ -45,13 +45,13 @@
MapAuthorData(const std::string& author_list) {
std::vector<std::string> authors;
boost::split(authors, author_list, boost::is_any_of(","));
- m_names = i18n::localize_list(authors, i18n::ConcatenateWith::AMPERSAND);
- m_number = authors.size();
+ names_ = i18n::localize_list(authors, i18n::ConcatenateWith::AMPERSAND);
+ number_ = authors.size();
}
private:
- std::string m_names;
- size_t m_number;
+ std::string names_;
+ size_t number_;
};
/**
=== 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:17:30 +0000
@@ -33,10 +33,10 @@
MapView::MapView(
UI::Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h, InteractiveBase& player)
: UI::Panel(parent, x, y, w, h),
- m_renderer(new GameRenderer()),
- m_intbase(player),
- m_viewpoint(Point(0, 0)),
- m_dragging(false) {
+ renderer_(new GameRenderer()),
+ intbase_(player),
+ viewpoint_(Point(0, 0)),
+ dragging_(false) {
}
MapView::~MapView()
@@ -50,7 +50,7 @@
const Widelands::Map & map = intbase().egbase().map();
Point p;
MapviewPixelFunctions::get_save_pix(map, c, p.x, p.y);
- p -= m_viewpoint;
+ p -= viewpoint_;
// If the user has scrolled the node outside the viewable area, he most
// surely doesn't want to jump there.
@@ -86,15 +86,15 @@
}
if (upcast(InteractivePlayer const, interactive_player, &intbase())) {
- m_renderer->rendermap(dst, egbase, m_viewpoint, interactive_player->player());
+ renderer_->rendermap(dst, egbase, viewpoint_, interactive_player->player());
} else {
- m_renderer->rendermap(dst, egbase, m_viewpoint);
+ renderer_->rendermap(dst, egbase, viewpoint_);
}
}
void MapView::set_changeview(const MapView::ChangeViewFn & fn)
{
- m_changeview = fn;
+ changeview_ = fn;
}
/*
@@ -104,22 +104,22 @@
*/
void MapView::set_viewpoint(Point vp, bool jump)
{
- if (vp == m_viewpoint)
+ if (vp == viewpoint_)
return;
MapviewPixelFunctions::normalize_pix(intbase().egbase().map(), vp);
- m_viewpoint = vp;
+ viewpoint_ = vp;
- if (m_changeview)
- m_changeview(vp, jump);
- changeview(m_viewpoint.x, m_viewpoint.y);
+ if (changeview_)
+ changeview_(vp, jump);
+ changeview(viewpoint_.x, viewpoint_.y);
}
void MapView::stop_dragging() {
WLApplication::get()->set_mouse_lock(false);
grab_mouse(false);
- m_dragging = false;
+ dragging_ = false;
}
/**
@@ -138,7 +138,7 @@
fieldclicked();
} else if (btn == SDL_BUTTON_RIGHT) {
- m_dragging = true;
+ dragging_ = true;
grab_mouse(true);
WLApplication::get()->set_mouse_lock(true);
}
@@ -146,7 +146,7 @@
}
bool MapView::handle_mouserelease(const uint8_t btn, int32_t, int32_t)
{
- if (btn == SDL_BUTTON_RIGHT && m_dragging)
+ if (btn == SDL_BUTTON_RIGHT && dragging_)
stop_dragging();
return true;
}
@@ -160,7 +160,7 @@
bool MapView::handle_mousemove
(uint8_t const state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff)
{
- if (m_dragging) {
+ if (dragging_) {
if (state & SDL_BUTTON(SDL_BUTTON_RIGHT))
set_rel_viewpoint(Point(xdiff, ydiff), false);
else stop_dragging();
@@ -183,8 +183,8 @@
===============
*/
void MapView::track_sel(Point m) {
- m += m_viewpoint;
- m_intbase.set_sel_pos
+ m += viewpoint_;
+ intbase_.set_sel_pos
(MapviewPixelFunctions::calc_node_and_triangle
(intbase().egbase().map(), m.x, m.y));
}
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -63,10 +63,10 @@
void warp_mouse_to_node(Widelands::Coords);
void set_viewpoint(Point vp, bool jump);
- void set_rel_viewpoint(Point r, bool jump) {set_viewpoint(m_viewpoint + r, jump);}
+ void set_rel_viewpoint(Point r, bool jump) {set_viewpoint(viewpoint_ + r, jump);}
- Point get_viewpoint() const {return m_viewpoint;}
- bool is_dragging() const {return m_dragging;}
+ Point get_viewpoint() const {return viewpoint_;}
+ bool is_dragging() const {return dragging_;}
// Drawing
void draw(RenderTarget &) override;
@@ -80,16 +80,16 @@
void track_sel(Point m);
protected:
- InteractiveBase & intbase() const {return m_intbase;}
+ InteractiveBase & intbase() const {return intbase_;}
private:
void stop_dragging();
- std::unique_ptr<GameRenderer> m_renderer;
- InteractiveBase & m_intbase;
- ChangeViewFn m_changeview;
- Point m_viewpoint;
- bool m_dragging;
+ std::unique_ptr<GameRenderer> renderer_;
+ InteractiveBase & intbase_;
+ ChangeViewFn changeview_;
+ Point viewpoint_;
+ bool dragging_;
};
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -36,11 +36,11 @@
InteractiveBase & ibase)
:
UI::Panel (&parent, x, y, 10, 10),
- m_ibase (ibase),
- m_viewx (0),
- m_viewy (0),
- m_pic_map_spot(g_gr->images().get("pics/map_spot.png")),
- m_flags (flags)
+ ibase_ (ibase),
+ viewx_ (0),
+ viewy_ (0),
+ pic_map_spot_(g_gr->images().get("pics/map_spot.png")),
+ flags_ (flags)
{}
@@ -52,8 +52,8 @@
*/
void MiniMap::View::set_view_pos(const int32_t x, const int32_t y)
{
- m_viewx = x / TRIANGLE_WIDTH;
- m_viewy = y / TRIANGLE_HEIGHT;
+ viewx_ = x / TRIANGLE_WIDTH;
+ viewy_ = y / TRIANGLE_HEIGHT;
update();
}
@@ -62,12 +62,12 @@
void MiniMap::View::draw(RenderTarget & dst)
{
minimap_image_ =
- draw_minimap(m_ibase.egbase(),
- m_ibase.get_player(),
- (*m_flags) & (MiniMapLayer::Zoom2) ?
- Point((m_viewx - get_w() / 4), (m_viewy - get_h() / 4)) :
- Point((m_viewx - get_w() / 2), (m_viewy - get_h() / 2)),
- *m_flags | MiniMapLayer::ViewWindow);
+ draw_minimap(ibase_.egbase(),
+ ibase_.get_player(),
+ (*flags_) & (MiniMapLayer::Zoom2) ?
+ Point((viewx_ - get_w() / 4), (viewy_ - get_h() / 4)) :
+ Point((viewx_ - get_w() / 2), (viewy_ - get_h() / 2)),
+ *flags_ | MiniMapLayer::ViewWindow);
dst.blit(Point(), minimap_image_.get());
}
@@ -83,15 +83,15 @@
// calculates the coordinates corresponding to the mouse position
Widelands::Coords c;
- if (*m_flags & MiniMapLayer::Zoom2)
+ if (*flags_ & MiniMapLayer::Zoom2)
c = Widelands::Coords
- (m_viewx + 1 - (get_w() / 2 - x) / 2,
- m_viewy + 1 - (get_h() / 2 - y) / 2);
+ (viewx_ + 1 - (get_w() / 2 - x) / 2,
+ viewy_ + 1 - (get_h() / 2 - y) / 2);
else
c = Widelands::Coords
- (m_viewx + 1 - get_w() / 2 + x, m_viewy + 1 - get_h() / 2 + y);
+ (viewx_ + 1 - get_w() / 2 + x, viewy_ + 1 - get_h() / 2 + y);
- m_ibase.egbase().map().normalize_coords(c);
+ ibase_.egbase().map().normalize_coords(c);
dynamic_cast<MiniMap&>(*get_parent()).warpview(c.x * TRIANGLE_WIDTH, c.y * TRIANGLE_HEIGHT);
@@ -102,7 +102,7 @@
}
void MiniMap::View::set_zoom(int32_t z) {
- const Widelands::Map & map = m_ibase.egbase().map();
+ const Widelands::Map & map = ibase_.egbase().map();
set_size((map.get_width() * z), (map.get_height()) * z);
}
@@ -129,52 +129,52 @@
inline uint32_t MiniMap::number_of_buttons_per_row() const {return 3;}
inline uint32_t MiniMap::number_of_button_rows () const {return 2;}
inline uint32_t MiniMap::but_w () const {
- return m_view.get_w() / number_of_buttons_per_row();
+ return view_.get_w() / number_of_buttons_per_row();
}
inline uint32_t MiniMap::but_h () const {return 20;}
MiniMap::MiniMap(InteractiveBase & ibase, Registry * const registry)
:
UI::UniqueWindow(&ibase, "minimap", registry, 0, 0, _("Map")),
- m_view(*this, ®istry->flags, 0, 0, 0, 0, ibase),
+ view_(*this, ®istry->flags, 0, 0, 0, 0, ibase),
button_terrn
(this, "terrain",
- but_w() * 0, m_view.get_h() + but_h() * 0, but_w(), but_h(),
+ but_w() * 0, view_.get_h() + but_h() * 0, but_w(), but_h(),
g_gr->images().get("pics/but0.png"),
g_gr->images().get("pics/button_terrn.png"),
_("Terrain"),
true, false, true),
button_owner
(this, "owner",
- but_w() * 1, m_view.get_h() + but_h() * 0, but_w(), but_h(),
+ but_w() * 1, view_.get_h() + but_h() * 0, but_w(), but_h(),
g_gr->images().get("pics/but0.png"),
g_gr->images().get("pics/button_owner.png"),
_("Owner"),
true, false, true),
button_flags
(this, "flags",
- but_w() * 2, m_view.get_h() + but_h() * 0, but_w(), but_h(),
+ but_w() * 2, view_.get_h() + but_h() * 0, but_w(), but_h(),
g_gr->images().get("pics/but0.png"),
g_gr->images().get("pics/button_flags.png"),
_("Flags"),
true, false, true),
button_roads
(this, "roads",
- but_w() * 0, m_view.get_h() + but_h() * 1, but_w(), but_h(),
+ but_w() * 0, view_.get_h() + but_h() * 1, but_w(), but_h(),
g_gr->images().get("pics/but0.png"),
g_gr->images().get("pics/button_roads.png"),
_("Roads"),
true, false, true),
button_bldns
(this, "buildings",
- but_w() * 1, m_view.get_h() + but_h() * 1, but_w(), but_h(),
+ but_w() * 1, view_.get_h() + but_h() * 1, but_w(), but_h(),
g_gr->images().get("pics/but0.png"),
g_gr->images().get("pics/button_bldns.png"),
_("Buildings"),
true, false, true),
button_zoom
(this, "zoom",
- but_w() * 2, m_view.get_h() + but_h() * 1, but_w(), but_h(),
+ but_w() * 2, view_.get_h() + but_h() * 1, but_w(), but_h(),
g_gr->images().get("pics/but0.png"),
g_gr->images().get("pics/button_zoom.png"),
_("Zoom"),
@@ -198,37 +198,37 @@
void MiniMap::toggle(MiniMapLayer const button) {
- *m_view.m_flags = MiniMapLayer(*m_view.m_flags ^ button);
+ *view_.flags_ = MiniMapLayer(*view_.flags_ ^ button);
if (button == MiniMapLayer::Zoom2)
resize();
update_button_permpressed();
}
void MiniMap::resize() {
- m_view.set_zoom(*m_view.m_flags & MiniMapLayer::Zoom2 ? 2 : 1);
+ view_.set_zoom(*view_.flags_ & MiniMapLayer::Zoom2 ? 2 : 1);
set_inner_size
- (m_view.get_w(), m_view.get_h() + number_of_button_rows() * but_h());
- button_terrn.set_pos(Point(but_w() * 0, m_view.get_h() + but_h() * 0));
+ (view_.get_w(), view_.get_h() + number_of_button_rows() * but_h());
+ button_terrn.set_pos(Point(but_w() * 0, view_.get_h() + but_h() * 0));
button_terrn.set_size(but_w(), but_h());
- button_owner.set_pos(Point(but_w() * 1, m_view.get_h() + but_h() * 0));
+ button_owner.set_pos(Point(but_w() * 1, view_.get_h() + but_h() * 0));
button_owner.set_size(but_w(), but_h());
- button_flags.set_pos(Point(but_w() * 2, m_view.get_h() + but_h() * 0));
+ button_flags.set_pos(Point(but_w() * 2, view_.get_h() + but_h() * 0));
button_flags.set_size(but_w(), but_h());
- button_roads.set_pos(Point(but_w() * 0, m_view.get_h() + but_h() * 1));
+ button_roads.set_pos(Point(but_w() * 0, view_.get_h() + but_h() * 1));
button_roads.set_size(but_w(), but_h());
- button_bldns.set_pos(Point(but_w() * 1, m_view.get_h() + but_h() * 1));
+ button_bldns.set_pos(Point(but_w() * 1, view_.get_h() + but_h() * 1));
button_bldns.set_size(but_w(), but_h());
- button_zoom .set_pos(Point(but_w() * 2, m_view.get_h() + but_h() * 1));
+ button_zoom .set_pos(Point(but_w() * 2, view_.get_h() + but_h() * 1));
button_zoom .set_size(but_w(), but_h());
move_inside_parent();
}
// Makes the buttons reflect the selected layers
void MiniMap::update_button_permpressed() {
- button_terrn.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Terrain);
- button_owner.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Owner);
- button_flags.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Flag);
- button_roads.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Road);
- button_bldns.set_perm_pressed(*m_view.m_flags & MiniMapLayer::Building);
- button_zoom .set_perm_pressed(*m_view.m_flags & MiniMapLayer::Zoom2);
+ button_terrn.set_perm_pressed(*view_.flags_ & MiniMapLayer::Terrain);
+ button_owner.set_perm_pressed(*view_.flags_ & MiniMapLayer::Owner);
+ button_flags.set_perm_pressed(*view_.flags_ & MiniMapLayer::Flag);
+ button_roads.set_perm_pressed(*view_.flags_ & MiniMapLayer::Road);
+ button_bldns.set_perm_pressed(*view_.flags_ & MiniMapLayer::Building);
+ button_zoom .set_perm_pressed(*view_.flags_ & MiniMapLayer::Zoom2);
}
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team
+ * Copyright (C) 2002-20116 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -46,7 +46,7 @@
boost::signals2::signal<void (int32_t, int32_t)> warpview;
void set_view_pos(int32_t const x, int32_t const y) {
- m_view.set_view_pos(x, y);
+ view_.set_view_pos(x, y);
}
private:
@@ -79,16 +79,16 @@
void set_zoom(int32_t z);
private:
- InteractiveBase & m_ibase;
- int32_t m_viewx, m_viewy;
- const Image* m_pic_map_spot;
+ InteractiveBase & ibase_;
+ int32_t viewx_, viewy_;
+ const Image* pic_map_spot_;
// This needs to be owned since it will be rendered by the RenderQueue
// later, so it must be valid for the whole frame.
std::unique_ptr<Texture> minimap_image_;
public:
- MiniMapLayer* m_flags;
+ MiniMapLayer* flags_;
};
uint32_t number_of_buttons_per_row() const;
@@ -96,7 +96,7 @@
uint32_t but_w () const;
uint32_t but_h () const;
- View m_view;
+ View view_;
UI::Button button_terrn;
UI::Button button_owner;
UI::Button button_flags;
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2011 by the Widelands Development Team
+ * Copyright (C) 2010-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -51,8 +51,8 @@
type_icon(nullptr),
type(nullptr),
s(settings),
- m_id(id),
- m_save(-2)
+ id_(id),
+ save_(-2)
{
set_size(w, h);
name = new UI::Textarea
@@ -81,7 +81,7 @@
/// Switch human players and spectator
void toggle_type() {
- UserSettings us = s->settings().users.at(m_id);
+ UserSettings us = s->settings().users.at(id_);
int16_t p = us.position;
if (p == UserSettings::none())
p = -1;
@@ -101,7 +101,7 @@
/// Care about visibility and current values
void refresh() {
- UserSettings us = s->settings().users.at(m_id);
+ UserSettings us = s->settings().users.at(id_);
if (us.position == UserSettings::not_connected()) {
std::string free_i18n = _("free");
std::string free_text =
@@ -113,7 +113,7 @@
type_icon->set_visible(false);
} else {
name->set_text(us.name);
- if (m_save != us.position) {
+ if (save_ != us.position) {
std::string pic;
std::string temp_tooltip;
if (us.position < UserSettings::highest_playernum()) {
@@ -127,7 +127,7 @@
}
// Either Button if changeable OR text if not
- if (m_id == s->settings().usernum) {
+ if (id_ == s->settings().usernum) {
type->set_pic(g_gr->images().get(pic));
type->set_tooltip(temp_tooltip);
type->set_visible(true);
@@ -136,7 +136,7 @@
type_icon->set_tooltip(temp_tooltip);
type_icon->set_visible(true);
}
- m_save = us.position;
+ save_ = us.position;
}
}
}
@@ -145,8 +145,8 @@
UI::Icon * type_icon;
UI::Button * type;
GameSettingsProvider * const s;
- uint8_t const m_id;
- int16_t m_save; // saved position to check rewrite need.
+ uint8_t const id_;
+ int16_t save_; // saved position to check rewrite need.
};
struct MultiPlayerPlayerGroup : public UI::Box {
@@ -165,9 +165,9 @@
init(nullptr),
s(settings),
n(npsb),
- m_id(id),
- m_tribepics(tp),
- m_tribenames(tn)
+ id_(id),
+ tribepics_(tp),
+ tribenames_(tn)
{
set_size(w, h);
@@ -217,42 +217,42 @@
/// Toggle through the types
void toggle_type() {
- n->toggle_type(m_id);
+ n->toggle_type(id_);
}
/// Toggle through the tribes + handle shared in players
void toggle_tribe() {
- n->toggle_tribe(m_id);
+ n->toggle_tribe(id_);
}
/// Toggle through the initializations
void toggle_init() {
- n->toggle_init(m_id);
+ n->toggle_init(id_);
}
/// Toggle through the teams
void toggle_team() {
- n->toggle_team(m_id);
+ n->toggle_team(id_);
}
/// Refresh all user interfaces
void refresh() {
const GameSettings & settings = s->settings();
- if (m_id >= settings.players.size()) {
+ if (id_ >= settings.players.size()) {
set_visible(false);
return;
}
- n->refresh(m_id);
+ n->refresh(id_);
set_visible(true);
- const PlayerSettings & player_setting = settings.players[m_id];
- bool typeaccess = s->can_change_player_state(m_id);
- bool tribeaccess = s->can_change_player_tribe(m_id);
- bool const initaccess = s->can_change_player_init(m_id);
- bool teamaccess = s->can_change_player_team(m_id);
+ const PlayerSettings & player_setting = settings.players[id_];
+ bool typeaccess = s->can_change_player_state(id_);
+ bool tribeaccess = s->can_change_player_tribe(id_);
+ bool const initaccess = s->can_change_player_init(id_);
+ bool teamaccess = s->can_change_player_team(id_);
type->set_enabled(typeaccess);
if (player_setting.state == PlayerSettings::stateClosed) {
@@ -320,21 +320,21 @@
type->set_pic(g_gr->images().get(pic));
if (player_setting.random_tribe) {
std::string random = pgettext("tribe", "Random");
- if (!m_tribenames["random"].size())
- m_tribepics[random] = g_gr->images().get("pics/random.png");
+ if (!tribenames_["random"].size())
+ tribepics_[random] = g_gr->images().get("pics/random.png");
tribe->set_tooltip(random.c_str());
- tribe->set_pic(m_tribepics[random]);
+ tribe->set_pic(tribepics_[random]);
} else {
- if (!m_tribenames[player_setting.tribe].size()) {
+ if (!tribenames_[player_setting.tribe].size()) {
// get tribes name and picture
i18n::Textdomain td("tribes");
for (const TribeBasicInfo& tribeinfo : settings.tribes) {
- m_tribenames[tribeinfo.name] = _(tribeinfo.descname);
- m_tribepics[tribeinfo.name] = g_gr->images().get(tribeinfo.icon);
+ tribenames_[tribeinfo.name] = _(tribeinfo.descname);
+ tribepics_[tribeinfo.name] = g_gr->images().get(tribeinfo.icon);
}
}
- tribe->set_tooltip(m_tribenames[player_setting.tribe].c_str());
- tribe->set_pic(m_tribepics[player_setting.tribe]);
+ tribe->set_tooltip(tribenames_[player_setting.tribe].c_str());
+ tribe->set_pic(tribepics_[player_setting.tribe]);
}
tribe->set_flat(false);
@@ -375,9 +375,9 @@
UI::Button * team;
GameSettingsProvider * const s;
NetworkPlayerSettingsBackend * const n;
- uint8_t const m_id;
- std::map<std::string, const Image* > & m_tribepics;
- std::map<std::string, std::string> & m_tribenames;
+ uint8_t const id_;
+ std::map<std::string, const Image* > & tribepics_;
+ std::map<std::string, std::string> & tribenames_;
};
MultiPlayerSetupGroup::MultiPlayerSetupGroup
@@ -392,9 +392,9 @@
npsb(new NetworkPlayerSettingsBackend(s)),
clientbox(this, 0, buth, UI::Box::Vertical, w / 3, h - buth),
playerbox(this, w * 6 / 15, buth, UI::Box::Vertical, w * 9 / 15, h - buth),
-m_buth(buth),
-m_fsize(fsize),
-m_fname(fname)
+buth_(buth),
+fsize_(fsize),
+fname_(fname)
{
UI::TextStyle tsmaller(UI::TextStyle::makebold(UI::Font::get(fname, fsize * 3 / 4), UI_FONT_CLR_FG));
@@ -462,7 +462,7 @@
(&playerbox, i,
0, 0, playerbox.get_w(), buth,
s, npsb.get(),
- m_tribepics, m_tribenames);
+ tribepics_, tribenames_);
playerbox.add(multi_player_player_groups.at(i), 1);
}
refresh();
@@ -488,7 +488,7 @@
for (uint32_t i = 0; i < settings.users.size(); ++i) {
if (!multi_player_client_groups.at(i)) {
multi_player_client_groups.at(i) = new MultiPlayerClientGroup(
- &clientbox, i, 0, 0, clientbox.get_w(), m_buth, s, UI::Font::get(m_fname, m_fsize));
+ &clientbox, i, 0, 0, clientbox.get_w(), buth_, s, UI::Font::get(fname_, fsize_));
clientbox.add(&*multi_player_client_groups.at(i), 1);
}
multi_player_client_groups.at(i)->refresh();
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 by the Widelands Development Team
+ * Copyright (C) 2010-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -64,11 +64,11 @@
UI::Box clientbox, playerbox;
std::vector<UI::Textarea *> labels;
- uint32_t m_buth, m_fsize;
- std::string m_fname;
+ uint32_t buth_, fsize_;
+ std::string fname_;
- std::map<std::string, const Image* > m_tribepics;
- std::map<std::string, std::string> m_tribenames;
+ std::map<std::string, const Image* > tribepics_;
+ std::map<std::string, std::string> tribenames_;
};
=== 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:17:30 +0000
@@ -180,16 +180,16 @@
d->btnPlayerType->set_title(title);
TribeBasicInfo info = Widelands::Tribes::tribeinfo(player.tribe);
- if (!m_tribenames[player.tribe].size()) {
+ if (!tribenames_[player.tribe].size()) {
// Tribe's localized name
- m_tribenames[player.tribe] = info.descname;
+ tribenames_[player.tribe] = info.descname;
}
if (player.random_tribe) {
d->btnPlayerTribe->set_title(pgettext("tribe", "Random"));
d->btnPlayerTribe->set_tooltip(_("The tribe will be set at random."));
} else {
i18n::Textdomain td("tribes");
- d->btnPlayerTribe->set_title(_(m_tribenames[player.tribe]));
+ d->btnPlayerTribe->set_title(_(tribenames_[player.tribe]));
d->btnPlayerTribe->set_tooltip(info.tooltip);
}
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006, 2008, 2010 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -55,7 +55,7 @@
void toggle_playerteam();
PlayerDescriptionGroupImpl * d;
- std::map<std::string, std::string> m_tribenames;
+ std::map<std::string, std::string> tribenames_;
};
=== 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:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2008-2013 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -247,10 +247,10 @@
int32_t const x, int32_t const y, int32_t const w, int32_t const h)
:
UI::Panel (parent, x, y, w, h),
-m_plotmode(PLOTMODE_ABSOLUTE),
-m_sample_rate(0),
-m_time (TIME_GAME),
-m_game_time_id(0)
+plotmode_(PLOTMODE_ABSOLUTE),
+sample_rate_(0),
+time_ (TIME_GAME),
+game_time_id_(0)
{}
@@ -258,15 +258,15 @@
uint32_t game_time = 0;
// Find running time of the game, based on the plot data
- for (uint32_t plot = 0; plot < m_plotdata.size(); ++plot)
- if (game_time < m_plotdata[plot].dataset->size() * m_sample_rate)
- game_time = m_plotdata[plot].dataset->size() * m_sample_rate;
+ for (uint32_t plot = 0; plot < plotdata_.size(); ++plot)
+ if (game_time < plotdata_[plot].dataset->size() * sample_rate_)
+ game_time = plotdata_[plot].dataset->size() * sample_rate_;
return game_time;
}
std::vector<std::string> WuiPlotArea::get_labels() {
std::vector<std::string> labels;
- for (int32_t i = 0; i < m_game_time_id; i++) {
+ for (int32_t i = 0; i < game_time_id_; i++) {
UNIT unit = get_suggested_unit(time_in_ms[i]);
uint32_t val = ms_to_unit(unit, time_in_ms[i]);
labels.push_back((boost::format(get_unit_name(unit)) % boost::lexical_cast<std::string>(val)).str());
@@ -276,7 +276,7 @@
}
uint32_t WuiPlotArea::get_plot_time() {
- if (m_time == TIME_GAME) {
+ if (time_ == TIME_GAME) {
// Start with the game time
uint32_t time_ms = get_game_time();
@@ -297,7 +297,7 @@
}
return time_ms;
} else {
- return time_in_ms[m_time];
+ return time_in_ms[time_];
}
}
@@ -316,8 +316,8 @@
uint32_t i;
for (i = 1; i < 7 && time_in_ms[i] <= game_time; i++) {
}
- m_game_time_id = i;
- return m_game_time_id;
+ game_time_id_ = i;
+ return game_time_id_;
}
/*
@@ -331,22 +331,22 @@
draw_diagram(time_ms, get_inner_w(), get_inner_h(), xline_length, dst);
// How many do we take together when relative ploting
- const int32_t how_many = calc_how_many(time_ms, m_sample_rate);
+ const int32_t how_many = calc_how_many(time_ms, sample_rate_);
uint32_t max = 0;
// Find the maximum value.
- if (m_plotmode == PLOTMODE_ABSOLUTE) {
- for (uint32_t i = 0; i < m_plotdata.size(); ++i)
- if (m_plotdata[i].showplot) {
- for (uint32_t l = 0; l < m_plotdata[i].dataset->size(); ++l)
- if (max < (*m_plotdata[i].dataset)[l])
- max = (*m_plotdata[i].dataset)[l];
+ if (plotmode_ == PLOTMODE_ABSOLUTE) {
+ for (uint32_t i = 0; i < plotdata_.size(); ++i)
+ if (plotdata_[i].showplot) {
+ for (uint32_t l = 0; l < plotdata_[i].dataset->size(); ++l)
+ if (max < (*plotdata_[i].dataset)[l])
+ max = (*plotdata_[i].dataset)[l];
}
} else {
- for (uint32_t plot = 0; plot < m_plotdata.size(); ++plot)
- if (m_plotdata[plot].showplot) {
+ for (uint32_t plot = 0; plot < plotdata_.size(); ++plot)
+ if (plotdata_[plot].showplot) {
- const std::vector<uint32_t> & dataset = *m_plotdata[plot].dataset;
+ const std::vector<uint32_t> & dataset = *plotdata_[plot].dataset;
uint32_t add = 0;
// Relative data, first entry is always zero.
@@ -372,27 +372,27 @@
/
(static_cast<float>(time_ms)
/
- static_cast<float>(m_sample_rate));
- for (uint32_t plot = 0; plot < m_plotdata.size(); ++plot)
- if (m_plotdata[plot].showplot) {
-
- RGBColor color = m_plotdata[plot].plotcolor;
- std::vector<uint32_t> const * dataset = m_plotdata[plot].dataset;
-
- std::vector<uint32_t> m_data;
- if (m_plotmode == PLOTMODE_RELATIVE) {
+ static_cast<float>(sample_rate_));
+ for (uint32_t plot = 0; plot < plotdata_.size(); ++plot)
+ if (plotdata_[plot].showplot) {
+
+ RGBColor color = plotdata_[plot].plotcolor;
+ std::vector<uint32_t> const * dataset = plotdata_[plot].dataset;
+
+ std::vector<uint32_t> data_;
+ if (plotmode_ == PLOTMODE_RELATIVE) {
uint32_t add = 0;
// Relative data, first entry is always zero
- m_data.push_back(0);
+ data_.push_back(0);
for (uint32_t i = 0; i < dataset->size(); ++i) {
add += (*dataset)[i];
if (0 == ((i + 1) % how_many)) {
- m_data.push_back(add);
+ data_.push_back(add);
add = 0;
}
}
- dataset = &m_data;
+ dataset = &data_;
sub = (xline_length - space_left_of_label) / static_cast<float>(nr_samples);
}
@@ -449,12 +449,12 @@
std::vector<uint32_t> const * const data,
RGBColor const color)
{
- if (id >= m_plotdata.size())
- m_plotdata.resize(id + 1);
+ if (id >= plotdata_.size())
+ plotdata_.resize(id + 1);
- m_plotdata[id].dataset = data;
- m_plotdata[id].showplot = false;
- m_plotdata[id].plotcolor = color;
+ plotdata_[id].dataset = data;
+ plotdata_[id].showplot = false;
+ plotdata_[id].plotcolor = color;
get_game_time_id();
}
@@ -463,33 +463,33 @@
* Change the plot color of a registed data stream
*/
void WuiPlotArea::set_plotcolor(uint32_t id, RGBColor color) {
- if (id > m_plotdata.size()) return;
+ if (id > plotdata_.size()) return;
- m_plotdata[id].plotcolor = color;
+ plotdata_[id].plotcolor = color;
}
/*
* Show this plot data?
*/
void WuiPlotArea::show_plot(uint32_t const id, bool const t) {
- assert(id < m_plotdata.size());
- m_plotdata[id].showplot = t;
+ assert(id < plotdata_.size());
+ plotdata_[id].showplot = t;
}
/*
* Set sample rate the data uses
*/
void WuiPlotArea::set_sample_rate(uint32_t const id) {
- m_sample_rate = id;
+ sample_rate_ = id;
}
void WuiPlotAreaSlider::draw(RenderTarget & dst) {
- int32_t new_game_time_id = m_plot_area.get_game_time_id();
- if (new_game_time_id != m_last_game_time_id) {
- m_last_game_time_id = new_game_time_id;
- set_labels(m_plot_area.get_labels());
- slider.set_value(m_plot_area.get_time_id());
+ int32_t new_game_time_id = plot_area_.get_game_time_id();
+ if (new_game_time_id != last_game_time_id_) {
+ last_game_time_id_ = new_game_time_id;
+ set_labels(plot_area_.get_labels());
+ slider.set_value(plot_area_.get_time_id());
}
UI::DiscreteSlider::draw(dst);
}
@@ -517,28 +517,28 @@
2);
// How many do we take together when relative ploting
- const int32_t how_many = calc_how_many(time_ms, m_sample_rate);
+ const int32_t how_many = calc_how_many(time_ms, sample_rate_);
//find max and min value
int32_t max = 0;
int32_t min = 0;
- if (m_plotmode == PLOTMODE_ABSOLUTE) {
- for (uint32_t i = 0; i < m_plotdata.size(); ++i)
- if (m_plotdata[i].showplot) {
- for (uint32_t l = 0; l < m_plotdata[i].dataset->size(); ++l) {
- int32_t temp = (*m_plotdata[i].dataset)[l] -
- (*m_negative_plotdata[i].dataset)[l];
+ if (plotmode_ == PLOTMODE_ABSOLUTE) {
+ for (uint32_t i = 0; i < plotdata_.size(); ++i)
+ if (plotdata_[i].showplot) {
+ for (uint32_t l = 0; l < plotdata_[i].dataset->size(); ++l) {
+ int32_t temp = (*plotdata_[i].dataset)[l] -
+ (*negative_plotdata_[i].dataset)[l];
if (max < temp) max = temp;
if (min > temp) min = temp;
}
}
} else {
- for (uint32_t plot = 0; plot < m_plotdata.size(); ++plot)
- if (m_plotdata[plot].showplot) {
+ for (uint32_t plot = 0; plot < plotdata_.size(); ++plot)
+ if (plotdata_[plot].showplot) {
- const std::vector<uint32_t> & dataset = *m_plotdata[plot].dataset;
- const std::vector<uint32_t> & ndataset = *m_negative_plotdata[plot].dataset;
+ const std::vector<uint32_t> & dataset = *plotdata_[plot].dataset;
+ const std::vector<uint32_t> & ndataset = *negative_plotdata_[plot].dataset;
int32_t add = 0;
// Relative data, first entry is always zero.
@@ -577,28 +577,28 @@
/
(static_cast<float>(time_ms)
/
- static_cast<float>(m_sample_rate));
- for (uint32_t plot = 0; plot < m_plotdata.size(); ++plot)
- if (m_plotdata[plot].showplot) {
-
- RGBColor color = m_plotdata[plot].plotcolor;
- std::vector<uint32_t> const * dataset = m_plotdata[plot].dataset;
- std::vector<uint32_t> const * ndataset = m_negative_plotdata[plot].dataset;
-
- std::vector<uint32_t> m_data;
- if (m_plotmode == PLOTMODE_RELATIVE) {
+ static_cast<float>(sample_rate_));
+ for (uint32_t plot = 0; plot < plotdata_.size(); ++plot)
+ if (plotdata_[plot].showplot) {
+
+ RGBColor color = plotdata_[plot].plotcolor;
+ std::vector<uint32_t> const * dataset = plotdata_[plot].dataset;
+ std::vector<uint32_t> const * ndataset = negative_plotdata_[plot].dataset;
+
+ std::vector<uint32_t> data_;
+ if (plotmode_ == PLOTMODE_RELATIVE) {
int32_t add = 0;
// Relative data, first entry is always zero
- m_data.push_back(0);
+ data_.push_back(0);
for (uint32_t i = 0; i < dataset->size(); ++i) {
add += (*dataset)[i] - (*ndataset)[i];
if (0 == ((i + 1) % how_many)) {
- m_data.push_back(add);
+ data_.push_back(add);
add = 0;
}
}
- dataset = &m_data;
+ dataset = &data_;
sub = xline_length / static_cast<float>(nr_samples);
}
@@ -615,8 +615,8 @@
void DifferentialPlotArea::register_negative_plot_data
(uint32_t const id, std::vector<uint32_t> const * const data) {
- if (id >= m_negative_plotdata.size())
- m_negative_plotdata.resize(id + 1);
+ if (id >= negative_plotdata_.size())
+ negative_plotdata_.resize(id + 1);
- m_negative_plotdata[id].dataset = data;
+ negative_plotdata_[id].dataset = data;
}
=== modified file 'src/wui/plot_area.h'
--- src/wui/plot_area.h 2014-09-10 13:03:40 +0000
+++ src/wui/plot_area.h 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2007-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -58,21 +58,21 @@
void draw(RenderTarget &) override;
void set_time(TIME id) {
- m_time = id;
+ time_ = id;
}
void set_time_id(int32_t time) {
- if (time == m_game_time_id)
+ if (time == game_time_id_)
set_time(TIME_GAME);
else
set_time(static_cast<TIME>(time));
}
- TIME get_time() {return static_cast<TIME>(m_time); }
+ TIME get_time() {return static_cast<TIME>(time_); }
int32_t get_time_id() {
- if (m_time == TIME_GAME)
- return m_game_time_id;
+ if (time_ == TIME_GAME)
+ return game_time_id_;
else
- return m_time;
+ return time_;
}
void set_sample_rate(uint32_t id); // in milliseconds
@@ -82,7 +82,7 @@
(uint32_t id, const std::vector<uint32_t> * data, RGBColor);
void show_plot(uint32_t id, bool t);
- void set_plotmode(int32_t id) {m_plotmode = id;}
+ void set_plotmode(int32_t id) {plotmode_ = id;}
void set_plotcolor(uint32_t id, RGBColor color);
@@ -99,16 +99,16 @@
bool showplot;
RGBColor plotcolor;
};
- std::vector<PlotData> m_plotdata;
+ std::vector<PlotData> plotdata_;
- int32_t m_plotmode;
- int32_t m_sample_rate;
+ int32_t plotmode_;
+ int32_t sample_rate_;
private:
uint32_t get_game_time();
- TIME m_time; // How much do you want to list
- int32_t m_game_time_id; // what label is used for TIME_GAME
+ TIME time_; // How much do you want to list
+ int32_t game_time_id_; // what label is used for TIME_GAME
};
/**
@@ -133,8 +133,8 @@
tooltip_text,
cursor_size,
enabled),
- m_plot_area(plot_area),
- m_last_game_time_id(plot_area.get_game_time_id())
+ plot_area_(plot_area),
+ last_game_time_id_(plot_area.get_game_time_id())
{
changedto.connect(boost::bind(&WuiPlotArea::set_time_id, &plot_area, _1));
}
@@ -143,8 +143,8 @@
void draw(RenderTarget & dst) override;
private:
- WuiPlotArea & m_plot_area;
- int32_t m_last_game_time_id;
+ WuiPlotArea & plot_area_;
+ int32_t last_game_time_id_;
};
/**
@@ -170,7 +170,7 @@
struct ReducedPlotData {
const std::vector<uint32_t> * dataset;
};
- std::vector<ReducedPlotData> m_negative_plotdata;
+ std::vector<ReducedPlotData> negative_plotdata_;
};
=== modified file 'src/wui/productionsitewindow.cc'
--- src/wui/productionsitewindow.cc 2015-11-28 22:29:26 +0000
+++ src/wui/productionsitewindow.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -35,7 +35,7 @@
using Widelands::ProductionSite;
-static char const * pic_tab_wares = "pics/menu_tab_wares.png";
+static char const * pic_tab_wares = "pics/menu_tab_wares.png";
static char const * pic_tab_workers = "pics/menu_list_workers.png";
/*
@@ -70,40 +70,40 @@
// Add workers tab if applicable
if (!productionsite().descr().nr_working_positions()) {
- m_worker_table = nullptr;
+ worker_table_ = nullptr;
} else {
UI::Box * worker_box = new UI::Box
(get_tabs(),
0, 0, UI::Box::Vertical);
- m_worker_table = new UI::Table<uintptr_t>(worker_box, 0, 0, 0, 100);
- m_worker_caps = new UI::Box(worker_box, 0, 0, UI::Box::Horizontal);
+ worker_table_ = new UI::Table<uintptr_t>(worker_box, 0, 0, 0, 100);
+ worker_caps_ = new UI::Box(worker_box, 0, 0, UI::Box::Horizontal);
- m_worker_table->add_column(210, (ngettext
+ worker_table_->add_column(210, (ngettext
("Worker", "Workers", productionsite().descr().nr_working_positions())
));
- m_worker_table->add_column(60, _("Exp"));
- m_worker_table->add_column(150, _("Next Level"));
+ worker_table_->add_column(60, _("Exp"));
+ worker_table_->add_column(150, _("Next Level"));
for (unsigned int i = 0; i < productionsite().descr().nr_working_positions(); ++i) {
- m_worker_table->add(i);
+ worker_table_->add(i);
}
- m_worker_table->fit_height();
+ worker_table_->fit_height();
if (igbase().can_act(building().owner().player_number())) {
- m_worker_caps->add_inf_space();
+ worker_caps_->add_inf_space();
UI::Button * evict_button = new UI::Button
- (m_worker_caps, "evict", 0, 0, 34, 34,
+ (worker_caps_, "evict", 0, 0, 34, 34,
g_gr->images().get("pics/but4.png"),
g_gr->images().get("pics/menu_drop_soldier.png"),
_("Terminate the employment of the selected worker"));
evict_button->sigclicked.connect
(boost::bind(&ProductionSiteWindow::evict_worker, boost::ref(*this)));
- m_worker_caps->add(evict_button, UI::Box::AlignCenter);
+ worker_caps_->add(evict_button, UI::Box::AlignCenter);
}
- worker_box->add(m_worker_table, UI::Box::AlignLeft, true);
+ worker_box->add(worker_table_, UI::Box::AlignLeft, true);
worker_box->add_space(4);
- worker_box->add(m_worker_caps, UI::Box::AlignLeft, true);
+ worker_box->add(worker_caps_, UI::Box::AlignLeft, true);
get_tabs()->add
("workers", g_gr->images().get(pic_tab_workers),
worker_box,
@@ -147,12 +147,12 @@
void ProductionSiteWindow::update_worker_table()
{
- if (m_worker_table == nullptr) {
+ if (worker_table_ == nullptr) {
return;
}
assert
(productionsite().descr().nr_working_positions() ==
- m_worker_table->size());
+ worker_table_->size());
for
(unsigned int i = 0;
@@ -163,7 +163,7 @@
const Widelands::Request * request =
productionsite().working_positions()[i].worker_request;
UI::Table<uintptr_t>::EntryRecord & er =
- m_worker_table->get_record(i);
+ worker_table_->get_record(i);
if (worker) {
er.set_picture(0, worker->descr().icon(), worker->descr().descname());
@@ -202,13 +202,13 @@
continue;
}
}
- m_worker_table->update();
+ worker_table_->update();
}
void ProductionSiteWindow::evict_worker() {
- if (m_worker_table->has_selection()) {
+ if (worker_table_->has_selection()) {
Widelands::Worker * worker =
- productionsite().working_positions()[m_worker_table->get_selected()].worker;
+ productionsite().working_positions()[worker_table_->get_selected()].worker;
if (worker) {
igbase().game().send_player_evict_worker(*worker);
}
=== modified file 'src/wui/productionsitewindow.h'
--- src/wui/productionsitewindow.h 2015-11-28 22:29:26 +0000
+++ src/wui/productionsitewindow.h 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -39,8 +39,8 @@
void evict_worker();
private:
- UI::Table<uintptr_t> * m_worker_table;
- UI::Box * m_worker_caps;
+ UI::Table<uintptr_t> * worker_table_;
+ UI::Box * worker_caps_;
};
#endif // end of include guard: WL_WUI_PRODUCTIONSITEWINDOW_H
=== modified file 'src/wui/quicknavigation.cc'
--- src/wui/quicknavigation.cc 2014-11-22 11:26:51 +0000
+++ src/wui/quicknavigation.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 by the Widelands Development Team
+ * Copyright (C) 2010-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -28,67 +28,67 @@
QuickNavigation::QuickNavigation
(const Widelands::EditorGameBase & egbase,
uint32_t screenwidth, uint32_t screenheight)
-: m_egbase(egbase)
+: egbase_(egbase)
{
- m_screenwidth = screenwidth;
- m_screenheight = screenheight;
+ screenwidth_ = screenwidth;
+ screenheight_ = screenheight;
- m_havefirst = false;
- m_update = true;
- m_history_index = 0;
+ havefirst_ = false;
+ update_ = true;
+ history_index_ = 0;
}
void QuickNavigation::set_setview(const QuickNavigation::SetViewFn & fn)
{
- m_setview = fn;
+ setview_ = fn;
}
void QuickNavigation::setview(Point where)
{
- m_update = false;
- m_setview(where);
- m_update = true;
+ update_ = false;
+ setview_(where);
+ update_ = true;
}
void QuickNavigation::view_changed(Point newpos, bool jump)
{
- if (m_havefirst && m_update) {
+ if (havefirst_ && update_) {
if (!jump) {
Point delta =
MapviewPixelFunctions::calc_pix_difference
- (m_egbase.map(), newpos, m_anchor);
+ (egbase_.map(), newpos, anchor_);
if
- (static_cast<uint32_t>(abs(delta.x)) > m_screenwidth ||
- static_cast<uint32_t>(abs(delta.y)) > m_screenheight)
+ (static_cast<uint32_t>(abs(delta.x)) > screenwidth_ ||
+ static_cast<uint32_t>(abs(delta.y)) > screenheight_)
jump = true;
}
if (jump) {
- if (m_history_index < m_history.size())
- m_history.erase
- (m_history.begin() + m_history_index,
- m_history.end());
- m_history.push_back(m_current);
- if (m_history.size() > MaxHistorySize)
- m_history.erase
- (m_history.begin(),
- m_history.end() - MaxHistorySize);
- m_history_index = m_history.size();
+ if (history_index_ < history_.size())
+ history_.erase
+ (history_.begin() + history_index_,
+ history_.end());
+ history_.push_back(current_);
+ if (history_.size() > MaxHistorySize)
+ history_.erase
+ (history_.begin(),
+ history_.end() - MaxHistorySize);
+ history_index_ = history_.size();
}
}
- if (jump || !m_havefirst) {
- m_anchor = newpos;
+ if (jump || !havefirst_) {
+ anchor_ = newpos;
}
- m_current = newpos;
- m_havefirst = true;
+ current_ = newpos;
+ havefirst_ = true;
}
bool QuickNavigation::handle_key(bool down, SDL_Keysym key)
{
- if (!m_havefirst)
+ if (!havefirst_)
return false;
if (!down)
return false;
@@ -101,30 +101,30 @@
WLApplication::get()->get_key_state(SDL_SCANCODE_LCTRL) ||
WLApplication::get()->get_key_state(SDL_SCANCODE_RCTRL);
if (ctrl) {
- m_landmarks[which].point = m_current;
- m_landmarks[which].set = true;
+ landmarks_[which].point = current_;
+ landmarks_[which].set = true;
} else {
- if (m_landmarks[which].set)
- m_setview(m_landmarks[which].point);
+ if (landmarks_[which].set)
+ setview_(landmarks_[which].point);
}
return true;
}
if (key.sym == SDLK_COMMA) {
- if (m_history_index > 0) {
- if (m_history_index >= m_history.size()) {
- m_history.push_back(m_current);
+ if (history_index_ > 0) {
+ if (history_index_ >= history_.size()) {
+ history_.push_back(current_);
}
- m_history_index--;
- setview(m_history[m_history_index]);
+ history_index_--;
+ setview(history_[history_index_]);
}
return true;
}
if (key.sym == SDLK_PERIOD) {
- if (m_history_index + 1 < m_history.size()) {
- m_history_index++;
- setview(m_history[m_history_index]);
+ if (history_index_ + 1 < history_.size()) {
+ history_index_++;
+ setview(history_[history_index_]);
}
return true;
}
=== modified file 'src/wui/quicknavigation.h'
--- src/wui/quicknavigation.h 2014-10-14 06:30:20 +0000
+++ src/wui/quicknavigation.h 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 by the Widelands Development Team
+ * Copyright (C) 2010-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -52,27 +52,27 @@
private:
void setview(Point where);
- const Widelands::EditorGameBase & m_egbase;
- uint32_t m_screenwidth;
- uint32_t m_screenheight;
+ const Widelands::EditorGameBase & egbase_;
+ uint32_t screenwidth_;
+ uint32_t screenheight_;
/**
* This is the callback function that we call to request a change in view position.
*/
- SetViewFn m_setview;
+ SetViewFn setview_;
- bool m_havefirst;
- bool m_update;
- Point m_anchor;
- Point m_current;
+ bool havefirst_;
+ bool update_;
+ Point anchor_;
+ Point current_;
/**
* Keeps track of what the player has looked at to allow jumping back and forth
* in the history.
*/
/*@{*/
- std::vector<Point> m_history;
- std::vector<Point>::size_type m_history_index;
+ std::vector<Point> history_;
+ std::vector<Point>::size_type history_index_;
/*@}*/
struct Landmark {
@@ -85,7 +85,7 @@
/**
* Landmarks that were set explicitly by the player, mapped on the 0-9 keys.
*/
- Landmark m_landmarks[10];
+ Landmark landmarks_[10];
};
#endif // end of include guard: WL_WUI_QUICKNAVIGATION_H
=== modified file 'src/wui/soldierlist.cc'
--- src/wui/soldierlist.cc 2016-01-17 08:29:59 +0000
+++ src/wui/soldierlist.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2011, 2015 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
=== modified file 'src/wui/stock_menu.cc'
--- src/wui/stock_menu.cc 2015-11-28 22:29:26 +0000
+++ src/wui/stock_menu.cc 2016-01-24 20:17:30 +0000
@@ -38,35 +38,35 @@
(InteractivePlayer & plr, UI::UniqueWindow::Registry & registry)
:
UI::UniqueWindow(&plr, "stock_menu", ®istry, 480, 640, _("Stock")),
-m_player(plr)
+player_(plr)
{
UI::TabPanel * tabs =
new UI::TabPanel
(this, 0, 0, g_gr->images().get("pics/but1.png"));
set_center_panel(tabs);
- m_all_wares = new WaresDisplay(tabs, 0, 0, plr.player().tribe(), Widelands::wwWARE, false);
+ all_wares_ = new WaresDisplay(tabs, 0, 0, plr.player().tribe(), Widelands::wwWARE, false);
tabs->add
("total_wares", g_gr->images().get(pic_tab_wares),
- m_all_wares, _("Wares (total)"));
+ all_wares_, _("Wares (total)"));
- m_all_workers = new WaresDisplay(tabs, 0, 0, plr.player().tribe(), Widelands::wwWORKER, false);
+ all_workers_ = new WaresDisplay(tabs, 0, 0, plr.player().tribe(), Widelands::wwWORKER, false);
tabs->add
("workers_total", g_gr->images().get(pic_tab_workers),
- m_all_workers, _("Workers (total)"));
+ all_workers_, _("Workers (total)"));
- m_warehouse_wares = new WaresDisplay(tabs, 0, 0, plr.player().tribe(), Widelands::wwWARE, false);
+ warehouse_wares_ = new WaresDisplay(tabs, 0, 0, plr.player().tribe(), Widelands::wwWARE, false);
tabs->add
("wares_in_warehouses",
g_gr->images().get (pic_tab_wares_warehouse),
- m_warehouse_wares, _("Wares in warehouses")
+ warehouse_wares_, _("Wares in warehouses")
);
- m_warehouse_workers = new WaresDisplay(tabs, 0, 0, plr.player().tribe(), Widelands::wwWORKER, false);
+ warehouse_workers_ = new WaresDisplay(tabs, 0, 0, plr.player().tribe(), Widelands::wwWORKER, false);
tabs->add
("workers_in_warehouses",
g_gr->images().get(pic_tab_workers_warehouse),
- m_warehouse_workers, _("Workers in warehouses")
+ warehouse_workers_, _("Workers in warehouses")
);
}
@@ -79,10 +79,10 @@
{
UI::UniqueWindow::think();
- fill_total_waresdisplay(m_all_wares, Widelands::wwWARE);
- fill_total_waresdisplay(m_all_workers, Widelands::wwWORKER);
- fill_warehouse_waresdisplay(m_warehouse_wares, Widelands::wwWARE);
- fill_warehouse_waresdisplay(m_warehouse_workers, Widelands::wwWORKER);
+ fill_total_waresdisplay(all_wares_, Widelands::wwWARE);
+ fill_total_waresdisplay(all_workers_, Widelands::wwWORKER);
+ fill_warehouse_waresdisplay(warehouse_wares_, Widelands::wwWARE);
+ fill_warehouse_waresdisplay(warehouse_workers_, Widelands::wwWORKER);
}
/**
@@ -93,7 +93,7 @@
(WaresDisplay * waresdisplay, Widelands::WareWorker type)
{
waresdisplay->remove_all_warelists();
- const Widelands::Player & player = *m_player.get_player();
+ const Widelands::Player & player = *player_.get_player();
const uint32_t nrecos = player.get_nr_economies();
for (uint32_t i = 0; i < nrecos; ++i)
waresdisplay->add_warelist
@@ -110,7 +110,7 @@
(WaresDisplay * waresdisplay, Widelands::WareWorker type)
{
waresdisplay->remove_all_warelists();
- const Widelands::Player & player = *m_player.get_player();
+ const Widelands::Player & player = *player_.get_player();
const uint32_t nrecos = player.get_nr_economies();
for (uint32_t i = 0; i < nrecos; ++i) {
const std::vector<Widelands::Warehouse *> & warehouses =
=== modified file 'src/wui/stock_menu.h'
--- src/wui/stock_menu.h 2014-09-10 13:03:40 +0000
+++ src/wui/stock_menu.h 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -35,11 +35,11 @@
void think() override;
private:
- InteractivePlayer & m_player;
- WaresDisplay * m_all_wares;
- WaresDisplay * m_all_workers;
- WaresDisplay * m_warehouse_wares;
- WaresDisplay * m_warehouse_workers;
+ InteractivePlayer & player_;
+ WaresDisplay * all_wares_;
+ WaresDisplay * all_workers_;
+ WaresDisplay * warehouse_wares_;
+ WaresDisplay * warehouse_workers_;
void fill_total_waresdisplay(WaresDisplay * waresdisplay, Widelands::WareWorker type);
void fill_warehouse_waresdisplay(WaresDisplay * waresdisplay, Widelands::WareWorker type);
=== modified file 'src/wui/story_message_box.h'
--- src/wui/story_message_box.h 2015-08-05 14:50:23 +0000
+++ src/wui/story_message_box.h 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008, 2010 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
=== modified file 'src/wui/suggested_teams_box.cc'
--- src/wui/suggested_teams_box.cc 2015-03-06 16:51:37 +0000
+++ src/wui/suggested_teams_box.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 by the Widelands Development Team
+ * Copyright (C) 2015-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -35,17 +35,17 @@
int32_t max_x, int32_t max_y,
uint32_t inner_spacing) :
UI::Box(parent, x, y, orientation, max_x, max_y, inner_spacing),
- m_padding(padding),
- m_indent(indent),
- m_label_height(label_height)
+ padding_(padding),
+ indent_(indent),
+ label_height_(label_height)
{
- m_player_icons.clear();
- m_suggested_teams.clear();
+ player_icons_.clear();
+ suggested_teams_.clear();
set_size(max_x, max_y);
- m_suggested_teams_box_label =
+ suggested_teams_box_label_ =
new UI::Textarea(this, "", UI::Align_CenterLeft);
- add(m_suggested_teams_box_label, UI::Box::AlignLeft);
+ add(suggested_teams_box_label_, UI::Box::AlignLeft);
}
SuggestedTeamsBox::~SuggestedTeamsBox() {
SuggestedTeamsBox::hide();
@@ -53,63 +53,63 @@
void SuggestedTeamsBox::hide() {
// Delete former images
- for (UI::Icon* player_icon : m_player_icons) {
+ for (UI::Icon* player_icon : player_icons_) {
player_icon->set_icon(nullptr);
player_icon->set_visible(false);
player_icon->set_no_frame();
}
- m_player_icons.clear();
+ player_icons_.clear();
// Delete vs. labels
- for (UI::Textarea* vs_label : m_vs_labels) {
+ for (UI::Textarea* vs_label : vs_labels_) {
vs_label->set_visible(false);
}
- m_vs_labels.clear();
+ vs_labels_.clear();
set_visible(false);
- m_suggested_teams_box_label->set_visible(false);
- m_suggested_teams_box_label->set_text("");
+ suggested_teams_box_label_->set_visible(false);
+ suggested_teams_box_label_->set_text("");
}
void SuggestedTeamsBox::show(const std::vector<Widelands::Map::SuggestedTeamLineup>& suggested_teams)
{
hide();
- m_suggested_teams = suggested_teams;
+ suggested_teams_ = suggested_teams;
- if (!m_suggested_teams.empty()) {
+ if (!suggested_teams_.empty()) {
// Initialize
uint8_t lineup_counter = 0;
set_visible(true);
- m_suggested_teams_box_label->set_visible(true);
+ suggested_teams_box_label_->set_visible(true);
/** TRANSLATORS: Label for the list of suggested teams when choosing a map */
- m_suggested_teams_box_label->set_text(_("Suggested Teams:"));
- int32_t teamlist_offset = m_suggested_teams_box_label->get_y() +
- m_suggested_teams_box_label->get_h() +
- m_padding;
+ suggested_teams_box_label_->set_text(_("Suggested Teams:"));
+ int32_t teamlist_offset = suggested_teams_box_label_->get_y() +
+ suggested_teams_box_label_->get_h() +
+ padding_;
// Parse suggested teams
UI::Icon* player_icon;
UI::Textarea * vs_label;
- for (const Widelands::Map::SuggestedTeamLineup& lineup : m_suggested_teams) {
-
- m_lineup_box =
- new UI::Box(this, m_indent, teamlist_offset + lineup_counter * (m_label_height + m_padding),
- UI::Box::Horizontal, get_w() - m_indent);
-
- m_lineup_box->set_size(get_w(), m_label_height + m_padding);
+ for (const Widelands::Map::SuggestedTeamLineup& lineup : suggested_teams_) {
+
+ lineup_box_ =
+ new UI::Box(this, indent_, teamlist_offset + lineup_counter * (label_height_ + padding_),
+ UI::Box::Horizontal, get_w() - indent_);
+
+ lineup_box_->set_size(get_w(), label_height_ + padding_);
bool is_first = true;
for (const Widelands::Map::SuggestedTeam& team : lineup) {
if (!is_first) {
- m_lineup_box->add_space(m_padding);
- vs_label = new UI::Textarea(m_lineup_box, "x", UI::Align_BottomCenter);
- m_lineup_box->add(vs_label, UI::Box::AlignLeft);
+ lineup_box_->add_space(padding_);
+ vs_label = new UI::Textarea(lineup_box_, "x", UI::Align_BottomCenter);
+ lineup_box_->add(vs_label, UI::Box::AlignLeft);
vs_label->set_visible(true);
- m_vs_labels.push_back(vs_label);
- m_lineup_box->add_space(m_padding);
+ vs_labels_.push_back(vs_label);
+ lineup_box_->add_space(padding_);
}
is_first = false;
@@ -117,19 +117,19 @@
assert(player < MAX_PLAYERS);
const std::string player_filename = (boost::format("pics/fsel_editor_set_player_0%i_pos.png")
% (++player)).str().c_str();
- player_icon = new UI::Icon(m_lineup_box, 0, 0, 20, 20,
+ player_icon = new UI::Icon(lineup_box_, 0, 0, 20, 20,
g_gr->images().get(player_filename));
player_icon->set_visible(true);
player_icon->set_no_frame();
- m_lineup_box->add(player_icon, UI::Box::AlignLeft);
- m_player_icons.push_back(player_icon);
+ lineup_box_->add(player_icon, UI::Box::AlignLeft);
+ player_icons_.push_back(player_icon);
} // Players in team
} // Teams in lineup
++lineup_counter;
} // All lineups
// Adjust size to content
- set_size(get_w(), teamlist_offset + lineup_counter * (m_label_height + m_padding));
+ set_size(get_w(), teamlist_offset + lineup_counter * (label_height_ + padding_));
}
}
=== modified file 'src/wui/suggested_teams_box.h'
--- src/wui/suggested_teams_box.h 2015-03-06 16:51:37 +0000
+++ src/wui/suggested_teams_box.h 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 by the Widelands Development Team
+ * Copyright (C) 2015-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -45,14 +45,14 @@
void show(const std::vector<Widelands::Map::SuggestedTeamLineup>& suggested_teams);
private:
- int32_t const m_padding;
- int32_t const m_indent;
- int32_t const m_label_height;
- UI::Textarea * m_suggested_teams_box_label;
- UI::Box* m_lineup_box;
- std::vector<UI::Icon*> m_player_icons;
- std::vector<UI::Textarea*> m_vs_labels;
- std::vector<Widelands::Map::SuggestedTeamLineup> m_suggested_teams;
+ int32_t const padding_;
+ int32_t const indent_;
+ int32_t const label_height_;
+ UI::Textarea * suggested_teams_box_label_;
+ UI::Box* lineup_box_;
+ std::vector<UI::Icon*> player_icons_;
+ std::vector<UI::Textarea*> vs_labels_;
+ std::vector<Widelands::Map::SuggestedTeamLineup> suggested_teams_;
};
}
=== modified file 'src/wui/transport_draw.cc'
--- src/wui/transport_draw.cc 2016-01-17 19:54:32 +0000
+++ src/wui/transport_draw.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2007, 2009 by the Widelands Development Team
+ * Copyright (C) 2002-20016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
=== modified file 'src/wui/transport_ui.cc'
--- src/wui/transport_ui.cc 2015-11-28 22:29:26 +0000
+++ src/wui/transport_ui.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2012 by the Widelands Development Team
+ * Copyright (C) 2008-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -49,24 +49,24 @@
UI::UniqueWindow
(&parent, "economy_options", &economy.optionswindow_registry(), 0, 0,
_("Economy options")),
- m_tabpanel(this, 0, 0, g_gr->images().get("pics/but1.png"))
+ tabpanel_(this, 0, 0, g_gr->images().get("pics/but1.png"))
{
- set_center_panel(&m_tabpanel);
+ set_center_panel(&tabpanel_);
- m_tabpanel.add
+ tabpanel_.add
("wares",
g_gr->images().get(pic_tab_wares),
- new EconomyOptionsWarePanel(&m_tabpanel, parent, economy),
+ new EconomyOptionsWarePanel(&tabpanel_, parent, economy),
_("Wares"));
- m_tabpanel.add
+ tabpanel_.add
("workers",
g_gr->images().get(pic_tab_workers),
- new EconomyOptionsWorkerPanel(&m_tabpanel, parent, economy),
+ new EconomyOptionsWorkerPanel(&tabpanel_, parent, economy),
_("Workers"));
}
private:
- UI::TabPanel m_tabpanel;
+ UI::TabPanel tabpanel_;
struct TargetWaresDisplay : public AbstractWaresDisplay {
TargetWaresDisplay
@@ -78,9 +78,9 @@
Economy & economy)
:
AbstractWaresDisplay(parent, x, y, tribe, type, selectable),
- m_economy(economy)
+ economy_(economy)
{
- const Widelands::TribeDescr& owner_tribe = m_economy.owner().tribe();
+ const Widelands::TribeDescr& owner_tribe = economy_.owner().tribe();
if (type == Widelands::wwWORKER) {
for (const DescriptionIndex& worker_index : owner_tribe.workers()) {
const WorkerDescr* worker_descr = owner_tribe.get_worker_descr(worker_index);
@@ -102,11 +102,11 @@
return
boost::lexical_cast<std::string>
(get_type() == Widelands::wwWORKER ?
- m_economy.worker_target_quantity(ware).permanent :
- m_economy.ware_target_quantity(ware).permanent);
+ economy_.worker_target_quantity(ware).permanent :
+ economy_.ware_target_quantity(ware).permanent);
}
private:
- Economy & m_economy;
+ Economy & economy_;
};
@@ -114,17 +114,17 @@
* Wraps the wares display together with some buttons
*/
struct EconomyOptionsWarePanel : UI::Box {
- bool m_can_act;
- TargetWaresDisplay m_display;
- Economy & m_economy;
+ bool can_act_;
+ TargetWaresDisplay display_;
+ Economy & economy_;
EconomyOptionsWarePanel(UI::Panel * parent, InteractiveGameBase & igbase, Economy & economy) :
UI::Box(parent, 0, 0, UI::Box::Vertical),
- m_can_act(igbase.can_act(economy.owner().player_number())),
- m_display(this, 0, 0, economy.owner().tribe(), Widelands::wwWARE, m_can_act, economy),
- m_economy(economy)
+ can_act_(igbase.can_act(economy.owner().player_number())),
+ display_(this, 0, 0, economy.owner().tribe(), Widelands::wwWARE, can_act_, economy),
+ economy_(economy)
{
- add(&m_display, UI::Box::AlignLeft, true);
+ add(&display_, UI::Box::AlignLeft, true);
UI::Box * buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal);
add(buttons, UI::Box::AlignLeft);
@@ -136,7 +136,7 @@
(buttons, #callback, \
0, 0, 34, 34, \
g_gr->images().get("pics/but4.png"), \
- text, tooltip, m_can_act); \
+ text, tooltip, can_act_); \
b->sigclicked.connect(boost::bind(&EconomyOptionsWarePanel::callback, this)); \
buttons->add(b, UI::Box::AlignCenter);
ADD_WARE_BUTTON(decrease_target, "-", _("Decrease target"))
@@ -149,17 +149,17 @@
void decrease_target() {
- for (const DescriptionIndex& ware_index : m_economy.owner().tribe().wares()) {
- if (m_display.ware_selected(ware_index)) {
+ for (const DescriptionIndex& ware_index : economy_.owner().tribe().wares()) {
+ if (display_.ware_selected(ware_index)) {
const Economy::TargetQuantity & tq =
- m_economy.ware_target_quantity(ware_index);
+ economy_.ware_target_quantity(ware_index);
if (0 < tq.permanent) {
- Widelands::Player & player = m_economy.owner();
+ Widelands::Player & player = economy_.owner();
Game & game = dynamic_cast<Game&>(player.egbase());
game.send_player_command
(*new Widelands::CmdSetWareTargetQuantity
(game.get_gametime(), player.player_number(),
- player.get_economy_number(&m_economy), ware_index,
+ player.get_economy_number(&economy_), ware_index,
tq.permanent - 1));
}
}
@@ -167,16 +167,16 @@
}
void increase_target() {
- for (const DescriptionIndex& ware_index : m_economy.owner().tribe().wares()) {
- if (m_display.ware_selected(ware_index)) {
+ for (const DescriptionIndex& ware_index : economy_.owner().tribe().wares()) {
+ if (display_.ware_selected(ware_index)) {
const Economy::TargetQuantity & tq =
- m_economy.ware_target_quantity(ware_index);
- Widelands::Player & player = m_economy.owner();
+ economy_.ware_target_quantity(ware_index);
+ Widelands::Player & player = economy_.owner();
Game & game = dynamic_cast<Game&>(player.egbase());
game.send_player_command
(*new Widelands::CmdSetWareTargetQuantity
(game.get_gametime(), player.player_number(),
- player.get_economy_number(&m_economy), ware_index,
+ player.get_economy_number(&economy_), ware_index,
tq.permanent + 1));
}
}
@@ -184,30 +184,30 @@
void reset_target() {
- for (const DescriptionIndex& ware_index : m_economy.owner().tribe().wares()) {
- if (m_display.ware_selected(ware_index)) {
- Widelands::Player & player = m_economy.owner();
+ for (const DescriptionIndex& ware_index : economy_.owner().tribe().wares()) {
+ if (display_.ware_selected(ware_index)) {
+ Widelands::Player & player = economy_.owner();
Game & game = dynamic_cast<Game&>(player.egbase());
game.send_player_command
(*new Widelands::CmdResetWareTargetQuantity
(game.get_gametime(), player.player_number(),
- player.get_economy_number(&m_economy), ware_index));
+ player.get_economy_number(&economy_), ware_index));
}
}
}
};
struct EconomyOptionsWorkerPanel : UI::Box {
- bool m_can_act;
- TargetWaresDisplay m_display;
- Economy & m_economy;
+ bool can_act_;
+ TargetWaresDisplay display_;
+ Economy & economy_;
EconomyOptionsWorkerPanel(UI::Panel * parent, InteractiveGameBase & igbase, Economy & economy) :
UI::Box(parent, 0, 0, UI::Box::Vertical),
- m_can_act(igbase.can_act(economy.owner().player_number())),
- m_display(this, 0, 0, economy.owner().tribe(), Widelands::wwWORKER, m_can_act, economy),
- m_economy(economy)
+ can_act_(igbase.can_act(economy.owner().player_number())),
+ display_(this, 0, 0, economy.owner().tribe(), Widelands::wwWORKER, can_act_, economy),
+ economy_(economy)
{
- add(&m_display, UI::Box::AlignLeft, true);
+ add(&display_, UI::Box::AlignLeft, true);
UI::Box * buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal);
add(buttons, UI::Box::AlignLeft);
@@ -218,7 +218,7 @@
(buttons, #callback, \
0, 0, 34, 34, \
g_gr->images().get("pics/but4.png"), \
- text, tooltip, m_can_act); \
+ text, tooltip, can_act_); \
b->sigclicked.connect(boost::bind(&EconomyOptionsWorkerPanel::callback, this)); \
buttons->add(b, UI::Box::AlignCenter);
@@ -232,17 +232,17 @@
void decrease_target() {
- for (const DescriptionIndex& worker_index : m_economy.owner().tribe().workers()) {
- if (m_display.ware_selected(worker_index)) {
+ for (const DescriptionIndex& worker_index : economy_.owner().tribe().workers()) {
+ if (display_.ware_selected(worker_index)) {
const Economy::TargetQuantity & tq =
- m_economy.worker_target_quantity(worker_index);
+ economy_.worker_target_quantity(worker_index);
if (0 < tq.permanent) {
- Widelands::Player & player = m_economy.owner();
+ Widelands::Player & player = economy_.owner();
Game & game = dynamic_cast<Game&>(player.egbase());
game.send_player_command
(*new Widelands::CmdSetWorkerTargetQuantity
(game.get_gametime(), player.player_number(),
- player.get_economy_number(&m_economy), worker_index,
+ player.get_economy_number(&economy_), worker_index,
tq.permanent - 1));
}
}
@@ -250,30 +250,30 @@
}
void increase_target() {
- for (const DescriptionIndex& worker_index : m_economy.owner().tribe().workers()) {
- if (m_display.ware_selected(worker_index)) {
+ for (const DescriptionIndex& worker_index : economy_.owner().tribe().workers()) {
+ if (display_.ware_selected(worker_index)) {
const Economy::TargetQuantity & tq =
- m_economy.worker_target_quantity(worker_index);
- Widelands::Player & player = m_economy.owner();
+ economy_.worker_target_quantity(worker_index);
+ Widelands::Player & player = economy_.owner();
Game & game = dynamic_cast<Game&>(player.egbase());
game.send_player_command
(*new Widelands::CmdSetWorkerTargetQuantity
(game.get_gametime(), player.player_number(),
- player.get_economy_number(&m_economy), worker_index,
+ player.get_economy_number(&economy_), worker_index,
tq.permanent + 1));
}
}
}
void reset_target() {
- for (const DescriptionIndex& worker_index : m_economy.owner().tribe().workers()) {
- if (m_display.ware_selected(worker_index)) {
- Widelands::Player & player = m_economy.owner();
+ for (const DescriptionIndex& worker_index : economy_.owner().tribe().workers()) {
+ if (display_.ware_selected(worker_index)) {
+ Widelands::Player & player = economy_.owner();
Game & game = dynamic_cast<Game&>(player.egbase());
game.send_player_command
(*new Widelands::CmdResetWorkerTargetQuantity
(game.get_gametime(), player.player_number(),
- player.get_economy_number(&m_economy), worker_index));
+ player.get_economy_number(&economy_), worker_index));
}
}
}
=== modified file 'src/wui/ware_statistics_menu.cc'
--- src/wui/ware_statistics_menu.cc 2015-11-28 22:29:26 +0000
+++ src/wui/ware_statistics_menu.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -103,7 +103,7 @@
struct StatisticWaresDisplay : public AbstractWaresDisplay {
private:
- std::vector<uint8_t> & m_color_map;
+ std::vector<uint8_t> & color_map_;
public:
StatisticWaresDisplay
(UI::Panel * const parent,
@@ -113,7 +113,7 @@
std::vector<uint8_t> & color_map)
:
AbstractWaresDisplay(parent, x, y, tribe, Widelands::wwWARE, true, callback_function),
- m_color_map(color_map)
+ color_map_(color_map)
{
uint32_t w, h;
get_desired_size(w, h);
@@ -128,7 +128,7 @@
{
size_t index = static_cast<size_t>(ware);
- return colors[m_color_map[index]];
+ return colors[color_map_[index]];
}
};
@@ -137,15 +137,15 @@
:
UI::UniqueWindow
(&parent, "ware_statistics", ®istry, 400, 270, _("Ware Statistics")),
-m_parent(&parent)
+parent_(&parent)
{
uint8_t const nr_wares = parent.get_player()->egbase().tribes().nrwares();
//init color sets
- m_color_map.resize(nr_wares);
- std::fill(m_color_map.begin(), m_color_map.end(), INACTIVE);
- m_active_colors.resize(colors_length);
- std::fill(m_active_colors.begin(), m_active_colors.end(), 0);
+ color_map_.resize(nr_wares);
+ std::fill(color_map_.begin(), color_map_.end(), INACTIVE);
+ active_colors_.resize(colors_length);
+ std::fill(active_colors_.begin(), active_colors_.end(), 0);
// First, we must decide about the size.
UI::Box * box = new UI::Box(this, 0, 0, UI::Box::Vertical, 0, 0, 5);
@@ -164,48 +164,48 @@
(box, spacing, 0, g_gr->images().get("pics/but1.png"));
- m_plot_production =
+ plot_production_ =
new WuiPlotArea
(tabs,
0, 0, plot_width, plot_height);
- m_plot_production->set_sample_rate(STATISTICS_SAMPLE_TIME);
- m_plot_production->set_plotmode(WuiPlotArea::PLOTMODE_RELATIVE);
+ plot_production_->set_sample_rate(STATISTICS_SAMPLE_TIME);
+ plot_production_->set_plotmode(WuiPlotArea::PLOTMODE_RELATIVE);
tabs->add
("production", g_gr->images().get(pic_tab_production),
- m_plot_production, _("Production"));
+ plot_production_, _("Production"));
- m_plot_consumption =
+ plot_consumption_ =
new WuiPlotArea
(tabs,
0, 0, plot_width, plot_height);
- m_plot_consumption->set_sample_rate(STATISTICS_SAMPLE_TIME);
- m_plot_consumption->set_plotmode(WuiPlotArea::PLOTMODE_RELATIVE);
+ plot_consumption_->set_sample_rate(STATISTICS_SAMPLE_TIME);
+ plot_consumption_->set_plotmode(WuiPlotArea::PLOTMODE_RELATIVE);
tabs->add
("consumption", g_gr->images().get(pic_tab_consumption),
- m_plot_consumption, _("Consumption"));
+ plot_consumption_, _("Consumption"));
- m_plot_economy =
+ plot_economy_ =
new DifferentialPlotArea
(tabs,
0, 0, plot_width, plot_height);
- m_plot_economy->set_sample_rate(STATISTICS_SAMPLE_TIME);
- m_plot_economy->set_plotmode(WuiPlotArea::PLOTMODE_RELATIVE);
+ plot_economy_->set_sample_rate(STATISTICS_SAMPLE_TIME);
+ plot_economy_->set_plotmode(WuiPlotArea::PLOTMODE_RELATIVE);
tabs->add
("economy_health", g_gr->images().get(pic_tab_economy),
- m_plot_economy, _("Economy Health"));
+ plot_economy_, _("Economy Health"));
- m_plot_stock = new WuiPlotArea
+ plot_stock_ = new WuiPlotArea
(tabs,
0, 0, plot_width, plot_height);
- m_plot_stock->set_sample_rate(STATISTICS_SAMPLE_TIME);
- m_plot_stock->set_plotmode(WuiPlotArea::PLOTMODE_ABSOLUTE);
+ plot_stock_->set_sample_rate(STATISTICS_SAMPLE_TIME);
+ plot_stock_->set_plotmode(WuiPlotArea::PLOTMODE_ABSOLUTE);
tabs->add
("stock", g_gr->images().get(pic_tab_stock),
- m_plot_stock, _("Stock"));
+ plot_stock_, _("Stock"));
tabs->activate(0);
@@ -214,30 +214,30 @@
//register statistics data
for (Widelands::DescriptionIndex cur_ware = 0; cur_ware < nr_wares; ++cur_ware) {
- m_plot_production->register_plot_data
+ plot_production_->register_plot_data
(cur_ware,
parent.get_player()->get_ware_production_statistics
(Widelands::DescriptionIndex(cur_ware)),
colors[cur_ware]);
- m_plot_consumption->register_plot_data
+ plot_consumption_->register_plot_data
(cur_ware,
parent.get_player()->get_ware_consumption_statistics
(Widelands::DescriptionIndex(cur_ware)),
colors[cur_ware]);
- m_plot_economy->register_plot_data
+ plot_economy_->register_plot_data
(cur_ware,
parent.get_player()->get_ware_production_statistics
(Widelands::DescriptionIndex(cur_ware)),
colors[cur_ware]);
- m_plot_economy->register_negative_plot_data
+ plot_economy_->register_negative_plot_data
(cur_ware,
parent.get_player()->get_ware_consumption_statistics
(Widelands::DescriptionIndex(cur_ware)));
- m_plot_stock->register_plot_data
+ plot_stock_->register_plot_data
(cur_ware,
parent.get_player()->get_ware_stock_statistics
(Widelands::DescriptionIndex(cur_ware)),
@@ -248,12 +248,12 @@
(new StatisticWaresDisplay
(box, 0, 0, parent.get_player()->tribe(),
boost::bind(&WareStatisticsMenu::cb_changed_to, boost::ref(*this), _1, _2),
- m_color_map),
+ color_map_),
UI::Box::AlignLeft, true);
box->add
(new WuiPlotGenericAreaSlider
- (this, *m_plot_production, this,
+ (this, *plot_production_, this,
0, 0, 100, 45,
g_gr->images().get("pics/but1.png")),
UI::Box::AlignLeft, true);
@@ -269,34 +269,34 @@
//search lowest free color
uint8_t color_index = INACTIVE;
- for (uint32_t i = 0; i < m_active_colors.size(); ++i) {
- if (!m_active_colors[i]) {
+ for (uint32_t i = 0; i < active_colors_.size(); ++i) {
+ if (!active_colors_[i]) {
//prevent index out of bounds
color_index = std::min(i + 1, colors_length - 1);
- m_active_colors[i] = 1;
+ active_colors_[i] = 1;
break;
}
}
//assign color
- m_color_map[static_cast<size_t>(id)] = color_index;
- m_plot_production->set_plotcolor(static_cast<size_t>(id), colors[color_index]);
- m_plot_consumption->set_plotcolor(static_cast<size_t>(id), colors[color_index]);
- m_plot_economy->set_plotcolor(static_cast<size_t>(id), colors[color_index]);
- m_plot_stock->set_plotcolor(static_cast<size_t>(id), colors[color_index]);
+ color_map_[static_cast<size_t>(id)] = color_index;
+ plot_production_->set_plotcolor(static_cast<size_t>(id), colors[color_index]);
+ plot_consumption_->set_plotcolor(static_cast<size_t>(id), colors[color_index]);
+ plot_economy_->set_plotcolor(static_cast<size_t>(id), colors[color_index]);
+ plot_stock_->set_plotcolor(static_cast<size_t>(id), colors[color_index]);
} else { //deactivate ware
- uint8_t old_color = m_color_map[static_cast<size_t>(id)];
+ uint8_t old_color = color_map_[static_cast<size_t>(id)];
if (old_color != INACTIVE) {
- m_active_colors[old_color - 1] = 0;
- m_color_map[static_cast<size_t>(id)] = INACTIVE;
+ active_colors_[old_color - 1] = 0;
+ color_map_[static_cast<size_t>(id)] = INACTIVE;
}
}
- m_plot_production->show_plot(static_cast<size_t>(id), what);
- m_plot_consumption->show_plot(static_cast<size_t>(id), what);
- m_plot_economy->show_plot(static_cast<size_t>(id), what);
- m_plot_stock->show_plot(static_cast<size_t>(id), what);
+ plot_production_->show_plot(static_cast<size_t>(id), what);
+ plot_consumption_->show_plot(static_cast<size_t>(id), what);
+ plot_economy_->show_plot(static_cast<size_t>(id), what);
+ plot_stock_->show_plot(static_cast<size_t>(id), what);
}
/**
@@ -304,8 +304,8 @@
* statistics simultaneously.
*/
void WareStatisticsMenu::set_time(int32_t timescale) {
- m_plot_production->set_time_id(timescale);
- m_plot_consumption->set_time_id(timescale);
- m_plot_economy->set_time_id(timescale);
- m_plot_stock->set_time_id(timescale);
+ plot_production_->set_time_id(timescale);
+ plot_consumption_->set_time_id(timescale);
+ plot_economy_->set_time_id(timescale);
+ plot_stock_->set_time_id(timescale);
}
=== modified file 'src/wui/ware_statistics_menu.h'
--- src/wui/ware_statistics_menu.h 2015-11-11 09:52:55 +0000
+++ src/wui/ware_statistics_menu.h 2016-01-24 20:17:30 +0000
@@ -37,13 +37,13 @@
void set_time(int32_t);
private:
- InteractivePlayer * m_parent;
- WuiPlotArea * m_plot_production;
- WuiPlotArea * m_plot_consumption;
- WuiPlotArea * m_plot_stock;
- DifferentialPlotArea * m_plot_economy;
- std::vector<uint8_t> m_color_map; //maps ware index to colors
- std::vector<bool> m_active_colors;
+ InteractivePlayer * parent_;
+ WuiPlotArea * plot_production_;
+ WuiPlotArea * plot_consumption_;
+ WuiPlotArea * plot_stock_;
+ DifferentialPlotArea * plot_economy_;
+ std::vector<uint8_t> color_map_; //maps ware index to colors
+ std::vector<bool> active_colors_;
void clicked_help();
void cb_changed_to(Widelands::DescriptionIndex, bool);
=== modified file 'src/wui/warehousewindow.cc'
--- src/wui/warehousewindow.cc 2016-01-17 18:21:17 +0000
+++ src/wui/warehousewindow.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2013 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -52,7 +52,7 @@
void draw_ware(RenderTarget & dst, Widelands::DescriptionIndex ware) override;
private:
- Warehouse & m_warehouse;
+ Warehouse & warehouse_;
};
WarehouseWaresDisplay::WarehouseWaresDisplay
@@ -60,14 +60,14 @@
Warehouse & wh, Widelands::WareWorker type, bool selectable)
:
WaresDisplay(parent, 0, 0, wh.owner().tribe(), type, selectable),
-m_warehouse(wh)
+warehouse_(wh)
{
set_inner_size(width, 0);
- add_warelist(type == Widelands::wwWORKER ? m_warehouse.get_workers() : m_warehouse.get_wares());
+ add_warelist(type == Widelands::wwWORKER ? warehouse_.get_workers() : warehouse_.get_wares());
if (type == Widelands::wwWORKER)
{
const std::vector<Widelands::DescriptionIndex> & worker_types_without_cost =
- m_warehouse.owner().tribe().worker_types_without_cost();
+ warehouse_.owner().tribe().worker_types_without_cost();
for (size_t i = 0; i < worker_types_without_cost.size(); ++i)
{
hide_ware(worker_types_without_cost.at(i));
@@ -79,7 +79,7 @@
{
WaresDisplay::draw_ware(dst, ware);
- Warehouse::StockPolicy policy = m_warehouse.get_stock_policy(get_type(), ware);
+ Warehouse::StockPolicy policy = warehouse_.get_stock_policy(get_type(), ware);
const Image* pic = nullptr;
switch (policy) {
case Warehouse::SP_Prefer:
@@ -110,11 +110,11 @@
void set_policy(Warehouse::StockPolicy);
private:
- InteractiveGameBase & m_gb;
- Warehouse & m_wh;
- bool m_can_act;
- Widelands::WareWorker m_type;
- WarehouseWaresDisplay m_display;
+ InteractiveGameBase & gb_;
+ Warehouse & wh_;
+ bool can_act_;
+ Widelands::WareWorker type_;
+ WarehouseWaresDisplay display_;
};
WarehouseWaresPanel::WarehouseWaresPanel
@@ -122,15 +122,15 @@
InteractiveGameBase & gb, Warehouse & wh, Widelands::WareWorker type)
:
UI::Box(parent, 0, 0, UI::Box::Vertical),
- m_gb(gb),
- m_wh(wh),
- m_can_act(m_gb.can_act(m_wh.owner().player_number())),
- m_type(type),
- m_display(this, width, m_wh, m_type, m_can_act)
+ gb_(gb),
+ wh_(wh),
+ can_act_(gb_.can_act(wh_.owner().player_number())),
+ type_(type),
+ display_(this, width, wh_, type_, can_act_)
{
- add(&m_display, UI::Box::AlignLeft, true);
+ add(&display_, UI::Box::AlignLeft, true);
- if (m_can_act) {
+ if (can_act_) {
UI::Box * buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal);
UI::Button * b;
add(buttons, UI::Box::AlignLeft);
@@ -156,18 +156,18 @@
* Add Buttons policy buttons
*/
void WarehouseWaresPanel::set_policy(Warehouse::StockPolicy newpolicy) {
- if (m_gb.can_act(m_wh.owner().player_number())) {
- bool is_workers = m_type == Widelands::wwWORKER;
+ if (gb_.can_act(wh_.owner().player_number())) {
+ bool is_workers = type_ == Widelands::wwWORKER;
const std::set<Widelands::DescriptionIndex> indices =
- is_workers ? m_wh.owner().tribe().workers() : m_wh.owner().tribe().wares();
+ is_workers ? wh_.owner().tribe().workers() : wh_.owner().tribe().wares();
for (const Widelands::DescriptionIndex& index : indices) {
- if (m_display.ware_selected(index)) {
- m_gb.game().send_player_command
+ if (display_.ware_selected(index)) {
+ gb_.game().send_player_command
(*new Widelands::CmdSetStockPolicy
- (m_gb.game().get_gametime(),
- m_wh.owner().player_number(),
- m_wh, is_workers,
+ (gb_.game().get_gametime(),
+ wh_.owner().player_number(),
+ wh_, is_workers,
index, newpolicy));
}
}
=== modified file 'src/wui/waresdisplay.cc'
--- src/wui/waresdisplay.cc 2016-01-17 09:54:31 +0000
+++ src/wui/waresdisplay.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006-2013 by the Widelands Development Team
+ * Copyright (C) 2003-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -47,36 +47,36 @@
boost::function<void(Widelands::DescriptionIndex, bool)> callback_function,
bool horizontal)
:
- // Size is set when add_warelist is called, as it depends on the m_type.
+ // Size is set when add_warelist is called, as it depends on the type_.
UI::Panel(parent, x, y, 0, 0),
- m_tribe (tribe),
+ tribe_ (tribe),
- m_type (type),
- m_indices(m_type == Widelands::wwWORKER ? m_tribe.workers() : m_tribe.wares()),
- m_curware
+ type_ (type),
+ indices_(type_ == Widelands::wwWORKER ? tribe_.workers() : tribe_.wares()),
+ curware_
(this,
0, get_inner_h() - 25, get_inner_w(), 20,
"", UI::Align_Center),
- m_selectable(selectable),
- m_horizontal(horizontal),
- m_selection_anchor(Widelands::INVALID_INDEX),
- m_callback_function(callback_function)
+ selectable_(selectable),
+ horizontal_(horizontal),
+ selection_anchor_(Widelands::INVALID_INDEX),
+ callback_function_(callback_function)
{
- for (const Widelands::DescriptionIndex& index : m_indices) {
- m_selected.insert(std::make_pair(index, false));
- m_hidden.insert(std::make_pair(index, false));
- m_in_selection.insert(std::make_pair(index, false));
+ for (const Widelands::DescriptionIndex& index : indices_) {
+ selected_.insert(std::make_pair(index, false));
+ hidden_.insert(std::make_pair(index, false));
+ in_selection_.insert(std::make_pair(index, false));
// Prerender all texts to avoid flickering with mouseover
- m_curware.set_text(index != Widelands::INVALID_INDEX ?
- (m_type == Widelands::wwWORKER ?
- m_tribe.get_worker_descr(index)->descname() :
- m_tribe.get_ware_descr(index)->descname()) :
+ curware_.set_text(index != Widelands::INVALID_INDEX ?
+ (type_ == Widelands::wwWORKER ?
+ tribe_.get_worker_descr(index)->descname() :
+ tribe_.get_ware_descr(index)->descname()) :
"");
}
- m_curware.set_text(_("Stock"));
+ curware_.set_text(_("Stock"));
// Find out geometry from icons_order
unsigned int columns = icons_order().size();
@@ -84,13 +84,13 @@
for (unsigned int i = 0; i < icons_order().size(); i++)
if (icons_order()[i].size() > rows)
rows = icons_order()[i].size();
- if (m_horizontal) {
+ if (horizontal_) {
unsigned int s = columns;
columns = rows;
rows = s;
}
- // 25 is height of m_curware text
+ // 25 is height of curware_ text
set_desired_size
(columns * (WARE_MENU_PIC_WIDTH + WARE_MENU_PIC_PAD_X) + 1,
rows * (WARE_MENU_PIC_HEIGHT + WARE_MENU_INFO_SIZE + WARE_MENU_PIC_PAD_Y) + 1 + 25);
@@ -102,12 +102,12 @@
{
const Widelands::DescriptionIndex index = ware_at_point(x, y);
- m_curware.set_text(index != Widelands::INVALID_INDEX ?
- (m_type == Widelands::wwWORKER ?
- m_tribe.get_worker_descr(index)->descname() :
- m_tribe.get_ware_descr(index)->descname()) :
+ curware_.set_text(index != Widelands::INVALID_INDEX ?
+ (type_ == Widelands::wwWORKER ?
+ tribe_.get_worker_descr(index)->descname() :
+ tribe_.get_ware_descr(index)->descname()) :
"");
- if (m_selection_anchor != Widelands::INVALID_INDEX) {
+ if (selection_anchor_ != Widelands::INVALID_INDEX) {
// Ensure mouse button is still pressed as some
// mouse release events do not reach us
if (state ^ SDL_BUTTON_LMASK) {
@@ -127,17 +127,17 @@
if (btn == SDL_BUTTON_LEFT) {
Widelands::DescriptionIndex ware = ware_at_point(x, y);
- if (!m_tribe.has_ware(ware) && !m_tribe.has_worker(ware)) {
+ if (!tribe_.has_ware(ware) && !tribe_.has_worker(ware)) {
return false;
}
- if (!m_selectable) {
+ if (!selectable_) {
return true;
}
- if (m_selection_anchor == Widelands::INVALID_INDEX) {
+ if (selection_anchor_ == Widelands::INVALID_INDEX) {
// Create the selection anchor to be able to select
// multiple ware by dragging.
- m_selection_anchor = ware;
- m_in_selection[ware] = true;
+ selection_anchor_ = ware;
+ in_selection_[ware] = true;
} else {
// A mouse release has been missed
}
@@ -149,14 +149,14 @@
bool AbstractWaresDisplay::handle_mouserelease(uint8_t btn, int32_t x, int32_t y)
{
- if (btn != SDL_BUTTON_LEFT || m_selection_anchor == Widelands::INVALID_INDEX) {
+ if (btn != SDL_BUTTON_LEFT || selection_anchor_ == Widelands::INVALID_INDEX) {
return UI::Panel::handle_mouserelease(btn, x, y);
}
- bool to_be_selected = !ware_selected(m_selection_anchor);
+ bool to_be_selected = !ware_selected(selection_anchor_);
- for (const Widelands::DescriptionIndex& index : m_indices) {
- if (m_in_selection[index]) {
+ for (const Widelands::DescriptionIndex& index : indices_) {
+ if (in_selection_[index]) {
if (to_be_selected) {
select_ware(index);
} else {
@@ -166,9 +166,9 @@
}
// Release anchor, empty selection
- m_selection_anchor = Widelands::INVALID_INDEX;
- for (std::pair<const Widelands::DescriptionIndex&, bool> resetme : m_in_selection) {
- m_in_selection[resetme.first] = false;
+ selection_anchor_ = Widelands::INVALID_INDEX;
+ for (std::pair<const Widelands::DescriptionIndex&, bool> resetme : in_selection_) {
+ in_selection_[resetme.first] = false;
}
return true;
}
@@ -186,15 +186,15 @@
unsigned int i = x / (WARE_MENU_PIC_WIDTH + WARE_MENU_PIC_PAD_X);
unsigned int j = y / (WARE_MENU_PIC_HEIGHT + WARE_MENU_INFO_SIZE + WARE_MENU_PIC_PAD_Y);
- if (m_horizontal) {
+ if (horizontal_) {
unsigned int s = i;
i = j;
j = s;
}
if (i < icons_order().size() && j < icons_order()[i].size()) {
const Widelands::DescriptionIndex& ware = icons_order()[i][j];
- assert(m_hidden.count(ware) == 1);
- if (!(m_hidden.find(ware)->second)) {
+ assert(hidden_.count(ware) == 1);
+ if (!(hidden_.find(ware)->second)) {
return ware;
}
}
@@ -208,15 +208,15 @@
// and current pos to allow their selection on mouse release
void AbstractWaresDisplay::update_anchor_selection(int32_t x, int32_t y)
{
- if (m_selection_anchor == Widelands::INVALID_INDEX || x < 0 || y < 0) {
+ if (selection_anchor_ == Widelands::INVALID_INDEX || x < 0 || y < 0) {
return;
}
- for (std::pair<const Widelands::DescriptionIndex&, bool> resetme : m_in_selection) {
- m_in_selection[resetme.first] = false;
+ for (std::pair<const Widelands::DescriptionIndex&, bool> resetme : in_selection_) {
+ in_selection_[resetme.first] = false;
}
- Point anchor_pos = ware_position(m_selection_anchor);
+ Point anchor_pos = ware_position(selection_anchor_);
// Add an offset to make sure the anchor line and column will be
// selected when selecting in topleft direction
int32_t anchor_x = anchor_pos.x + WARE_MENU_PIC_WIDTH / 2;
@@ -225,36 +225,36 @@
unsigned int left_ware_idx = anchor_x / (WARE_MENU_PIC_WIDTH + WARE_MENU_PIC_PAD_X);
unsigned int top_ware_idx = anchor_y / (WARE_MENU_PIC_HEIGHT + WARE_MENU_INFO_SIZE + WARE_MENU_PIC_PAD_Y);
unsigned int right_ware_idx = x / (WARE_MENU_PIC_WIDTH + WARE_MENU_PIC_PAD_X);
- unsigned int bottom_ware_idx = y / (WARE_MENU_PIC_HEIGHT + WARE_MENU_INFO_SIZE + WARE_MENU_PIC_PAD_Y);
+ unsigned int bottoware_idx_ = y / (WARE_MENU_PIC_HEIGHT + WARE_MENU_INFO_SIZE + WARE_MENU_PIC_PAD_Y);
unsigned int tmp;
// Reverse col/row and anchor/endpoint if needed
- if (m_horizontal) {
+ if (horizontal_) {
tmp = left_ware_idx;
left_ware_idx = top_ware_idx;
top_ware_idx = tmp;
tmp = right_ware_idx;
- right_ware_idx = bottom_ware_idx;
- bottom_ware_idx = tmp;
+ right_ware_idx = bottoware_idx_;
+ bottoware_idx_ = tmp;
}
if (left_ware_idx > right_ware_idx) {
tmp = left_ware_idx;
left_ware_idx = right_ware_idx;
right_ware_idx = tmp;
}
- if (top_ware_idx > bottom_ware_idx) {
+ if (top_ware_idx > bottoware_idx_) {
tmp = top_ware_idx;
- top_ware_idx = bottom_ware_idx;
- bottom_ware_idx = tmp;
+ top_ware_idx = bottoware_idx_;
+ bottoware_idx_ = tmp;
}
for (unsigned int cur_ware_x = left_ware_idx; cur_ware_x <= right_ware_idx; cur_ware_x++) {
if (cur_ware_x < icons_order().size()) {
- for (unsigned cur_ware_y = top_ware_idx; cur_ware_y <= bottom_ware_idx; cur_ware_y++) {
+ for (unsigned cur_ware_y = top_ware_idx; cur_ware_y <= bottoware_idx_; cur_ware_y++) {
if (cur_ware_y < icons_order()[cur_ware_x].size()) {
Widelands::DescriptionIndex ware = icons_order()[cur_ware_x][cur_ware_y];
- if (!m_hidden[ware]) {
- m_in_selection[ware] = true;
+ if (!hidden_[ware]) {
+ in_selection_[ware] = true;
}
}
}
@@ -267,12 +267,12 @@
void AbstractWaresDisplay::layout()
{
- m_curware.set_pos(Point(0, get_inner_h() - 25));
- m_curware.set_size(get_inner_w(), 20);
+ curware_.set_pos(Point(0, get_inner_h() - 25));
+ curware_.set_size(get_inner_w(), 20);
}
void WaresDisplay::remove_all_warelists() {
- m_warelists.clear();
+ warelists_.clear();
for (boost::signals2::connection& c : connections_)
c.disconnect();
connections_.clear();
@@ -282,8 +282,8 @@
void AbstractWaresDisplay::draw(RenderTarget & dst)
{
- for (const Widelands::DescriptionIndex& index : m_indices) {
- if (!m_hidden[index]) {
+ for (const Widelands::DescriptionIndex& index : indices_) {
+ if (!hidden_[index]) {
draw_ware(dst, index);
}
}
@@ -291,22 +291,22 @@
const Widelands::TribeDescr::WaresOrder & AbstractWaresDisplay::icons_order() const
{
- switch (m_type) {
+ switch (type_) {
case Widelands::wwWARE:
- return m_tribe.wares_order();
+ return tribe_.wares_order();
case Widelands::wwWORKER:
- return m_tribe.workers_order();
+ return tribe_.workers_order();
}
NEVER_HERE();
}
const Widelands::TribeDescr::WaresOrderCoords & AbstractWaresDisplay::icons_order_coords() const
{
- switch (m_type) {
+ switch (type_) {
case Widelands::wwWARE:
- return m_tribe.wares_order_coords();
+ return tribe_.wares_order_coords();
case Widelands::wwWORKER:
- return m_tribe.workers_order_coords();
+ return tribe_.workers_order_coords();
}
NEVER_HERE();
}
@@ -315,7 +315,7 @@
Point AbstractWaresDisplay::ware_position(Widelands::DescriptionIndex id) const
{
Point p(2, 2);
- if (m_horizontal) {
+ if (horizontal_) {
p.x += icons_order_coords()[id].second *
(WARE_MENU_PIC_WIDTH + WARE_MENU_PIC_PAD_X);
p.y += icons_order_coords()[id].first *
@@ -342,15 +342,15 @@
{
Point p = ware_position(id);
- bool draw_selected = m_selected[id];
- if (m_selection_anchor != Widelands::INVALID_INDEX) {
+ bool draw_selected = selected_[id];
+ if (selection_anchor_ != Widelands::INVALID_INDEX) {
// Draw the temporary selected wares as if they were
// selected.
// TODO(unknown): Use another pic for the temporary selection
- if (!ware_selected(m_selection_anchor)) {
- draw_selected |= m_in_selection[id];
+ if (!ware_selected(selection_anchor_)) {
+ draw_selected |= in_selection_[id];
} else {
- draw_selected &= !m_in_selection[id];
+ draw_selected &= !in_selection_[id];
}
}
@@ -361,8 +361,8 @@
dst.blit(p, bgpic);
- const Image* icon = m_type == Widelands::wwWORKER ? m_tribe.get_worker_descr(id)->icon()
- : m_tribe.get_ware_descr(id)->icon();
+ const Image* icon = type_ == Widelands::wwWORKER ? tribe_.get_worker_descr(id)->icon()
+ : tribe_.get_ware_descr(id)->icon();
dst.blit(p + Point((w - WARE_MENU_PIC_WIDTH) / 2, 1), icon);
@@ -380,51 +380,51 @@
// Wares highlighting/selecting
void AbstractWaresDisplay::select_ware(Widelands::DescriptionIndex ware)
{
- if (m_selected[ware])
+ if (selected_[ware])
return;
- m_selected[ware] = true;
+ selected_[ware] = true;
update();
- if (m_callback_function)
- m_callback_function(ware, true);
+ if (callback_function_)
+ callback_function_(ware, true);
}
void AbstractWaresDisplay::unselect_ware(Widelands::DescriptionIndex ware)
{
- if (!m_selected[ware])
+ if (!selected_[ware])
return;
- m_selected[ware] = false;
+ selected_[ware] = false;
update();
- if (m_callback_function)
- m_callback_function(ware, false);
+ if (callback_function_)
+ callback_function_(ware, false);
}
bool AbstractWaresDisplay::ware_selected(Widelands::DescriptionIndex ware) {
- return m_selected[ware];
+ return selected_[ware];
}
// Wares hiding
void AbstractWaresDisplay::hide_ware(Widelands::DescriptionIndex ware)
{
- if (m_hidden[ware])
+ if (hidden_[ware])
return;
- m_hidden[ware] = true;
+ hidden_[ware] = true;
update();
}
void AbstractWaresDisplay::unhide_ware(Widelands::DescriptionIndex ware)
{
- if (!m_hidden[ware])
+ if (!hidden_[ware])
return;
- m_hidden[ware] = false;
+ hidden_[ware] = false;
update();
}
bool AbstractWaresDisplay::ware_hidden(Widelands::DescriptionIndex ware) {
- return m_hidden[ware];
+ return hidden_[ware];
}
WaresDisplay::WaresDisplay
@@ -447,7 +447,7 @@
std::string WaresDisplay::info_for_ware(Widelands::DescriptionIndex ware) {
int totalstock = 0;
- for (const Widelands::WareList* warelist : m_warelists) {
+ for (const Widelands::WareList* warelist : warelists_) {
totalstock += warelist->stock(ware);
}
return boost::lexical_cast<std::string>(totalstock);
@@ -462,7 +462,7 @@
(const Widelands::WareList & wares)
{
// If you register something twice, it is counted twice. Not my problem.
- m_warelists.push_back(&wares);
+ warelists_.push_back(&wares);
connections_.push_back(wares.changed.connect(boost::bind(&WaresDisplay::update, boost::ref(*this))));
update();
=== modified file 'src/wui/waresdisplay.h'
--- src/wui/waresdisplay.h 2015-11-28 22:29:26 +0000
+++ src/wui/waresdisplay.h 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2003-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -69,7 +69,7 @@
bool ware_hidden(Widelands::DescriptionIndex);
Widelands::DescriptionIndex ware_at_point(int32_t x, int32_t y) const;
- Widelands::WareWorker get_type() const {return m_type;}
+ Widelands::WareWorker get_type() const {return type_;}
protected:
void layout() override;
@@ -92,30 +92,30 @@
/**
* Update the anchored selection. When first mouse button is pressed on a
- * ware, it is stored in @ref m_selection_anchor. Mouse moves trigger this
+ * ware, it is stored in @ref selection_anchor_. Mouse moves trigger this
* function to select all wares in the rectangle between the anchor and the
- * mouse position. They are temporary stored in @ref m_in_selection.
+ * mouse position. They are temporary stored in @ref in_selection_.
* Releasing the mouse button will performs the selection. This allows
* selection of multiple wares by dragging.
*/
void update_anchor_selection(int32_t x, int32_t y);
- const Widelands::TribeDescr & m_tribe;
- Widelands::WareWorker m_type;
- const std::set<Widelands::DescriptionIndex> m_indices;
- UI::Textarea m_curware;
- WareListSelectionType m_selected;
- WareListSelectionType m_hidden;
- WareListSelectionType m_in_selection; //Wares in temporary anchored selection
- bool m_selectable;
- bool m_horizontal;
+ const Widelands::TribeDescr & tribe_;
+ Widelands::WareWorker type_;
+ const std::set<Widelands::DescriptionIndex> indices_;
+ UI::Textarea curware_;
+ WareListSelectionType selected_;
+ WareListSelectionType hidden_;
+ WareListSelectionType in_selection_; //Wares in temporary anchored selection
+ bool selectable_;
+ bool horizontal_;
/**
* The ware on which the mouse press has been performed.
* It is not selected directly, but will be on mouse release.
*/
- Widelands::DescriptionIndex m_selection_anchor;
- boost::function<void(Widelands::DescriptionIndex, bool)> m_callback_function;
+ Widelands::DescriptionIndex selection_anchor_;
+ boost::function<void(Widelands::DescriptionIndex, bool)> callback_function_;
};
/*
@@ -143,7 +143,7 @@
private:
using WareListVector = std::vector<const Widelands::WareList *>;
- WareListVector m_warelists;
+ WareListVector warelists_;
std::vector<boost::signals2::connection> connections_;
};
=== modified file 'src/wui/waresqueuedisplay.cc'
--- src/wui/waresqueuedisplay.cc 2014-12-06 15:32:50 +0000
+++ src/wui/waresqueuedisplay.cc 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -42,33 +42,33 @@
bool show_only)
:
UI::Panel(parent, x, y, 0, 28),
-m_igb(igb),
-m_building(building),
-m_queue(queue),
-m_priority_radiogroup(nullptr),
-m_increase_max_fill(nullptr),
-m_decrease_max_fill(nullptr),
-m_ware_index(queue->get_ware()),
-m_ware_type(Widelands::wwWARE),
-m_max_fill_indicator(g_gr->images().get(pic_max_fill_indicator)),
-m_cache_size(queue->get_max_size()),
-m_cache_filled(queue->get_filled()),
-m_cache_max_fill(queue->get_max_fill()),
-m_total_height(0),
-m_show_only(show_only)
+igb_(igb),
+building_(building),
+queue_(queue),
+priority_radiogroup_(nullptr),
+increase_max_fill_(nullptr),
+decrease_max_fill_(nullptr),
+ware_index_(queue->get_ware()),
+ware_type_(Widelands::wwWARE),
+max_fill_indicator_(g_gr->images().get(pic_max_fill_indicator)),
+cache_size_(queue->get_max_size()),
+cache_filled_(queue->get_filled()),
+cache_max_fill_(queue->get_max_fill()),
+total_height_(0),
+show_only_(show_only)
{
const Widelands::WareDescr & ware =
- *queue->owner().tribe().get_ware_descr(m_queue->get_ware());
+ *queue->owner().tribe().get_ware_descr(queue_->get_ware());
set_tooltip(ware.descname().c_str());
- m_icon = ware.icon();
+ icon_ = ware.icon();
- uint16_t ph = m_max_fill_indicator->height();
+ uint16_t ph = max_fill_indicator_->height();
uint32_t priority_button_height = show_only ? 0 : 3 * PriorityButtonSize;
uint32_t image_height = show_only ? WARE_MENU_PIC_HEIGHT : std::max<int32_t>(WARE_MENU_PIC_HEIGHT, ph);
- m_total_height = std::max(priority_button_height, image_height) + 2 * Border;
+ total_height_ = std::max(priority_button_height, image_height) + 2 * Border;
max_size_changed();
@@ -77,7 +77,7 @@
WaresQueueDisplay::~WaresQueueDisplay()
{
- delete m_priority_radiogroup;
+ delete priority_radiogroup_;
}
/**
@@ -87,20 +87,20 @@
*/
void WaresQueueDisplay::max_size_changed()
{
- uint32_t pbs = m_show_only ? 0 : PriorityButtonSize;
- uint32_t ctrl_b_size = m_show_only ? 0 : 2 * WARE_MENU_PIC_WIDTH;
+ uint32_t pbs = show_only_ ? 0 : PriorityButtonSize;
+ uint32_t ctrl_b_size = show_only_ ? 0 : 2 * WARE_MENU_PIC_WIDTH;
- m_cache_size = m_queue->get_max_size();
+ cache_size_ = queue_->get_max_size();
update_priority_buttons();
update_max_fill_buttons();
- if (m_cache_size <= 0) {
+ if (cache_size_ <= 0) {
set_desired_size(0, 0);
} else {
set_desired_size
- (m_cache_size * (CellWidth + CellSpacing) + pbs + ctrl_b_size + 2 * Border,
- m_total_height);
+ (cache_size_ * (CellWidth + CellSpacing) + pbs + ctrl_b_size + 2 * Border,
+ total_height_);
}
}
@@ -109,14 +109,14 @@
*/
void WaresQueueDisplay::think()
{
- if (static_cast<uint32_t>(m_queue->get_max_size()) != m_cache_size)
+ if (static_cast<uint32_t>(queue_->get_max_size()) != cache_size_)
max_size_changed();
- if (static_cast<uint32_t>(m_queue->get_filled()) != m_cache_filled)
+ if (static_cast<uint32_t>(queue_->get_filled()) != cache_filled_)
update();
- if (static_cast<uint32_t>(m_queue->get_max_fill()) != m_cache_max_fill) {
- m_cache_max_fill = m_queue->get_max_fill();
+ if (static_cast<uint32_t>(queue_->get_max_fill()) != cache_max_fill_) {
+ cache_max_fill_ = queue_->get_max_fill();
compute_max_fill_buttons_enabled_state();
update();
}
@@ -128,40 +128,40 @@
*/
void WaresQueueDisplay::draw(RenderTarget & dst)
{
- if (!m_cache_size)
+ if (!cache_size_)
return;
- m_cache_filled = m_queue->get_filled();
- m_cache_max_fill = m_queue->get_max_fill();
+ cache_filled_ = queue_->get_filled();
+ cache_max_fill_ = queue_->get_max_fill();
- uint32_t nr_wares_to_draw = std::min(m_cache_filled, m_cache_size);
- uint32_t nr_empty_to_draw = m_cache_size - nr_wares_to_draw;
+ uint32_t nr_wares_to_draw = std::min(cache_filled_, cache_size_);
+ uint32_t nr_empty_to_draw = cache_size_ - nr_wares_to_draw;
Point point;
- point.x = Border + (m_show_only ? 0 : CellWidth + CellSpacing);
- point.y = Border + (m_total_height - 2 * Border - WARE_MENU_PIC_HEIGHT) / 2;
+ point.x = Border + (show_only_ ? 0 : CellWidth + CellSpacing);
+ point.y = Border + (total_height_ - 2 * Border - WARE_MENU_PIC_HEIGHT) / 2;
for (; nr_wares_to_draw; --nr_wares_to_draw, point.x += CellWidth + CellSpacing) {
dst.blitrect_scale(
- Rect(point.x, point.y, m_icon->width(), m_icon->height()),
- m_icon,
- Rect(0, 0, m_icon->width(), m_icon->height()),
+ Rect(point.x, point.y, icon_->width(), icon_->height()),
+ icon_,
+ Rect(0, 0, icon_->width(), icon_->height()),
1.0,
BlendMode::UseAlpha);
}
for (; nr_empty_to_draw; --nr_empty_to_draw, point.x += CellWidth + CellSpacing) {
- dst.blitrect_scale_monochrome(Rect(point.x, point.y, m_icon->width(), m_icon->height()),
- m_icon,
- Rect(0, 0, m_icon->width(), m_icon->height()),
+ dst.blitrect_scale_monochrome(Rect(point.x, point.y, icon_->width(), icon_->height()),
+ icon_,
+ Rect(0, 0, icon_->width(), icon_->height()),
RGBAColor(166, 166, 166, 127));
}
- if (!m_show_only) {
- uint16_t pw = m_max_fill_indicator->width();
+ if (!show_only_) {
+ uint16_t pw = max_fill_indicator_->width();
point.y = Border;
point.x = Border + CellWidth + CellSpacing +
- (m_queue->get_max_fill() * (CellWidth + CellSpacing)) - CellSpacing / 2 - pw / 2;
- dst.blit(point, m_max_fill_indicator);
+ (queue_->get_max_fill() * (CellWidth + CellSpacing)) - CellSpacing / 2 - pw / 2;
+ dst.blit(point, max_fill_indicator_);
}
}
@@ -170,93 +170,93 @@
*/
void WaresQueueDisplay::update_priority_buttons()
{
- if (m_cache_size <= 0 || m_show_only) {
- delete m_priority_radiogroup;
- m_priority_radiogroup = nullptr;
+ if (cache_size_ <= 0 || show_only_) {
+ delete priority_radiogroup_;
+ priority_radiogroup_ = nullptr;
}
- Point pos = Point(m_cache_size * CellWidth + Border, 0);
- pos.x = (m_cache_size + 2) * (CellWidth + CellSpacing) + Border;
- pos.y = Border + (m_total_height - 2 * Border - 3 * PriorityButtonSize) / 2;
+ Point pos = Point(cache_size_ * CellWidth + Border, 0);
+ pos.x = (cache_size_ + 2) * (CellWidth + CellSpacing) + Border;
+ pos.y = Border + (total_height_ - 2 * Border - 3 * PriorityButtonSize) / 2;
- if (m_priority_radiogroup) {
+ if (priority_radiogroup_) {
pos.y += 2 * PriorityButtonSize;
- for (UI::Radiobutton * btn = m_priority_radiogroup->get_first_button(); btn; btn = btn->next_button()) {
+ for (UI::Radiobutton * btn = priority_radiogroup_->get_first_button(); btn; btn = btn->next_button()) {
btn->set_pos(pos);
pos.y -= PriorityButtonSize;
}
} else {
- m_priority_radiogroup = new UI::Radiogroup();
+ priority_radiogroup_ = new UI::Radiogroup();
- m_priority_radiogroup->add_button
+ priority_radiogroup_->add_button
(this, pos, g_gr->images().get(pic_priority_high), _("Highest priority"));
pos.y += PriorityButtonSize;
- m_priority_radiogroup->add_button
+ priority_radiogroup_->add_button
(this, pos, g_gr->images().get(pic_priority_normal), _("Normal priority"));
pos.y += PriorityButtonSize;
- m_priority_radiogroup->add_button
+ priority_radiogroup_->add_button
(this, pos, g_gr->images().get(pic_priority_low), _("Lowest priority"));
}
- int32_t priority = m_building.get_priority(m_ware_type, m_ware_index, false);
+ int32_t priority = building_.get_priority(ware_type_, ware_index_, false);
switch (priority) {
case HIGH_PRIORITY:
- m_priority_radiogroup->set_state(0);
+ priority_radiogroup_->set_state(0);
break;
case DEFAULT_PRIORITY:
- m_priority_radiogroup->set_state(1);
+ priority_radiogroup_->set_state(1);
break;
case LOW_PRIORITY:
- m_priority_radiogroup->set_state(2);
+ priority_radiogroup_->set_state(2);
break;
default:
break;
}
- m_priority_radiogroup->changedto.connect
+ priority_radiogroup_->changedto.connect
(boost::bind(&WaresQueueDisplay::radiogroup_changed, this, _1));
- bool const can_act = m_igb.can_act(m_building.owner().player_number());
+ bool const can_act = igb_.can_act(building_.owner().player_number());
if (!can_act)
- m_priority_radiogroup->set_enabled(false);
+ priority_radiogroup_->set_enabled(false);
}
/**
* Updates the desired size buttons
*/
void WaresQueueDisplay::update_max_fill_buttons() {
- delete m_increase_max_fill;
- delete m_decrease_max_fill;
- m_increase_max_fill = nullptr;
- m_decrease_max_fill = nullptr;
+ delete increase_max_fill_;
+ delete decrease_max_fill_;
+ increase_max_fill_ = nullptr;
+ decrease_max_fill_ = nullptr;
- if (m_cache_size <= 0 || m_show_only)
+ if (cache_size_ <= 0 || show_only_)
return;
uint32_t x = Border;
- uint32_t y = Border + (m_total_height - 2 * Border - WARE_MENU_PIC_WIDTH) / 2;
+ uint32_t y = Border + (total_height_ - 2 * Border - WARE_MENU_PIC_WIDTH) / 2;
- m_decrease_max_fill = new UI::Button
+ decrease_max_fill_ = new UI::Button
(this, "decrease_max_fill",
x, y, WARE_MENU_PIC_WIDTH, WARE_MENU_PIC_HEIGHT,
g_gr->images().get("pics/but4.png"),
g_gr->images().get("pics/scrollbar_left.png"),
_("Decrease the number of wares you want to be stored here."));
- m_decrease_max_fill->sigclicked.connect
+ decrease_max_fill_->sigclicked.connect
(boost::bind(&WaresQueueDisplay::decrease_max_fill_clicked, boost::ref(*this)));
- x = Border + (m_cache_size + 1) * (CellWidth + CellSpacing);
- m_increase_max_fill = new UI::Button
+ x = Border + (cache_size_ + 1) * (CellWidth + CellSpacing);
+ increase_max_fill_ = new UI::Button
(this, "increase_max_fill",
x, y, WARE_MENU_PIC_WIDTH, WARE_MENU_PIC_HEIGHT,
g_gr->images().get("pics/but4.png"),
g_gr->images().get("pics/scrollbar_right.png"),
_("Increase the number of wares you want to be stored here."));
- m_increase_max_fill->sigclicked.connect
+ increase_max_fill_->sigclicked.connect
(boost::bind(&WaresQueueDisplay::increase_max_fill_clicked, boost::ref(*this)));
- m_increase_max_fill->set_repeating(true);
- m_decrease_max_fill->set_repeating(true);
+ increase_max_fill_->set_repeating(true);
+ decrease_max_fill_->set_repeating(true);
compute_max_fill_buttons_enabled_state();
}
@@ -279,8 +279,8 @@
return;
}
- m_igb.game().send_player_set_ware_priority
- (m_building, m_ware_type, m_ware_index, priority);
+ igb_.game().send_player_set_ware_priority
+ (building_, ware_type_, ware_index_, priority);
}
/**
@@ -289,20 +289,20 @@
*/
void WaresQueueDisplay::decrease_max_fill_clicked()
{
- assert (m_cache_max_fill > 0);
+ assert (cache_max_fill_ > 0);
- m_igb.game().send_player_set_ware_max_fill
- (m_building, m_ware_index, m_cache_max_fill - 1);
+ igb_.game().send_player_set_ware_max_fill
+ (building_, ware_index_, cache_max_fill_ - 1);
}
void WaresQueueDisplay::increase_max_fill_clicked()
{
- assert (m_cache_max_fill < m_queue->get_max_size());
+ assert (cache_max_fill_ < queue_->get_max_size());
- m_igb.game().send_player_set_ware_max_fill
- (m_building, m_ware_index, m_cache_max_fill + 1);
+ igb_.game().send_player_set_ware_max_fill
+ (building_, ware_index_, cache_max_fill_ + 1);
}
@@ -310,13 +310,13 @@
{
// Disable those buttons for replay watchers
- bool const can_act = m_igb.can_act(m_building.owner().player_number());
+ bool const can_act = igb_.can_act(building_.owner().player_number());
if (!can_act) {
- if (m_increase_max_fill) m_increase_max_fill->set_enabled(false);
- if (m_decrease_max_fill) m_decrease_max_fill->set_enabled(false);
+ if (increase_max_fill_) increase_max_fill_->set_enabled(false);
+ if (decrease_max_fill_) decrease_max_fill_->set_enabled(false);
} else {
- if (m_decrease_max_fill) m_decrease_max_fill->set_enabled(m_cache_max_fill > 0);
- if (m_increase_max_fill) m_increase_max_fill->set_enabled(m_cache_max_fill < m_queue->get_max_size());
+ if (decrease_max_fill_) decrease_max_fill_->set_enabled(cache_max_fill_ > 0);
+ if (increase_max_fill_) increase_max_fill_->set_enabled(cache_max_fill_ < queue_->get_max_size());
}
}
=== modified file 'src/wui/waresqueuedisplay.h'
--- src/wui/waresqueuedisplay.h 2015-11-28 22:29:26 +0000
+++ src/wui/waresqueuedisplay.h 2016-01-24 20:17:30 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2013 by the Widelands Development Team
+ * Copyright (C) 2010-2016 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -69,23 +69,23 @@
void draw(RenderTarget &) override;
private:
- InteractiveGameBase & m_igb;
- Widelands::Building & m_building;
- Widelands::WaresQueue * m_queue;
- UI::Radiogroup * m_priority_radiogroup;
- UI::Button * m_increase_max_fill;
- UI::Button * m_decrease_max_fill;
- Widelands::DescriptionIndex m_ware_index;
- Widelands::WareWorker m_ware_type;
- const Image* m_icon; //< Index to ware's picture
- const Image* m_max_fill_indicator;
-
-
- uint32_t m_cache_size;
- uint32_t m_cache_filled;
- uint32_t m_cache_max_fill;
- uint32_t m_total_height;
- bool m_show_only;
+ InteractiveGameBase & igb_;
+ Widelands::Building & building_;
+ Widelands::WaresQueue * queue_;
+ UI::Radiogroup * priority_radiogroup_;
+ UI::Button * increase_max_fill_;
+ UI::Button * decrease_max_fill_;
+ Widelands::DescriptionIndex ware_index_;
+ Widelands::WareWorker ware_type_;
+ const Image* icon_; //< Index to ware's picture
+ const Image* max_fill_indicator_;
+
+
+ uint32_t cache_size_;
+ uint32_t cache_filled_;
+ uint32_t cache_max_fill_;
+ uint32_t total_height_;
+ bool show_only_;
virtual void max_size_changed();
void update_priority_buttons();
Follow ups