Removed trailing tabs and whitespaces from C++ source

I used this command line: find <source directory> -name \*.\[ch\]pp -print0 | xargs -0 sed -i 's/[[:blank:]]*$//'
This commit is contained in:
Elvish_Hunter 2015-12-21 20:39:37 +01:00
parent 203f7b0ded
commit 9b7b1751fd
136 changed files with 346 additions and 346 deletions

View file

@ -1187,7 +1187,7 @@ namespace {
a_.get_unit().set_movement(-1, true); a_.get_unit().set_movement(-1, true);
return; return;
} }
a_.get_unit().set_facing(a_.loc_.get_relative_dir(d_.loc_)); a_.get_unit().set_facing(a_.loc_.get_relative_dir(d_.loc_));
d_.get_unit().set_facing(d_.loc_.get_relative_dir(a_.loc_)); d_.get_unit().set_facing(d_.loc_.get_relative_dir(a_.loc_));
@ -1458,8 +1458,8 @@ namespace
return retv; return retv;
} }
virtual std::string description() const virtual std::string description() const
{ {
return "an advancement choice"; return "an advancement choice";
} }
private: private:
const map_location loc_; const map_location loc_;

View file

@ -519,7 +519,7 @@ namespace { // Helpers for place_recruit()
error_msg << "SYNC: In recruit " << new_unit.type_id() << error_msg << "SYNC: In recruit " << new_unit.type_id() <<
": has checksum " << checksum << ": has checksum " << checksum <<
" while datasource has checksum " << old_checksum << "\n"; " while datasource has checksum " << old_checksum << "\n";
if(old_checksum.empty()) if(old_checksum.empty())
{ {
error_msg << "Original result is \n" << original_checksum_config << "\n"; error_msg << "Original result is \n" << original_checksum_config << "\n";
} }

View file

@ -26,7 +26,7 @@ struct shroud_clearing_action
{ {
} }
typedef std::vector<map_location> t_route; typedef std::vector<map_location> t_route;
shroud_clearing_action(const unit_const_ptr u, const t_route::const_iterator& begin, const t_route::const_iterator& end) shroud_clearing_action(const unit_const_ptr u, const t_route::const_iterator& begin, const t_route::const_iterator& end)
@ -41,7 +41,7 @@ struct shroud_clearing_action
t_route route; t_route route;
/// A record of the affected unit's ability to see. /// A record of the affected unit's ability to see.
clearer_info view_info; clearer_info view_info;
void write(config & cfg) const void write(config & cfg) const
{ {
write_locations(route, cfg); write_locations(route, cfg);

View file

@ -46,7 +46,7 @@ public:
/// Creates an undo_action based on a config. /// Creates an undo_action based on a config.
/// Throws bad_lexical_cast or config::error if it cannot parse the config properly. /// Throws bad_lexical_cast or config::error if it cannot parse the config properly.
static undo_action_base * create_action(const config & cfg); static undo_action_base * create_action(const config & cfg);
// Functions related to managing the undo stack: // Functions related to managing the undo stack:
/// Adds an auto-shroud toggle to the undo stack. /// Adds an auto-shroud toggle to the undo stack.

View file

@ -36,7 +36,7 @@ void undo_action::write_tconfig_vector(const tconfig_vector& vec, config& cfg, c
{ {
BOOST_FOREACH(const config& c, vec) BOOST_FOREACH(const config& c, vec)
{ {
cfg.add_child(tag, c); cfg.add_child(tag, c);
} }
} }

View file

@ -92,7 +92,7 @@ namespace actions {
tconfig_vector umc_commands_redo; tconfig_vector umc_commands_redo;
void execute_undo_umc_wml(); void execute_undo_umc_wml();
void execute_redo_umc_wml(); void execute_redo_umc_wml();
static void read_tconfig_vector(tconfig_vector& vec, const config& cfg, const std::string& tag); static void read_tconfig_vector(tconfig_vector& vec, const config& cfg, const std::string& tag);
static void write_tconfig_vector(const tconfig_vector& vec, config& cfg, const std::string& tag); static void write_tconfig_vector(const tconfig_vector& vec, config& cfg, const std::string& tag);
}; };

View file

@ -7,7 +7,7 @@ namespace actions
{ {
namespace undo namespace undo
{ {
/** /**
* Writes this into the provided config. * Writes this into the provided config.
*/ */

View file

@ -8,7 +8,7 @@ namespace actions
{ {
namespace undo namespace undo
{ {
struct dismiss_action : undo_action struct dismiss_action : undo_action
{ {
unit_ptr dismissed_unit; unit_ptr dismissed_unit;

View file

@ -22,7 +22,7 @@ namespace actions
namespace undo namespace undo
{ {
/** /**
* Writes this into the provided config. * Writes this into the provided config.
*/ */

View file

@ -9,7 +9,7 @@ namespace actions
{ {
namespace undo namespace undo
{ {
struct move_action : undo_action, shroud_clearing_action struct move_action : undo_action, shroud_clearing_action
{ {
int starting_moves; int starting_moves;

View file

@ -18,7 +18,7 @@ namespace actions
{ {
namespace undo namespace undo
{ {
/** /**
* Writes this into the provided config. * Writes this into the provided config.
*/ */

View file

@ -9,7 +9,7 @@ namespace actions
{ {
namespace undo namespace undo
{ {
struct recall_action : undo_action, shroud_clearing_action struct recall_action : undo_action, shroud_clearing_action
{ {

View file

@ -9,7 +9,7 @@ namespace actions
{ {
namespace undo namespace undo
{ {
struct recruit_action : undo_action, shroud_clearing_action struct recruit_action : undo_action, shroud_clearing_action
{ {
const unit_type & u_type; const unit_type & u_type;

View file

@ -8,7 +8,7 @@ namespace actions
{ {
namespace undo namespace undo
{ {
struct auto_shroud_action : undo_action_base { struct auto_shroud_action : undo_action_base {
bool active; bool active;

View file

@ -103,7 +103,7 @@ public:
explicit config(const std::string &child); explicit config(const std::string &child);
~config(); ~config();
// Verifies that the string can be used as an attribute or tag name // Verifies that the string can be used as an attribute or tag name
static bool valid_id(std::string); static bool valid_id(std::string);

View file

@ -60,7 +60,7 @@ void controller_base::handle_event(const SDL_Event& event)
hotkey::execute_command(get_display(), quit_hotkey, get_hotkey_command_executor()); hotkey::execute_command(get_display(), quit_hotkey, get_hotkey_command_executor());
break; break;
} }
process_keydown_event(event); process_keydown_event(event);
hotkey::key_event(get_display(), event, get_hotkey_command_executor()); hotkey::key_event(get_display(), event, get_hotkey_command_executor());
} else { } else {

View file

@ -96,7 +96,7 @@ bool open_object(const std::string& path_or_url)
LOG_DU << "open_object(): on Win32, will use ShellExecute()\n"; LOG_DU << "open_object(): on Win32, will use ShellExecute()\n";
std::wstring u16path = unicode_cast<std::wstring>(path_or_url); std::wstring u16path = unicode_cast<std::wstring>(path_or_url);
const ptrdiff_t res = reinterpret_cast<ptrdiff_t>(ShellExecute(NULL, L"open", u16path.c_str(), NULL, NULL, SW_SHOW)); const ptrdiff_t res = reinterpret_cast<ptrdiff_t>(ShellExecute(NULL, L"open", u16path.c_str(), NULL, NULL, SW_SHOW));
if(res <= 32) { if(res <= 32) {
ERR_DU << "open_object(): ShellExecute() failed (" << res << ")" << std::endl; ERR_DU << "open_object(): ShellExecute() failed (" << res << ")" << std::endl;

View file

@ -101,14 +101,14 @@ std::string read_pipe_line(scoped_posix_pipe& p)
std::string ver; std::string ver;
int c; int c;
ver.reserve(64); ver.reserve(64);
// We only want the first line. // We only want the first line.
while((c = std::fgetc(p)) && c != EOF && c != '\n' && c != '\r') { while((c = std::fgetc(p)) && c != EOF && c != '\n' && c != '\r') {
ver.push_back(static_cast<char>(c)); ver.push_back(static_cast<char>(c));
} }
return ver; return ver;
} }
#endif #endif
@ -118,16 +118,16 @@ std::string read_pipe_line(scoped_posix_pipe& p)
std::string os_version() std::string os_version()
{ {
#if defined(_X11) || defined(__APPLE__) #if defined(_X11) || defined(__APPLE__)
#ifdef __APPLE__ #ifdef __APPLE__
// //
// Standard Mac OSX version // Standard Mac OSX version
// //
static const std::string version_plist = "/System/Library/CoreServices/SystemVersion.plist"; static const std::string version_plist = "/System/Library/CoreServices/SystemVersion.plist";
static const std::string defaults_bin = "/usr/bin/defaults"; static const std::string defaults_bin = "/usr/bin/defaults";
if(filesystem::file_exists(defaults_bin) && filesystem::file_exists(version_plist)) { if(filesystem::file_exists(defaults_bin) && filesystem::file_exists(version_plist)) {
static const std::string cmdline static const std::string cmdline
= defaults_bin + " read " + version_plist + " ProductUserVisibleVersion"; = defaults_bin + " read " + version_plist + " ProductUserVisibleVersion";

View file

@ -64,7 +64,7 @@ void display_chat_manager::add_chat_message(const time_t& time, const std::strin
if (*w == message.substr(0,pos)) remove_whisperer(*w); if (*w == message.substr(0,pos)) remove_whisperer(*w);
} }
} }
if (!preferences::parse_should_show_lobby_join(sender, message)) return; if (!preferences::parse_should_show_lobby_join(sender, message)) return;
if (preferences::is_ignored(sender)) return; if (preferences::is_ignored(sender)) return;

View file

@ -32,7 +32,7 @@ public:
void add_observer(const std::string& name) { observers_.insert(name); } void add_observer(const std::string& name) { observers_.insert(name); }
void remove_observer(const std::string& name) { observers_.erase(name); } void remove_observer(const std::string& name) { observers_.erase(name); }
const std::set<std::string>& observers() const { return observers_; } const std::set<std::string>& observers() const { return observers_; }
void add_whisperer(const std::string& nick) { whisperers_.insert(nick); } void add_whisperer(const std::string& nick) { whisperers_.insert(nick); }
void remove_whisperer(const std::string& nick) { whisperers_.erase(nick); } void remove_whisperer(const std::string& nick) { whisperers_.erase(nick); }
const std::set<std::string>& whisperers() const { return whisperers_; } const std::set<std::string>& whisperers() const { return whisperers_; }

View file

@ -402,7 +402,7 @@ void pump()
} }
break; break;
} }
#ifndef __APPLE__ #ifndef __APPLE__
case SDL_KEYDOWN: { case SDL_KEYDOWN: {
if(event.key.keysym.sym == SDLK_F4 && (event.key.keysym.mod == KMOD_RALT || event.key.keysym.mod == KMOD_LALT)) { if(event.key.keysym.sym == SDLK_F4 && (event.key.keysym.mod == KMOD_RALT || event.key.keysym.mod == KMOD_LALT)) {

View file

@ -33,7 +33,7 @@ class config;
struct SDL_RWops; struct SDL_RWops;
namespace filesystem { namespace filesystem {
SDL_RWops* load_RWops(const std::string &path); SDL_RWops* load_RWops(const std::string &path);
/** An exception object used when an IO error occurs */ /** An exception object used when an IO error occurs */

View file

@ -173,12 +173,12 @@ namespace {
catch(...) catch(...)
{ {
ERR_FS << "Invalid UTF-16 string" << std::endl; ERR_FS << "Invalid UTF-16 string" << std::endl;
return std::codecvt_base::error; return std::codecvt_base::error;
} }
return std::codecvt_base::ok; return std::codecvt_base::ok;
} }
}; };
#ifdef _WIN32 #ifdef _WIN32
class static_runner { class static_runner {
public: public:
@ -371,7 +371,7 @@ void get_files_in_dir(const std::string &dir,
} }
} else if (st.type() == bfs::directory_file) { } else if (st.type() == bfs::directory_file) {
std::string basename = di->path().filename().string(); std::string basename = di->path().filename().string();
if(!basename.empty() && basename[0] == '.' ) if(!basename.empty() && basename[0] == '.' )
continue; continue;
if (filter == SKIP_MEDIA_DIR if (filter == SKIP_MEDIA_DIR
@ -1084,12 +1084,12 @@ const std::vector<std::string>& get_binary_paths(const std::string& type)
std::string get_binary_file_location(const std::string& type, const std::string& filename) std::string get_binary_file_location(const std::string& type, const std::string& filename)
{ {
// We define ".." as "remove everything before" this is needed becasue // We define ".." as "remove everything before" this is needed becasue
// on the one hand allowing ".." would be a security risk but // on the one hand allowing ".." would be a security risk but
// especialy for terrains the c++ engine puts a hardcoded "terrain/" before filename // especialy for terrains the c++ engine puts a hardcoded "terrain/" before filename
// and there would be no way to "escape" from "terrain/" otherwise. This is not the // and there would be no way to "escape" from "terrain/" otherwise. This is not the
// best solution but we cannot remove it without another solution (subtypes maybe?). // best solution but we cannot remove it without another solution (subtypes maybe?).
// using 'for' instead 'if' to allow putting delcaration and check into the brackets // using 'for' instead 'if' to allow putting delcaration and check into the brackets
for(std::string::size_type pos = filename.rfind("../"); pos != std::string::npos;) for(std::string::size_type pos = filename.rfind("../"); pos != std::string::npos;)
return get_binary_file_location(type, filename.substr(pos + 3)); return get_binary_file_location(type, filename.substr(pos + 3));

View file

@ -493,7 +493,7 @@ void undraw_floating_labels(surface screen)
//undraw labels in reverse order, so that a LIFO process occurs, and the screen is restored //undraw labels in reverse order, so that a LIFO process occurs, and the screen is restored
//into the exact state it started in. //into the exact state it started in.
for(label_map::reverse_iterator i = labels.rbegin(); i != labels.rend(); ++i) { for(label_map::reverse_iterator i = labels.rbegin(); i != labels.rend(); ++i) {
if(context.count(i->first) > 0) { if(context.count(i->first) > 0) {
i->second.undraw(screen); i->second.undraw(screen);
} }
} }

View file

@ -293,7 +293,7 @@ static TTF_Font* get_font(font_id id)
const std::map<font_id, ttf_record>::iterator it = font_table.find(id); const std::map<font_id, ttf_record>::iterator it = font_table.find(id);
if(it != font_table.end()) { if(it != font_table.end()) {
if (it->second.font != NULL) { if (it->second.font != NULL) {
// If we found a valid record, use SDL_TTF to add in the difference // If we found a valid record, use SDL_TTF to add in the difference
// between its intrinsic style and the desired style. // between its intrinsic style and the desired style.
TTF_SetFontStyle(it->second.font, it->second.style ^ id.style); TTF_SetFontStyle(it->second.font, it->second.style ^ id.style);
} }

View file

@ -55,8 +55,8 @@ t_string interpolate_variables_into_tstring(const t_string &str, const variable_
} }
/// An alias for boost::assign::map_list_of<std::string, std::string> /// An alias for boost::assign::map_list_of<std::string, std::string>
inline boost::assign_detail::generic_list< std::pair inline boost::assign_detail::generic_list< std::pair
< <
boost::assign_detail::assign_decay<std::string>::type, boost::assign_detail::assign_decay<std::string>::type,
boost::assign_detail::assign_decay<std::string>::type boost::assign_detail::assign_decay<std::string>::type
> > > >
string_map_of(const std::string& k, const std::string& v) string_map_of(const std::string& k, const std::string& v)

View file

@ -62,7 +62,7 @@ public:
void clear_variable(const std::string& varname); void clear_variable(const std::string& varname);
/// Clears only the config children /// Clears only the config children
/// does nothing if varname is no valid variable name. /// does nothing if varname is no valid variable name.
void clear_variable_cfg(const std::string& varname); void clear_variable_cfg(const std::string& varname);
const rand_rng::mt_rng& rng() const { return rng_; } const rand_rng::mt_rng& rng() const { return rng_; }
rand_rng::mt_rng& rng() { return rng_; } rand_rng::mt_rng& rng() { return rng_; }

View file

@ -592,14 +592,14 @@ namespace {
static const std::string s_prefix = "(\\d+ )?"; static const std::string s_prefix = "(\\d+ )?";
static const std::string s_all = "(" + s_prefix + s_terrain + s_sep + ")+"; static const std::string s_all = "(" + s_prefix + s_terrain + s_sep + ")+";
static const boost::regex r_all(s_all); static const boost::regex r_all(s_all);
const std::string& mapfile = filesystem::get_wml_location(filename_); const std::string& mapfile = filesystem::get_wml_location(filename_);
std::string res = ""; std::string res = "";
if(filesystem::file_exists(mapfile)) { if(filesystem::file_exists(mapfile)) {
res = filesystem::read_file(mapfile); res = filesystem::read_file(mapfile);
} }
config retv; config retv;
if(boost::regex_match(res, r_all)) if(boost::regex_match(res, r_all))
{ {
retv["map_data"] = res; retv["map_data"] = res;
} }
@ -610,8 +610,8 @@ namespace {
return config(); return config();
} }
virtual std::string description() const virtual std::string description() const
{ {
return "Map Data"; return "Map Data";
} }
}; };

View file

@ -530,7 +530,7 @@ bool t_pump::operator()()
// Clear the unit cache, since the best clearing time is hard to figure out // Clear the unit cache, since the best clearing time is hard to figure out
// due to status changes by WML. Every event will flush the cache. // due to status changes by WML. Every event will flush the cache.
unit::clear_status_caches(); unit::clear_status_caches();
{ // Block for context::scoped { // Block for context::scoped
context::scoped evc(impl_->contexts_, false); context::scoped evc(impl_->contexts_, false);
if ( resources::lua_kernel->run_event(ev) ) { if ( resources::lua_kernel->run_event(ev) ) {

View file

@ -121,7 +121,7 @@ private:
const config &side_cfg_; const config &side_cfg_;
std::vector<const config*> entry_points_; std::vector<const config*> entry_points_;
std::vector<std::string> entry_point_titles_; std::vector<std::string> entry_point_titles_;
}; };

View file

@ -775,7 +775,7 @@ void connect_engine::send_level_data(const network::connection sock) const
("create_game", config_of ("create_game", config_of
("name", params_.name) ("name", params_.name)
("password", params_.password) ("password", params_.password)
) )
); );
network::send_data(level_, sock); network::send_data(level_, sock);
} else { } else {
@ -811,7 +811,7 @@ void connect_engine::load_previous_sides_users()
const std::string& save_id = side->previous_save_id(); const std::string& save_id = side->previous_save_id();
if (side_users.find(save_id) != side_users.end()) { if (side_users.find(save_id) != side_users.end()) {
side->set_reserved_for(side_users[save_id]); side->set_reserved_for(side_users[save_id]);
if (side->controller() != CNTR_COMPUTER) { if (side->controller() != CNTR_COMPUTER) {
side->set_controller(CNTR_RESERVED); side->set_controller(CNTR_RESERVED);
names.insert(side_users[save_id]); names.insert(side_users[save_id]);
@ -901,13 +901,13 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
// Tweak the controllers. // Tweak the controllers.
if (cfg_["controller"] == "network_ai" || if (cfg_["controller"] == "network_ai" ||
(parent_.state_.classification().campaign_type == game_classification::CAMPAIGN_TYPE::SCENARIO && cfg_["controller"].blank())) (parent_.state_.classification().campaign_type == game_classification::CAMPAIGN_TYPE::SCENARIO && cfg_["controller"].blank()))
{ {
cfg_["controller"] = "ai"; cfg_["controller"] = "ai";
} }
//this is a workaround for bug #21797 //this is a workaround for bug #21797
if(cfg_["controller"] == "network" && !allow_player_ && parent_.params_.saved_game) if(cfg_["controller"] == "network" && !allow_player_ && parent_.params_.saved_game)
{ {
WRN_MP << "Found a side controlled by a network player with allow_player=no" << std::endl; WRN_MP << "Found a side controlled by a network player with allow_player=no" << std::endl;
cfg_["controller"] = "ai"; cfg_["controller"] = "ai";
} }
@ -970,7 +970,7 @@ side_engine::~side_engine()
std::string side_engine::user_description() const std::string side_engine::user_description() const
{ {
switch(controller_) switch(controller_)
{ {
case CNTR_LOCAL: case CNTR_LOCAL:
return N_("Anonymous player"); return N_("Anonymous player");
@ -1009,20 +1009,20 @@ config side_engine::new_config() const
if (!cfg_.has_attribute("side") || cfg_["side"].to_int() != index_ + 1) { if (!cfg_.has_attribute("side") || cfg_["side"].to_int() != index_ + 1) {
res["side"] = index_ + 1; res["side"] = index_ + 1;
} }
res["controller"] = controller_names[controller_]; res["controller"] = controller_names[controller_];
if(player_id_ == preferences::login() && res["controller"] == "network") { if(player_id_ == preferences::login() && res["controller"] == "network") {
// the hosts rveices the serversided controller wteaks after the start event, but // the hosts rveices the serversided controller wteaks after the start event, but
// for mp sync it's very important that the controller types are correct // for mp sync it's very important that the controller types are correct
// during the start/prestart event (otherwse random unit creation during prestart fails). // during the start/prestart event (otherwse random unit creation during prestart fails).
res["controller"] = "human"; res["controller"] = "human";
} }
std::string desc = user_description(); std::string desc = user_description();
if(!desc.empty()) { if(!desc.empty()) {
res["user_description"] = t_string(desc, "wesnoth"); res["user_description"] = t_string(desc, "wesnoth");
desc = vgettext( desc = vgettext(
"$playername $side", "$playername $side",
boost::assign::map_list_of boost::assign::map_list_of
("playername", _(desc.c_str())) ("playername", _(desc.c_str()))
("side", res["side"].str()) ("side", res["side"].str())
@ -1032,7 +1032,7 @@ config side_engine::new_config() const
} }
if(res["name"].str().empty() && !desc.empty()) { if(res["name"].str().empty() && !desc.empty()) {
res["name"] = desc; res["name"] = desc;
} }
assert(controller_ != CNTR_LAST); assert(controller_ != CNTR_LAST);
if(controller_ == CNTR_COMPUTER && allow_player_) { if(controller_ == CNTR_COMPUTER && allow_player_) {
@ -1046,7 +1046,7 @@ config side_engine::new_config() const
// Side's "current_player" is the player which is currently taken that side // Side's "current_player" is the player which is currently taken that side
// or the one which is reserved to it. // or the one which is reserved to it.
// "player_id" is the id of the client who controlls that side, // "player_id" is the id of the client who controlls that side,
// that always the host for Local players and AIs // that always the host for Local players and AIs
// any always empty for free/reserved sides or null controlled sides. // any always empty for free/reserved sides or null controlled sides.
// especialy you can use !res["player_id"].empty() to check whether a side is already taken. // especialy you can use !res["player_id"].empty() to check whether a side is already taken.
@ -1060,7 +1060,7 @@ config side_engine::new_config() const
} else if(controller_ == CNTR_COMPUTER) { } else if(controller_ == CNTR_COMPUTER) {
//TODO what is the content of player_id_ here ? //TODO what is the content of player_id_ here ?
res["current_player"] = desc; res["current_player"] = desc;
res["player_id"] = preferences::login(); res["player_id"] = preferences::login();
} else if(!player_id_.empty()) { } else if(!player_id_.empty()) {
res["player_id"] = player_id_; res["player_id"] = player_id_;
res["current_player"] = player_id_; res["current_player"] = player_id_;

View file

@ -132,7 +132,7 @@ private:
std::vector<std::string> team_names_; std::vector<std::string> team_names_;
std::vector<std::string> user_team_names_; std::vector<std::string> user_team_names_;
std::vector<std::string> player_teams_; std::vector<std::string> player_teams_;
std::set<std::string>& connected_users_rw(); std::set<std::string>& connected_users_rw();
}; };
@ -246,9 +246,9 @@ private:
int gold_; int gold_;
int income_; int income_;
// set during create_engines constructor never set after that. // set during create_engines constructor never set after that.
// the name of the player who is preferred for this side, // the name of the player who is preferred for this side,
// if controller_ == reserved only this player can take this side. // if controller_ == reserved only this player can take this side.
// can also be a number of a side if this side shoudl be controlled // can also be a number of a side if this side shoudl be controlled
// by the player who controlls that side // by the player who controlls that side
std::string reserved_for_; std::string reserved_for_;
std::string player_id_; std::string player_id_;

View file

@ -572,7 +572,7 @@ void create_engine::prepare_for_campaign(const std::string& difficulty)
* *
* Launches difficulty selection gui and returns selected difficulty name. * Launches difficulty selection gui and returns selected difficulty name.
* *
* The gui can be bypassed by supplying a number from 1 to the number of * The gui can be bypassed by supplying a number from 1 to the number of
* difficulties available, corresponding to a choice of difficulty. * difficulties available, corresponding to a choice of difficulty.
* This is useful for specifying difficulty via command line. * This is useful for specifying difficulty via command line.
* *

View file

@ -207,7 +207,7 @@ public:
void prepare_for_saved_game(); void prepare_for_saved_game();
//random maps, user maps //random maps, user maps
void prepare_for_other(); void prepare_for_other();
std::string select_campaign_difficulty(int set_value = -1); std::string select_campaign_difficulty(int set_value = -1);
void apply_level_filter(const std::string& name); void apply_level_filter(const std::string& name);
@ -244,7 +244,7 @@ public:
get_extras_by_type(const MP_EXTRA extra_type); get_extras_by_type(const MP_EXTRA extra_type);
bool toggle_current_mod(bool force = false); bool toggle_current_mod(bool force = false);
bool generator_assigned() const; bool generator_assigned() const;
void generator_user_config(display& disp); void generator_user_config(display& disp);

View file

@ -544,7 +544,7 @@ static bool enter_connect_mode(game_display& disp, const config& game_config,
} }
static bool enter_configure_mode(game_display& disp, const config& game_config, static bool enter_configure_mode(game_display& disp, const config& game_config,
saved_game& state, saved_game& state,
bool local_players_only = false); bool local_players_only = false);
static void enter_create_mode(game_display& disp, const config& game_config, static void enter_create_mode(game_display& disp, const config& game_config,

View file

@ -108,7 +108,7 @@ configure::configure(game_display& disp, const config &cfg, chat& c, config& gam
// Build the list of scenarios to play // Build the list of scenarios to play
DBG_MP << "constructing multiplayer configure dialog" << std::endl; DBG_MP << "constructing multiplayer configure dialog" << std::endl;
countdown_game_.set_check(engine_.mp_countdown_default()); countdown_game_.set_check(engine_.mp_countdown_default());
countdown_game_.set_help_string(_("Enables user time limit")); countdown_game_.set_help_string(_("Enables user time limit"));
@ -296,7 +296,7 @@ void configure::get_parameters()
countdown_init_time_slider_.value() : -1; countdown_init_time_slider_.value() : -1;
if(mp_countdown_reservoir_time_val > 0 && mp_countdown_init_time_val > mp_countdown_reservoir_time_val) if(mp_countdown_reservoir_time_val > 0 && mp_countdown_init_time_val > mp_countdown_reservoir_time_val)
mp_countdown_init_time_val = mp_countdown_reservoir_time_val; mp_countdown_init_time_val = mp_countdown_reservoir_time_val;
// Updates the values in the configure_engine to match // Updates the values in the configure_engine to match
// the values selected by the user with the widgets: // the values selected by the user with the widgets:
engine_.set_game_name(name_entry_.text()); engine_.set_game_name(name_entry_.text());

View file

@ -941,7 +941,7 @@ bool gamebrowser::game_matches_filter(const game_item& i, const config& cfg)
BOOST_FOREACH(const std::string& search_string, utils::split(preferences::fi_text(), ' ', utils::STRIP_SPACES)) { BOOST_FOREACH(const std::string& search_string, utils::split(preferences::fi_text(), ' ', utils::STRIP_SPACES)) {
if(!boost::contains(i.map_info, search_string, chars_equal_insensitive) && if(!boost::contains(i.map_info, search_string, chars_equal_insensitive) &&
!boost::contains(i.name, search_string, chars_equal_insensitive) && !boost::contains(i.name, search_string, chars_equal_insensitive) &&
!boost::contains(i.era_and_mod_info, search_string, chars_equal_insensitive)) { !boost::contains(i.era_and_mod_info, search_string, chars_equal_insensitive)) {
found_match = false; found_match = false;

View file

@ -260,7 +260,7 @@ void wait::join_game(bool observe)
// Add the map name to the title. // Add the map name to the title.
append_to_title(": " + get_scenario()["name"].t_str()); append_to_title(": " + get_scenario()["name"].t_str());
game_config::add_color_info(get_scenario()); game_config::add_color_info(get_scenario());
if (!observe) { if (!observe) {
//search for an appropriate vacant slot. If a description is set //search for an appropriate vacant slot. If a description is set

View file

@ -223,7 +223,7 @@ LEVEL_RESULT campaign_controller::playsingle_scenario(end_level_data &end_level)
LEVEL_RESULT campaign_controller::playmp_scenario(end_level_data &end_level) LEVEL_RESULT campaign_controller::playmp_scenario(end_level_data &end_level)
{ {
playmp_controller playcontroller(state_.get_starting_pos(), state_, playmp_controller playcontroller(state_.get_starting_pos(), state_,
game_config_, tdata_, disp_.video(), mp_info_); game_config_, tdata_, disp_.video(), mp_info_);
LEVEL_RESULT res = playcontroller.play_scenario(state_.get_starting_pos()); LEVEL_RESULT res = playcontroller.play_scenario(state_.get_starting_pos());
@ -262,7 +262,7 @@ LEVEL_RESULT campaign_controller::play_game()
else { else {
state_.get_replay().set_to_end(); state_.get_replay().set_to_end();
} }
state_.expand_scenario(); state_.expand_scenario();
game_classification::CAMPAIGN_TYPE game_type = state_.classification().campaign_type; game_classification::CAMPAIGN_TYPE game_type = state_.classification().campaign_type;
@ -289,7 +289,7 @@ LEVEL_RESULT campaign_controller::play_game()
if(is_replay_) { if(is_replay_) {
return res; return res;
} }
} else } else
#endif #endif
{ {
res = playmp_scenario(end_level); res = playmp_scenario(end_level);
@ -336,7 +336,7 @@ LEVEL_RESULT campaign_controller::play_game()
savegame::replay_savegame save(state_, preferences::save_compression_format()); savegame::replay_savegame save(state_, preferences::save_compression_format());
save.save_game_automatic(disp_.video(), true); save.save_game_automatic(disp_.video(), true);
} }
state_.convert_to_start_save(); state_.convert_to_start_save();
//If there is no next scenario we're done now. //If there is no next scenario we're done now.

View file

@ -34,7 +34,7 @@ bool enter_create_mode(game_display& disp, const config& game_config,
std::vector<ng::create_engine::level_ptr> campaigns( std::vector<ng::create_engine::level_ptr> campaigns(
create_eng.get_levels_by_type_unfiltered(ng::level::TYPE::SP_CAMPAIGN)); create_eng.get_levels_by_type_unfiltered(ng::level::TYPE::SP_CAMPAIGN));
if (campaigns.empty()) { if (campaigns.empty()) {
gui2::show_error_message(disp.video(), gui2::show_error_message(disp.video(),
_("No campaigns are available.\n")); _("No campaigns are available.\n"));

View file

@ -567,7 +567,7 @@ bool game_launcher::play_test()
); );
game_config_manager::get()-> game_config_manager::get()->
load_game_config_for_game(state_.classification()); load_game_config_for_game(state_.classification());

View file

@ -210,7 +210,7 @@ void game_state::init(const config& level, play_controller & pc)
} }
} }
} }
pathfind_manager_.reset(new pathfind::manager(level)); pathfind_manager_.reset(new pathfind::manager(level));
lua_kernel_.reset(new game_lua_kernel(NULL, *this, pc, *reports_)); lua_kernel_.reset(new game_lua_kernel(NULL, *this, pc, *reports_));

View file

@ -76,7 +76,7 @@ private:
size_t translate_x(size_t x) const; size_t translate_x(size_t x) const;
size_t translate_y(size_t y) const; size_t translate_y(size_t y) const;
const cave_map_generator& params; const cave_map_generator& params;
bool flipx_, flipy_; bool flipx_, flipy_;

View file

@ -242,7 +242,7 @@ bool default_map_generator_job::generate_lake(terrain_map& terrain, int x, int y
* successfully. * successfully.
*/ */
namespace namespace
{ {
struct for_randomshuffle struct for_randomshuffle
{ {

View file

@ -43,7 +43,7 @@ public:
bool roads_between_castles, std::map<map_location,std::string>* labels, bool roads_between_castles, std::map<map_location,std::string>* labels,
const config& cfg); const config& cfg);
private: private:
typedef std::vector<std::vector<int> > height_map; typedef std::vector<std::vector<int> > height_map;
typedef t_translation::t_map terrain_map; typedef t_translation::t_map terrain_map;

View file

@ -87,7 +87,7 @@ const char* sngettext (const char *singular, const char *plural, int n)
return msgval; return msgval;
} }
#endif #endif
std::string dsngettext (const char * domainname, const char *singular, const char *plural, int n) std::string dsngettext (const char * domainname, const char *singular, const char *plural, int n)
{ {
bind_textdomain_codeset(domainname, "UTF-8"); bind_textdomain_codeset(domainname, "UTF-8");
@ -132,7 +132,7 @@ void set_language(const std::string& slocale, const std::vector<std::string>* al
// use that value, so someone with es would get the game in Spanish // use that value, so someone with es would get the game in Spanish
// instead of en_US the first time round // instead of en_US the first time round
// LANGUAGE overrides other settings, so for now just get rid of it // LANGUAGE overrides other settings, so for now just get rid of it
#ifdef _WIN32 #ifdef _WIN32
(void)alternates; (void)alternates;
std::string win_locale(locale, 0, 2); std::string win_locale(locale, 0, 2);

View file

@ -53,7 +53,7 @@
#define UNUSEDNOWARN #define UNUSEDNOWARN
#endif #endif
namespace translation namespace translation
{ {
std::string dgettext(const char* domain, const char* msgid); std::string dgettext(const char* domain, const char* msgid);
std::string egettext(const char*); std::string egettext(const char*);
@ -61,11 +61,11 @@ namespace translation
//const char* sngettext(const char *singular, const char *plural, int n); //const char* sngettext(const char *singular, const char *plural, int n);
std::string dsngettext(const char * domainname, const char *singular, const char *plural, int n); std::string dsngettext(const char * domainname, const char *singular, const char *plural, int n);
inline UNUSEDNOWARN static std::string gettext(const char* str) inline UNUSEDNOWARN static std::string gettext(const char* str)
{ return translation::dgettext(GETTEXT_DOMAIN, str); } { return translation::dgettext(GETTEXT_DOMAIN, str); }
inline UNUSEDNOWARN static std::string sgettext(const char* str) inline UNUSEDNOWARN static std::string sgettext(const char* str)
{ return translation::dsgettext(GETTEXT_DOMAIN, str); } { return translation::dsgettext(GETTEXT_DOMAIN, str); }
inline UNUSEDNOWARN static std::string sngettext(const char* str1, const char* str2, int n) inline UNUSEDNOWARN static std::string sngettext(const char* str1, const char* str2, int n)
{ return translation::dsngettext(GETTEXT_DOMAIN, str1, str2 , n); } { return translation::dsngettext(GETTEXT_DOMAIN, str1, str2 , n); }

View file

@ -1317,7 +1317,7 @@ private:
* text_markup & f_bool & false & Can the text have mark-up? $ * text_markup & f_bool & false & Can the text have mark-up? $
* text_link_aware & f_bool & false & * text_link_aware & f_bool & false &
* Is the text link aware? $ * Is the text link aware? $
* text_link_color & f_string & "#ffff00" & * text_link_color & f_string & "#ffff00" &
* The color of links in the text $ * The color of links in the text $
* maximum_width & f_int & -1 & The maximum width the text is allowed to * maximum_width & f_int & -1 & The maximum width the text is allowed to
* be. $ * be. $

View file

@ -79,7 +79,7 @@ struct filter_transform
bool operator()(const config& cfg) const bool operator()(const config& cfg) const
{ {
FOREACH(const AUTO& filter, filtertext_) FOREACH(const AUTO& filter, filtertext_)
{ {
bool found = false; bool found = false;
FOREACH(const AUTO& attribute, cfg.attribute_range()) FOREACH(const AUTO& attribute, cfg.attribute_range())
{ {
@ -183,7 +183,7 @@ void taddon_list::register_sort_button_alphabetical(twindow& window, const std::
void taddon_list::register_sort_button_numeric(twindow& window, const std::string& id, const std::string& prop_id) void taddon_list::register_sort_button_numeric(twindow& window, const std::string& id, const std::string& prop_id)
{ {
register_sort_button(window, id, boost::bind(&num_up, &cfg_, prop_id, _1, _2), boost::bind(&num_down, &cfg_, prop_id, _1, _2)); register_sort_button(window, id, boost::bind(&num_up, &cfg_, prop_id, _1, _2), boost::bind(&num_down, &cfg_, prop_id, _1, _2));
} }

View file

@ -154,7 +154,7 @@ void tcampaign_selection::pre_show(CVideo& video, twindow& window)
tree_group_item["victory"] = tree_group_field; tree_group_item["victory"] = tree_group_field;
tree.add_node("campaign", tree_group_item).set_id(lexical_cast<std::string>(id++)); tree.add_node("campaign", tree_group_item).set_id(lexical_cast<std::string>(id++));
/*** Add detail item ***/ /*** Add detail item ***/
string_map detail_item; string_map detail_item;
std::map<std::string, string_map> detail_page; std::map<std::string, string_map> detail_page;
@ -169,7 +169,7 @@ void tcampaign_selection::pre_show(CVideo& video, twindow& window)
multi_page.add_page(detail_page); multi_page.add_page(detail_page);
} }
if (!engine_.get_const_extras_by_type(ng::create_engine::MOD).empty()) { if (!engine_.get_const_extras_by_type(ng::create_engine::MOD).empty()) {
tree_group_field["label"] = "Modifications"; tree_group_field["label"] = "Modifications";
tree_group_item["tree_view_node_label"] = tree_group_field; tree_group_item["tree_view_node_label"] = tree_group_field;
//tree_group_item["tree_view_node_label"] = tree_group_field; //tree_group_item["tree_view_node_label"] = tree_group_field;
@ -178,7 +178,7 @@ void tcampaign_selection::pre_show(CVideo& video, twindow& window)
id = 0; id = 0;
tree_group_item.clear(); tree_group_item.clear();
FOREACH(const AUTO& mod, engine_.get_const_extras_by_type(ng::create_engine::MOD)) FOREACH(const AUTO& mod, engine_.get_const_extras_by_type(ng::create_engine::MOD))
{ {
bool active = std::find(enabled.begin(), enabled.end(), mod->id) != enabled.end(); bool active = std::find(enabled.begin(), enabled.end(), mod->id) != enabled.end();
/*** Add tree item ***/ /*** Add tree item ***/

View file

@ -49,7 +49,7 @@ private:
// populate era and mod lists // populate era and mod lists
void update_lists(twindow& window); void update_lists(twindow& window);
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */ /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
virtual const std::string& window_id() const; virtual const std::string& window_id() const;

View file

@ -79,7 +79,7 @@ private:
/** Current map generator index */ /** Current map generator index */
int current_map_generator_; int current_map_generator_;
/** random seed integer input*/ /** random seed integer input*/
std::string random_seed_; std::string random_seed_;

View file

@ -285,15 +285,15 @@ void tgame_load::display_savegame(twindow& window)
evaluate_summary_string(str, summary); evaluate_summary_string(str, summary);
// Always toggle show_replay on if the save is a replay // Always toggle show_replay on if the save is a replay
ttoggle_button& replay_toggle = ttoggle_button& replay_toggle =
find_widget<ttoggle_button>(&window, "show_replay", false); find_widget<ttoggle_button>(&window, "show_replay", false);
// cancel orders doesnt make sense on replay saves or start-of-scenario saves. // cancel orders doesnt make sense on replay saves or start-of-scenario saves.
ttoggle_button& cancel_orders_toggle = ttoggle_button& cancel_orders_toggle =
find_widget<ttoggle_button>(&window, "cancel_orders", false); find_widget<ttoggle_button>(&window, "cancel_orders", false);
const bool is_replay = is_replay_save(summary); const bool is_replay = is_replay_save(summary);
const bool is_scenario_start = summary["turn"].empty(); const bool is_scenario_start = summary["turn"].empty();
replay_toggle.set_value(is_replay); replay_toggle.set_value(is_replay);
replay_toggle.set_active(!is_replay && !is_scenario_start); replay_toggle.set_active(!is_replay && !is_scenario_start);
cancel_orders_toggle.set_active(!is_replay && !is_scenario_start); cancel_orders_toggle.set_active(!is_replay && !is_scenario_start);

View file

@ -1,13 +1,13 @@
/* /*
Part of the Battle for Wesnoth Project http://www.wesnoth.org/ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY. but WITHOUT ANY WARRANTY.
See the COPYING file for more details. See the COPYING file for more details.
*/ */
@ -24,7 +24,7 @@ namespace gui2 {
class tlabel_settings : public tdialog { class tlabel_settings : public tdialog {
public: public:
tlabel_settings(display_context& dc); tlabel_settings(display_context& dc);
/** /**
* The execute function. * The execute function.
* *
@ -35,13 +35,13 @@ private:
std::map<std::string, bool> all_labels; std::map<std::string, bool> all_labels;
std::map<std::string, t_string> labels_display; std::map<std::string, t_string> labels_display;
display_context& viewer; display_context& viewer;
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */ /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
virtual const std::string& window_id() const; virtual const std::string& window_id() const;
/** Inherited from tdialog. */ /** Inherited from tdialog. */
void pre_show(CVideo& video, twindow& window); void pre_show(CVideo& video, twindow& window);
/** Callback for toggling a checkbox state. */ /** Callback for toggling a checkbox state. */
void toggle_category(twidget& box, std::string category); void toggle_category(twidget& box, std::string category);
}; };

View file

@ -219,7 +219,7 @@ public:
void maybe_update_prefix (const std::string & text) { void maybe_update_prefix (const std::string & text) {
LOG_LUA << "maybe update prefix\n"; LOG_LUA << "maybe update prefix\n";
LOG_LUA << "prefix_: '"<< prefix_ << "'\t text='"<< text << "'\n"; LOG_LUA << "prefix_: '"<< prefix_ << "'\t text='"<< text << "'\n";
if (!end_of_history_) return; if (!end_of_history_) return;

View file

@ -262,7 +262,7 @@ void tunit_create::print_stats(std::stringstream& str, const int row)
{ {
if(tr["availability"] != "musthave") continue; if(tr["availability"] != "musthave") continue;
const std::string gender_string = const std::string gender_string =
u->genders().front() == unit_race::FEMALE ? "female_name" : "male_name"; u->genders().front() == unit_race::FEMALE ? "female_name" : "male_name";
t_string name = tr[gender_string]; t_string name = tr[gender_string];
@ -301,10 +301,10 @@ void tunit_create::print_stats(std::stringstream& str, const int row)
BOOST_FOREACH(const attack_type& a, u->attacks()) BOOST_FOREACH(const attack_type& a, u->attacks())
{ {
str << "<span color='#f5e6c1'>" << a.num_attacks() str << "<span color='#f5e6c1'>" << a.num_attacks()
<< font::weapon_numbers_sep << a.damage() << " " << a.name() << "</span>" << "\n"; << font::weapon_numbers_sep << a.damage() << " " << a.name() << "</span>" << "\n";
str << "<span color='#a69275'>" << " " << a.range() str << "<span color='#a69275'>" << " " << a.range()
<< font::weapon_details_sep << a.type() << "</span>" << "\n"; << font::weapon_details_sep << a.type() << "</span>" << "\n";
const std::string special = a.weapon_specials(); const std::string special = a.weapon_specials();
@ -324,7 +324,7 @@ void tunit_create::print_stats(std::stringstream& str, const int row)
void tunit_create::list_item_clicked(twindow& window) void tunit_create::list_item_clicked(twindow& window)
{ {
const int selected_row const int selected_row
= find_widget<tlistbox>(&window, "unit_type_list", false).get_selected_row(); = find_widget<tlistbox>(&window, "unit_type_list", false).get_selected_row();
if(selected_row == -1) { if(selected_row == -1) {

View file

@ -484,7 +484,7 @@ void tvertical_list::handle_key_down_arrow(SDLMod /*modifier*/, bool& handled)
handled = true; handled = true;
for(size_t i = get_ordered_index(get_selected_item()) + 1; i < get_item_count(); ++i) { for(size_t i = get_ordered_index(get_selected_item()) + 1; i < get_item_count(); ++i) {
// why do we do this check here but not in handle_key_up_arrow? // why do we do this check here but not in handle_key_up_arrow?
if(item_ordered(i).get_visible() == twidget::tvisible::invisible if(item_ordered(i).get_visible() == twidget::tvisible::invisible
|| !get_item_shown(get_item_at_ordered(i))) { || !get_item_shown(get_item_at_ordered(i))) {

View file

@ -364,7 +364,7 @@ protected:
/** Gets the grid of an item. */ /** Gets the grid of an item. */
virtual const tgrid& item_ordered(const unsigned index) const = 0; virtual const tgrid& item_ordered(const unsigned index) const = 0;
virtual unsigned get_ordered_index(unsigned index) const = 0; virtual unsigned get_ordered_index(unsigned index) const = 0;
virtual unsigned get_item_at_ordered(unsigned index_ordered) const = 0; virtual unsigned get_item_at_ordered(unsigned index_ordered) const = 0;
}; };

View file

@ -1047,7 +1047,7 @@ private:
typedef boost::function<bool (unsigned, unsigned)> torder_func; typedef boost::function<bool (unsigned, unsigned)> torder_func;
torder_func order_func_; torder_func order_func_;
virtual void set_order(const torder_func& order) OVERRIDE virtual void set_order(const torder_func& order) OVERRIDE
{ {
order_func_ = order; order_func_ = order;
@ -1071,7 +1071,7 @@ private:
return order_func_(a, b); return order_func_(a, b);
} }
}; };
virtual unsigned get_ordered_index(unsigned index) const virtual unsigned get_ordered_index(unsigned index) const
{ {
assert(index < items_.size()); assert(index < items_.size());
@ -1101,7 +1101,7 @@ private:
for(size_t i = 0; i < order_.size(); ++i) { for(size_t i = 0; i < order_.size(); ++i) {
items_[order_[i]]->ordered_index = i; items_[order_[i]]->ordered_index = i;
} }
order_dirty_ = false; order_dirty_ = false;
} }
else { else {

View file

@ -44,7 +44,7 @@ public:
/** The number of states, that is 2 for normal buttons, 3 for tristate buttons. */ /** The number of states, that is 2 for normal buttons, 3 for tristate buttons. */
virtual unsigned num_states() const = 0; virtual unsigned num_states() const = 0;
bool get_value_bool() const bool get_value_bool() const
{ {
assert(num_states() == 2); assert(num_states() == 2);

View file

@ -91,7 +91,7 @@ public:
/** Inherited from tselectable_ */ /** Inherited from tselectable_ */
void set_value(const unsigned selected); void set_value(const unsigned selected);
/** Inherited from tselectable_ */ /** Inherited from tselectable_ */
unsigned num_states() const OVERRIDE; unsigned num_states() const OVERRIDE;

View file

@ -265,7 +265,7 @@ std::string unit_topic_generator::operator()() const {
} }
ss << "\n\n"; ss << "\n\n";
if (!female_portrait.empty() && female_portrait != male_portrait && female_portrait != female_type.image() && female_portrait != "unit_image") { if (!female_portrait.empty() && female_portrait != male_portrait && female_portrait != female_type.image() && female_portrait != "unit_image") {
ss << "<img>src='" << female_portrait << "' box='no' align='right' float='yes'</img> "; ss << "<img>src='" << female_portrait << "' box='no' align='right' float='yes'</img> ";
} }

View file

@ -476,7 +476,7 @@ std::string get_names(std::string id)
names.push_back(item->get_name()); names.push_back(item->get_name());
} }
} }
// These are hard-coded, non-rebindable hotkeys // These are hard-coded, non-rebindable hotkeys
if (id == "quit") { if (id == "quit") {
names.push_back("escape"); names.push_back("escape");

View file

@ -430,7 +430,7 @@ void play_controller::hotkey_handler::show_menu(const std::vector<std::string>&
while(i != items.end()) { while(i != items.end()) {
if (*i == "AUTOSAVES") { if (*i == "AUTOSAVES") {
// Autosave visibility is similar to LOAD_GAME hotkey // Autosave visibility is similar to LOAD_GAME hotkey
++i; continue; //cmd = &hotkey::hotkey_command::get_command_by_command(hotkey::HOTKEY_LOAD_GAME); ++i; continue; //cmd = &hotkey::hotkey_command::get_command_by_command(hotkey::HOTKEY_LOAD_GAME);
} else { } else {
cmd = &hotkey::get_hotkey_command(*i); cmd = &hotkey::get_hotkey_command(*i);

View file

@ -221,15 +221,15 @@ bool playsingle_controller::hotkey_handler::can_execute_command(const hotkey::ho
return (!browse() || linger()) && !events::commands_disabled; return (!browse() || linger()) && !events::commands_disabled;
case hotkey::HOTKEY_DELAY_SHROUD: case hotkey::HOTKEY_DELAY_SHROUD:
return !linger() return !linger()
&& (viewing_team().uses_fog() || viewing_team().uses_shroud()) && (viewing_team().uses_fog() || viewing_team().uses_shroud())
&& viewing_team_is_playing() && viewing_team_is_playing()
&& viewing_team().is_local_human() && viewing_team().is_local_human()
&& !events::commands_disabled; && !events::commands_disabled;
case hotkey::HOTKEY_UPDATE_SHROUD: case hotkey::HOTKEY_UPDATE_SHROUD:
return !linger() return !linger()
&& viewing_team_is_playing() && viewing_team_is_playing()
&& viewing_team().is_local_human() && viewing_team().is_local_human()
&& !events::commands_disabled && !events::commands_disabled
&& viewing_team().auto_shroud_updates() == false; && viewing_team().auto_shroud_updates() == false;

View file

@ -73,8 +73,8 @@ public:
//replay //replay
replay_controller& get_replay_controller() replay_controller& get_replay_controller()
{ {
assert(playsingle_controller_.get_replay_controller()); assert(playsingle_controller_.get_replay_controller());
return *playsingle_controller_.get_replay_controller(); return *playsingle_controller_.get_replay_controller();
} }
virtual void stop_replay() OVERRIDE virtual void stop_replay() OVERRIDE

View file

@ -1263,7 +1263,7 @@ bool save_image(const locator & i_locator, const std::string & filename)
bool save_image(const surface & surf, const std::string & filename) bool save_image(const surface & surf, const std::string & filename)
{ {
if (surf.null()) { if (surf.null()) {
return false; return false;
} }
#ifdef HAVE_LIBPNG #ifdef HAVE_LIBPNG

View file

@ -1059,7 +1059,7 @@ static lu_mem singlestep (lua_State *L) {
g->gcstate = GCSatomic; /* finish mark phase */ g->gcstate = GCSatomic; /* finish mark phase */
g->GCestimate = g->GCmemtrav; /* save what was counted */; g->GCestimate = g->GCmemtrav; /* save what was counted */;
work = atomic(L); /* add what was traversed by 'atomic' */ work = atomic(L); /* add what was traversed by 'atomic' */
g->GCestimate += work; /* estimate of total memory traversed */ g->GCestimate += work; /* estimate of total memory traversed */
sw = entersweep(L); sw = entersweep(L);
return work + sw * GCSWEEPCOST; return work + sw * GCSWEEPCOST;
} }

View file

@ -114,7 +114,7 @@ namespace make_enum_detail
#define ADD_PAREN_2( A, B ) ((A, B)) ADD_PAREN_1 #define ADD_PAREN_2( A, B ) ((A, B)) ADD_PAREN_1
#define ADD_PAREN_1_END #define ADD_PAREN_1_END
#define ADD_PAREN_2_END #define ADD_PAREN_2_END
#define MAKEPAIRS( INPUT ) BOOST_PP_CAT(ADD_PAREN_1 INPUT,_END) #define MAKEPAIRS( INPUT ) BOOST_PP_CAT(ADD_PAREN_1 INPUT,_END)
#define PP_SEQ_FOR_EACH_I_PAIR(macro, data, pairs) BOOST_PP_SEQ_FOR_EACH_I(macro, data, MAKEPAIRS(pairs)) #define PP_SEQ_FOR_EACH_I_PAIR(macro, data, pairs) BOOST_PP_SEQ_FOR_EACH_I(macro, data, MAKEPAIRS(pairs))

View file

@ -382,7 +382,7 @@ void terrain_label::read(const config &cfg)
visible_in_shroud_ = cfg["visible_in_shroud"].to_bool(); visible_in_shroud_ = cfg["visible_in_shroud"].to_bool();
immutable_ = cfg["immutable"].to_bool(true); immutable_ = cfg["immutable"].to_bool(true);
category_ = cfg["category"].str(); category_ = cfg["category"].str();
int side = cfg["side"].to_int(-1); int side = cfg["side"].to_int(-1);
if(side >= 0) { if(side >= 0) {
creator_ = side - 1; creator_ = side - 1;
@ -603,14 +603,14 @@ bool terrain_label::hidden() const
std::string category = "cat:" + category_; std::string category = "cat:" + category_;
std::string creator = "side:" + str_cast(creator_ + 1); std::string creator = "side:" + str_cast(creator_ + 1);
const std::vector<std::string>& hidden_categories = parent_->disp().get_disp_context().hidden_label_categories(); const std::vector<std::string>& hidden_categories = parent_->disp().get_disp_context().hidden_label_categories();
if(std::find(hidden_categories.begin(), hidden_categories.end(), category) != hidden_categories.end()) if(std::find(hidden_categories.begin(), hidden_categories.end(), category) != hidden_categories.end())
return true; return true;
if(creator_ >= 0 && std::find(hidden_categories.begin(), hidden_categories.end(), creator) != hidden_categories.end()) if(creator_ >= 0 && std::find(hidden_categories.begin(), hidden_categories.end(), creator) != hidden_categories.end())
return true; return true;
if(!team_name().empty() && std::find(hidden_categories.begin(), hidden_categories.end(), "team") != hidden_categories.end()) if(!team_name().empty() && std::find(hidden_categories.begin(), hidden_categories.end(), "team") != hidden_categories.end())
return true; return true;
// Fog can hide some labels. // Fog can hide some labels.
if ( !visible_in_fog_ && is_fogged(parent_->disp(), loc_) ) if ( !visible_in_fog_ && is_fogged(parent_->disp(), loc_) )
return true; return true;

View file

@ -94,7 +94,7 @@ private:
team_label_map labels_; team_label_map labels_;
bool enabled_; bool enabled_;
mutable std::vector<std::string> categories; mutable std::vector<std::string> categories;
mutable bool categories_dirty; mutable bool categories_dirty;
}; };

View file

@ -72,12 +72,12 @@ map_location::DIRECTION map_location::parse_direction(const std::string& str)
if(str.empty()) { if(str.empty()) {
return NDIRECTIONS; return NDIRECTIONS;
} }
// Syntax: [-] (n|ne|se|s|sw|nw) [:cw|:ccw] // Syntax: [-] (n|ne|se|s|sw|nw) [:cw|:ccw]
// - means "take opposite direction" and has higher precedence // - means "take opposite direction" and has higher precedence
// :cw and :ccw mean "one step (counter-)clockwise" // :cw and :ccw mean "one step (counter-)clockwise"
// Parentheses can be used for grouping or to apply an operator more than once // Parentheses can be used for grouping or to apply an operator more than once
const size_t open = str.find_first_of('('), close = str.find_last_of(')'); const size_t open = str.find_first_of('('), close = str.find_last_of(')');
if (open != std::string::npos && close != std::string::npos) { if (open != std::string::npos && close != std::string::npos) {
std::string sub = str.substr(open + 1, close - open - 1); std::string sub = str.substr(open + 1, close - open - 1);
@ -86,12 +86,12 @@ map_location::DIRECTION map_location::parse_direction(const std::string& str)
sub.replace(open, close - open + 1, write_direction(dir)); sub.replace(open, close - open + 1, write_direction(dir));
return parse_direction(sub); return parse_direction(sub);
} }
const size_t start = str[0] == '-' ? 1 : 0; const size_t start = str[0] == '-' ? 1 : 0;
const size_t end = str.find_first_of(':'); const size_t end = str.find_first_of(':');
const std::string& main_dir = str.substr(start, end - start); const std::string& main_dir = str.substr(start, end - start);
map_location::DIRECTION dir; map_location::DIRECTION dir;
if (main_dir == "n") { if (main_dir == "n") {
dir = NORTH; dir = NORTH;
} else if (main_dir == "ne") { } else if (main_dir == "ne") {
@ -107,11 +107,11 @@ map_location::DIRECTION map_location::parse_direction(const std::string& str)
} else { } else {
return NDIRECTIONS; return NDIRECTIONS;
} }
if (start == 1) { if (start == 1) {
dir = get_opposite_dir(dir); dir = get_opposite_dir(dir);
} }
if (end != std::string::npos) { if (end != std::string::npos) {
const std::string rel_dir = str.substr(end + 1); const std::string rel_dir = str.substr(end + 1);
if (rel_dir == "cw") { if (rel_dir == "cw") {
@ -122,7 +122,7 @@ map_location::DIRECTION map_location::parse_direction(const std::string& str)
return NDIRECTIONS; return NDIRECTIONS;
} }
} }
return dir; return dir;
} }

View file

@ -1071,7 +1071,7 @@ void menu_handler::clear_labels()
resources::recorder->clear_labels(gui_->current_team_name(), false); resources::recorder->clear_labels(gui_->current_team_name(), false);
} }
} }
void menu_handler::label_settings() { void menu_handler::label_settings() {
// TODO: I think redraw_everything might be a bit too much? It causes a flicker. // TODO: I think redraw_everything might be a bit too much? It causes a flicker.
if(gui2::tlabel_settings::execute(board(), gui_->video())) if(gui2::tlabel_settings::execute(board(), gui_->video()))
@ -3122,7 +3122,7 @@ void menu_handler::request_control_change ( int side_num, const std::string& pla
return; return;
} else { } else {
//The server will (or won't because we aren't allowed to change the controller) //The server will (or won't because we aren't allowed to change the controller)
//send us a [change_controller] back, which we then handle in playturn.cpp //send us a [change_controller] back, which we then handle in playturn.cpp
change_side_controller(side,player); change_side_controller(side,player);
} }
} }

View file

@ -890,7 +890,7 @@ size_t mouse_handler::move_unit_along_route(const std::vector<map_location> & st
LOG_NG << "move unit along route from " << steps.front() << " to " << steps.back() << "\n"; LOG_NG << "move unit along route from " << steps.front() << " to " << steps.back() << "\n";
size_t moves = actions::move_unit_and_record(steps, &pc_.get_undo_stack(), false, true, &interrupted); size_t moves = actions::move_unit_and_record(steps, &pc_.get_undo_stack(), false, true, &interrupted);
cursor::set(cursor::NORMAL); cursor::set(cursor::NORMAL);
gui().invalidate_game_status(); gui().invalidate_game_status();

View file

@ -36,7 +36,7 @@ mt_rng::mt_rng() :
{ {
} }
mt_rng::mt_rng(boost::uint32_t seed) mt_rng::mt_rng(boost::uint32_t seed)
: random_seed_(seed) : random_seed_(seed)
, mt_(random_seed_) , mt_(random_seed_)
@ -47,15 +47,15 @@ mt_rng::mt_rng(boost::uint32_t seed)
mt_rng::mt_rng(const config& cfg) : mt_rng::mt_rng(const config& cfg) :
random_seed_(42), random_seed_(42),
mt_(random_seed_), //we don't have the seed at construction time, we have to seed after construction in this case. Constructing an mt19937 is somewhat expensive, apparently has about 2kb of private memory. mt_(random_seed_), //we don't have the seed at construction time, we have to seed after construction in this case. Constructing an mt19937 is somewhat expensive, apparently has about 2kb of private memory.
random_calls_(0) random_calls_(0)
{ {
config::attribute_value seed = cfg["random_seed"]; config::attribute_value seed = cfg["random_seed"];
seed_random(seed.str(), cfg["random_calls"].to_int(0)); seed_random(seed.str(), cfg["random_calls"].to_int(0));
} }
bool mt_rng::operator== (const mt_rng & other) const { bool mt_rng::operator== (const mt_rng & other) const {
return random_seed_ == other.random_seed_ return random_seed_ == other.random_seed_
&& random_calls_ == other.random_calls_ && random_calls_ == other.random_calls_
&& mt_ == other.mt_; && mt_ == other.mt_;
} }
@ -87,8 +87,8 @@ void mt_rng::seed_random(const uint32_t seed, const unsigned int call_count)
void mt_rng::seed_random(const std::string & seed_str, const unsigned int call_count) void mt_rng::seed_random(const std::string & seed_str, const unsigned int call_count)
{ {
uint32_t new_seed; uint32_t new_seed;
std::istringstream s(seed_str); std::istringstream s(seed_str);
if (!(s >> std::hex >> new_seed)) { if (!(s >> std::hex >> new_seed)) {
new_seed = 42; new_seed = 42;
DBG_RND << "Failed to seed a random number generator using seed string '" << seed_str << "', it could not be parsed to hex. Seeding with 42.\n"; DBG_RND << "Failed to seed a random number generator using seed string '" << seed_str << "', it could not be parsed to hex. Seeding with 42.\n";

View file

@ -26,8 +26,8 @@ namespace rand_rng
{ {
/* /*
This class provides an interface, similar to simple_rng, to the This class provides an interface, similar to simple_rng, to the
boost mt19937 generator. boost mt19937 generator.
*/ */
class mt_rng class mt_rng
@ -41,10 +41,10 @@ public:
/** /**
* Same as uint32_t version, but uses a stringstream to convert given * Same as uint32_t version, but uses a stringstream to convert given
* hex string. * hex string.
* @param seed A hex string. Should not have 0x leading. * @param seed A hex string. Should not have 0x leading.
* @param call_count Value to set internal call counter to after seeding. * @param call_count Value to set internal call counter to after seeding.
*/ */
void seed_random(const std::string & seed, const unsigned int call_count = 0); void seed_random(const std::string & seed, const unsigned int call_count = 0);
/** /**
@ -73,9 +73,9 @@ private:
/** Number of time a random number is generated. */ /** Number of time a random number is generated. */
unsigned int random_calls_; unsigned int random_calls_;
/** On my local version of boost::random, I can use mt_.discard to discard a number of rng results. /** On my local version of boost::random, I can use mt_.discard to discard a number of rng results.
In older versions this seems to be unavailable. I'm implementing as a private method of mt_rng, In older versions this seems to be unavailable. I'm implementing as a private method of mt_rng,
following description here: http://www.boost.org/doc/libs/1_51_0/doc/html/boost/random/mersenne_twister_engine.html#id1408119-bb following description here: http://www.boost.org/doc/libs/1_51_0/doc/html/boost/random/mersenne_twister_engine.html#id1408119-bb
*/ */
void discard(const unsigned int call_count); void discard(const unsigned int call_count);

View file

@ -43,7 +43,7 @@ struct persist_choice: mp_sync::user_choice {
, side(side_num) { , side(side_num) {
} }
virtual config query_user(int /*side_for*/) const { virtual config query_user(int /*side_for*/) const {
//side can be different from side_for: if side was null-controlled //side can be different from side_for: if side was null-controlled
//then get_user_choice will use the next non-null-controlled side instead //then get_user_choice will use the next non-null-controlled side instead
config ret; config ret;
ret["side"] = side; ret["side"] = side;
@ -53,10 +53,10 @@ struct persist_choice: mp_sync::user_choice {
virtual config random_choice(int /*side_for*/) const { virtual config random_choice(int /*side_for*/) const {
return config(); return config();
} }
virtual std::string description() const virtual std::string description() const
{ {
return "a global variable"; return "a global variable";
} }
virtual bool is_visible() const { return false; } virtual bool is_visible() const { return false; }
}; };

View file

@ -183,7 +183,7 @@ play_controller::play_controller(const config& level, saved_game& state_of_game,
, player_type_changed_(false) , player_type_changed_(false)
{ {
copy_persistent(level, level_); copy_persistent(level, level_);
resources::controller = this; resources::controller = this;
resources::persist = &persist_; resources::persist = &persist_;
resources::recorder = replay_.get(); resources::recorder = replay_.get();
@ -236,7 +236,7 @@ void play_controller::init(CVideo& video, const config& level)
LOG_NG << "initializing game_state..." << (SDL_GetTicks() - ticks()) << std::endl; LOG_NG << "initializing game_state..." << (SDL_GetTicks() - ticks()) << std::endl;
gamestate_.reset(new game_state(level, *this, tdata_)); gamestate_.reset(new game_state(level, *this, tdata_));
resources::gameboard = &gamestate().board_; resources::gameboard = &gamestate().board_;
resources::gamedata = &gamestate().gamedata_; resources::gamedata = &gamestate().gamedata_;
resources::teams = &gamestate().board_.teams_; resources::teams = &gamestate().board_.teams_;
@ -245,7 +245,7 @@ void play_controller::init(CVideo& video, const config& level)
resources::filter_con = &gamestate(); resources::filter_con = &gamestate();
resources::undo_stack = &undo_stack(); resources::undo_stack = &undo_stack();
resources::game_events = gamestate().events_manager_.get(); resources::game_events = gamestate().events_manager_.get();
gamestate_->init(level, *this); gamestate_->init(level, *this);
resources::tunnels = gamestate().pathfind_manager_.get(); resources::tunnels = gamestate().pathfind_manager_.get();
@ -407,7 +407,7 @@ void play_controller::init_side_begin()
// If we are observers we move to watch next team if it is allowed // If we are observers we move to watch next team if it is allowed
if ((is_observer() && !current_team().get_disallow_observers()) if ((is_observer() && !current_team().get_disallow_observers())
|| (current_team().is_local_human() && !this->is_replay())) || (current_team().is_local_human() && !this->is_replay()))
{ {
update_gui_to_player(current_side() - 1); update_gui_to_player(current_side() - 1);
} }
@ -522,7 +522,7 @@ config play_controller::to_config() const
//Write the soundsources. //Write the soundsources.
soundsources_manager_->write_sourcespecs(cfg); soundsources_manager_->write_sourcespecs(cfg);
gui_->labels().write(cfg); gui_->labels().write(cfg);
sound::write_music_play_list(cfg); sound::write_music_play_list(cfg);
@ -550,7 +550,7 @@ void play_controller::finish_side_turn()
pump().fire("side " + side_num + " turn " + turn_num + " end"); pump().fire("side " + side_num + " turn " + turn_num + " end");
// This is where we refog, after all of a side's events are done. // This is where we refog, after all of a side's events are done.
actions::recalculate_fog(current_side()); actions::recalculate_fog(current_side());
check_victory(); check_victory();
sync.do_final_checkup(); sync.do_final_checkup();
} }
@ -651,7 +651,7 @@ void play_controller::tab()
BOOST_FOREACH(const std::string& o, gui_->observers()){ BOOST_FOREACH(const std::string& o, gui_->observers()){
dictionary.insert(o); dictionary.insert(o);
} }
// Add nicks who whispered you // Add nicks who whispered you
BOOST_FOREACH(const std::string& w, gui_->get_chat_manager().whisperers()){ BOOST_FOREACH(const std::string& w, gui_->get_chat_manager().whisperers()){
dictionary.insert(w); dictionary.insert(w);
@ -1086,7 +1086,7 @@ void play_controller::start_game(const config& level)
gamestate().start_event_fired_ = true; gamestate().start_event_fired_ = true;
resources::recorder->add_start_if_not_there_yet(); resources::recorder->add_start_if_not_there_yet();
resources::recorder->get_next_action(); resources::recorder->get_next_action();
set_scontext_synced sync; set_scontext_synced sync;
fire_prestart(); fire_prestart();
@ -1096,7 +1096,7 @@ void play_controller::start_game(const config& level)
for ( int side = gamestate().board_.teams().size(); side != 0; --side ) for ( int side = gamestate().board_.teams().size(); side != 0; --side )
actions::clear_shroud(side, false, false); actions::clear_shroud(side, false, false);
init_gui(); init_gui();
LOG_NG << "first_time..." << (is_skipping_replay() ? "skipping" : "no skip") << "\n"; LOG_NG << "first_time..." << (is_skipping_replay() ? "skipping" : "no skip") << "\n";
@ -1148,7 +1148,7 @@ void play_controller::play_side()
gui_->parse_team_overlays(); gui_->parse_team_overlays();
do { do {
update_viewing_player(); update_viewing_player();
{ {
save_blocker blocker; save_blocker blocker;
maybe_do_init_side(); maybe_do_init_side();
if(is_regular_game_end()) { if(is_regular_game_end()) {

View file

@ -139,7 +139,7 @@ public:
void reset_end_level_data() { void reset_end_level_data() {
gamestate().end_level_data_ = boost::none_t(); gamestate().end_level_data_ = boost::none_t();
} }
bool is_regular_game_end() const { bool is_regular_game_end() const {
return gamestate().end_level_data_.get_ptr() != NULL; return gamestate().end_level_data_.get_ptr() != NULL;
} }
const end_level_data& get_end_level_data_const() const { const end_level_data& get_end_level_data_const() const {
@ -366,7 +366,7 @@ private:
protected: protected:
bool player_type_changed_; bool player_type_changed_;
virtual void sync_end_turn() {}; virtual void sync_end_turn() {};
virtual void check_time_over(); virtual void check_time_over();
virtual void update_viewing_player() = 0; virtual void update_viewing_player() = 0;

View file

@ -43,7 +43,7 @@ static lg::log_domain log_engine("engine");
#define LOG_NG LOG_STREAM(info, log_engine) #define LOG_NG LOG_STREAM(info, log_engine)
playmp_controller::playmp_controller(const config& level, playmp_controller::playmp_controller(const config& level,
saved_game& state_of_game, const config& game_config, saved_game& state_of_game, const config& game_config,
const tdata_cache & tdata, CVideo& video, const tdata_cache & tdata, CVideo& video,
mp_campaign_info* mp_info) mp_campaign_info* mp_info)
: playsingle_controller(level, state_of_game, : playsingle_controller(level, state_of_game,
@ -104,7 +104,7 @@ void playmp_controller::play_linger_turn()
if (is_host()) { if (is_host()) {
end_turn_enable(true); end_turn_enable(true);
} }
while(end_turn_ == END_TURN_NONE) { while(end_turn_ == END_TURN_NONE) {
config cfg; config cfg;
if(network_reader_.read(cfg)) { if(network_reader_.read(cfg)) {
@ -310,7 +310,7 @@ void playmp_controller::after_human_turn(){
if(saved_game_.mp_settings().mp_countdown) if(saved_game_.mp_settings().mp_countdown)
{ {
//time_left + turn_bonus + (action_bouns * number of actions done) //time_left + turn_bonus + (action_bouns * number of actions done)
const int new_time_in_secs = (current_team().countdown_time() / 1000) const int new_time_in_secs = (current_team().countdown_time() / 1000)
+ saved_game_.mp_settings().mp_countdown_turn_bonus + saved_game_.mp_settings().mp_countdown_turn_bonus
+ saved_game_.mp_settings().mp_countdown_action_bonus * current_team().action_bonus_count(); + saved_game_.mp_settings().mp_countdown_action_bonus * current_team().action_bonus_count();
const int new_time = 1000 * std::min<int>(new_time_in_secs, saved_game_.mp_settings().mp_countdown_reservoir_time); const int new_time = 1000 * std::min<int>(new_time_in_secs, saved_game_.mp_settings().mp_countdown_reservoir_time);
@ -460,7 +460,7 @@ void playmp_controller::process_network_data()
turn_info::PROCESS_DATA_RESULT res = turn_info::PROCESS_CONTINUE; turn_info::PROCESS_DATA_RESULT res = turn_info::PROCESS_CONTINUE;
config cfg; config cfg;
if(!resources::recorder->at_end()) { if(!resources::recorder->at_end()) {
res = turn_info::replay_to_process_data_result(do_replay()); res = turn_info::replay_to_process_data_result(do_replay());
} }
else if(network_reader_.read(cfg)) { else if(network_reader_.read(cfg)) {
res = turn_data_.process_network_data(cfg); res = turn_data_.process_network_data(cfg);

View file

@ -25,7 +25,7 @@ class playmp_controller : public playsingle_controller, public syncmp_handler
{ {
public: public:
playmp_controller(const config& level, saved_game& state_of_game, playmp_controller(const config& level, saved_game& state_of_game,
const config& game_config, const config& game_config,
const tdata_cache & tdata, CVideo& video, const tdata_cache & tdata, CVideo& video,
mp_campaign_info* mp_info); mp_campaign_info* mp_info);
virtual ~playmp_controller(); virtual ~playmp_controller();

View file

@ -86,7 +86,7 @@ playsingle_controller::playsingle_controller(const config& level,
{ {
hotkey_handler_.reset(new hotkey_handler(*this, saved_game_)); //upgrade hotkey handler to the sp (whiteboard enabled) version hotkey_handler_.reset(new hotkey_handler(*this, saved_game_)); //upgrade hotkey handler to the sp (whiteboard enabled) version
// game may need to start in linger mode // game may need to start in linger mode
linger_ = this->is_regular_game_end(); linger_ = this->is_regular_game_end();

View file

@ -55,7 +55,7 @@ public:
class hotkey_handler; class hotkey_handler;
std::string describe_result() const; std::string describe_result() const;
bool get_player_type_changed() const { return player_type_changed_; } bool get_player_type_changed() const { return player_type_changed_; }
void set_player_type_changed() { player_type_changed_ = true; } void set_player_type_changed() { player_type_changed_ = true; }
virtual bool should_return_to_play_side(); virtual bool should_return_to_play_side();

View file

@ -79,11 +79,11 @@ namespace random_new
return next_random_impl(); return next_random_impl();
} }
/** /**
* This code is based on the boost implementation of uniform_smallint. * This code is based on the boost implementation of uniform_smallint.
* http://www.boost.org/doc/libs/1_55_0/boost/random/uniform_smallint.hpp * http://www.boost.org/doc/libs/1_55_0/boost/random/uniform_smallint.hpp
* Using that code would be ideal, except that boost, and C++11, do not * Using that code would be ideal, except that boost, and C++11, do not
* guarantee that it will work the same way on all platforms, or that the * guarantee that it will work the same way on all platforms, or that the
* results may not be different in future versions of the library. * results may not be different in future versions of the library.
* The simplified version I have written should work the same on all * The simplified version I have written should work the same on all
* platforms, which is the most important thing for us. * platforms, which is the most important thing for us.

View file

@ -28,7 +28,7 @@ namespace random_new
{ {
public: public:
rng(); rng();
/** /**
* Provides the next random draw. This is raw PRG output. * Provides the next random draw. This is raw PRG output.
*/ */
uint32_t next_random(); uint32_t next_random();
@ -40,14 +40,14 @@ namespace random_new
*/ */
unsigned int get_random_calls(); unsigned int get_random_calls();
/** /**
* This helper method provides a random int from the underlying generator, * This helper method provides a random int from the underlying generator,
* using results of next_random in a manner guaranteed to be cross platform. * using results of next_random in a manner guaranteed to be cross platform.
* The result will be random in range [min,max] inclusive. * The result will be random in range [min,max] inclusive.
* @param min The minimum value produced. * @param min The minimum value produced.
* @param max The maximum value produced. * @param max The maximum value produced.
*/ */
int get_random_int(int min, int max) int get_random_int(int min, int max)
{ return min + get_random_int_in_range_zero_to(max - min); } { return min + get_random_int_in_range_zero_to(max - min); }
static rng& default_instance(); static rng& default_instance();
protected: protected:
@ -55,7 +55,7 @@ namespace random_new
unsigned int random_calls_; unsigned int random_calls_;
private: private:
/** Does the hard work of get_random_int. /** Does the hard work of get_random_int.
* The result will be random in range [0,max] inclusive. * The result will be random in range [0,max] inclusive.
* @param max The maximum value produced. * @param max The maximum value produced.
*/ */

View file

@ -39,7 +39,7 @@ namespace random_new
private: private:
void initialize(); void initialize();
bool has_valid_seed_; bool has_valid_seed_;
boost::function0<std::string> seed_generator_; boost::function0<std::string> seed_generator_;
rand_rng::mt_rng gen_; rand_rng::mt_rng gen_;
}; };
} }

View file

@ -494,7 +494,7 @@ void replay::undo_cut(config& dst)
//"async"=yes means rename_unit //"async"=yes means rename_unit
//"dependent"=true means user input //"dependent"=true means user input
const config &c = command(cmd_index); const config &c = command(cmd_index);
if(c["undo"].to_bool(true) && !c["async"].to_bool(false) && !c["dependent"].to_bool(false)) if(c["undo"].to_bool(true) && !c["async"].to_bool(false) && !c["dependent"].to_bool(false))
{ {
if(c["sent"].to_bool(false)) if(c["sent"].to_bool(false))
@ -511,7 +511,7 @@ void replay::undo_cut(config& dst)
if (cmd_index < 0) if (cmd_index < 0)
{ {
ERR_REPLAY << "trying to undo a command but no command was found.\n"; ERR_REPLAY << "trying to undo a command but no command was found.\n";
return; return;
} }
//Fix the [command]s after the undone action. This includes dependent commands for that user actions and async user action. //Fix the [command]s after the undone action. This includes dependent commands for that user actions and async user action.
@ -723,7 +723,7 @@ REPLAY_RETURN do_replay_handle(bool one_move)
(team_name.empty() ? events::chat_handler::MESSAGE_PUBLIC (team_name.empty() ? events::chat_handler::MESSAGE_PUBLIC
: events::chat_handler::MESSAGE_PRIVATE), : events::chat_handler::MESSAGE_PRIVATE),
preferences::message_bell()); preferences::message_bell());
} }
} }
} }
else if (const config &child = cfg->child("label")) else if (const config &child = cfg->child("label"))
@ -841,7 +841,7 @@ REPLAY_RETURN do_replay_handle(bool one_move)
else else
{ {
LOG_REPLAY << "found commandname " << commandname << "in replay"; LOG_REPLAY << "found commandname " << commandname << "in replay";
if((*cfg)["from_side"].to_int(0) != resources::controller->current_side()) { if((*cfg)["from_side"].to_int(0) != resources::controller->current_side()) {
ERR_REPLAY << "recieved a synced [command] from side " << (*cfg)["from_side"].to_int(0) << ". Expacted was a [command] from side " << resources::controller->current_side() << "\n"; ERR_REPLAY << "recieved a synced [command] from side " << (*cfg)["from_side"].to_int(0) << ". Expacted was a [command] from side " << resources::controller->current_side() << "\n";
} }

View file

@ -53,7 +53,7 @@ class replay
public: public:
explicit replay(replay_recorder_base& base); explicit replay(replay_recorder_base& base);
void add_start(); void add_start();
void add_countdown_update(int value,int team); void add_countdown_update(int value,int team);

View file

@ -62,7 +62,7 @@ struct replay_play_turn : public replay_play_moves_base
int turn_begin_; int turn_begin_;
replay_play_turn(int turn_begin) : replay_play_moves_base(1, false), turn_begin_(turn_begin) {} replay_play_turn(int turn_begin) : replay_play_moves_base(1, false), turn_begin_(turn_begin) {}
virtual void new_side_turn(int , int turn) virtual void new_side_turn(int , int turn)
{ {
if (turn != turn_begin_) { if (turn != turn_begin_) {
start(); start();
} }
@ -75,7 +75,7 @@ struct replay_play_side : public replay_play_moves_base
int side_begin_; int side_begin_;
replay_play_side(int turn_begin, int side_begin) : replay_play_moves_base(1, false), turn_begin_(turn_begin), side_begin_(side_begin) {} replay_play_side(int turn_begin, int side_begin) : replay_play_moves_base(1, false), turn_begin_(turn_begin), side_begin_(side_begin) {}
virtual void new_side_turn(int side , int turn) virtual void new_side_turn(int side , int turn)
{ {
if (turn != turn_begin_ || side != side_begin_) { if (turn != turn_begin_ || side != side_begin_) {
start(); start();
} }
@ -197,7 +197,7 @@ void replay_controller::update_replay_ui()
if (play_move_b) { if (play_move_b) {
play_move_b->enable(false); play_move_b->enable(false);
} }
} }
} }
@ -326,7 +326,7 @@ REPLAY_RETURN replay_controller::play_side_impl()
return res; return res;
} }
if(res == REPLAY_RETURN_AT_END) { if(res == REPLAY_RETURN_AT_END) {
new replay_stop_condition(); new replay_stop_condition();
} }
} }
controller_.play_slice(false); controller_.play_slice(false);

View file

@ -84,7 +84,7 @@ private:
play_controller& controller_; play_controller& controller_;
boost::scoped_ptr<replay_stop_condition> stop_condition_; boost::scoped_ptr<replay_stop_condition> stop_condition_;
events::command_disabler disabler_; events::command_disabler disabler_;
enum REPLAY_VISION enum REPLAY_VISION
{ {
HUMAN_TEAM, HUMAN_TEAM,

View file

@ -26,8 +26,8 @@ void replay_recorder_base::swap(replay_recorder_base& other)
} }
int replay_recorder_base::get_pos() const int replay_recorder_base::get_pos() const
{ {
return pos_; return pos_;
} }
int replay_recorder_base::size() const int replay_recorder_base::size() const

View file

@ -40,7 +40,7 @@ namespace events {
class mouse_handler; class mouse_handler;
} }
class reports class reports
{ {
public: public:

View file

@ -33,7 +33,7 @@ class play_controller;
* game dialog from the destructor of a class is a bad idea, because those * game dialog from the destructor of a class is a bad idea, because those
* functions throw exceptions. For example if the user decides to quit the game, * functions throw exceptions. For example if the user decides to quit the game,
* or there is a filesystem erorr. If the destructor throws exceptions, it will * or there is a filesystem erorr. If the destructor throws exceptions, it will
* cause memory leaks and crashes. * cause memory leaks and crashes.
* http://wiki.wesnoth.org/CodingStandards#Destructors_must_not_throw_exceptions * http://wiki.wesnoth.org/CodingStandards#Destructors_must_not_throw_exceptions
* *
* As a temporary fix the destructor has been changed to swallow all exceptions. * As a temporary fix the destructor has been changed to swallow all exceptions.

View file

@ -310,7 +310,7 @@ void saved_game::expand_mp_events()
{ mods.push_back(modevents_entry("era", mp_settings_.mp_era)); } { mods.push_back(modevents_entry("era", mp_settings_.mp_era)); }
if(classification_.campaign != "") if(classification_.campaign != "")
{ mods.push_back(modevents_entry("campaign", classification_.campaign)); } { mods.push_back(modevents_entry("campaign", classification_.campaign)); }
// In the first iteration mod contains no [resource]s in all other iterations, mods contains only [resource]s // In the first iteration mod contains no [resource]s in all other iterations, mods contains only [resource]s
do { do {
BOOST_FOREACH(modevents_entry& mod, mods) BOOST_FOREACH(modevents_entry& mod, mods)
@ -380,7 +380,7 @@ void saved_game::expand_random_scenario()
{ {
scenario_new.add_child("story", story); scenario_new.add_child("story", story);
} }
scenario_new["id"] = starting_pos_["id"]; scenario_new["id"] = starting_pos_["id"];
starting_pos_ = scenario_new; starting_pos_ = scenario_new;
update_label(); update_label();
set_defaults(); set_defaults();
@ -494,7 +494,7 @@ config saved_game::to_config() const
r.add_child("replay_start", replay_start_); r.add_child("replay_start", replay_start_);
} }
replay_data_.write(r.add_child("replay")); replay_data_.write(r.add_child("replay"));
if(starting_pos_type_ == STARTINGPOS_SNAPSHOT) if(starting_pos_type_ == STARTINGPOS_SNAPSHOT)
{ {
r.add_child("snapshot", starting_pos_); r.add_child("snapshot", starting_pos_);
@ -644,7 +644,7 @@ void saved_game::set_data(config& cfg)
statistics::fresh_stats(); statistics::fresh_stats();
statistics::read_stats(stats); statistics::read_stats(stats);
} }
classification_ = game_classification(cfg); classification_ = game_classification(cfg);
mp_settings_ = mp_game_settings(cfg.child_or_empty("multiplayer")); mp_settings_ = mp_game_settings(cfg.child_or_empty("multiplayer"));
cfg.clear(); cfg.clear();

View file

@ -106,7 +106,7 @@ public:
private: private:
bool has_carryover_expanded_; bool has_carryover_expanded_;
/** /**
depends on has_carryover_expanded_: depends on has_carryover_expanded_:
if true: The carryover information for all sides from the previous scenario that aren't used in this scenario (to be carried over to the next scenario). if true: The carryover information for all sides from the previous scenario that aren't used in this scenario (to be carried over to the next scenario).
if false: The carryover information for all sides from the previous scenario. if false: The carryover information for all sides from the previous scenario.

View file

@ -166,7 +166,7 @@ private:
//before_save (write replay data) changes this so it cannot be const //before_save (write replay data) changes this so it cannot be const
saved_game& gamestate_; saved_game& gamestate_;
/** Filename of the savegame file on disk */ /** Filename of the savegame file on disk */
std::string filename_; std::string filename_;
const std::string title_; /** Title of the savegame dialog */ const std::string title_; /** Title of the savegame dialog */

View file

@ -2262,7 +2262,7 @@ int game_lua_kernel::intf_print(lua_State *L) {
color = string_to_color(cfg["color"]); color = string_to_color(cfg["color"]);
} else if(cfg.has_attribute("red") || cfg.has_attribute("green") || cfg.has_attribute("blue")) { } else if(cfg.has_attribute("red") || cfg.has_attribute("green") || cfg.has_attribute("blue")) {
color = create_color(cfg["red"], cfg["green"], cfg["blue"]); color = create_color(cfg["red"], cfg["green"], cfg["blue"]);
} }
const SDL_Rect& rect = game_display_->map_outside_area(); const SDL_Rect& rect = game_display_->map_outside_area();

View file

@ -405,9 +405,9 @@ std::string register_vconfig_metatable(lua_State *L)
lua_pushstring(L, "wml object"); lua_pushstring(L, "wml object");
lua_setfield(L, -2, "__metatable"); lua_setfield(L, -2, "__metatable");
// Metatables for the iterator userdata // Metatables for the iterator userdata
// I don't bother setting __metatable because this // I don't bother setting __metatable because this
// userdata is only ever stored in the iterator's // userdata is only ever stored in the iterator's
// upvalues, so it's never visible to the user. // upvalues, so it's never visible to the user.
@ -415,7 +415,7 @@ std::string register_vconfig_metatable(lua_State *L)
lua_pushstring(L, "__gc"); lua_pushstring(L, "__gc");
lua_pushcfunction(L, &impl_vconfig_pairs_collect); lua_pushcfunction(L, &impl_vconfig_pairs_collect);
lua_rawset(L, -3); lua_rawset(L, -3);
luaL_newmetatable(L, vconfigipairsKey); luaL_newmetatable(L, vconfigipairsKey);
lua_pushstring(L, "__gc"); lua_pushstring(L, "__gc");
lua_pushcfunction(L, &impl_vconfig_ipairs_collect); lua_pushcfunction(L, &impl_vconfig_ipairs_collect);
@ -765,7 +765,7 @@ bool LuaW_checkvariable(lua_State *L, variable_access_create& v, int n)
default: default:
default_explicit: default_explicit:
return luaL_typerror(L, n, "WML table or scalar") != 0; return luaL_typerror(L, n, "WML table or scalar") != 0;
} }
} }
catch (const invalid_variablename_exception&) catch (const invalid_variablename_exception&)

View file

@ -18,7 +18,7 @@
* Using this, for example, C++ method functions may be boost::bind'ed and * Using this, for example, C++ method functions may be boost::bind'ed and
* then pushed into the lua environment and called like usual. * then pushed into the lua environment and called like usual.
* *
* They are represented as user data with a call operator, which uses a * They are represented as user data with a call operator, which uses a
* dispatcher implemented as a C-style function to retrieve the boost * dispatcher implemented as a C-style function to retrieve the boost
* function and execute it. Thus effectively all that we have to provide * function and execute it. Thus effectively all that we have to provide
* is a "value type" user data (full userdata, not light userdata) in lua * is a "value type" user data (full userdata, not light userdata) in lua
@ -50,7 +50,7 @@
* way should have C-function shim provided for each method which may be called * way should have C-function shim provided for each method which may be called
* by lua -- the object's "this" is retrieved from the userdata type on the * by lua -- the object's "this" is retrieved from the userdata type on the
* stack, and used to call the appopriate method. A metatable is defined, which * stack, and used to call the appopriate method. A metatable is defined, which
* may be the same as the "lua module" placed in the global namespace which may * may be the same as the "lua module" placed in the global namespace which may
* also provide access to a constructor. * also provide access to a constructor.
* *
* This approach is often quite good for small objects. Wesnoth uses full userdata * This approach is often quite good for small objects. Wesnoth uses full userdata

View file

@ -16,7 +16,7 @@
#define LUA_FILEOPS_HPP_INCLUDED #define LUA_FILEOPS_HPP_INCLUDED
/** /**
* This namespace contains the implementations for wesnoth's * This namespace contains the implementations for wesnoth's
* safe fileops for lua. * safe fileops for lua.
*/ */

Some files were not shown because too many files have changed in this diff Show more