widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #05678
[Merge] lp:~klaus-halfmann/widelands/bug-1395278-ui_fsmenu into lp:widelands
Klaus Halfmann has proposed merging lp:~klaus-halfmann/widelands/bug-1395278-ui_fsmenu into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~klaus-halfmann/widelands/bug-1395278-ui_fsmenu/+merge/284339
Migration from m_... to ..._ mostly in ui_fsmenu
--
Your team Widelands Developers is requested to review the proposed merge of lp:~klaus-halfmann/widelands/bug-1395278-ui_fsmenu into lp:widelands.
=== modified file 'src/ui_fsmenu/base.h'
--- src/ui_fsmenu/base.h 2015-12-05 12:51:16 +0000
+++ src/ui_fsmenu/base.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006, 2008-2009 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/ui_fsmenu/campaign_select.cc'
--- src/ui_fsmenu/campaign_select.cc 2015-10-23 18:03:33 +0000
+++ src/ui_fsmenu/campaign_select.cc 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-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
@@ -42,71 +42,71 @@
*/
FullscreenMenuCampaignSelect::FullscreenMenuCampaignSelect() :
FullscreenMenuLoadMapOrGame(),
- m_table(this, tablex_, tabley_, tablew_, tableh_, false),
+ table_(this, tablex_, tabley_, tablew_, tableh_, false),
// Main Title
- m_title
+ title_
(this, get_w() / 2, tabley_ / 3,
_("Choose a campaign"),
UI::Align_HCenter),
// Campaign description
- m_label_campname
+ label_campname_
(this, right_column_x_, tabley_,
"",
UI::Align_Left),
- m_ta_campname(this,
- right_column_x_ + indent_, get_y_from_preceding(m_label_campname) + padding_,
- get_right_column_w(right_column_x_) - indent_, m_label_height),
-
- m_label_tribename
- (this, right_column_x_, get_y_from_preceding(m_ta_campname) + 2 * padding_,
- "",
- UI::Align_Left),
- m_ta_tribename(this,
- right_column_x_ + indent_, get_y_from_preceding(m_label_tribename) + padding_,
- get_right_column_w(right_column_x_ + indent_), m_label_height),
-
- m_label_difficulty
- (this, right_column_x_, get_y_from_preceding(m_ta_tribename) + 2 * padding_,
- "",
- UI::Align_Left),
- m_ta_difficulty(this,
- right_column_x_ + indent_, get_y_from_preceding(m_label_difficulty) + padding_,
- get_right_column_w(right_column_x_ + indent_), 2 * m_label_height - padding_),
-
- m_label_description
- (this, right_column_x_, get_y_from_preceding(m_ta_difficulty) + 2 * padding_,
+ ta_campname_(this,
+ right_column_x_ + indent_, get_y_fropreceding_(label_campname_) + padding_,
+ get_right_column_w(right_column_x_) - indent_, label_height_),
+
+ label_tribename_
+ (this, right_column_x_, get_y_fropreceding_(ta_campname_) + 2 * padding_,
+ "",
+ UI::Align_Left),
+ ta_tribename_(this,
+ right_column_x_ + indent_, get_y_fropreceding_(label_tribename_) + padding_,
+ get_right_column_w(right_column_x_ + indent_), label_height_),
+
+ label_difficulty_
+ (this, right_column_x_, get_y_fropreceding_(ta_tribename_) + 2 * padding_,
+ "",
+ UI::Align_Left),
+ ta_difficulty_(this,
+ right_column_x_ + indent_, get_y_fropreceding_(label_difficulty_) + padding_,
+ get_right_column_w(right_column_x_ + indent_), 2 * label_height_ - padding_),
+
+ label_description_
+ (this, right_column_x_, get_y_fropreceding_(ta_difficulty_) + 2 * padding_,
_("Description:"),
UI::Align_Left),
- m_ta_description
+ ta_description_
(this,
right_column_x_ + indent_,
- get_y_from_preceding(m_label_description) + padding_,
+ get_y_fropreceding_(label_description_) + padding_,
get_right_column_w(right_column_x_ + indent_),
- m_buty - get_y_from_preceding(m_label_description) - 4 * padding_)
+ buty_ - get_y_fropreceding_(label_description_) - 4 * padding_)
{
- m_title.set_textstyle(UI::TextStyle::ui_big());
+ title_.set_textstyle(UI::TextStyle::ui_big());
back_.set_tooltip(_("Return to the main menu"));
ok_.set_tooltip(_("Play this campaign"));
- m_ta_campname.set_tooltip(_("The name of this campaign"));
- m_ta_tribename.set_tooltip(_("The tribe you will be playing"));
- m_ta_difficulty.set_tooltip(_("The difficulty of this campaign"));
+ ta_campname_.set_tooltip(_("The name of this campaign"));
+ ta_tribename_.set_tooltip(_("The tribe you will be playing"));
+ ta_difficulty_.set_tooltip(_("The difficulty of this campaign"));
ok_.sigclicked.connect(boost::bind(&FullscreenMenuCampaignSelect::clicked_ok, boost::ref(*this)));
back_.sigclicked.connect(boost::bind(&FullscreenMenuCampaignSelect::clicked_back, boost::ref(*this)));
- m_table.selected.connect(boost::bind(&FullscreenMenuCampaignSelect::entry_selected, this));
- m_table.double_clicked.connect(boost::bind(&FullscreenMenuCampaignSelect::clicked_ok, boost::ref(*this)));
+ table_.selected.connect(boost::bind(&FullscreenMenuCampaignSelect::entry_selected, this));
+ table_.double_clicked.connect(boost::bind(&FullscreenMenuCampaignSelect::clicked_ok, boost::ref(*this)));
/** TRANSLATORS: Campaign difficulty table header */
- m_table.add_column(45, _("Diff."), _("Difficulty"), UI::Align_Left);
- m_table.add_column(100, _("Tribe"), _("Tribe Name"), UI::Align_Left);
- m_table.add_column(m_table.get_w() - 100 - 45, _("Campaign Name"), _("Campaign Name"), UI::Align_Left);
- m_table.set_column_compare
+ table_.add_column(45, _("Diff."), _("Difficulty"), UI::Align_Left);
+ table_.add_column(100, _("Tribe"), _("Tribe Name"), UI::Align_Left);
+ table_.add_column(table_.get_w() - 100 - 45, _("Campaign Name"), _("Campaign Name"), UI::Align_Left);
+ table_.set_column_compare
(0,
boost::bind(&FullscreenMenuCampaignSelect::compare_difficulty, this, _1, _2));
- m_table.set_sort_column(0);
- m_table.focus();
+ table_.set_sort_column(0);
+ table_.focus();
fill_table();
}
@@ -136,25 +136,25 @@
bool FullscreenMenuCampaignSelect::set_has_selection()
{
- bool has_selection = m_table.has_selection();
+ bool has_selection = table_.has_selection();
ok_.set_enabled(has_selection);
if (!has_selection) {
- m_label_campname.set_text(std::string());
- m_label_tribename.set_text(std::string());
- m_label_difficulty.set_text(std::string());
- m_label_description.set_text(std::string());
+ label_campname_.set_text(std::string());
+ label_tribename_.set_text(std::string());
+ label_difficulty_.set_text(std::string());
+ label_description_.set_text(std::string());
- m_ta_campname.set_text(std::string());
- m_ta_tribename.set_text(std::string());
- m_ta_difficulty.set_text(std::string());
- m_ta_description.set_text(std::string());
+ ta_campname_.set_text(std::string());
+ ta_tribename_.set_text(std::string());
+ ta_difficulty_.set_text(std::string());
+ ta_description_.set_text(std::string());
} else {
- m_label_campname.set_text(_("Campaign Name:"));
- m_label_tribename.set_text(_("Tribe:"));
- m_label_difficulty.set_text(_("Difficulty:"));
- m_label_description.set_text(_("Description:"));
+ label_campname_.set_text(_("Campaign Name:"));
+ label_tribename_.set_text(_("Tribe:"));
+ label_difficulty_.set_text(_("Difficulty:"));
+ label_description_.set_text(_("Description:"));
}
return has_selection;
}
@@ -163,16 +163,16 @@
void FullscreenMenuCampaignSelect::entry_selected()
{
if (set_has_selection()) {
- const CampaignListData& campaign_data = m_campaigns_data[m_table.get_selected()];
+ const CampaignListData& campaign_data = campaigns_data_[table_.get_selected()];
campaign = campaign_data.index;
- m_ta_campname.set_text(campaign_data.name);
- m_ta_tribename.set_text(campaign_data.tribename);
- m_ta_difficulty.set_text(campaign_data.difficulty_description);
- m_ta_description.set_text(campaign_data.description);
+ ta_campname_.set_text(campaign_data.name);
+ ta_tribename_.set_text(campaign_data.tribename);
+ ta_difficulty_.set_text(campaign_data.difficulty_description);
+ ta_description_.set_text(campaign_data.description);
}
- m_ta_description.scroll_to_top();
+ ta_description_.scroll_to_top();
}
@@ -181,8 +181,8 @@
*/
void FullscreenMenuCampaignSelect::fill_table()
{
- m_campaigns_data.clear();
- m_table.clear();
+ campaigns_data_.clear();
+ table_.clear();
// Read in the campaign config
Profile prof("campaigns/campaigns.conf", nullptr, "maps");
@@ -236,9 +236,9 @@
campaign_data.description = _(s.get_string(cdescription.c_str(), ""));
}
- m_campaigns_data.push_back(campaign_data);
+ campaigns_data_.push_back(campaign_data);
- UI::Table<uintptr_t>::EntryRecord& tableEntry = m_table.add(i);
+ UI::Table<uintptr_t>::EntryRecord& tableEntry = table_.add(i);
tableEntry.set_picture(0, g_gr->images().get(difficulty_picture_filenames[difficulty]));
tableEntry.set_string(1, campaign_data.tribename);
tableEntry.set_string(2, campaign_data.name);
@@ -249,18 +249,18 @@
csection = (boost::format("campsect%u") % i).str();
} // while (s.get_string(csection.c_str()))
- m_table.sort();
+ table_.sort();
- if (m_table.size()) {
- m_table.select(0);
+ if (table_.size()) {
+ table_.select(0);
}
}
bool FullscreenMenuCampaignSelect::compare_difficulty
(uint32_t rowa, uint32_t rowb)
{
- const CampaignListData& r1 = m_campaigns_data[m_table[rowa]];
- const CampaignListData& r2 = m_campaigns_data[m_table[rowb]];
+ const CampaignListData& r1 = campaigns_data_[table_[rowa]];
+ const CampaignListData& r2 = campaigns_data_[table_[rowb]];
if (r1.difficulty < r2.difficulty) {
return true;
@@ -281,59 +281,59 @@
*/
FullscreenMenuCampaignMapSelect::FullscreenMenuCampaignMapSelect(bool is_tutorial) :
FullscreenMenuLoadMapOrGame(),
- m_table(this, tablex_, tabley_, tablew_, tableh_, false),
+ table_(this, tablex_, tabley_, tablew_, tableh_, false),
// Main title
- m_title
+ title_
(this, get_w() / 2, tabley_ / 3,
is_tutorial ? _("Choose a tutorial") : _("Choose a scenario"),
UI::Align_HCenter),
- m_subtitle
- (this, get_w() / 6, get_y_from_preceding(m_title) + 6 * padding_,
- get_w() * 2 / 3, 4 * m_label_height,
+ subtitle_
+ (this, get_w() / 6, get_y_fropreceding_(title_) + 6 * padding_,
+ get_w() * 2 / 3, 4 * label_height_,
"",
UI::Align_HCenter),
// Map description
- m_label_mapname
+ label_mapname_
(this, right_column_x_, tabley_,
"",
UI::Align_Left),
- m_ta_mapname(this,
- right_column_x_ + indent_, get_y_from_preceding(m_label_mapname) + padding_,
- get_right_column_w(right_column_x_ + indent_), m_label_height),
+ ta_mapname_(this,
+ right_column_x_ + indent_, get_y_fropreceding_(label_mapname_) + padding_,
+ get_right_column_w(right_column_x_ + indent_), label_height_),
- m_label_author
+ label_author_
(this,
- right_column_x_, get_y_from_preceding(m_ta_mapname) + 2 * padding_,
+ right_column_x_, get_y_fropreceding_(ta_mapname_) + 2 * padding_,
"",
UI::Align_Left),
- m_ta_author(this,
- right_column_x_ + indent_, get_y_from_preceding(m_label_author) + padding_,
- get_right_column_w(right_column_x_ + indent_), 2 * m_label_height),
+ ta_author_(this,
+ right_column_x_ + indent_, get_y_fropreceding_(label_author_) + padding_,
+ get_right_column_w(right_column_x_ + indent_), 2 * label_height_),
- m_label_description
- (this, right_column_x_, get_y_from_preceding(m_ta_author) + padding_,
+ label_description_
+ (this, right_column_x_, get_y_fropreceding_(ta_author_) + padding_,
"",
UI::Align_Left),
- m_ta_description
+ ta_description_
(this,
right_column_x_ + indent_,
- get_y_from_preceding(m_label_description) + padding_,
+ get_y_fropreceding_(label_description_) + padding_,
get_right_column_w(right_column_x_ + indent_),
- m_buty - get_y_from_preceding(m_label_description) - 4 * padding_),
+ buty_ - get_y_fropreceding_(label_description_) - 4 * padding_),
- m_is_tutorial(is_tutorial)
+ is_tutorial_(is_tutorial)
{
- m_title.set_textstyle(UI::TextStyle::ui_big());
+ title_.set_textstyle(UI::TextStyle::ui_big());
back_.set_tooltip(_("Return to the main menu"));
- if (m_is_tutorial) {
+ if (is_tutorial_) {
ok_.set_tooltip(_("Play this tutorial"));
- m_ta_mapname.set_tooltip(_("The name of this tutorial"));
- m_ta_description.set_tooltip(_("What you will learn in this tutorial"));
+ ta_mapname_.set_tooltip(_("The name of this tutorial"));
+ ta_description_.set_tooltip(_("What you will learn in this tutorial"));
} else {
ok_.set_tooltip(_("Play this scenario"));
- m_ta_mapname.set_tooltip(_("The name of this scenario"));
+ ta_mapname_.set_tooltip(_("The name of this scenario"));
}
ok_.sigclicked.connect
@@ -342,25 +342,25 @@
back_.sigclicked.connect
(boost::bind
(&FullscreenMenuCampaignMapSelect::clicked_back, boost::ref(*this)));
- m_table.selected.connect(boost::bind(&FullscreenMenuCampaignMapSelect::entry_selected, this));
- m_table.double_clicked.connect
+ table_.selected.connect(boost::bind(&FullscreenMenuCampaignMapSelect::entry_selected, this));
+ table_.double_clicked.connect
(boost::bind(&FullscreenMenuCampaignMapSelect::clicked_ok, boost::ref(*this)));
/** TRANSLATORS: Campaign scenario number table header */
std::string number_tooltip;
std::string name_tooltip;
- if (m_is_tutorial) {
+ if (is_tutorial_) {
number_tooltip = _("The order in which the tutorials should be played");
name_tooltip = _("Tutorial Name");
} else {
number_tooltip = _("The number of this scenario in the campaign");
name_tooltip = _("Scenario Name");
}
- m_table.add_column(35, _("#"), number_tooltip, UI::Align_Left);
- m_table.add_column(m_table.get_w() - 35, name_tooltip, name_tooltip, UI::Align_Left);
- m_table.set_sort_column(0);
+ table_.add_column(35, _("#"), number_tooltip, UI::Align_Left);
+ table_.add_column(table_.get_w() - 35, name_tooltip, name_tooltip, UI::Align_Left);
+ table_.set_sort_column(0);
- m_table.focus();
+ table_.focus();
}
@@ -379,21 +379,21 @@
bool FullscreenMenuCampaignMapSelect::set_has_selection()
{
- bool has_selection = m_table.has_selection();
+ bool has_selection = table_.has_selection();
ok_.set_enabled(has_selection);
if (!has_selection) {
- m_label_mapname.set_text(std::string());
- m_label_author.set_text(std::string());
- m_label_description.set_text(std::string());
+ label_mapname_.set_text(std::string());
+ label_author_.set_text(std::string());
+ label_description_.set_text(std::string());
- m_ta_mapname.set_text(std::string());
- m_ta_author.set_text(std::string());
- m_ta_description.set_text(std::string());
+ ta_mapname_.set_text(std::string());
+ ta_author_.set_text(std::string());
+ ta_description_.set_text(std::string());
} else {
- m_is_tutorial? m_label_mapname.set_text(_("Tutorial:")) : m_label_mapname.set_text(_("Scenario:"));
- m_label_description.set_text(_("Description:"));
+ is_tutorial_? label_mapname_.set_text(_("Tutorial:")) : label_mapname_.set_text(_("Scenario:"));
+ label_description_.set_text(_("Description:"));
}
return has_selection;
}
@@ -401,7 +401,7 @@
void FullscreenMenuCampaignMapSelect::entry_selected() {
if (set_has_selection()) {
- const CampaignScenarioData& scenario_data = m_scenarios_data[m_table.get_selected()];
+ const CampaignScenarioData& scenario_data = scenarios_data_[table_.get_selected()];
campmapfile = scenario_data.path;
Widelands::Map map;
@@ -416,22 +416,22 @@
MapAuthorData authors(map.get_author());
- m_ta_author.set_text(authors.get_names());
- if (m_is_tutorial) {
- m_ta_author.set_tooltip(ngettext("The designer of this tutorial", "The designers of this tutorial",
+ ta_author_.set_text(authors.get_names());
+ if (is_tutorial_) {
+ ta_author_.set_tooltip(ngettext("The designer of this tutorial", "The designers of this tutorial",
authors.get_number()));
} else {
- m_ta_author.set_tooltip(ngettext("The designer of this scenario", "The designers of this scenario",
+ ta_author_.set_tooltip(ngettext("The designer of this scenario", "The designers of this scenario",
authors.get_number()));
}
- m_label_author.set_text(ngettext("Author:", "Authors:", authors.get_number()));
+ label_author_.set_text(ngettext("Author:", "Authors:", authors.get_number()));
{
i18n::Textdomain td("maps");
- m_ta_mapname.set_text(_(map.get_name()));
- m_ta_description.set_text(_(map.get_description()));
+ ta_mapname_.set_text(_(map.get_name()));
+ ta_description_.set_text(_(map.get_description()));
}
- m_ta_description.scroll_to_top();
+ ta_description_.scroll_to_top();
// The dummy scenario can't be played, so we disable the OK button.
if (campmapfile == "campaigns/dummy.wmf") {
@@ -449,14 +449,14 @@
// read in the campaign config
Profile* prof;
std::string campsection;
- if (m_is_tutorial) {
+ if (is_tutorial_) {
prof = new Profile("campaigns/tutorials.conf", nullptr, "maps");
// Set subtitle of the page
const std::string subtitle1 = _("Pick a tutorial from the list, then hit \"OK\".");
const std::string subtitle2 =
_("You can see a description of the currently selected tutorial on the right.");
- m_subtitle.set_text((boost::format("%s\n%s") % subtitle1 % subtitle2).str());
+ subtitle_.set_text((boost::format("%s\n%s") % subtitle1 % subtitle2).str());
// Get section of campaign-maps
campsection = "tutorials";
@@ -474,7 +474,7 @@
i18n::Textdomain td("maps");
campaign_name = _(global_s.get_string((boost::format("campname%u") % campaign).str().c_str()));
}
- m_subtitle.set_text((boost::format("%s — %s") % campaign_tribe % campaign_name).str());
+ subtitle_.set_text((boost::format("%s — %s") % campaign_tribe % campaign_name).str());
// Get section of campaign-maps
campsection = global_s.get_string((boost::format("campsect%u") % campaign).str().c_str());
@@ -491,15 +491,15 @@
// Add all visible entries to the list.
while (Section * const s = prof->get_section(mapsection)) {
- if (m_is_tutorial || c.get_bool(mapsection.c_str())) {
+ if (is_tutorial_ || c.get_bool(mapsection.c_str())) {
CampaignScenarioData scenario_data;
scenario_data.index = i + 1;
scenario_data.name = s->get_string("name", "");
scenario_data.path = s->get_string("path");
- m_scenarios_data.push_back(scenario_data);
+ scenarios_data_.push_back(scenario_data);
- UI::Table<uintptr_t>::EntryRecord& tableEntry = m_table.add(i);
+ UI::Table<uintptr_t>::EntryRecord& tableEntry = table_.add(i);
tableEntry.set_string(0, (boost::format("%u") % scenario_data.index).str());
tableEntry.set_picture(1, g_gr->images().get("pics/ls_wlmap.png"), scenario_data.name);
}
@@ -508,9 +508,9 @@
++i;
mapsection = campsection + (boost::format("%02i") % i).str();
}
- m_table.sort();
+ table_.sort();
- if (m_table.size()) {
- m_table.select(0);
+ if (table_.size()) {
+ table_.select(0);
}
}
=== modified file 'src/ui_fsmenu/campaign_select.h'
--- src/ui_fsmenu/campaign_select.h 2015-03-03 09:09:28 +0000
+++ src/ui_fsmenu/campaign_select.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2008, 2010-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
@@ -68,19 +68,19 @@
bool compare_difficulty(uint32_t, uint32_t);
- UI::Table<uintptr_t const> m_table;
-
- UI::Textarea m_title;
- UI::Textarea m_label_campname;
- UI::MultilineTextarea m_ta_campname;
- UI::Textarea m_label_tribename;
- UI::MultilineTextarea m_ta_tribename;
- UI::Textarea m_label_difficulty;
- UI::MultilineTextarea m_ta_difficulty;
- UI::Textarea m_label_description;
- UI::MultilineTextarea m_ta_description;
-
- std::vector<CampaignListData> m_campaigns_data;
+ UI::Table<uintptr_t const> table_;
+
+ UI::Textarea title_;
+ UI::Textarea label_campname_;
+ UI::MultilineTextarea ta_campname_;
+ UI::Textarea label_tribename_;
+ UI::MultilineTextarea ta_tribename_;
+ UI::Textarea label_difficulty_;
+ UI::MultilineTextarea ta_difficulty_;
+ UI::Textarea label_description_;
+ UI::MultilineTextarea ta_description_;
+
+ std::vector<CampaignListData> campaigns_data_;
/// Variables used for exchange between the two Campaign UIs and
/// Game::run_campaign
@@ -115,23 +115,23 @@
CampaignScenarioData() : index(0) {}
};
- UI::Table<uintptr_t const> m_table;
+ UI::Table<uintptr_t const> table_;
- UI::Textarea m_title;
- UI::MultilineTextarea m_subtitle;
- UI::Textarea m_label_mapname;
- UI::MultilineTextarea m_ta_mapname;
- UI::Textarea m_label_author;
- UI::MultilineTextarea m_ta_author;
- UI::Textarea m_label_description;
- UI::MultilineTextarea m_ta_description;
+ UI::Textarea title_;
+ UI::MultilineTextarea subtitle_;
+ UI::Textarea label_mapname_;
+ UI::MultilineTextarea ta_mapname_;
+ UI::Textarea label_author_;
+ UI::MultilineTextarea ta_author_;
+ UI::Textarea label_description_;
+ UI::MultilineTextarea ta_description_;
uint32_t campaign;
std::string campmapfile;
- std::vector<CampaignScenarioData> m_scenarios_data;
+ std::vector<CampaignScenarioData> scenarios_data_;
- bool m_is_tutorial;
+ bool is_tutorial_;
};
#endif // end of include guard: WL_UI_FSMENU_CAMPAIGN_SELECT_H
=== modified file 'src/ui_fsmenu/internet_lobby.cc'
--- src/ui_fsmenu/internet_lobby.cc 2015-11-09 08:15:31 +0000
+++ src/ui_fsmenu/internet_lobby.cc 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006-2009, 2011-2013, 2015 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
@@ -40,28 +40,28 @@
FullscreenMenuBase("internetmenu.jpg"),
// Values for alignment and size
- m_butx (get_w() * 13 / 40),
- m_butw (get_w() * 36 / 125),
- m_buth (get_h() * 19 / 400),
- m_lisw (get_w() * 623 / 1000),
- m_fs (fs_small()),
- m_prev_clientlist_len(1000),
- m_fn (ui_fn()),
+ butx_ (get_w() * 13 / 40),
+ butw_ (get_w() * 36 / 125),
+ buth_ (get_h() * 19 / 400),
+ lisw_ (get_w() * 623 / 1000),
+ fs_ (fs_small()),
+ prev_clientlist_len_(1000),
+ fn_ (ui_fn()),
// Text labels
title
(this,
get_w() / 2, get_h() / 20,
_("Metaserver Lobby"), UI::Align_HCenter),
- m_clients
+ clients_
(this,
get_w() * 4 / 125, get_h() * 15 / 100,
_("Clients online:")),
- m_opengames
+ opengames_
(this,
get_w() * 17 / 25, get_h() * 15 / 100,
_("List of games:")),
- m_servername
+ servername_
(this,
get_w() * 17 / 25, get_h() * 63 / 100,
_("Name of your server:")),
@@ -69,40 +69,40 @@
// Buttons
joingame
(this, "join_game",
- get_w() * 17 / 25, get_h() * 55 / 100, m_butw, m_buth,
+ get_w() * 17 / 25, get_h() * 55 / 100, butw_, buth_,
g_gr->images().get("pics/but1.png"),
_("Join this game"), std::string(), false, false),
hostgame
(this, "host_game",
- get_w() * 17 / 25, get_h() * 81 / 100, m_butw, m_buth,
+ get_w() * 17 / 25, get_h() * 81 / 100, butw_, buth_,
g_gr->images().get("pics/but1.png"),
_("Open a new game"), std::string(), true, false),
back
(this, "back",
- get_w() * 17 / 25, get_h() * 90 / 100, m_butw, m_buth,
+ get_w() * 17 / 25, get_h() * 90 / 100, butw_, buth_,
g_gr->images().get("pics/but0.png"),
_("Back"), std::string(), true, false),
// Edit boxes
servername
- (this, get_w() * 17 / 25, get_h() * 68 / 100, m_butw, m_buth,
+ (this, get_w() * 17 / 25, get_h() * 68 / 100, butw_, buth_,
g_gr->images().get("pics/but2.png")),
// List
clientsonline
(this,
get_w() * 4 / 125, get_h() / 5,
- m_lisw, get_h() * 3 / 10),
+ lisw_, get_h() * 3 / 10),
opengames
(this,
get_w() * 17 / 25, get_h() / 5,
- m_butw, get_h() * 7 / 20),
+ butw_, get_h() * 7 / 20),
// The chat UI
chat
(this,
get_w() * 4 / 125, get_h() * 51 / 100,
- m_lisw, get_h() * 44 / 100,
+ lisw_, get_h() * 44 / 100,
InternetGaming::ref()),
// Login information
@@ -119,15 +119,15 @@
// Set the texts and style of UI elements
Section & s = g_options.pull_section("global"); // for playername
- title .set_font(m_fn, fs_big(), UI_FONT_CLR_FG);
- m_opengames .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
- m_clients .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
- m_servername.set_font(m_fn, m_fs, UI_FONT_CLR_FG);
+ title .set_font(fn_, fs_big(), UI_FONT_CLR_FG);
+ opengames_ .set_font(fn_, fs_, UI_FONT_CLR_FG);
+ clients_ .set_font(fn_, fs_, UI_FONT_CLR_FG);
+ servername_.set_font(fn_, fs_, UI_FONT_CLR_FG);
std::string server = s.get_string("servername", "");
servername .set_text (server);
servername .changed.connect
(boost::bind(&FullscreenMenuInternetLobby::change_servername, this));
- servername .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
+ servername .set_font(fn_, fs_, UI_FONT_CLR_FG);
// prepare the lists
std::string t_tip = (boost::format("%s%s%s%s%s%s%s%s%s%s")
@@ -143,14 +143,14 @@
% "</p></rt>").str();
clientsonline .add_column(22, "*", t_tip);
/** TRANSLATORS: Player Name */
- clientsonline .add_column((m_lisw - 22) * 3 / 8, pgettext("player", "Name"));
- clientsonline .add_column((m_lisw - 22) * 2 / 8, _("Points"));
- clientsonline .add_column((m_lisw - 22) * 3 / 8, _("Game"));
+ clientsonline .add_column((lisw_ - 22) * 3 / 8, pgettext("player", "Name"));
+ clientsonline .add_column((lisw_ - 22) * 2 / 8, _("Points"));
+ clientsonline .add_column((lisw_ - 22) * 3 / 8, _("Game"));
clientsonline.set_column_compare
(0, boost::bind(&FullscreenMenuInternetLobby::compare_clienttype, this, _1, _2));
clientsonline .double_clicked.connect
(boost::bind(&FullscreenMenuInternetLobby::client_doubleclicked, this, _1));
- opengames .set_font(m_fn, m_fs);
+ opengames .set_font(fn_, fs_);
opengames .selected.connect
(boost::bind(&FullscreenMenuInternetLobby::server_selected, this));
opengames .double_clicked.connect
@@ -293,11 +293,11 @@
}
// If a new player joins the lobby, play a sound.
- if (clients.size() != m_prev_clientlist_len)
+ if (clients.size() != prev_clientlist_len_)
{
- if (clients.size() > m_prev_clientlist_len && !InternetGaming::ref().sound_off())
+ if (clients.size() > prev_clientlist_len_ && !InternetGaming::ref().sound_off())
play_new_chat_member();
- m_prev_clientlist_len = clients.size();
+ prev_clientlist_len_ = clients.size();
}
}
=== modified file 'src/ui_fsmenu/internet_lobby.h'
--- src/ui_fsmenu/internet_lobby.h 2015-10-02 16:32:51 +0000
+++ src/ui_fsmenu/internet_lobby.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006-2009, 2011-2012 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
@@ -44,15 +44,15 @@
void clicked_ok() override;
private:
- uint32_t m_butx;
- uint32_t m_butw;
- uint32_t m_buth;
- uint32_t m_lisw;
- uint32_t m_fs;
- uint32_t m_prev_clientlist_len;
- std::string m_fn;
- UI::Textarea title, m_clients, m_opengames;
- UI::Textarea m_servername;
+ uint32_t butx_;
+ uint32_t butw_;
+ uint32_t buth_;
+ uint32_t lisw_;
+ uint32_t fs_;
+ uint32_t prev_clientlist_len_;
+ std::string fn_;
+ UI::Textarea title, clients_, opengames_;
+ UI::Textarea servername_;
UI::Button joingame, hostgame, back;
UI::EditBox servername;
UI::Table<const InternetClient * const> clientsonline;
=== modified file 'src/ui_fsmenu/intro.cc'
--- src/ui_fsmenu/intro.cc 2015-08-06 17:14:34 +0000
+++ src/ui_fsmenu/intro.cc 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 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
@@ -26,12 +26,12 @@
: FullscreenMenuBase("splash.jpg"),
// Text area
-m_message
+message_
(this,
get_w() / 2, get_h() * 19 / 20,
_("Press any key or click to continue ..."), UI::Align_HCenter)
{
- m_message.set_font(ui_fn(), fs_small() * 6 / 5, RGBColor(192, 192, 128));
+ message_.set_font(ui_fn(), fs_small() * 6 / 5, RGBColor(192, 192, 128));
}
bool FullscreenMenuIntro::handle_mousepress (uint8_t, int32_t, int32_t)
=== modified file 'src/ui_fsmenu/intro.h'
--- src/ui_fsmenu/intro.h 2014-11-13 08:39:14 +0000
+++ src/ui_fsmenu/intro.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 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,7 +37,7 @@
bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
bool handle_key(bool down, SDL_Keysym) override;
private:
- UI::Textarea m_message;
+ UI::Textarea message_;
};
#endif // end of include guard: WL_UI_FSMENU_INTRO_H
=== modified file 'src/ui_fsmenu/launch_mpg.cc'
--- src/ui_fsmenu/launch_mpg.cc 2016-01-24 09:20:30 +0000
+++ src/ui_fsmenu/launch_mpg.cc 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006-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
@@ -52,7 +52,7 @@
:
/** TRANSLATORS: Dialog box title for selecting between map or saved game for new multiplayer game */
Window(parent, "selection_window", 0, 0, w, h, _("Please select")),
- m_ctrl(gc)
+ ctrl_(gc)
{
center_to_parent();
@@ -94,15 +94,15 @@
void think() override {
- if (m_ctrl)
- m_ctrl->think();
+ if (ctrl_)
+ ctrl_->think();
}
void pressedButton(FullscreenMenuBase::MenuTarget i) {
end_modal<FullscreenMenuBase::MenuTarget>(i);
}
private:
- GameController * m_ctrl;
+ GameController * ctrl_;
};
FullscreenMenuLaunchMPG::FullscreenMenuLaunchMPG
@@ -111,141 +111,141 @@
FullscreenMenuBase("launchMPGmenu.jpg"),
// Values for alignment and size
- m_butw (get_w() / 4),
- m_buth (get_h() * 9 / 200),
- m_fs (fs_small()),
- m_fn (ui_fn()),
+ butw_ (get_w() / 4),
+ buth_ (get_h() * 9 / 200),
+ fs_ (fs_small()),
+ fn_ (ui_fn()),
// TODO(GunChleoc): We still need to use these consistently. Just getting them in for now
// so we can have the SuggestedTeamsBox
- m_padding(4),
- m_indent(10),
- m_label_height(20),
- m_right_column_x(get_w() * 37 / 50),
+ padding_(4),
+ indent_(10),
+ label_height_(20),
+ right_column_x_(get_w() * 37 / 50),
// Buttons
- m_change_map_or_save
+ change_map_or_save_
(this, "change_map_or_save",
- m_right_column_x + m_butw - m_buth, get_h() * 3 / 20, m_buth, m_buth,
+ right_column_x_ + butw_ - buth_, get_h() * 3 / 20, buth_, buth_,
g_gr->images().get("pics/but1.png"),
g_gr->images().get("pics/menu_toggle_minimap.png"),
_("Change map or saved game"), false, false),
- m_ok
+ ok_
(this, "ok",
- m_right_column_x, get_h() * 12 / 20 - 2 * m_label_height, m_butw, m_buth,
+ right_column_x_, get_h() * 12 / 20 - 2 * label_height_, butw_, buth_,
g_gr->images().get("pics/but2.png"),
_("Start game"), std::string(), false, false),
- m_back
+ back_
(this, "back",
- m_right_column_x, get_h() * 218 / 240, m_butw, m_buth,
+ right_column_x_, get_h() * 218 / 240, butw_, buth_,
g_gr->images().get("pics/but0.png"),
_("Back"), std::string(), true, false),
- m_wincondition
+ wincondition_
(this, "win_condition",
- m_right_column_x, get_h() * 11 / 20 - 2 * m_label_height, m_butw, m_buth,
+ right_column_x_, get_h() * 11 / 20 - 2 * label_height_, butw_, buth_,
g_gr->images().get("pics/but1.png"),
"", std::string(), false, false),
- m_help_button
+ help_button_
(this, "help",
- m_right_column_x + m_butw - m_buth, get_h() / 100, m_buth, m_buth,
+ right_column_x_ + butw_ - buth_, get_h() / 100, buth_, buth_,
g_gr->images().get("pics/but1.png"),
g_gr->images().get("pics/menu_help.png"),
_("Show the help window"), true, false),
// Text labels
- m_title
+ title_
(this,
get_w() / 2, get_h() / 25,
_("Multiplayer Game Setup"), UI::Align_HCenter),
- m_mapname
+ mapname_
(this,
- m_right_column_x, get_h() * 3 / 20,
+ right_column_x_, get_h() * 3 / 20,
std::string()),
- m_clients
+ clients_
(this,
// (get_w() * 57 / 80) is the width of the MultiPlayerSetupGroup
get_w() / 50, get_h() / 10, (get_w() * 57 / 80) / 3, get_h() / 10,
_("Clients"), UI::Align_HCenter),
- m_players
+ players_
(this,
get_w() / 50 + (get_w() * 57 / 80) * 6 / 15, get_h() / 10, (get_w() * 57 / 80) * 9 / 15, get_h() / 10,
_("Players"), UI::Align_HCenter),
- m_map
+ map_
(this,
- m_right_column_x, get_h() / 10, m_butw, get_h() / 10,
+ right_column_x_, get_h() / 10, butw_, get_h() / 10,
_("Map"), UI::Align_HCenter),
- m_wincondition_type
+ wincondition_type_
(this,
- m_right_column_x + (m_butw / 2), get_h() * 10 / 20 - 1.5 * m_label_height,
+ right_column_x_ + (butw_ / 2), get_h() * 10 / 20 - 1.5 * label_height_,
_("Type of game"), UI::Align_HCenter),
- m_map_info(this, m_right_column_x, get_h() * 2 / 10, m_butw, get_h() * 23 / 80 - 2 * m_label_height),
- m_client_info(this, m_right_column_x, get_h() * 13 / 20 - 2 * m_label_height, m_butw, 2 * m_label_height),
- m_help(nullptr),
+ map_info_(this, right_column_x_, get_h() * 2 / 10, butw_, get_h() * 23 / 80 - 2 * label_height_),
+ client_info_(this, right_column_x_, get_h() * 13 / 20 - 2 * label_height_, butw_, 2 * label_height_),
+ help_(nullptr),
// Variables and objects used in the menu
- m_settings (settings),
- m_ctrl (ctrl),
- m_chat (nullptr)
+ settings_ (settings),
+ ctrl_ (ctrl),
+ chat_ (nullptr)
{
- m_change_map_or_save.sigclicked.connect
+ change_map_or_save_.sigclicked.connect
(boost::bind
(&FullscreenMenuLaunchMPG::change_map_or_save, boost::ref(*this)));
- m_ok.sigclicked.connect(boost::bind(&FullscreenMenuLaunchMPG::clicked_ok, boost::ref(*this)));
- m_back.sigclicked.connect(boost::bind(&FullscreenMenuLaunchMPG::clicked_back, boost::ref(*this)));
- m_wincondition.sigclicked.connect
+ ok_.sigclicked.connect(boost::bind(&FullscreenMenuLaunchMPG::clicked_ok, boost::ref(*this)));
+ back_.sigclicked.connect(boost::bind(&FullscreenMenuLaunchMPG::clicked_back, boost::ref(*this)));
+ wincondition_.sigclicked.connect
(boost::bind
(&FullscreenMenuLaunchMPG::win_condition_clicked,
boost::ref(*this)));
- m_help_button.sigclicked.connect
+ help_button_.sigclicked.connect
(boost::bind
(&FullscreenMenuLaunchMPG::help_clicked,
boost::ref(*this)));
- m_lua = new LuaInterface();
+ lua_ = new LuaInterface();
win_condition_clicked();
- m_title .set_font(m_fn, fs_big(), UI_FONT_CLR_FG);
- m_mapname .set_font(m_fn, m_fs, RGBColor(255, 255, 127));
- m_clients .set_font(m_fn, m_fs, RGBColor(0, 255, 0));
- m_players .set_font(m_fn, m_fs, RGBColor(0, 255, 0));
- m_map .set_font(m_fn, m_fs, RGBColor(0, 255, 0));
-
- m_mapname .set_text(_("(no map)"));
- m_map_info.set_text(_("The host has not yet selected a map or saved game."));
-
- m_mpsg =
+ title_ .set_font(fn_, fs_big(), UI_FONT_CLR_FG);
+ mapname_ .set_font(fn_, fs_, RGBColor(255, 255, 127));
+ clients_ .set_font(fn_, fs_, RGBColor(0, 255, 0));
+ players_ .set_font(fn_, fs_, RGBColor(0, 255, 0));
+ map_ .set_font(fn_, fs_, RGBColor(0, 255, 0));
+
+ mapname_ .set_text(_("(no map)"));
+ map_info_.set_text(_("The host has not yet selected a map or saved game."));
+
+ mpsg_ =
new MultiPlayerSetupGroup
(this,
get_w() / 50, get_h() / 8, get_w() * 57 / 80, get_h() / 2,
- settings, m_butw, m_buth, m_fn, m_fs);
+ settings, butw_, buth_, fn_, fs_);
// If we are the host, open the map or save selection menu at startup
- if (m_settings->settings().usernum == 0 && m_settings->settings().mapname.empty()) {
+ if (settings_->settings().usernum == 0 && settings_->settings().mapname.empty()) {
change_map_or_save();
// Try to associate the host with the first player
- if (!m_settings->settings().players.empty()) {
- m_settings->set_player_number(0);
+ if (!settings_->settings().players.empty()) {
+ settings_->set_player_number(0);
}
}
// Y coordinate will be set later, when we know how high this box will get.
- m_suggested_teams_box = new UI::SuggestedTeamsBox
- (this, m_right_column_x, 0, UI::Box::Vertical,
- m_padding, m_indent, m_label_height,
- get_w() - m_right_column_x, 4 * m_label_height);
+ suggested_teams_box_ = new UI::SuggestedTeamsBox
+ (this, right_column_x_, 0, UI::Box::Vertical,
+ padding_, indent_, label_height_,
+ get_w() - right_column_x_, 4 * label_height_);
}
FullscreenMenuLaunchMPG::~FullscreenMenuLaunchMPG() {
- delete m_lua;
- delete m_mpsg;
- delete m_chat;
+ delete lua_;
+ delete mpsg_;
+ delete chat_;
}
void FullscreenMenuLaunchMPG::think()
{
- if (m_ctrl)
- m_ctrl->think();
+ if (ctrl_)
+ ctrl_->think();
refresh();
}
@@ -258,8 +258,8 @@
*/
void FullscreenMenuLaunchMPG::set_chat_provider(ChatProvider & chat)
{
- delete m_chat;
- m_chat = new GameChatPanel
+ delete chat_;
+ chat_ = new GameChatPanel
(this, get_w() / 50, get_h() * 13 / 20, get_w() * 57 / 80, get_h() * 3 / 10, chat);
}
@@ -277,7 +277,7 @@
*/
void FullscreenMenuLaunchMPG::win_condition_clicked()
{
- m_settings->next_win_condition();
+ settings_->next_win_condition();
win_condition_update();
}
@@ -285,14 +285,14 @@
* update win conditions information
*/
void FullscreenMenuLaunchMPG::win_condition_update() {
- if (m_settings->settings().scenario) {
- m_wincondition.set_title(_("Scenario"));
- m_wincondition.set_tooltip
+ if (settings_->settings().scenario) {
+ wincondition_.set_title(_("Scenario"));
+ wincondition_.set_tooltip
(_("Win condition is set through the scenario"));
- } else if (m_settings->settings().savegame) {
+ } else if (settings_->settings().savegame) {
/** Translators: This is a game type */
- m_wincondition.set_title(_("Saved Game"));
- m_wincondition.set_tooltip
+ wincondition_.set_title(_("Saved Game"));
+ wincondition_.set_tooltip
(_("The game is a saved game – the win condition was set before."));
} else {
win_condition_load();
@@ -306,14 +306,14 @@
void FullscreenMenuLaunchMPG::win_condition_load() {
bool is_usable = true;
try {
- std::unique_ptr<LuaTable> t = m_lua->run_script(m_settings->get_win_condition_script());
+ std::unique_ptr<LuaTable> t = lua_->run_script(settings_->get_win_condition_script());
t->do_not_warn_about_unaccessed_keys();
// Skip this win condition if the map doesn't have all the required tags
- if (t->has_key("map_tags") && !m_settings->settings().mapfilename.empty()) {
+ if (t->has_key("map_tags") && !settings_->settings().mapfilename.empty()) {
Widelands::Map map;
std::unique_ptr<Widelands::MapLoader> ml =
- map.get_correct_loader(m_settings->settings().mapfilename);
+ map.get_correct_loader(settings_->settings().mapfilename);
ml->preload_map(true);
for (const std::string map_tag : t->get_table("map_tags")->array_entries<std::string>()) {
if (!map.has_tag(map_tag)) {
@@ -328,9 +328,9 @@
{
i18n::Textdomain td("win_conditions");
- m_wincondition.set_title(_(name));
+ wincondition_.set_title(_(name));
}
- m_wincondition.set_tooltip(descr.c_str());
+ wincondition_.set_tooltip(descr.c_str());
} catch (LuaTableKeyError &) {
// might be that this is not a win condition after all.
is_usable = false;
@@ -343,7 +343,7 @@
/// Opens a popup window to select a map or saved game
void FullscreenMenuLaunchMPG::change_map_or_save() {
MapOrSaveSelectionWindow selection_window
- (this, m_ctrl, get_w() / 3, get_h() / 4);
+ (this, ctrl_, get_w() / 3, get_h() / 4);
auto result = selection_window.run<FullscreenMenuBase::MenuTarget>();
assert(result == FullscreenMenuBase::MenuTarget::kNormalGame ||
result == FullscreenMenuBase::MenuTarget::kScenarioGame ||
@@ -359,30 +359,30 @@
* Select a map and send all information to the user interface.
*/
void FullscreenMenuLaunchMPG::select_map() {
- if (!m_settings->can_change_map())
+ if (!settings_->can_change_map())
return;
- FullscreenMenuMapSelect msm(m_settings, m_ctrl);
+ FullscreenMenuMapSelect msm(settings_, ctrl_);
FullscreenMenuBase::MenuTarget code = msm.run<FullscreenMenuBase::MenuTarget>();
if (code == FullscreenMenuBase::MenuTarget::kBack) {
// Set scenario = false, else the menu might crash when back is pressed.
- m_settings->set_scenario(false);
+ settings_->set_scenario(false);
return;
}
- m_settings->set_scenario(code == FullscreenMenuBase::MenuTarget::kScenarioGame);
+ settings_->set_scenario(code == FullscreenMenuBase::MenuTarget::kScenarioGame);
const MapData & mapdata = *msm.get_map();
- m_nr_players = mapdata.nrplayers;
+ nr_players_ = mapdata.nrplayers;
// If the same map was selected again, maybe the state of the "scenario" check box was changed
// So we should recheck all map predefined values,
- // which is done in refresh(), if m_filename_proof is different to settings.mapfilename -> dummy rename
- if (mapdata.filename == m_filename_proof)
- m_filename_proof = m_filename_proof + "new";
+ // which is done in refresh(), if filename_proof_ is different to settings.mapfilename -> dummy rename
+ if (mapdata.filename == filename_proof_)
+ filename_proof_ = filename_proof_ + "new";
- m_settings->set_map(mapdata.name, mapdata.filename, m_nr_players);
+ settings_->set_map(mapdata.name, mapdata.filename, nr_players_);
}
/**
@@ -390,11 +390,11 @@
* interface.
*/
void FullscreenMenuLaunchMPG::select_saved_game() {
- if (!m_settings->can_change_map())
+ if (!settings_->can_change_map())
return;
Widelands::Game game; // The place all data is saved to.
- FullscreenMenuLoadGame lsgm(game, m_settings, m_ctrl);
+ FullscreenMenuLoadGame lsgm(game, settings_, ctrl_);
FullscreenMenuBase::MenuTarget code = lsgm.run<FullscreenMenuBase::MenuTarget>();
if (code == FullscreenMenuBase::MenuTarget::kBack) {
@@ -402,7 +402,7 @@
}
// Saved game was selected - therefore not a scenario
- m_settings->set_scenario(false);
+ settings_->set_scenario(false);
std::string filename = lsgm.filename();
@@ -414,9 +414,9 @@
Section & s = prof.get_safe_section("global");
std::string mapname = s.get_safe_string("name");
- m_nr_players = s.get_safe_int("nr_players");
+ nr_players_ = s.get_safe_int("nr_players");
- m_settings->set_map(mapname, filename, m_nr_players, true);
+ settings_->set_map(mapname, filename, nr_players_, true);
// Check for sendability
if (g_fs->is_directory(filename)) {
@@ -434,12 +434,12 @@
warning.run<UI::Panel::Returncodes>();
}
} else {
- if (!m_settings || m_settings->settings().saved_games.empty())
+ if (!settings_ || settings_->settings().saved_games.empty())
throw wexception("A file was selected, that is not available to the client");
// this file is obviously a file from the dedicated server's saved games pool not available locally.
- for (uint32_t i = 0; i < m_settings->settings().saved_games.size(); ++i)
- if (m_settings->settings().saved_games.at(i).path == filename) {
- m_settings->set_map(filename, filename, m_settings->settings().saved_games.at(i).players, true);
+ for (uint32_t i = 0; i < settings_->settings().saved_games.size(); ++i)
+ if (settings_->settings().saved_games.at(i).path == filename) {
+ settings_->set_map(filename, filename, settings_->settings().saved_games.at(i).players, true);
return;
}
throw wexception("The selected file could not be found in the pool of dedicated saved games.");
@@ -451,7 +451,7 @@
*/
void FullscreenMenuLaunchMPG::clicked_ok()
{
- if (!g_fs->file_exists(m_settings->settings().mapfilename))
+ if (!g_fs->file_exists(settings_->settings().mapfilename))
throw WLWarning
(_("File not found"),
_
@@ -462,8 +462,8 @@
"a file that you do not own. Normally, such a file should be sent "
"from the host to you, but perhaps the transfer was not yet "
"finished!?!"),
- m_settings->settings().mapfilename.c_str());
- if (m_settings->can_launch())
+ settings_->settings().mapfilename.c_str());
+ if (settings_->can_launch())
end_modal<FullscreenMenuBase::MenuTarget>(FullscreenMenuBase::MenuTarget::kNormalGame);
}
@@ -474,20 +474,20 @@
*/
void FullscreenMenuLaunchMPG::refresh()
{
- const GameSettings & settings = m_settings->settings();
+ const GameSettings & settings = settings_->settings();
- if (settings.mapfilename != m_filename_proof) {
+ if (settings.mapfilename != filename_proof_) {
if (!g_fs->file_exists(settings.mapfilename)) {
- m_client_info.set_color(UI_FONT_CLR_WARNING);
- m_client_info.set_text
+ client_info_.set_color(UI_FONT_CLR_WARNING);
+ client_info_.set_text
(_("The selected file can not be found. If it is not automatically "
"transferred to you, please write to the host about this problem."));
} else {
// Reset font color
- m_client_info.set_color(UI_FONT_CLR_FG);
+ client_info_.set_color(UI_FONT_CLR_FG);
// Update local nr of players - needed for the client UI
- m_nr_players = settings.players.size();
+ nr_players_ = settings.players.size();
// Care about the newly selected file. This has to be done here and not
// after selection of a new map / saved game, as the clients user
@@ -505,7 +505,7 @@
//It will also translate 'false-positively' on any user-made map which shares a name with
//the official maps, but this should not be a problem to worry about.
i18n::Textdomain td("maps");
- m_mapname.set_text(_(settings.mapname));
+ mapname_.set_text(_(settings.mapname));
}
} else {
// Write client infos
@@ -513,21 +513,21 @@
(settings.playernum >= 0) && (settings.playernum < MAX_PLAYERS) ?
(boost::format(_("You are Player %i.")) % (settings.playernum + 1)).str() :
_("You are a spectator.");
- m_client_info.set_text(client_info);
+ client_info_.set_text(client_info);
}
- m_ok.set_enabled(m_settings->can_launch());
-
- m_change_map_or_save.set_enabled(m_settings->can_change_map());
- m_change_map_or_save.set_visible(m_settings->can_change_map());
-
- m_wincondition.set_enabled
- (m_settings->can_change_map() && !settings.savegame && !settings.scenario);
+ ok_.set_enabled(settings_->can_launch());
+
+ change_map_or_save_.set_enabled(settings_->can_change_map());
+ change_map_or_save_.set_visible(settings_->can_change_map());
+
+ wincondition_.set_enabled
+ (settings_->can_change_map() && !settings.savegame && !settings.scenario);
win_condition_update();
// Update the multi player setup group
- m_mpsg->refresh();
+ mpsg_->refresh();
}
/**
@@ -537,7 +537,7 @@
*/
void FullscreenMenuLaunchMPG::set_scenario_values()
{
- const GameSettings & settings = m_settings->settings();
+ const GameSettings & settings = settings_->settings();
if (settings.mapfilename.empty())
throw wexception
("settings()->scenario was set to true, but no map is available");
@@ -547,18 +547,18 @@
ml->preload_map(true);
Widelands::PlayerNumber const nrplayers = map.get_nrplayers();
for (uint8_t i = 0; i < nrplayers; ++i) {
- m_settings->set_player_tribe (i, map.get_scenario_player_tribe (i + 1));
- m_settings->set_player_closeable(i, map.get_scenario_player_closeable(i + 1));
+ settings_->set_player_tribe (i, map.get_scenario_player_tribe (i + 1));
+ settings_->set_player_closeable(i, map.get_scenario_player_closeable(i + 1));
std::string ai(map.get_scenario_player_ai(i + 1));
if (!ai.empty()) {
- m_settings->set_player_state(i, PlayerSettings::stateComputer);
- m_settings->set_player_ai (i, ai);
+ settings_->set_player_state(i, PlayerSettings::stateComputer);
+ settings_->set_player_ai (i, ai);
} else if
(settings.players.at(i).state != PlayerSettings::stateHuman
&&
settings.players.at(i).state != PlayerSettings::stateOpen)
{
- m_settings->set_player_state(i, PlayerSettings::stateOpen);
+ settings_->set_player_state(i, PlayerSettings::stateOpen);
}
}
}
@@ -568,7 +568,7 @@
*/
void FullscreenMenuLaunchMPG::load_previous_playerdata()
{
- std::unique_ptr<FileSystem> l_fs(g_fs->make_sub_file_system(m_settings->settings().mapfilename.c_str()));
+ std::unique_ptr<FileSystem> l_fs(g_fs->make_sub_file_system(settings_->settings().mapfilename.c_str()));
Profile prof;
prof.read("map/player_names", nullptr, *l_fs);
std::string infotext = _("Saved players are:");
@@ -577,7 +577,7 @@
std::string player_save_ai [MAX_PLAYERS];
uint8_t i = 1;
- for (; i <= m_nr_players; ++i) {
+ for (; i <= nr_players_; ++i) {
infotext += "\n* ";
Section & s = prof.get_safe_section((boost::format("player_%u")
% static_cast<unsigned int>(i)).str());
@@ -592,28 +592,28 @@
infotext += ":\n ";
infotext += closed_string;
// Close the player
- m_settings->set_player_state(i - 1, PlayerSettings::stateClosed);
+ settings_->set_player_state(i - 1, PlayerSettings::stateClosed);
continue; // if tribe is empty, the player does not exist
}
// Set team to "none" - to get the real team, we would need to load the savegame completely
// Do we want that? No! So we just reset teams to not confuse the clients.
- m_settings->set_player_team(i - 1, 0);
+ settings_->set_player_team(i - 1, 0);
if (player_save_ai[i - 1].empty()) {
// Assure that player is open
- if (m_settings->settings().players.at(i - 1).state != PlayerSettings::stateHuman)
- m_settings->set_player_state(i - 1, PlayerSettings::stateOpen);
+ if (settings_->settings().players.at(i - 1).state != PlayerSettings::stateHuman)
+ settings_->set_player_state(i - 1, PlayerSettings::stateOpen);
} else {
- m_settings->set_player_state(i - 1, PlayerSettings::stateComputer);
- m_settings->set_player_ai(i - 1, player_save_ai[i - 1]);
+ settings_->set_player_state(i - 1, PlayerSettings::stateComputer);
+ settings_->set_player_ai(i - 1, player_save_ai[i - 1]);
}
// Set player's tribe
- m_settings->set_player_tribe(i - 1, player_save_tribe[i - 1]);
+ settings_->set_player_tribe(i - 1, player_save_tribe[i - 1]);
// get translated tribename
- for (const TribeBasicInfo& tribeinfo : m_settings->settings().tribes) {
+ for (const TribeBasicInfo& tribeinfo : settings_->settings().tribes) {
if (tribeinfo.name == player_save_tribe[i - 1]) {
i18n::Textdomain td("tribes"); // for translated initialisation
player_save_tribe[i - 1] = _(tribeinfo.descname);
@@ -641,8 +641,8 @@
}
}
}
- m_map_info.set_text(infotext);
- m_filename_proof = m_settings->settings().mapfilename;
+ map_info_.set_text(infotext);
+ filename_proof_ = settings_->settings().mapfilename;
}
/**
@@ -652,12 +652,12 @@
{
Widelands::Map map; // MapLoader needs a place to put its preload data
- std::unique_ptr<Widelands::MapLoader> ml = map.get_correct_loader(m_settings->settings().mapfilename);
+ std::unique_ptr<Widelands::MapLoader> ml = map.get_correct_loader(settings_->settings().mapfilename);
if (!ml) {
throw WLWarning("There was an error!", "The map file seems to be invalid!");
}
- map.set_filename(m_settings->settings().mapfilename);
+ map.set_filename(settings_->settings().mapfilename);
{
i18n::Textdomain td("maps");
ml->preload_map(true);
@@ -667,31 +667,31 @@
infotext += std::string(_("Map details:")) + "\n";
infotext += std::string("• ") + (boost::format(_("Size: %1$u x %2$u"))
% map.get_width() % map.get_height()).str() + "\n";
- infotext += std::string("• ") + (boost::format(ngettext("%u Player", "%u Players", m_nr_players))
- % m_nr_players).str() + "\n";
- if (m_settings->settings().scenario)
+ infotext += std::string("• ") + (boost::format(ngettext("%u Player", "%u Players", nr_players_))
+ % nr_players_).str() + "\n";
+ if (settings_->settings().scenario)
infotext += std::string("• ") + (boost::format(_("Scenario mode selected"))).str() + "\n";
infotext += "\n";
infotext += map.get_description();
infotext += "\n";
infotext += map.get_hint();
- m_map_info.set_text(infotext);
- m_filename_proof = m_settings->settings().mapfilename;
+ map_info_.set_text(infotext);
+ filename_proof_ = settings_->settings().mapfilename;
- m_suggested_teams_box->hide();
- m_suggested_teams_box->show(map.get_suggested_teams());
- m_suggested_teams_box->set_pos(
- Point(m_suggested_teams_box->get_x(),
- m_back.get_y() - m_padding - m_suggested_teams_box->get_h() - m_padding));
+ suggested_teams_box_->hide();
+ suggested_teams_box_->show(map.get_suggested_teams());
+ suggested_teams_box_->set_pos(
+ Point(suggested_teams_box_->get_x(),
+ back_.get_y() - padding_ - suggested_teams_box_->get_h() - padding_));
}
/// Show help
void FullscreenMenuLaunchMPG::help_clicked() {
- if (m_help) {
- m_help->set_visible(true);
+ if (help_) {
+ help_->set_visible(true);
} else {
- m_help.reset(new UI::FullscreenHelpWindow(this, m_lua, "scripting/widelands/multiplayer_help.lua",
+ help_.reset(new UI::FullscreenHelpWindow(this, lua_, "scripting/widelands/multiplayer_help.lua",
/** TRANSLATORS: This is a heading for a help window */
_("Multiplayer Game Setup")));
}
=== modified file 'src/ui_fsmenu/launch_mpg.h'
--- src/ui_fsmenu/launch_mpg.h 2015-11-18 08:41:27 +0000
+++ src/ui_fsmenu/launch_mpg.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 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
@@ -59,7 +59,7 @@
void clicked_back() override;
private:
- LuaInterface * m_lua;
+ LuaInterface * lua_;
void change_map_or_save();
void select_map();
@@ -72,30 +72,30 @@
void load_map_info();
void help_clicked();
- uint32_t m_butw;
- uint32_t m_buth;
- uint32_t m_fs;
- std::string m_fn;
+ uint32_t butw_;
+ uint32_t buth_;
+ uint32_t fs_;
+ std::string fn_;
// TODO(GunChleoc): We still need to use these consistently. Just getting them in for now
// so we can have the SuggestedTeamsBox
- int32_t const m_padding; // Common padding between panels
- int32_t const m_indent; // Indent for elements below labels
- int32_t const m_label_height;
- int32_t const m_right_column_x;
-
- UI::Button m_change_map_or_save, m_ok, m_back, m_wincondition;
- UI::Button m_help_button;
- UI::Textarea m_title, m_mapname, m_clients, m_players, m_map, m_wincondition_type;
- UI::MultilineTextarea m_map_info, m_client_info;
- std::unique_ptr<UI::FullscreenHelpWindow> m_help;
- GameSettingsProvider * m_settings;
- GameController * m_ctrl;
- GameChatPanel * m_chat;
- MultiPlayerSetupGroup * m_mpsg;
- std::string m_filename_proof; // local variable to check state
- int16_t m_nr_players;
-
- UI::SuggestedTeamsBox* m_suggested_teams_box;
+ int32_t const padding_; // Common padding between panels
+ int32_t const indent_; // Indent for elements below labels
+ int32_t const label_height_;
+ int32_t const right_column_x_;
+
+ UI::Button change_map_or_save_, ok_, back_, wincondition_;
+ UI::Button help_button_;
+ UI::Textarea title_, mapname_, clients_, players_, map_, wincondition_type_;
+ UI::MultilineTextarea map_info_, client_info_;
+ std::unique_ptr<UI::FullscreenHelpWindow> help_;
+ GameSettingsProvider * settings_;
+ GameController * ctrl_;
+ GameChatPanel * chat_;
+ MultiPlayerSetupGroup * mpsg_;
+ std::string filename_proof_; // local variable to check state
+ int16_t nr_players_;
+
+ UI::SuggestedTeamsBox* suggested_teams_box_;
};
=== modified file 'src/ui_fsmenu/launch_spg.cc'
--- src/ui_fsmenu/launch_spg.cc 2015-11-29 09:43:15 +0000
+++ src/ui_fsmenu/launch_spg.cc 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006-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
@@ -51,121 +51,121 @@
FullscreenMenuBase("ui_fsmenu.jpg"),
// Values for alignment and size
- m_butw (get_w() / 4),
- m_buth (get_h() * 9 / 200),
+ butw_ (get_w() / 4),
+ buth_ (get_h() * 9 / 200),
// Buttons
- m_select_map
+ select_map_
(this, "select_map",
- get_w() * 7 / 10, get_h() * 3 / 10, m_butw, m_buth,
+ get_w() * 7 / 10, get_h() * 3 / 10, butw_, buth_,
g_gr->images().get("pics/but1.png"),
_("Select map"), std::string(), false, false),
- m_wincondition
+ wincondition_
(this, "win_condition",
- get_w() * 7 / 10, get_h() * 4 / 10 + m_buth, m_butw, m_buth,
+ get_w() * 7 / 10, get_h() * 4 / 10 + buth_, butw_, buth_,
g_gr->images().get("pics/but1.png"),
"", std::string(), false, false),
- m_back
+ back_
(this, "back",
- get_w() * 7 / 10, get_h() * 17 / 20, m_butw, m_buth,
+ get_w() * 7 / 10, get_h() * 17 / 20, butw_, buth_,
g_gr->images().get("pics/but0.png"),
_("Back"), std::string(), true, false),
- m_ok
+ ok_
(this, "ok",
- get_w() * 7 / 10, get_h() * 9 / 10, m_butw, m_buth,
+ get_w() * 7 / 10, get_h() * 9 / 10, butw_, buth_,
g_gr->images().get("pics/but2.png"),
_("Start game"), std::string(), false, false),
// Text labels
- m_title
+ title_
(this,
get_w() / 2, get_h() / 10,
_("Launch Game"), UI::Align_HCenter),
- m_mapname
+ mapname_
(this,
- get_w() * 7 / 10 + m_butw / 2, get_h() * 53 / 200 - 15,
+ get_w() * 7 / 10 + butw_ / 2, get_h() * 53 / 200 - 15,
std::string(), UI::Align_HCenter),
- m_name
+ name_
(this,
get_w() * 1 / 25, get_h() * 53 / 200 - 15,
_("Player’s name"), UI::Align_Left),
- m_type
+ type_
(this,
// (Element x) + (PlayerDescriptionGroup x) + border
((get_w() * 16 / 25) * 35 / 125) + (get_w() / 25) + 2, get_h() * 53 / 200 - 15,
_("Player’s type"), UI::Align_Left),
- m_team
+ team_
(this,
((get_w() * 16 / 25) * 35 / 125) + (get_w() / 25) + 2, get_h() * 53 / 200,
_("Team"), UI::Align_Left),
- m_tribe
+ tribe_
(this,
((get_w() * 16 / 25) * 80 / 125) + (get_w() / 25) + 2, get_h() * 53 / 200 - 15,
_("Player’s tribe"), UI::Align_Left),
- m_init
+ init_
(this,
((get_w() * 16 / 25) * 55 / 125) + (get_w() / 25) + 2, get_h() * 53 / 200,
_("Start type"), UI::Align_Left),
- m_wincondition_type
+ wincondition_type_
(this,
- get_w() * 7 / 10 + (m_butw / 2), get_h() * 7 / 20 + m_buth,
+ get_w() * 7 / 10 + (butw_ / 2), get_h() * 7 / 20 + buth_,
_("Type of game"), UI::Align_HCenter),
// Variables and objects used in the menu
- m_settings (settings),
- m_ctrl (ctrl),
- m_is_scenario (false)
+ settings_ (settings),
+ ctrl_ (ctrl),
+ is_scenario_ (false)
{
- m_select_map.sigclicked.connect(boost::bind(&FullscreenMenuLaunchSPG::select_map, boost::ref(*this)));
- m_wincondition.sigclicked.connect
+ select_map_.sigclicked.connect(boost::bind(&FullscreenMenuLaunchSPG::select_map, boost::ref(*this)));
+ wincondition_.sigclicked.connect
(boost::bind
(&FullscreenMenuLaunchSPG::win_condition_clicked,
boost::ref(*this)));
- m_back.sigclicked.connect(boost::bind(&FullscreenMenuLaunchSPG::clicked_back, boost::ref(*this)));
- m_ok.sigclicked.connect
+ back_.sigclicked.connect(boost::bind(&FullscreenMenuLaunchSPG::clicked_back, boost::ref(*this)));
+ ok_.sigclicked.connect
(boost::bind
(&FullscreenMenuLaunchSPG::clicked_ok, boost::ref(*this)));
- m_lua = new LuaInterface();
- m_win_condition_scripts = m_settings->settings().win_condition_scripts;
- m_cur_wincondition = -1;
+ lua_ = new LuaInterface();
+ win_condition_scripts_ = settings_->settings().win_condition_scripts;
+ cur_wincondition_ = -1;
win_condition_clicked();
- m_title.set_textstyle(UI::TextStyle::ui_big());
+ title_.set_textstyle(UI::TextStyle::ui_big());
UI::TextStyle tsmaller
(UI::TextStyle::makebold
(UI::Font::get(ui_fn(), fs_small() * 4 / 5), UI_FONT_CLR_FG));
- m_name.set_textstyle(tsmaller);
- m_type.set_textstyle(tsmaller);
- m_team.set_textstyle(tsmaller);
- m_tribe.set_textstyle(tsmaller);
- m_init.set_textstyle(tsmaller);
+ name_.set_textstyle(tsmaller);
+ type_.set_textstyle(tsmaller);
+ team_.set_textstyle(tsmaller);
+ tribe_.set_textstyle(tsmaller);
+ init_.set_textstyle(tsmaller);
- uint32_t y = get_h() * 3 / 10 - m_buth;
+ uint32_t y = get_h() * 3 / 10 - buth_;
char posIco[42];
for (uint32_t i = 0; i < MAX_PLAYERS; ++i) {
sprintf(posIco, "pics/fsel_editor_set_player_0%i_pos.png", i + 1);
- m_pos[i] =
+ pos_[i] =
new UI::Button
(this, "switch_to_position",
- get_w() / 100, y += m_buth, get_h() * 17 / 500, get_h() * 17 / 500,
+ get_w() / 100, y += buth_, get_h() * 17 / 500, get_h() * 17 / 500,
g_gr->images().get("pics/but1.png"),
g_gr->images().get(posIco),
_("Switch to position"), false);
- m_pos[i]->sigclicked.connect
+ pos_[i]->sigclicked.connect
(boost::bind(&FullscreenMenuLaunchSPG::switch_to_position, boost::ref(*this), i));
- m_players[i] =
+ players_[i] =
new PlayerDescriptionGroup
(this,
get_w() / 25, y, get_w() * 16 / 25, get_h() * 17 / 500 * 2,
settings, i);
- y += m_buth / 1.17;
+ y += buth_ / 1.17;
}
}
FullscreenMenuLaunchSPG::~FullscreenMenuLaunchSPG() {
- delete m_lua;
+ delete lua_;
}
/**
@@ -175,7 +175,7 @@
void FullscreenMenuLaunchSPG::start()
{
select_map();
- if (m_settings->settings().mapname.empty()) {
+ if (settings_->settings().mapname.empty()) {
end_modal<FullscreenMenuBase::MenuTarget>(FullscreenMenuBase::MenuTarget::kBack);
}
}
@@ -183,8 +183,8 @@
void FullscreenMenuLaunchSPG::think()
{
- if (m_ctrl)
- m_ctrl->think();
+ if (ctrl_)
+ ctrl_->think();
refresh();
}
@@ -199,9 +199,9 @@
// user it seems as if the launchgame-menu is a child of mapselect and
// not the other way around - just end_modal(0); will be seen as bug
// from user point of view, so we reopen the mapselect-menu.
- m_settings->set_map(std::string(), std::string(), 0);
+ settings_->set_map(std::string(), std::string(), 0);
select_map();
- if (m_settings->settings().mapname.empty())
+ if (settings_->settings().mapname.empty())
return end_modal<FullscreenMenuBase::MenuTarget>(FullscreenMenuBase::MenuTarget::kBack);
refresh();
}
@@ -211,10 +211,10 @@
*/
void FullscreenMenuLaunchSPG::win_condition_clicked()
{
- if (m_settings->can_change_map()) {
- m_cur_wincondition++;
- m_cur_wincondition %= m_win_condition_scripts.size();
- m_settings->set_win_condition_script(m_win_condition_scripts[m_cur_wincondition]);
+ if (settings_->can_change_map()) {
+ cur_wincondition_++;
+ cur_wincondition_ %= win_condition_scripts_.size();
+ settings_->set_win_condition_script(win_condition_scripts_[cur_wincondition_]);
}
win_condition_update();
@@ -224,9 +224,9 @@
* update win conditions information
*/
void FullscreenMenuLaunchSPG::win_condition_update() {
- if (m_settings->settings().scenario) {
- m_wincondition.set_title(_("Scenario"));
- m_wincondition.set_tooltip
+ if (settings_->settings().scenario) {
+ wincondition_.set_title(_("Scenario"));
+ wincondition_.set_tooltip
(_("Win condition is set through the scenario"));
} else {
win_condition_load();
@@ -242,14 +242,14 @@
bool is_usable = true;
try {
std::unique_ptr<LuaTable> t =
- m_lua->run_script(m_settings->get_win_condition_script());
+ lua_->run_script(settings_->get_win_condition_script());
t->do_not_warn_about_unaccessed_keys();
// Skip this win condition if the map doesn't have all the required tags
- if (t->has_key("map_tags") && !m_settings->settings().mapfilename.empty()) {
+ if (t->has_key("map_tags") && !settings_->settings().mapfilename.empty()) {
Widelands::Map map;
std::unique_ptr<Widelands::MapLoader> ml =
- map.get_correct_loader(m_settings->settings().mapfilename);
+ map.get_correct_loader(settings_->settings().mapfilename);
ml->preload_map(true);
for (const std::string map_tag : t->get_table("map_tags")->array_entries<std::string>()) {
if (!map.has_tag(map_tag)) {
@@ -263,9 +263,9 @@
const std::string descr = t->get_string("description");
{
i18n::Textdomain td("win_conditions");
- m_wincondition.set_title(_(name));
+ wincondition_.set_title(_(name));
}
- m_wincondition.set_tooltip(descr.c_str());
+ wincondition_.set_tooltip(descr.c_str());
} catch (LuaTableKeyError &) {
// might be that this is not a win condition after all.
is_usable = false;
@@ -280,7 +280,7 @@
*/
void FullscreenMenuLaunchSPG::clicked_ok()
{
- if (!g_fs->file_exists(m_filename))
+ if (!g_fs->file_exists(filename_))
throw WLWarning
(_("File not found"),
_
@@ -291,9 +291,9 @@
"a file that you do not own. Normally, such a file should be sent "
"from the host to you, but perhaps the transfer was not yet "
"finished!?!"),
- m_filename.c_str());
- if (m_settings->can_launch()) {
- if (m_is_scenario) {
+ filename_.c_str());
+ if (settings_->can_launch()) {
+ if (is_scenario_) {
end_modal<FullscreenMenuBase::MenuTarget>(FullscreenMenuBase::MenuTarget::kScenarioGame);
} else {
end_modal<FullscreenMenuBase::MenuTarget>(FullscreenMenuBase::MenuTarget::kNormalGame);
@@ -308,44 +308,44 @@
*/
void FullscreenMenuLaunchSPG::refresh()
{
- const GameSettings & settings = m_settings->settings();
+ const GameSettings & settings = settings_->settings();
{
// Translate the maps name
const char * nomap = _("(no map)");
i18n::Textdomain td("maps");
- m_mapname.set_text(settings.mapname.size() != 0 ? _(settings.mapname) : nomap);
+ mapname_.set_text(settings.mapname.size() != 0 ? _(settings.mapname) : nomap);
}
- m_filename = settings.mapfilename;
- m_nr_players = settings.players.size();
-
- m_ok.set_enabled(m_settings->can_launch());
-
- m_select_map.set_visible(m_settings->can_change_map());
- m_select_map.set_enabled(m_settings->can_change_map());
- m_wincondition.set_enabled
- (m_settings->can_change_map() && !settings.scenario);
+ filename_ = settings.mapfilename;
+ nr_players_ = settings.players.size();
+
+ ok_.set_enabled(settings_->can_launch());
+
+ select_map_.set_visible(settings_->can_change_map());
+ select_map_.set_enabled(settings_->can_change_map());
+ wincondition_.set_enabled
+ (settings_->can_change_map() && !settings.scenario);
if (settings.scenario)
set_scenario_values();
// "Choose Position" Buttons in frond of PDG
- for (uint8_t i = 0; i < m_nr_players; ++i) {
- m_pos[i]->set_visible(true);
+ for (uint8_t i = 0; i < nr_players_; ++i) {
+ pos_[i]->set_visible(true);
const PlayerSettings & player = settings.players[i];
if
(player.state == PlayerSettings::stateOpen ||
player.state == PlayerSettings::stateComputer)
- m_pos[i]->set_enabled(true);
+ pos_[i]->set_enabled(true);
else
- m_pos[i]->set_enabled(false);
+ pos_[i]->set_enabled(false);
}
- for (uint32_t i = m_nr_players; i < MAX_PLAYERS; ++i)
- m_pos[i]->set_visible(false);
+ for (uint32_t i = nr_players_; i < MAX_PLAYERS; ++i)
+ pos_[i]->set_visible(false);
// update the player description groups
for (uint32_t i = 0; i < MAX_PLAYERS; ++i)
- m_players[i]->refresh();
+ players_[i]->refresh();
win_condition_update();
}
@@ -356,26 +356,26 @@
*/
void FullscreenMenuLaunchSPG::select_map()
{
- if (!m_settings->can_change_map())
+ if (!settings_->can_change_map())
return;
- FullscreenMenuMapSelect msm(m_settings, nullptr);
+ FullscreenMenuMapSelect msm(settings_, nullptr);
FullscreenMenuBase::MenuTarget code = msm.run<FullscreenMenuBase::MenuTarget>();
if (code == FullscreenMenuBase::MenuTarget::kBack) {
// Set scenario = false, else the menu might crash when back is pressed.
- m_settings->set_scenario(false);
+ settings_->set_scenario(false);
return; // back was pressed
}
- m_is_scenario = code == FullscreenMenuBase::MenuTarget::kScenarioGame;
- m_settings->set_scenario(m_is_scenario);
+ is_scenario_ = code == FullscreenMenuBase::MenuTarget::kScenarioGame;
+ settings_->set_scenario(is_scenario_);
const MapData & mapdata = *msm.get_map();
- m_nr_players = mapdata.nrplayers;
+ nr_players_ = mapdata.nrplayers;
- safe_place_for_host(m_nr_players);
- m_settings->set_map(mapdata.name, mapdata.filename, m_nr_players);
+ safe_place_for_host(nr_players_);
+ settings_->set_map(mapdata.name, mapdata.filename, nr_players_);
}
@@ -386,18 +386,18 @@
*/
void FullscreenMenuLaunchSPG::set_scenario_values()
{
- if (m_settings->settings().mapfilename.empty())
+ if (settings_->settings().mapfilename.empty())
throw wexception
("settings()->scenario was set to true, but no map is available");
Widelands::Map map; // MapLoader needs a place to put its preload data
std::unique_ptr<Widelands::MapLoader> map_loader(
- map.get_correct_loader(m_settings->settings().mapfilename));
- map.set_filename(m_settings->settings().mapfilename);
+ map.get_correct_loader(settings_->settings().mapfilename));
+ map.set_filename(settings_->settings().mapfilename);
map_loader->preload_map(true);
Widelands::PlayerNumber const nrplayers = map.get_nrplayers();
for (uint8_t i = 0; i < nrplayers; ++i) {
- m_settings->set_player_name (i, map.get_scenario_player_name (i + 1));
- m_settings->set_player_tribe(i, map.get_scenario_player_tribe(i + 1));
+ settings_->set_player_name (i, map.get_scenario_player_name (i + 1));
+ settings_->set_player_tribe(i, map.get_scenario_player_tribe(i + 1));
}
}
@@ -406,7 +406,7 @@
*/
void FullscreenMenuLaunchSPG::switch_to_position(uint8_t const pos)
{
- m_settings->set_player_number(pos);
+ settings_->set_player_number(pos);
}
@@ -417,7 +417,7 @@
void FullscreenMenuLaunchSPG::safe_place_for_host
(uint8_t const newplayernumber)
{
- GameSettings settings = m_settings->settings();
+ GameSettings settings = settings_->settings();
// Check whether the host would still keep a valid position and return if
// yes.
@@ -436,7 +436,7 @@
}
// Kick player 1 and take the position
- m_settings->set_player_state(0, PlayerSettings::stateClosed);
- m_settings->set_player_state(0, PlayerSettings::stateOpen);
+ settings_->set_player_state(0, PlayerSettings::stateClosed);
+ settings_->set_player_state(0, PlayerSettings::stateOpen);
switch_to_position(0);
}
=== modified file 'src/ui_fsmenu/launch_spg.h'
--- src/ui_fsmenu/launch_spg.h 2015-11-18 08:35:44 +0000
+++ src/ui_fsmenu/launch_spg.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 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
@@ -41,7 +41,7 @@
*
* The menu has a lot dynamic user-interfaces, that are only shown in specific
* cases:
- * UI::Button m_select_map - only shown if the player has the right to
+ * UI::Button select_map_ - only shown if the player has the right to
* change the map.
*
*/
@@ -61,7 +61,7 @@
void clicked_back() override;
private:
- LuaInterface * m_lua;
+ LuaInterface * lua_;
void select_map();
void win_condition_clicked();
@@ -71,24 +71,24 @@
void switch_to_position(uint8_t);
void safe_place_for_host(uint8_t);
- uint32_t m_butw;
- uint32_t m_buth;
+ uint32_t butw_;
+ uint32_t buth_;
- UI::Button m_select_map, m_wincondition, m_back, m_ok;
- UI::Button * m_pos[MAX_PLAYERS];
- UI::Textarea m_title, m_mapname;
- UI::Textarea m_name, m_type, m_team, m_tribe, m_init, m_wincondition_type;
- GameSettingsProvider * m_settings;
- GameController * m_ctrl; // optional
- PlayerDescriptionGroup * m_players[MAX_PLAYERS];
- std::string m_filename;
- std::string m_filename_proof; // local var. to check UI state
- std::string m_player_save_name[MAX_PLAYERS];
- std::string m_player_save_tribe[MAX_PLAYERS];
- int8_t m_nr_players;
- bool m_is_scenario;
- std::vector<std::string> m_win_condition_scripts;
- uint8_t m_cur_wincondition;
+ UI::Button select_map_, wincondition_, back_, ok_;
+ UI::Button * pos_[MAX_PLAYERS];
+ UI::Textarea title_, mapname_;
+ UI::Textarea name_, type_, team_, tribe_, init_, wincondition_type_;
+ GameSettingsProvider * settings_;
+ GameController * ctrl_; // optional
+ PlayerDescriptionGroup * players_[MAX_PLAYERS];
+ std::string filename_;
+ std::string filename_proof_; // local var. to check UI state
+ std::string player_save_name_[MAX_PLAYERS];
+ std::string player_save_tribe_[MAX_PLAYERS];
+ int8_t nr_players_;
+ bool is_scenario_;
+ std::vector<std::string> win_condition_scripts_;
+ uint8_t cur_wincondition_;
};
=== modified file 'src/ui_fsmenu/load_map_or_game.cc'
--- src/ui_fsmenu/load_map_or_game.cc 2015-10-02 07:02:00 +0000
+++ src/ui_fsmenu/load_map_or_game.cc 2016-01-28 20:02:32 +0000
@@ -39,35 +39,35 @@
// Values for alignment and size
padding_(4),
indent_(10),
- m_label_height(20),
+ label_height_(20),
tablex_(get_w() * 47 / 2500),
tabley_(get_h() * 17 / 50),
tablew_(get_w() * 711 / 1250),
tableh_(get_h() * 6083 / 10000),
- m_right_column_margin(15),
- right_column_x_(tablex_ + tablew_ + m_right_column_margin),
- m_buty (get_h() * 9 / 10),
- m_butw ((get_w() - right_column_x_ - m_right_column_margin) / 2 - padding_),
+ right_column_margin_(15),
+ right_column_x_(tablex_ + tablew_ + right_column_margin_),
+ buty_ (get_h() * 9 / 10),
+ butw_ ((get_w() - right_column_x_ - right_column_margin_) / 2 - padding_),
buth_ (get_h() * 9 / 200),
- m_right_column_tab(get_w() - m_right_column_margin - m_butw),
+ right_column_tab_(get_w() - right_column_margin_ - butw_),
// Main buttons
back_
(this, "back",
- right_column_x_, m_buty, m_butw, buth_,
+ right_column_x_, buty_, butw_, buth_,
g_gr->images().get("pics/but0.png"),
_("Back"), std::string(), true, false),
ok_
(this, "ok",
- get_w() - m_right_column_margin - m_butw, m_buty, m_butw, buth_,
+ get_w() - right_column_margin_ - butw_, buty_, butw_, buth_,
g_gr->images().get("pics/but2.png"),
_("OK"), std::string(), false, false)
{}
-int32_t FullscreenMenuLoadMapOrGame::get_y_from_preceding(UI::Panel& preceding_panel) {
+int32_t FullscreenMenuLoadMapOrGame::get_y_fropreceding_(UI::Panel& preceding_panel) {
return preceding_panel.get_y() + preceding_panel.get_h();
}
int32_t FullscreenMenuLoadMapOrGame::get_right_column_w(int32_t x) {
- return get_w() - m_right_column_margin - x;
+ return get_w() - right_column_margin_ - x;
}
=== modified file 'src/ui_fsmenu/load_map_or_game.h'
--- src/ui_fsmenu/load_map_or_game.h 2015-10-02 07:02:00 +0000
+++ src/ui_fsmenu/load_map_or_game.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 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
@@ -62,7 +62,7 @@
virtual void fill_table() {}
// Returns a y coordinate that can be used to position a Panel below the Panel directly above it
- int32_t get_y_from_preceding(UI::Panel& preceding_panel);
+ int32_t get_y_fropreceding_(UI::Panel& preceding_panel);
// Returns the width that a Panel in the right column should have, depending on its x position
int32_t get_right_column_w(int32_t x);
@@ -70,12 +70,12 @@
// UI coordinates and spacers
int32_t const padding_; // Common padding between panels
int32_t const indent_; // Indent for elements below labels
- int32_t const m_label_height;
+ int32_t const label_height_;
int32_t const tablex_, tabley_, tablew_, tableh_;
- int32_t const m_right_column_margin; // X margins of the right column
+ int32_t const right_column_margin_; // X margins of the right column
int32_t const right_column_x_;
- int32_t const m_buty, m_butw, buth_; // Button dimensions
- int32_t const m_right_column_tab;
+ int32_t const buty_, butw_, buth_; // Button dimensions
+ int32_t const right_column_tab_;
// Main buttons
UI::Button back_;
=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc 2016-01-23 13:57:18 +0000
+++ src/ui_fsmenu/loadgame.cc 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 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
@@ -81,107 +81,107 @@
FullscreenMenuLoadGame::FullscreenMenuLoadGame
(Widelands::Game & g, GameSettingsProvider * gsp, GameController * gc, bool is_replay) :
FullscreenMenuLoadMapOrGame(),
- m_table(this, tablex_, tabley_, tablew_, tableh_, true),
+ table_(this, tablex_, tabley_, tablew_, tableh_, true),
- m_is_replay(is_replay),
+ is_replay_(is_replay),
// Main title
- m_title
+ title_
(this, get_w() / 2, tabley_ / 3,
- m_is_replay ? _("Choose a replay") : _("Choose a saved game"), UI::Align_HCenter),
+ is_replay_ ? _("Choose a replay") : _("Choose a saved game"), UI::Align_HCenter),
// Savegame description
- m_label_mapname
+ label_mapname_
(this, right_column_x_, tabley_, "", UI::Align_Left),
- m_ta_mapname(this,
- right_column_x_ + indent_, get_y_from_preceding(m_label_mapname) + padding_,
- get_right_column_w(right_column_x_ + indent_), 2 * m_label_height - padding_),
-
- m_label_gametime
- (this, right_column_x_, get_y_from_preceding(m_ta_mapname) + 2 * padding_,
- "",
- UI::Align_Left),
- m_ta_gametime(this,
- m_right_column_tab, m_label_gametime.get_y(),
- get_right_column_w(m_right_column_tab), m_label_height),
-
- m_label_players
- (this, right_column_x_, get_y_from_preceding(m_ta_gametime),
- "",
- UI::Align_Left),
- m_ta_players(this,
- m_right_column_tab, m_label_players.get_y(),
- get_right_column_w(m_right_column_tab), m_label_height),
-
- m_label_version
- (this, right_column_x_, get_y_from_preceding(m_ta_players),
- "",
- UI::Align_Left),
- m_ta_version(this,
- m_right_column_tab, m_label_version.get_y(), "", UI::Align_Left),
-
- m_label_win_condition
- (this, right_column_x_, get_y_from_preceding(m_ta_version) + 3 * padding_,
- "",
- UI::Align_Left),
- m_ta_win_condition(this,
- right_column_x_ + indent_, get_y_from_preceding(m_label_win_condition) + padding_,
- get_right_column_w(right_column_x_ + indent_), m_label_height),
-
- m_delete
+ ta_mapname_(this,
+ right_column_x_ + indent_, get_y_fropreceding_(label_mapname_) + padding_,
+ get_right_column_w(right_column_x_ + indent_), 2 * label_height_ - padding_),
+
+ label_gametime_
+ (this, right_column_x_, get_y_fropreceding_(ta_mapname_) + 2 * padding_,
+ "",
+ UI::Align_Left),
+ ta_gametime_(this,
+ right_column_tab_, label_gametime_.get_y(),
+ get_right_column_w(right_column_tab_), label_height_),
+
+ label_players_
+ (this, right_column_x_, get_y_fropreceding_(ta_gametime_),
+ "",
+ UI::Align_Left),
+ ta_players_(this,
+ right_column_tab_, label_players_.get_y(),
+ get_right_column_w(right_column_tab_), label_height_),
+
+ label_version_
+ (this, right_column_x_, get_y_fropreceding_(ta_players_),
+ "",
+ UI::Align_Left),
+ ta_version_(this,
+ right_column_tab_, label_version_.get_y(), "", UI::Align_Left),
+
+ label_win_condition_
+ (this, right_column_x_, get_y_fropreceding_(ta_version_) + 3 * padding_,
+ "",
+ UI::Align_Left),
+ ta_win_condition_(this,
+ right_column_x_ + indent_, get_y_fropreceding_(label_win_condition_) + padding_,
+ get_right_column_w(right_column_x_ + indent_), label_height_),
+
+ delete_
(this, "delete",
- right_column_x_, m_buty - buth_ - 2 * padding_,
- m_butw, buth_,
+ right_column_x_, buty_ - buth_ - 2 * padding_,
+ butw_, buth_,
g_gr->images().get("pics/but0.png"),
_("Delete"), std::string(), false, false),
- m_ta_errormessage
+ ta_errormessage_
(this,
right_column_x_,
- get_y_from_preceding(m_ta_mapname) + 2 * padding_,
+ get_y_fropreceding_(ta_mapname_) + 2 * padding_,
get_right_column_w(right_column_x_),
- m_delete.get_y() - get_y_from_preceding(m_ta_mapname) - 6 * padding_),
+ delete_.get_y() - get_y_fropreceding_(ta_mapname_) - 6 * padding_),
- m_minimap_y(get_y_from_preceding(m_ta_win_condition) + 3 * padding_),
- m_minimap_w(get_right_column_w(right_column_x_)),
- m_minimap_h(m_delete.get_y() - get_y_from_preceding(m_ta_win_condition) - 6 * padding_),
- m_minimap_icon(this,
- right_column_x_, get_y_from_preceding(m_ta_win_condition) + 3 * padding_,
- m_minimap_w, m_minimap_h, nullptr),
+ minimap_y_(get_y_fropreceding_(ta_win_condition_) + 3 * padding_),
+ minimap_w_(get_right_column_w(right_column_x_)),
+ minimap_h_(delete_.get_y() - get_y_fropreceding_(ta_win_condition_) - 6 * padding_),
+ minimap_icon_(this,
+ right_column_x_, get_y_fropreceding_(ta_win_condition_) + 3 * padding_,
+ minimap_w_, minimap_h_, nullptr),
// "Data container" for the savegame information
- m_game(g),
- m_settings(gsp),
- m_ctrl(gc)
+ game_(g),
+ settings_(gsp),
+ ctrl_(gc)
{
- m_title.set_textstyle(UI::TextStyle::ui_big());
- m_ta_gametime.set_tooltip(_("The time that elapsed inside this game"));
- m_ta_players.set_tooltip(_("The number of players"));
- m_ta_version.set_tooltip(_("The version of Widelands that this game was played under"));
- m_ta_win_condition.set_tooltip(_("The win condition that was set for this game"));
+ title_.set_textstyle(UI::TextStyle::ui_big());
+ ta_gametime_.set_tooltip(_("The time that elapsed inside this game"));
+ ta_players_.set_tooltip(_("The number of players"));
+ ta_version_.set_tooltip(_("The version of Widelands that this game was played under"));
+ ta_win_condition_.set_tooltip(_("The win condition that was set for this game"));
- if (m_is_replay) {
+ if (is_replay_) {
back_.set_tooltip(_("Return to the main menu"));
ok_.set_tooltip(_("Load this replay"));
- m_ta_mapname.set_tooltip(_("The map that this replay is based on"));
- m_delete.set_tooltip(_("Delete this replay"));
+ ta_mapname_.set_tooltip(_("The map that this replay is based on"));
+ delete_.set_tooltip(_("Delete this replay"));
} else {
back_.set_tooltip(_("Return to the single player menu"));
ok_.set_tooltip(_("Load this game"));
- m_ta_mapname.set_tooltip(_("The map that this game is based on"));
- m_delete.set_tooltip(_("Delete this game"));
+ ta_mapname_.set_tooltip(_("The map that this game is based on"));
+ delete_.set_tooltip(_("Delete this game"));
}
- m_minimap_icon.set_visible(false);
+ minimap_icon_.set_visible(false);
back_.sigclicked.connect(boost::bind(&FullscreenMenuLoadGame::clicked_back, boost::ref(*this)));
ok_.sigclicked.connect(boost::bind(&FullscreenMenuLoadGame::clicked_ok, boost::ref(*this)));
- m_delete.sigclicked.connect
+ delete_.sigclicked.connect
(boost::bind
(&FullscreenMenuLoadGame::clicked_delete, boost::ref(*this)));
- m_table.add_column(130, _("Save Date"), _("The date this game was saved"), UI::Align_Left);
+ table_.add_column(130, _("Save Date"), _("The date this game was saved"), UI::Align_Left);
int used_width = 130;
- if (m_is_replay || m_settings->settings().multiplayer) {
+ if (is_replay_ || settings_->settings().multiplayer) {
std::vector<std::string> modes;
- if (m_is_replay) {
+ if (is_replay_) {
/** TRANSLATORS: Tooltip for the "Mode" column when choosing a game/replay to load. */
/** TRANSLATORS: Make sure that you keep consistency in your translation. */
modes.push_back(_("SP = Single Player"));
@@ -200,7 +200,7 @@
const std::string mode_tooltip_2 =
_("Numbers are the number of players.");
- m_table.add_column(65,
+ table_.add_column(65,
/** TRANSLATORS: Game Mode table column when choosing a game/replay to load. */
/** TRANSLATORS: Keep this to 5 letters maximum. */
/** TRANSLATORS: A tooltip will explain if you need to use an abbreviation. */
@@ -209,33 +209,33 @@
UI::Align_Left);
used_width += 65;
}
- m_table.add_column(m_table.get_w() - used_width,
+ table_.add_column(table_.get_w() - used_width,
_("Description"),
_("The filename that the game was saved under followed by the map’s name, "
"or the map’s name followed by the last objective achieved."),
UI::Align_Left);
- m_table.set_column_compare
+ table_.set_column_compare
(0,
boost::bind(&FullscreenMenuLoadGame::compare_date_descending, this, _1, _2));
- m_table.selected.connect(boost::bind(&FullscreenMenuLoadGame::entry_selected, this));
- m_table.double_clicked.connect(boost::bind(&FullscreenMenuLoadGame::clicked_ok, boost::ref(*this)));
- m_table.set_sort_column(0);
- m_table.focus();
+ table_.selected.connect(boost::bind(&FullscreenMenuLoadGame::entry_selected, this));
+ table_.double_clicked.connect(boost::bind(&FullscreenMenuLoadGame::clicked_ok, boost::ref(*this)));
+ table_.set_sort_column(0);
+ table_.focus();
fill_table();
}
void FullscreenMenuLoadGame::think()
{
- if (m_ctrl) {
- m_ctrl->think();
+ if (ctrl_) {
+ ctrl_->think();
}
}
// Reverse default sort order for save date column
bool FullscreenMenuLoadGame::compare_date_descending(uint32_t rowa, uint32_t rowb)
{
- const SavegameData & r1 = m_games_data[m_table[rowa]];
- const SavegameData & r2 = m_games_data[m_table[rowb]];
+ const SavegameData & r1 = games_data_[table_[rowa]];
+ const SavegameData & r2 = games_data_[table_[rowb]];
return r1.savetimestamp < r2.savetimestamp;
}
@@ -243,39 +243,39 @@
void FullscreenMenuLoadGame::clicked_ok()
{
- const SavegameData & gamedata = m_games_data[m_table.get_selected()];
+ const SavegameData & gamedata = games_data_[table_.get_selected()];
if (gamedata.errormessage.empty()) {
- m_filename = gamedata.filename;
+ filename_ = gamedata.filename;
end_modal<FullscreenMenuBase::MenuTarget>(FullscreenMenuBase::MenuTarget::kOk);
}
}
void FullscreenMenuLoadGame::clicked_delete()
{
- if (!m_table.has_selection()) {
+ if (!table_.has_selection()) {
return;
}
- const SavegameData & gamedata = m_games_data[m_table.get_selected()];
+ const SavegameData & gamedata = games_data_[table_.get_selected()];
std::string message = (boost::format("%s %s\n")
- % m_label_mapname.get_text() % gamedata.mapname).str();
+ % label_mapname_.get_text() % gamedata.mapname).str();
message = (boost::format("%s %s %s\n") % message
- % m_label_win_condition.get_text() % gamedata.wincondition).str();
+ % label_win_condition_.get_text() % gamedata.wincondition).str();
message = (boost::format("%s %s %s\n") % message
% _("Save Date:") % gamedata.savedatestring).str();
message = (boost::format("%s %s %s\n") % message
- % m_label_gametime.get_text() % gametimestring(gamedata.gametime)).str();
+ % label_gametime_.get_text() % gametimestring(gamedata.gametime)).str();
message = (boost::format("%s %s %s\n\n") % message
- % m_label_players.get_text() % gamedata.nrplayers).str();
+ % label_players_.get_text() % gamedata.nrplayers).str();
message = (boost::format("%s %s %s\n") % message
% _("Filename:") % gamedata.filename).str();
- if (m_is_replay) {
+ if (is_replay_) {
message = (boost::format("%s\n\n%s")
% _("Do you really want to delete this replay?") % message).str();
} else {
@@ -287,7 +287,7 @@
(this, _("Confirm deleting file"), message, UI::WLMessageBox::MBoxType::kOkCancel);
if (confirmationBox.run<UI::Panel::Returncodes>() == UI::Panel::Returncodes::kOk) {
g_fs->fs_unlink(gamedata.filename);
- if (m_is_replay) {
+ if (is_replay_) {
g_fs->fs_unlink(gamedata.filename + WLGF_SUFFIX);
}
fill_table();
@@ -297,31 +297,31 @@
bool FullscreenMenuLoadGame::set_has_selection()
{
- bool has_selection = m_table.has_selection();
+ bool has_selection = table_.has_selection();
ok_.set_enabled(has_selection);
- m_delete.set_enabled(has_selection);
+ delete_.set_enabled(has_selection);
if (!has_selection) {
- m_label_mapname .set_text(std::string());
- m_label_gametime.set_text(std::string());
- m_label_players.set_text(std::string());
- m_label_version.set_text(std::string());
- m_label_win_condition.set_text(std::string());
+ label_mapname_ .set_text(std::string());
+ label_gametime_.set_text(std::string());
+ label_players_.set_text(std::string());
+ label_version_.set_text(std::string());
+ label_win_condition_.set_text(std::string());
- m_ta_mapname .set_text(std::string());
- m_ta_gametime.set_text(std::string());
- m_ta_players.set_text(std::string());
- m_ta_version.set_text(std::string());
- m_ta_win_condition.set_text(std::string());
- m_minimap_icon.set_icon(nullptr);
- m_minimap_icon.set_visible(false);
- m_minimap_icon.set_no_frame();
- m_minimap_image.reset();
+ ta_mapname_ .set_text(std::string());
+ ta_gametime_.set_text(std::string());
+ ta_players_.set_text(std::string());
+ ta_version_.set_text(std::string());
+ ta_win_condition_.set_text(std::string());
+ minimap_icon_.set_icon(nullptr);
+ minimap_icon_.set_visible(false);
+ minimap_icon_.set_no_frame();
+ minimap_image_.reset();
} else {
- m_label_mapname .set_text(_("Map Name:"));
- m_label_gametime.set_text(_("Gametime:"));
- m_label_players.set_text(_("Players:"));
- m_label_win_condition.set_text(_("Win Condition:"));
+ label_mapname_ .set_text(_("Map Name:"));
+ label_gametime_.set_text(_("Gametime:"));
+ label_players_.set_text(_("Players:"));
+ label_win_condition_.set_text(_("Win Condition:"));
}
return has_selection;
}
@@ -331,97 +331,97 @@
{
if (set_has_selection()) {
- const SavegameData & gamedata = m_games_data[m_table.get_selected()];
- m_ta_errormessage.set_text(gamedata.errormessage);
+ const SavegameData & gamedata = games_data_[table_.get_selected()];
+ ta_errormessage_.set_text(gamedata.errormessage);
if (gamedata.errormessage.empty()) {
- m_ta_errormessage.set_visible(false);
- m_ta_mapname.set_text(gamedata.mapname);
- m_ta_gametime.set_text(gametimestring(gamedata.gametime));
+ ta_errormessage_.set_visible(false);
+ ta_mapname_.set_text(gamedata.mapname);
+ ta_gametime_.set_text(gametimestring(gamedata.gametime));
uint8_t number_of_players = gamedata.nrplayers;
if (number_of_players > 0) {
- m_ta_players.set_text((boost::format("%u") % static_cast<unsigned int>(number_of_players)).str());
+ ta_players_.set_text((boost::format("%u") % static_cast<unsigned int>(number_of_players)).str());
} else {
- m_label_players.set_text("");
- m_ta_players.set_text("");
+ label_players_.set_text("");
+ ta_players_.set_text("");
}
if (gamedata.version.empty()) {
- m_label_version.set_text("");
- m_ta_version.set_text("");
+ label_version_.set_text("");
+ ta_version_.set_text("");
} else {
- m_label_version.set_text(_("Widelands Version:"));
- m_ta_version.set_text(gamedata.version);
+ label_version_.set_text(_("Widelands Version:"));
+ ta_version_.set_text(gamedata.version);
}
{
i18n::Textdomain td("win_conditions");
- m_ta_win_condition.set_text(_(gamedata.wincondition));
+ ta_win_condition_.set_text(_(gamedata.wincondition));
}
std::string minimap_path = gamedata.minimap_path;
// Delete former image
- m_minimap_icon.set_icon(nullptr);
- m_minimap_icon.set_visible(false);
- m_minimap_icon.set_no_frame();
- m_minimap_image.reset();
+ minimap_icon_.set_icon(nullptr);
+ minimap_icon_.set_visible(false);
+ minimap_icon_.set_no_frame();
+ minimap_image_.reset();
// Load the new one
if (!minimap_path.empty()) {
try {
// Load the image
- m_minimap_image = load_image(
+ minimap_image_ = load_image(
minimap_path,
std::unique_ptr<FileSystem>(g_fs->make_sub_file_system(gamedata.filename)).get());
// Scale it
- double scale = double(m_minimap_w) / m_minimap_image->width();
- double scaleY = double(m_minimap_h) / m_minimap_image->height();
+ double scale = double(minimap_w_) / minimap_image_->width();
+ double scaleY = double(minimap_h_) / minimap_image_->height();
if (scaleY < scale) {
scale = scaleY;
}
if (scale > 1.0) scale = 1.0; // Don't make the image too big; fuzziness will result
- uint16_t w = scale * m_minimap_image->width();
- uint16_t h = scale * m_minimap_image->height();
+ uint16_t w = scale * minimap_image_->width();
+ uint16_t h = scale * minimap_image_->height();
// Center the minimap in the available space
- int32_t xpos = right_column_x_ + (get_w() - m_right_column_margin - w - right_column_x_) / 2;
- int32_t ypos = m_minimap_y;
+ int32_t xpos = right_column_x_ + (get_w() - right_column_margin_ - w - right_column_x_) / 2;
+ int32_t ypos = minimap_y_;
// Set small minimaps higher up for a more harmonious look
- if (h < m_minimap_h * 2 / 3) {
- ypos += (m_minimap_h - h) / 3;
+ if (h < minimap_h_ * 2 / 3) {
+ ypos += (minimap_h_ - h) / 3;
} else {
- ypos += (m_minimap_h - h) / 2;
+ ypos += (minimap_h_ - h) / 2;
}
- m_minimap_icon.set_size(w, h);
- m_minimap_icon.set_pos(Point(xpos, ypos));
- m_minimap_icon.set_frame(UI_FONT_CLR_FG);
- m_minimap_icon.set_visible(true);
- m_minimap_icon.set_icon(m_minimap_image.get());
+ minimap_icon_.set_size(w, h);
+ minimap_icon_.set_pos(Point(xpos, ypos));
+ minimap_icon_.set_frame(UI_FONT_CLR_FG);
+ minimap_icon_.set_visible(true);
+ minimap_icon_.set_icon(minimap_image_.get());
} catch (const std::exception & e) {
log("Failed to load the minimap image : %s\n", e.what());
}
}
} else {
- m_label_mapname.set_text(_("Filename:"));
- m_ta_mapname.set_text(gamedata.mapname);
- m_label_gametime.set_text("");
- m_ta_gametime.set_text("");
- m_label_players.set_text("");
- m_ta_players.set_text("");
- m_label_version.set_text("");
- m_ta_version.set_text("");
- m_label_win_condition.set_text("");
- m_ta_win_condition.set_text("");
-
- m_minimap_icon.set_icon(nullptr);
- m_minimap_icon.set_visible(false);
- m_minimap_icon.set_no_frame();
- m_minimap_image.reset();
-
- m_ta_errormessage.set_visible(true);
+ label_mapname_.set_text(_("Filename:"));
+ ta_mapname_.set_text(gamedata.mapname);
+ label_gametime_.set_text("");
+ ta_gametime_.set_text("");
+ label_players_.set_text("");
+ ta_players_.set_text("");
+ label_version_.set_text("");
+ ta_version_.set_text("");
+ label_win_condition_.set_text("");
+ ta_win_condition_.set_text("");
+
+ minimap_icon_.set_icon(nullptr);
+ minimap_icon_.set_visible(false);
+ minimap_icon_.set_no_frame();
+ minimap_image_.reset();
+
+ ta_errormessage_.set_visible(true);
ok_.set_enabled(false);
}
}
@@ -432,18 +432,18 @@
*/
void FullscreenMenuLoadGame::fill_table() {
- m_games_data.clear();
- m_table.clear();
-
-
- if (m_settings && !m_settings->settings().saved_games.empty()) {
+ games_data_.clear();
+ table_.clear();
+
+
+ if (settings_ && !settings_->settings().saved_games.empty()) {
SavegameData gamedata;
- for (uint32_t i = 0; i < m_settings->settings().saved_games.size(); ++i) {
- gamedata.filename = m_settings->settings().saved_games.at(i).path;
- m_games_data.push_back(gamedata);
+ for (uint32_t i = 0; i < settings_->settings().saved_games.size(); ++i) {
+ gamedata.filename = settings_->settings().saved_games.at(i).path;
+ games_data_.push_back(gamedata);
UI::Table<uintptr_t const>::EntryRecord & te =
- m_table.add(m_games_data.size() - 1);
+ table_.add(games_data_.size() - 1);
te.set_string(0, FileSystem::filename_without_ext(gamedata.filename.c_str()).c_str());
}
} else { // Normal case
@@ -451,7 +451,7 @@
FilenameSet gamefiles;
- if (m_is_replay) {
+ if (is_replay_) {
gamefiles = filter(g_fs->list_directory(REPLAY_DIR),
[](const std::string& fn) {return boost::ends_with(fn, REPLAY_SUFFIX);});
} else {
@@ -468,7 +468,7 @@
SavegameData gamedata;
std::string savename = gamefilename;
- if (m_is_replay) savename += WLGF_SUFFIX;
+ if (is_replay_) savename += WLGF_SUFFIX;
if (!g_fs->file_exists(savename.c_str())) {
continue;
@@ -477,13 +477,13 @@
gamedata.filename = gamefilename;
try {
- Widelands::GameLoader gl(savename.c_str(), m_game);
+ Widelands::GameLoader gl(savename.c_str(), game_);
gl.preload_game(gpdp);
gamedata.gametype = gpdp.get_gametype();
- if (!m_is_replay) {
- if (m_settings->settings().multiplayer) {
+ if (!is_replay_) {
+ if (settings_->settings().multiplayer) {
if (gamedata.gametype == GameController::GameType::SINGLEPLAYER) {
continue;
}
@@ -502,16 +502,16 @@
time(&t);
struct tm * currenttime = localtime(&t);
// We need to put these into variables because of a sideeffect of the localtime function.
- int8_t current_year = currenttime->tm_year;
+ int8_t current_year = currenttime->tm_year;
int8_t current_month = currenttime->tm_mon;
- int8_t current_day = currenttime->tm_mday;
+ int8_t current_day = currenttime->tm_mday;
struct tm * savedate = localtime(&gamedata.savetimestamp);
if (gamedata.savetimestamp > 0) {
- if (savedate->tm_year == current_year &&
- savedate->tm_mon == current_month &&
- savedate->tm_mday == current_day) { // Today
+ if (savedate->tm_year == current_year &&
+ savedate->tm_mon == current_month &&
+ savedate->tm_mday == current_day) { // Today
// Adding the 0 padding in a separate statement so translators won't have to deal with it
const std::string minute = (boost::format("%02u") % savedate->tm_min).str();
@@ -521,11 +521,11 @@
gamedata.savedatestring = (boost::format(_("Today, %1%:%2%"))
% savedate->tm_hour % minute).str();
} else if ((savedate->tm_year == current_year &&
- savedate->tm_mon == current_month &&
- savedate->tm_mday == current_day - 1) ||
+ savedate->tm_mon == current_month &&
+ savedate->tm_mday == current_day - 1) ||
(savedate->tm_year == current_year - 1 &&
- savedate->tm_mon == 11 && current_month == 0 &&
- savedate->tm_mday == 31 && current_day == 1)) { // Yesterday
+ savedate->tm_mon == 11 && current_month == 0 &&
+ savedate->tm_mday == 31 && current_day == 1)) { // Yesterday
// Adding the 0 padding in a separate statement so translators won't have to deal with it
const std::string minute = (boost::format("%02u") % savedate->tm_min).str();
@@ -549,13 +549,13 @@
gamedata.wincondition = _(gpdp.get_win_condition());
}
gamedata.minimap_path = gpdp.get_minimap_path();
- m_games_data.push_back(gamedata);
+ games_data_.push_back(gamedata);
UI::Table<uintptr_t const>::EntryRecord & te =
- m_table.add(m_games_data.size() - 1);
+ table_.add(games_data_.size() - 1);
te.set_string(0, gamedata.savedatestring);
- if (m_is_replay || m_settings->settings().multiplayer) {
+ if (is_replay_ || settings_->settings().multiplayer) {
std::string gametypestring;
switch (gamedata.gametype) {
case GameController::GameType::SINGLEPLAYER:
@@ -605,12 +605,12 @@
const std::string fs_filename = FileSystem::filename_without_ext(gamedata.filename.c_str());
gamedata.mapname = fs_filename;
- m_games_data.push_back(gamedata);
+ games_data_.push_back(gamedata);
UI::Table<uintptr_t const>::EntryRecord & te =
- m_table.add(m_games_data.size() - 1);
+ table_.add(games_data_.size() - 1);
te.set_string(0, "");
- if (m_is_replay || m_settings->settings().multiplayer) {
+ if (is_replay_ || settings_->settings().multiplayer) {
te.set_string(1, "");
/** TRANSLATORS: Prefix for incompatible files in load game screens */
te.set_string(2, (boost::format(_("Incompatible: %s")) % fs_filename).str());
@@ -620,10 +620,10 @@
}
}
}
- m_table.sort();
+ table_.sort();
- if (m_table.size()) {
- m_table.select(0);
+ if (table_.size()) {
+ table_.select(0);
}
}
=== modified file 'src/ui_fsmenu/loadgame.h'
--- src/ui_fsmenu/loadgame.h 2015-06-07 09:37:12 +0000
+++ src/ui_fsmenu/loadgame.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 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
@@ -75,7 +75,7 @@
(Widelands::Game&, GameSettingsProvider* gsp, GameController* gc = nullptr,
bool is_replay = false);
- const std::string & filename() {return m_filename;}
+ const std::string & filename() {return filename_;}
void think() override;
@@ -92,36 +92,36 @@
bool compare_date_descending(uint32_t, uint32_t);
void clicked_delete();
- UI::Table<uintptr_t const> m_table;
-
- bool m_is_replay;
-
- UI::Textarea m_title;
- UI::Textarea m_label_mapname;
- UI::MultilineTextarea m_ta_mapname; // Multiline for long names
- UI::Textarea m_label_gametime;
- UI::MultilineTextarea m_ta_gametime; // Multiline because we want tooltips
- UI::Textarea m_label_players;
- UI::MultilineTextarea m_ta_players;
- UI::Textarea m_label_version;
- UI::Textarea m_ta_version;
- UI::Textarea m_label_win_condition;
- UI::MultilineTextarea m_ta_win_condition;
-
- UI::Button m_delete;
-
- UI::MultilineTextarea m_ta_errormessage;
-
- int32_t const m_minimap_y, m_minimap_w, m_minimap_h;
- UI::Icon m_minimap_icon;
- std::unique_ptr<const Image> m_minimap_image;
-
- std::vector<SavegameData> m_games_data;
- std::string m_filename;
-
- Widelands::Game& m_game;
- GameSettingsProvider* m_settings;
- GameController* m_ctrl;
+ UI::Table<uintptr_t const> table_;
+
+ bool is_replay_;
+
+ UI::Textarea title_;
+ UI::Textarea label_mapname_;
+ UI::MultilineTextarea ta_mapname_; // Multiline for long names
+ UI::Textarea label_gametime_;
+ UI::MultilineTextarea ta_gametime_; // Multiline because we want tooltips
+ UI::Textarea label_players_;
+ UI::MultilineTextarea ta_players_;
+ UI::Textarea label_version_;
+ UI::Textarea ta_version_;
+ UI::Textarea label_win_condition_;
+ UI::MultilineTextarea ta_win_condition_;
+
+ UI::Button delete_;
+
+ UI::MultilineTextarea ta_errormessage_;
+
+ int32_t const minimap_y_, minimap_w_, minimap_h_;
+ UI::Icon minimap_icon_;
+ std::unique_ptr<const Image> minimap_image_;
+
+ std::vector<SavegameData> games_data_;
+ std::string filename_;
+
+ Widelands::Game& game_;
+ GameSettingsProvider* settings_;
+ GameController* ctrl_;
};
=== modified file 'src/ui_fsmenu/main.cc'
--- src/ui_fsmenu/main.cc 2015-08-06 17:14:34 +0000
+++ src/ui_fsmenu/main.cc 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2009 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
@@ -30,37 +30,37 @@
// Buttons
// This box needs to be a bit higher than in the other menus, because we have a lot of buttons
- vbox(this, m_box_x, m_box_y - m_buth, UI::Box::Vertical,
- m_butw, get_h() - (m_box_y - m_buth), m_padding),
+ vbox(this, box_x_, box_y_ - buth_, UI::Box::Vertical,
+ butw_, get_h() - (box_y_ - buth_), padding_),
playtutorial
- (&vbox, "play_tutorial", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "play_tutorial", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Play Tutorial"), "", true, false),
singleplayer
- (&vbox, "single_player", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "single_player", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Single Player"), "", true, false),
multiplayer
- (&vbox, "multi_player", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "multi_player", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Multiplayer"), "", true, false),
replay
- (&vbox, "replay", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "replay", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Watch Replay"), "", true, false),
editor
- (&vbox, "editor", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "editor", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Editor"), "", true, false),
options
- (&vbox, "options", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "options", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Options"), "", true, false),
readme
- (&vbox, "readme", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "readme", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("View Readme"), "", true, false),
license
- (&vbox, "license", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "license", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("License"), "", true, false),
authors
- (&vbox, "authors", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "authors", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Authors"), "", true, false),
exit
- (&vbox, "exit", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "exit", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Exit Widelands"), "", true, false),
// Textlabels
@@ -70,7 +70,7 @@
(boost::format(_("Version %1$s (%2$s)")) % build_id().c_str() % build_type().c_str()).str(),
UI::Align_BottomRight),
copyright
- (this, 0, get_h() - 0.5 * m_buth,
+ (this, 0, get_h() - 0.5 * buth_,
/** TRANSLATORS: Placeholders are the copyright years */
(boost::format(_("(C) %1%-%2% by the Widelands Development Team"))
% kWidelandsCopyrightStart % kWidelandsCopyrightEnd).str(),
@@ -123,31 +123,31 @@
vbox.add(&playtutorial, UI::Box::AlignCenter);
- vbox.add_space(m_padding);
+ vbox.add_space(padding_);
vbox.add(&singleplayer, UI::Box::AlignCenter);
vbox.add(&multiplayer, UI::Box::AlignCenter);
vbox.add(&replay, UI::Box::AlignCenter);
- vbox.add_space(m_padding);
+ vbox.add_space(padding_);
vbox.add(&editor, UI::Box::AlignCenter);
- vbox.add_space(m_padding);
+ vbox.add_space(padding_);
vbox.add(&options, UI::Box::AlignCenter);
- vbox.add_space(m_padding);
+ vbox.add_space(padding_);
vbox.add(&readme, UI::Box::AlignCenter);
vbox.add(&license, UI::Box::AlignCenter);
vbox.add(&authors, UI::Box::AlignCenter);
- vbox.add_space(m_padding);
+ vbox.add_space(padding_);
vbox.add(&exit, UI::Box::AlignCenter);
- vbox.set_size(m_butw, get_h() - vbox.get_y());
+ vbox.set_size(butw_, get_h() - vbox.get_y());
}
void FullscreenMenuMain::clicked_ok() {
=== modified file 'src/ui_fsmenu/main_menu.cc'
--- src/ui_fsmenu/main_menu.cc 2014-11-13 11:29:20 +0000
+++ src/ui_fsmenu/main_menu.cc 2016-01-28 20:02:32 +0000
@@ -27,11 +27,11 @@
FullscreenMenuBase(background_image),
// Values for alignment and size
- m_box_x(get_w() * 13 / 40),
- m_box_y(get_h() * 6 / 25),
- m_butw(get_w() * 7 / 20),
- m_buth(get_h() * 9 / 200),
- m_title_y(get_h() * 3 / 40),
- m_padding(m_buth / 3),
- m_button_background("pics/but3.png")
+ box_x_(get_w() * 13 / 40),
+ box_y_(get_h() * 6 / 25),
+ butw_(get_w() * 7 / 20),
+ buth_(get_h() * 9 / 200),
+ title_y_(get_h() * 3 / 40),
+ padding_(buth_ / 3),
+ button_background_("pics/but3.png")
{}
=== modified file 'src/ui_fsmenu/main_menu.h'
--- src/ui_fsmenu/main_menu.h 2016-01-02 12:36:38 +0000
+++ src/ui_fsmenu/main_menu.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 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
@@ -38,12 +38,12 @@
FullscreenMenuMainMenu(const char* background_image);
protected:
- const uint32_t m_box_x, m_box_y;
- const uint32_t m_butw, m_buth;
- const uint32_t m_title_y;
- const uint32_t m_padding;
+ const uint32_t box_x_, box_y_;
+ const uint32_t butw_, buth_;
+ const uint32_t title_y_;
+ const uint32_t padding_;
- const std::string m_button_background;
+ const std::string button_background_;
};
#endif // end of include guard: WL_UI_FSMENU_MAIN_MENU_H
=== modified file 'src/ui_fsmenu/multiplayer.cc'
--- src/ui_fsmenu/multiplayer.cc 2015-11-08 19:38:17 +0000
+++ src/ui_fsmenu/multiplayer.cc 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2010, 2012, 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
@@ -32,20 +32,20 @@
// Title
title
(this,
- get_w() / 2, m_title_y,
+ get_w() / 2, title_y_,
_("Choose game type"), UI::Align_HCenter),
// Buttons
- vbox(this, m_box_x, m_box_y, UI::Box::Vertical,
- m_butw, get_h() - m_box_y, m_padding),
+ vbox(this, box_x_, box_y_, UI::Box::Vertical,
+ butw_, get_h() - box_y_, padding_),
metaserver
- (&vbox, "metaserver", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "metaserver", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Internet game"), "", true, false),
lan
- (&vbox, "lan", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "lan", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("LAN / Direct IP"), "", true, false),
back
- (&vbox, "back", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "back", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Back"), "", true, false)
{
metaserver.sigclicked.connect(boost::bind(&FullscreenMenuMultiPlayer::internet_login, boost::ref(*this)));
@@ -66,21 +66,21 @@
vbox.add(&lan, UI::Box::AlignCenter);
// Multiple add_space calls to get the same height for the back button as in the single player menu
- vbox.add_space(m_buth);
- vbox.add_space(m_buth);
- vbox.add_space(6 * m_buth);
+ vbox.add_space(buth_);
+ vbox.add_space(buth_);
+ vbox.add_space(6 * buth_);
vbox.add(&back, UI::Box::AlignCenter);
- vbox.set_size(m_butw, get_h() - vbox.get_y());
+ vbox.set_size(butw_, get_h() - vbox.get_y());
Section & s = g_options.pull_section("global");
- m_auto_log = s.get_bool("auto_log", false);
- if (m_auto_log) {
+ auto_log_ = s.get_bool("auto_log", false);
+ if (auto_log_) {
showloginbox =
new UI::Button
(this, "login_dialog",
- m_box_x + m_butw + m_buth / 4, get_h() * 6 / 25, m_buth, m_buth,
+ box_x_ + butw_ + buth_ / 4, get_h() * 6 / 25, buth_, buth_,
g_gr->images().get("pics/but1.png"),
g_gr->images().get("pics/continue.png"),
_("Show login dialog"), true, false);
@@ -93,7 +93,7 @@
/// called if the showloginbox button was pressed
void FullscreenMenuMultiPlayer::show_internet_login() {
- m_auto_log = false;
+ auto_log_ = false;
internet_login();
}
@@ -112,16 +112,16 @@
*/
void FullscreenMenuMultiPlayer::internet_login() {
Section & s = g_options.pull_section("global");
- if (m_auto_log) {
- m_nickname = s.get_string("nickname", _("nobody"));
- m_password = s.get_string("password", "nobody");
- m_register = s.get_bool("registered", false);
+ if (auto_log_) {
+ nickname_ = s.get_string("nickname", _("nobody"));
+ password_ = s.get_string("password", "nobody");
+ register_ = s.get_bool("registered", false);
} else {
LoginBox lb(*this);
if (lb.run<UI::Panel::Returncodes>() == UI::Panel::Returncodes::kOk) {
- m_nickname = lb.get_nickname();
- m_password = lb.get_password();
- m_register = lb.registered();
+ nickname_ = lb.get_nickname();
+ password_ = lb.get_password();
+ register_ = lb.registered();
s.set_bool("registered", lb.registered());
s.set_bool("auto_log", lb.set_automaticlog());
@@ -133,7 +133,7 @@
// Try to connect to the metaserver
const std::string & meta = s.get_string("metaserver", INTERNET_GAMING_METASERVER.c_str());
uint32_t port = s.get_natural("metaserverport", INTERNET_GAMING_PORT);
- InternetGaming::ref().login(m_nickname, m_password, m_register, meta, port);
+ InternetGaming::ref().login(nickname_, password_, register_, meta, port);
// Check whether metaserver send some data
if (InternetGaming::ref().logged_in())
=== modified file 'src/ui_fsmenu/multiplayer.h'
--- src/ui_fsmenu/multiplayer.h 2015-08-05 10:44:37 +0000
+++ src/ui_fsmenu/multiplayer.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006, 2008, 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
@@ -36,9 +36,9 @@
void show_internet_login();
void internet_login();
- std::string get_nickname() {return m_nickname;}
- std::string get_password() {return m_password;}
- bool registered() {return m_register;}
+ std::string get_nickname() {return nickname_;}
+ std::string get_password() {return password_;}
+ bool registered() {return register_;}
protected:
void clicked_ok() override;
@@ -52,10 +52,10 @@
UI::Button back;
// Values from internet login window
- std::string m_nickname;
- std::string m_password;
- bool m_register;
- bool m_auto_log;
+ std::string nickname_;
+ std::string password_;
+ bool register_;
+ bool auto_log_;
};
#endif // end of include guard: WL_UI_FSMENU_MULTIPLAYER_H
=== modified file 'src/ui_fsmenu/netsetup_lan.cc'
--- src/ui_fsmenu/netsetup_lan.cc 2015-10-03 07:48:26 +0000
+++ src/ui_fsmenu/netsetup_lan.cc 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006-2011 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
@@ -31,25 +31,25 @@
FullscreenMenuBase("ui_fsmenu.jpg"), // TODO(unknown): change this
// Values for alignment and size
- m_butx (get_w() * 13 / 40),
- m_butw (get_w() / 4),
- m_buth (get_h() * 19 / 400),
- m_lisw (get_w() * 9 / 16),
+ butx_ (get_w() * 13 / 40),
+ butw_ (get_w() / 4),
+ buth_ (get_h() * 19 / 400),
+ lisw_ (get_w() * 9 / 16),
// Text labels
title
(this,
get_w() / 2, get_h() / 10,
_("Begin Network Game"), UI::Align_HCenter),
- m_opengames
+ opengames_
(this,
get_w() * 3 / 50, get_h() * 27 / 100,
_("List of games in your local network:")),
- m_playername
+ playername_
(this,
get_w() * 16 / 25, get_h() * 27 / 100,
_("Your nickname:")),
- m_hostname
+ hostname_
(this,
get_w() * 16 / 25, get_h() * 17 / 40,
_("Host to connect:")),
@@ -57,38 +57,38 @@
// Buttons
joingame
(this, "join_game",
- get_w() * 16 / 25, get_h() * 5333 / 10000, m_butw, m_buth,
+ get_w() * 16 / 25, get_h() * 5333 / 10000, butw_, buth_,
g_gr->images().get("pics/but1.png"),
_("Join this game"), std::string(), true, false),
hostgame
(this, "host_game",
- get_w() * 16 / 25, get_h() * 6083 / 10000, m_butw, m_buth,
+ get_w() * 16 / 25, get_h() * 6083 / 10000, butw_, buth_,
g_gr->images().get("pics/but1.png"),
_("Host a new game"), std::string(), true, false),
back
(this, "back",
- get_w() * 16 / 25, get_h() * 8333 / 10000, m_butw, m_buth,
+ get_w() * 16 / 25, get_h() * 8333 / 10000, butw_, buth_,
g_gr->images().get("pics/but0.png"),
_("Back"), std::string(), true, false),
loadlasthost
(this, "load_previous_host",
- get_w() * 171 / 200, get_h() * 19 / 40, m_buth, m_buth,
+ get_w() * 171 / 200, get_h() * 19 / 40, buth_, buth_,
g_gr->images().get("pics/but1.png"),
g_gr->images().get("pics/menu_load_game.png"),
_("Load previous host"), true, false),
// Edit boxes
playername
- (this, get_w() * 16 / 25, get_h() * 3333 / 10000, m_butw, m_buth,
+ (this, get_w() * 16 / 25, get_h() * 3333 / 10000, butw_, buth_,
g_gr->images().get("pics/but2.png")),
hostname
- (this, get_w() * 16 / 25, get_h() * 19 / 40, get_w() * 17 / 80, m_buth,
+ (this, get_w() * 16 / 25, get_h() * 19 / 40, get_w() * 17 / 80, buth_,
g_gr->images().get("pics/but2.png")),
// List
opengames
(this,
- get_w() * 3 / 50, get_h() * 3333 / 10000, m_lisw, get_h() * 5433 / 10000)
+ get_w() * 3 / 50, get_h() * 3333 / 10000, lisw_, get_h() * 5433 / 10000)
{
joingame.sigclicked.connect
(boost::bind
@@ -113,9 +113,9 @@
playername .changed.connect
(boost::bind(&FullscreenMenuNetSetupLAN::change_playername, this));
playername .set_font(ui_fn(), fs_small(), UI_FONT_CLR_FG);
- opengames .add_column(m_lisw * 2 / 5, _("Host"));
- opengames .add_column(m_lisw * 2 / 5, _("Map"));
- opengames .add_column(m_lisw / 5, _("State"));
+ opengames .add_column(lisw_ * 2 / 5, _("Host"));
+ opengames .add_column(lisw_ * 2 / 5, _("Map"));
+ opengames .add_column(lisw_ / 5, _("State"));
opengames .selected.connect(boost::bind(&FullscreenMenuNetSetupLAN::game_selected, this, _1));
opengames .double_clicked.connect
(boost::bind(&FullscreenMenuNetSetupLAN::game_doubleclicked, this, _1));
=== modified file 'src/ui_fsmenu/netsetup_lan.h'
--- src/ui_fsmenu/netsetup_lan.h 2015-08-05 10:44:37 +0000
+++ src/ui_fsmenu/netsetup_lan.h 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006-2011 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
@@ -57,12 +57,12 @@
void clicked_ok() override;
private:
- uint32_t m_butx;
- uint32_t m_butw;
- uint32_t m_buth;
- uint32_t m_lisw;
- UI::Textarea title, m_opengames;
- UI::Textarea m_playername, m_hostname;
+ uint32_t butx_;
+ uint32_t butw_;
+ uint32_t buth_;
+ uint32_t lisw_;
+ UI::Textarea title, opengames_;
+ UI::Textarea playername_, hostname_;
UI::Button joingame, hostgame, back, loadlasthost;
UI::EditBox playername;
UI::EditBox hostname;
=== modified file 'src/ui_fsmenu/singleplayer.cc'
--- src/ui_fsmenu/singleplayer.cc 2015-08-06 17:14:34 +0000
+++ src/ui_fsmenu/singleplayer.cc 2016-01-28 20:02:32 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2009 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
@@ -29,23 +29,23 @@
// Title
title
(this,
- get_w() / 2, m_title_y,
+ get_w() / 2, title_y_,
_("Single Player"), UI::Align_HCenter),
// Buttons
- vbox(this, m_box_x, m_box_y, UI::Box::Vertical,
- m_butw, get_h() - m_box_y, m_padding),
+ vbox(this, box_x_, box_y_, UI::Box::Vertical,
+ butw_, get_h() - box_y_, padding_),
new_game
- (&vbox, "new_game", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "new_game", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("New Game"), "", true, false),
campaign
- (&vbox, "campaigns", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "campaigns", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Campaigns"), "", true, false),
load_game
- (&vbox, "load_game", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "load_game", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Load Game"), "", true, false),
back
- (&vbox, "back", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
+ (&vbox, "back", 0, 0, butw_, buth_, g_gr->images().get(button_background_),
_("Back"), "", true, false)
{
new_game.sigclicked.connect
@@ -74,15 +74,15 @@
vbox.add(&new_game, UI::Box::AlignCenter);
vbox.add(&campaign, UI::Box::AlignCenter);
- vbox.add_space(m_buth);
+ vbox.add_space(buth_);
vbox.add(&load_game, UI::Box::AlignCenter);
- vbox.add_space(6 * m_buth);
+ vbox.add_space(6 * buth_);
vbox.add(&back, UI::Box::AlignCenter);
- vbox.set_size(m_butw, get_h() - vbox.get_y());
+ vbox.set_size(butw_, get_h() - vbox.get_y());
}
void FullscreenMenuSinglePlayer::clicked_ok() {
Follow ups