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:
parent
203f7b0ded
commit
9b7b1751fd
136 changed files with 346 additions and 346 deletions
|
@ -1187,7 +1187,7 @@ namespace {
|
|||
a_.get_unit().set_movement(-1, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
a_.get_unit().set_facing(a_.loc_.get_relative_dir(d_.loc_));
|
||||
d_.get_unit().set_facing(d_.loc_.get_relative_dir(a_.loc_));
|
||||
|
||||
|
@ -1458,8 +1458,8 @@ namespace
|
|||
return retv;
|
||||
}
|
||||
virtual std::string description() const
|
||||
{
|
||||
return "an advancement choice";
|
||||
{
|
||||
return "an advancement choice";
|
||||
}
|
||||
private:
|
||||
const map_location loc_;
|
||||
|
|
|
@ -519,7 +519,7 @@ namespace { // Helpers for place_recruit()
|
|||
error_msg << "SYNC: In recruit " << new_unit.type_id() <<
|
||||
": has checksum " << checksum <<
|
||||
" 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";
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ struct shroud_clearing_action
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
|
@ -41,7 +41,7 @@ struct shroud_clearing_action
|
|||
t_route route;
|
||||
/// A record of the affected unit's ability to see.
|
||||
clearer_info view_info;
|
||||
|
||||
|
||||
void write(config & cfg) const
|
||||
{
|
||||
write_locations(route, cfg);
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
/// Creates an undo_action based on a config.
|
||||
/// Throws bad_lexical_cast or config::error if it cannot parse the config properly.
|
||||
static undo_action_base * create_action(const config & cfg);
|
||||
|
||||
|
||||
// Functions related to managing the undo stack:
|
||||
|
||||
/// Adds an auto-shroud toggle to the undo stack.
|
||||
|
|
|
@ -36,7 +36,7 @@ void undo_action::write_tconfig_vector(const tconfig_vector& vec, config& cfg, c
|
|||
{
|
||||
BOOST_FOREACH(const config& c, vec)
|
||||
{
|
||||
cfg.add_child(tag, c);
|
||||
cfg.add_child(tag, c);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace actions {
|
|||
tconfig_vector umc_commands_redo;
|
||||
void execute_undo_umc_wml();
|
||||
void execute_redo_umc_wml();
|
||||
|
||||
|
||||
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);
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace actions
|
|||
{
|
||||
namespace undo
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Writes this into the provided config.
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace actions
|
|||
{
|
||||
namespace undo
|
||||
{
|
||||
|
||||
|
||||
struct dismiss_action : undo_action
|
||||
{
|
||||
unit_ptr dismissed_unit;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace actions
|
|||
namespace undo
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Writes this into the provided config.
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace actions
|
|||
{
|
||||
namespace undo
|
||||
{
|
||||
|
||||
|
||||
struct move_action : undo_action, shroud_clearing_action
|
||||
{
|
||||
int starting_moves;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace actions
|
|||
{
|
||||
namespace undo
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Writes this into the provided config.
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace actions
|
|||
{
|
||||
namespace undo
|
||||
{
|
||||
|
||||
|
||||
|
||||
struct recall_action : undo_action, shroud_clearing_action
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace actions
|
|||
{
|
||||
namespace undo
|
||||
{
|
||||
|
||||
|
||||
struct recruit_action : undo_action, shroud_clearing_action
|
||||
{
|
||||
const unit_type & u_type;
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace actions
|
|||
{
|
||||
namespace undo
|
||||
{
|
||||
|
||||
|
||||
struct auto_shroud_action : undo_action_base {
|
||||
bool active;
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
explicit config(const std::string &child);
|
||||
|
||||
~config();
|
||||
|
||||
|
||||
// Verifies that the string can be used as an attribute or tag name
|
||||
static bool valid_id(std::string);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void controller_base::handle_event(const SDL_Event& event)
|
|||
hotkey::execute_command(get_display(), quit_hotkey, get_hotkey_command_executor());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
process_keydown_event(event);
|
||||
hotkey::key_event(get_display(), event, get_hotkey_command_executor());
|
||||
} else {
|
||||
|
|
|
@ -96,7 +96,7 @@ bool open_object(const std::string& path_or_url)
|
|||
LOG_DU << "open_object(): on Win32, will use ShellExecute()\n";
|
||||
|
||||
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));
|
||||
if(res <= 32) {
|
||||
ERR_DU << "open_object(): ShellExecute() failed (" << res << ")" << std::endl;
|
||||
|
|
|
@ -101,14 +101,14 @@ std::string read_pipe_line(scoped_posix_pipe& p)
|
|||
|
||||
std::string ver;
|
||||
int c;
|
||||
|
||||
|
||||
ver.reserve(64);
|
||||
|
||||
|
||||
// We only want the first line.
|
||||
while((c = std::fgetc(p)) && c != EOF && c != '\n' && c != '\r') {
|
||||
ver.push_back(static_cast<char>(c));
|
||||
}
|
||||
|
||||
|
||||
return ver;
|
||||
}
|
||||
#endif
|
||||
|
@ -118,16 +118,16 @@ std::string read_pipe_line(scoped_posix_pipe& p)
|
|||
std::string os_version()
|
||||
{
|
||||
#if defined(_X11) || defined(__APPLE__)
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
//
|
||||
// Standard Mac OSX version
|
||||
//
|
||||
|
||||
|
||||
static const std::string version_plist = "/System/Library/CoreServices/SystemVersion.plist";
|
||||
static const std::string defaults_bin = "/usr/bin/defaults";
|
||||
|
||||
|
||||
if(filesystem::file_exists(defaults_bin) && filesystem::file_exists(version_plist)) {
|
||||
static const std::string cmdline
|
||||
= defaults_bin + " read " + version_plist + " ProductUserVisibleVersion";
|
||||
|
|
|
@ -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 (!preferences::parse_should_show_lobby_join(sender, message)) return;
|
||||
if (preferences::is_ignored(sender)) return;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
void add_observer(const std::string& name) { observers_.insert(name); }
|
||||
void remove_observer(const std::string& name) { observers_.erase(name); }
|
||||
const std::set<std::string>& observers() const { return observers_; }
|
||||
|
||||
|
||||
void add_whisperer(const std::string& nick) { whisperers_.insert(nick); }
|
||||
void remove_whisperer(const std::string& nick) { whisperers_.erase(nick); }
|
||||
const std::set<std::string>& whisperers() const { return whisperers_; }
|
||||
|
|
|
@ -402,7 +402,7 @@ void pump()
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
#ifndef __APPLE__
|
||||
case SDL_KEYDOWN: {
|
||||
if(event.key.keysym.sym == SDLK_F4 && (event.key.keysym.mod == KMOD_RALT || event.key.keysym.mod == KMOD_LALT)) {
|
||||
|
|
|
@ -33,7 +33,7 @@ class config;
|
|||
struct SDL_RWops;
|
||||
|
||||
namespace filesystem {
|
||||
|
||||
|
||||
SDL_RWops* load_RWops(const std::string &path);
|
||||
|
||||
/** An exception object used when an IO error occurs */
|
||||
|
|
|
@ -173,12 +173,12 @@ namespace {
|
|||
catch(...)
|
||||
{
|
||||
ERR_FS << "Invalid UTF-16 string" << std::endl;
|
||||
return std::codecvt_base::error;
|
||||
return std::codecvt_base::error;
|
||||
}
|
||||
return std::codecvt_base::ok;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
class static_runner {
|
||||
public:
|
||||
|
@ -371,7 +371,7 @@ void get_files_in_dir(const std::string &dir,
|
|||
}
|
||||
} else if (st.type() == bfs::directory_file) {
|
||||
std::string basename = di->path().filename().string();
|
||||
|
||||
|
||||
if(!basename.empty() && basename[0] == '.' )
|
||||
continue;
|
||||
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)
|
||||
{
|
||||
// We define ".." as "remove everything before" this is needed becasue
|
||||
// on the one hand allowing ".." would be a security risk but
|
||||
// We define ".." as "remove everything before" this is needed becasue
|
||||
// on the one hand allowing ".." would be a security risk but
|
||||
// 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?).
|
||||
|
||||
|
||||
// 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;)
|
||||
return get_binary_file_location(type, filename.substr(pos + 3));
|
||||
|
|
|
@ -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
|
||||
//into the exact state it started in.
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
if(it != font_table.end()) {
|
||||
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.
|
||||
TTF_SetFontStyle(it->second.font, it->second.style ^ id.style);
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
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
|
||||
> >
|
||||
string_map_of(const std::string& k, const std::string& v)
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
void clear_variable(const std::string& varname);
|
||||
/// Clears only the config children
|
||||
/// 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_; }
|
||||
rand_rng::mt_rng& rng() { return rng_; }
|
||||
|
|
|
@ -592,14 +592,14 @@ namespace {
|
|||
static const std::string s_prefix = "(\\d+ )?";
|
||||
static const std::string s_all = "(" + s_prefix + s_terrain + s_sep + ")+";
|
||||
static const boost::regex r_all(s_all);
|
||||
|
||||
|
||||
const std::string& mapfile = filesystem::get_wml_location(filename_);
|
||||
std::string res = "";
|
||||
if(filesystem::file_exists(mapfile)) {
|
||||
res = filesystem::read_file(mapfile);
|
||||
}
|
||||
config retv;
|
||||
if(boost::regex_match(res, r_all))
|
||||
if(boost::regex_match(res, r_all))
|
||||
{
|
||||
retv["map_data"] = res;
|
||||
}
|
||||
|
@ -610,8 +610,8 @@ namespace {
|
|||
return config();
|
||||
}
|
||||
virtual std::string description() const
|
||||
{
|
||||
return "Map Data";
|
||||
{
|
||||
return "Map Data";
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -530,7 +530,7 @@ bool t_pump::operator()()
|
|||
// 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.
|
||||
unit::clear_status_caches();
|
||||
|
||||
|
||||
{ // Block for context::scoped
|
||||
context::scoped evc(impl_->contexts_, false);
|
||||
if ( resources::lua_kernel->run_event(ev) ) {
|
||||
|
|
|
@ -121,7 +121,7 @@ private:
|
|||
const config &side_cfg_;
|
||||
|
||||
std::vector<const config*> entry_points_;
|
||||
|
||||
|
||||
std::vector<std::string> entry_point_titles_;
|
||||
};
|
||||
|
||||
|
|
|
@ -775,7 +775,7 @@ void connect_engine::send_level_data(const network::connection sock) const
|
|||
("create_game", config_of
|
||||
("name", params_.name)
|
||||
("password", params_.password)
|
||||
)
|
||||
)
|
||||
);
|
||||
network::send_data(level_, sock);
|
||||
} else {
|
||||
|
@ -811,7 +811,7 @@ void connect_engine::load_previous_sides_users()
|
|||
const std::string& save_id = side->previous_save_id();
|
||||
if (side_users.find(save_id) != side_users.end()) {
|
||||
side->set_reserved_for(side_users[save_id]);
|
||||
|
||||
|
||||
if (side->controller() != CNTR_COMPUTER) {
|
||||
side->set_controller(CNTR_RESERVED);
|
||||
names.insert(side_users[save_id]);
|
||||
|
@ -901,13 +901,13 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
|
|||
|
||||
// Tweak the controllers.
|
||||
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";
|
||||
}
|
||||
//this is a workaround for bug #21797
|
||||
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;
|
||||
cfg_["controller"] = "ai";
|
||||
}
|
||||
|
@ -970,7 +970,7 @@ side_engine::~side_engine()
|
|||
|
||||
std::string side_engine::user_description() const
|
||||
{
|
||||
switch(controller_)
|
||||
switch(controller_)
|
||||
{
|
||||
case CNTR_LOCAL:
|
||||
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) {
|
||||
res["side"] = index_ + 1;
|
||||
}
|
||||
|
||||
|
||||
res["controller"] = controller_names[controller_];
|
||||
if(player_id_ == preferences::login() && res["controller"] == "network") {
|
||||
// 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
|
||||
// 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
|
||||
// during the start/prestart event (otherwse random unit creation during prestart fails).
|
||||
res["controller"] = "human";
|
||||
}
|
||||
|
||||
|
||||
std::string desc = user_description();
|
||||
if(!desc.empty()) {
|
||||
res["user_description"] = t_string(desc, "wesnoth");
|
||||
desc = vgettext(
|
||||
"$playername $side",
|
||||
"$playername $side",
|
||||
boost::assign::map_list_of
|
||||
("playername", _(desc.c_str()))
|
||||
("side", res["side"].str())
|
||||
|
@ -1032,7 +1032,7 @@ config side_engine::new_config() const
|
|||
}
|
||||
if(res["name"].str().empty() && !desc.empty()) {
|
||||
res["name"] = desc;
|
||||
}
|
||||
}
|
||||
|
||||
assert(controller_ != CNTR_LAST);
|
||||
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
|
||||
// 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
|
||||
// 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.
|
||||
|
@ -1060,7 +1060,7 @@ config side_engine::new_config() const
|
|||
} else if(controller_ == CNTR_COMPUTER) {
|
||||
//TODO what is the content of player_id_ here ?
|
||||
res["current_player"] = desc;
|
||||
res["player_id"] = preferences::login();
|
||||
res["player_id"] = preferences::login();
|
||||
} else if(!player_id_.empty()) {
|
||||
res["player_id"] = player_id_;
|
||||
res["current_player"] = player_id_;
|
||||
|
|
|
@ -132,7 +132,7 @@ private:
|
|||
std::vector<std::string> team_names_;
|
||||
std::vector<std::string> user_team_names_;
|
||||
std::vector<std::string> player_teams_;
|
||||
|
||||
|
||||
std::set<std::string>& connected_users_rw();
|
||||
};
|
||||
|
||||
|
@ -246,9 +246,9 @@ private:
|
|||
int gold_;
|
||||
int income_;
|
||||
// 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.
|
||||
// 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
|
||||
std::string reserved_for_;
|
||||
std::string player_id_;
|
||||
|
|
|
@ -572,7 +572,7 @@ void create_engine::prepare_for_campaign(const std::string& difficulty)
|
|||
*
|
||||
* 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.
|
||||
* This is useful for specifying difficulty via command line.
|
||||
*
|
||||
|
|
|
@ -207,7 +207,7 @@ public:
|
|||
void prepare_for_saved_game();
|
||||
//random maps, user maps
|
||||
void prepare_for_other();
|
||||
|
||||
|
||||
std::string select_campaign_difficulty(int set_value = -1);
|
||||
|
||||
void apply_level_filter(const std::string& name);
|
||||
|
@ -244,7 +244,7 @@ public:
|
|||
get_extras_by_type(const MP_EXTRA extra_type);
|
||||
|
||||
bool toggle_current_mod(bool force = false);
|
||||
|
||||
|
||||
bool generator_assigned() const;
|
||||
void generator_user_config(display& disp);
|
||||
|
||||
|
|
|
@ -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,
|
||||
saved_game& state,
|
||||
saved_game& state,
|
||||
bool local_players_only = false);
|
||||
|
||||
static void enter_create_mode(game_display& disp, const config& game_config,
|
||||
|
|
|
@ -108,7 +108,7 @@ configure::configure(game_display& disp, const config &cfg, chat& c, config& gam
|
|||
// Build the list of scenarios to play
|
||||
|
||||
DBG_MP << "constructing multiplayer configure dialog" << std::endl;
|
||||
|
||||
|
||||
countdown_game_.set_check(engine_.mp_countdown_default());
|
||||
countdown_game_.set_help_string(_("Enables user time limit"));
|
||||
|
||||
|
@ -296,7 +296,7 @@ void configure::get_parameters()
|
|||
countdown_init_time_slider_.value() : -1;
|
||||
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;
|
||||
|
||||
|
||||
// Updates the values in the configure_engine to match
|
||||
// the values selected by the user with the widgets:
|
||||
engine_.set_game_name(name_entry_.text());
|
||||
|
|
|
@ -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)) {
|
||||
|
||||
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)) {
|
||||
|
||||
found_match = false;
|
||||
|
|
|
@ -260,7 +260,7 @@ void wait::join_game(bool observe)
|
|||
|
||||
// Add the map name to the title.
|
||||
append_to_title(": " + get_scenario()["name"].t_str());
|
||||
|
||||
|
||||
game_config::add_color_info(get_scenario());
|
||||
if (!observe) {
|
||||
//search for an appropriate vacant slot. If a description is set
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
||||
|
||||
playmp_controller playcontroller(state_.get_starting_pos(), state_,
|
||||
game_config_, tdata_, disp_.video(), mp_info_);
|
||||
LEVEL_RESULT res = playcontroller.play_scenario(state_.get_starting_pos());
|
||||
|
@ -262,7 +262,7 @@ LEVEL_RESULT campaign_controller::play_game()
|
|||
else {
|
||||
state_.get_replay().set_to_end();
|
||||
}
|
||||
|
||||
|
||||
state_.expand_scenario();
|
||||
|
||||
game_classification::CAMPAIGN_TYPE game_type = state_.classification().campaign_type;
|
||||
|
@ -289,7 +289,7 @@ LEVEL_RESULT campaign_controller::play_game()
|
|||
if(is_replay_) {
|
||||
return res;
|
||||
}
|
||||
} else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
res = playmp_scenario(end_level);
|
||||
|
@ -336,7 +336,7 @@ LEVEL_RESULT campaign_controller::play_game()
|
|||
savegame::replay_savegame save(state_, preferences::save_compression_format());
|
||||
save.save_game_automatic(disp_.video(), true);
|
||||
}
|
||||
|
||||
|
||||
state_.convert_to_start_save();
|
||||
|
||||
//If there is no next scenario we're done now.
|
||||
|
|
|
@ -34,7 +34,7 @@ bool enter_create_mode(game_display& disp, const config& game_config,
|
|||
|
||||
std::vector<ng::create_engine::level_ptr> campaigns(
|
||||
create_eng.get_levels_by_type_unfiltered(ng::level::TYPE::SP_CAMPAIGN));
|
||||
|
||||
|
||||
if (campaigns.empty()) {
|
||||
gui2::show_error_message(disp.video(),
|
||||
_("No campaigns are available.\n"));
|
||||
|
|
|
@ -567,7 +567,7 @@ bool game_launcher::play_test()
|
|||
);
|
||||
|
||||
|
||||
|
||||
|
||||
game_config_manager::get()->
|
||||
load_game_config_for_game(state_.classification());
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ void game_state::init(const config& level, play_controller & pc)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pathfind_manager_.reset(new pathfind::manager(level));
|
||||
|
||||
lua_kernel_.reset(new game_lua_kernel(NULL, *this, pc, *reports_));
|
||||
|
|
|
@ -76,7 +76,7 @@ private:
|
|||
size_t translate_x(size_t x) const;
|
||||
size_t translate_y(size_t y) const;
|
||||
|
||||
|
||||
|
||||
const cave_map_generator& params;
|
||||
bool flipx_, flipy_;
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ bool default_map_generator_job::generate_lake(terrain_map& terrain, int x, int y
|
|||
* successfully.
|
||||
*/
|
||||
|
||||
namespace
|
||||
namespace
|
||||
{
|
||||
struct for_randomshuffle
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
bool roads_between_castles, std::map<map_location,std::string>* labels,
|
||||
const config& cfg);
|
||||
private:
|
||||
|
||||
|
||||
typedef std::vector<std::vector<int> > height_map;
|
||||
typedef t_translation::t_map terrain_map;
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ const char* sngettext (const char *singular, const char *plural, int n)
|
|||
return msgval;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
std::string dsngettext (const char * domainname, const char *singular, const char *plural, int n)
|
||||
{
|
||||
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
|
||||
// instead of en_US the first time round
|
||||
// LANGUAGE overrides other settings, so for now just get rid of it
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
(void)alternates;
|
||||
std::string win_locale(locale, 0, 2);
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#define UNUSEDNOWARN
|
||||
#endif
|
||||
|
||||
namespace translation
|
||||
namespace translation
|
||||
{
|
||||
std::string dgettext(const char* domain, const char* msgid);
|
||||
std::string egettext(const char*);
|
||||
|
@ -61,11 +61,11 @@ namespace translation
|
|||
//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);
|
||||
|
||||
inline UNUSEDNOWARN static std::string gettext(const char* str)
|
||||
inline UNUSEDNOWARN static std::string gettext(const char* 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); }
|
||||
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); }
|
||||
|
||||
|
||||
|
|
|
@ -1317,7 +1317,7 @@ private:
|
|||
* text_markup & f_bool & false & Can the text have mark-up? $
|
||||
* text_link_aware & f_bool & false &
|
||||
* Is the text link aware? $
|
||||
* text_link_color & f_string & "#ffff00" &
|
||||
* text_link_color & f_string & "#ffff00" &
|
||||
* The color of links in the text $
|
||||
* maximum_width & f_int & -1 & The maximum width the text is allowed to
|
||||
* be. $
|
||||
|
|
|
@ -79,7 +79,7 @@ struct filter_transform
|
|||
bool operator()(const config& cfg) const
|
||||
{
|
||||
FOREACH(const AUTO& filter, filtertext_)
|
||||
{
|
||||
{
|
||||
bool found = false;
|
||||
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)
|
||||
{
|
||||
|
||||
|
||||
register_sort_button(window, id, boost::bind(&num_up, &cfg_, prop_id, _1, _2), boost::bind(&num_down, &cfg_, prop_id, _1, _2));
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ void tcampaign_selection::pre_show(CVideo& video, twindow& window)
|
|||
tree_group_item["victory"] = tree_group_field;
|
||||
|
||||
tree.add_node("campaign", tree_group_item).set_id(lexical_cast<std::string>(id++));
|
||||
|
||||
|
||||
/*** Add detail item ***/
|
||||
string_map detail_item;
|
||||
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);
|
||||
}
|
||||
if (!engine_.get_const_extras_by_type(ng::create_engine::MOD).empty()) {
|
||||
|
||||
|
||||
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;
|
||||
|
@ -178,7 +178,7 @@ void tcampaign_selection::pre_show(CVideo& video, twindow& window)
|
|||
|
||||
id = 0;
|
||||
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();
|
||||
/*** Add tree item ***/
|
||||
|
|
|
@ -49,7 +49,7 @@ private:
|
|||
|
||||
// populate era and mod lists
|
||||
void update_lists(twindow& window);
|
||||
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ private:
|
|||
|
||||
/** Current map generator index */
|
||||
int current_map_generator_;
|
||||
|
||||
|
||||
/** random seed integer input*/
|
||||
std::string random_seed_;
|
||||
|
||||
|
|
|
@ -285,15 +285,15 @@ void tgame_load::display_savegame(twindow& window)
|
|||
evaluate_summary_string(str, summary);
|
||||
|
||||
// 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);
|
||||
// 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);
|
||||
|
||||
const bool is_replay = is_replay_save(summary);
|
||||
const bool is_scenario_start = summary["turn"].empty();
|
||||
|
||||
|
||||
replay_toggle.set_value(is_replay);
|
||||
replay_toggle.set_active(!is_replay && !is_scenario_start);
|
||||
cancel_orders_toggle.set_active(!is_replay && !is_scenario_start);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
|
@ -24,7 +24,7 @@ namespace gui2 {
|
|||
class tlabel_settings : public tdialog {
|
||||
public:
|
||||
tlabel_settings(display_context& dc);
|
||||
|
||||
|
||||
/**
|
||||
* The execute function.
|
||||
*
|
||||
|
@ -35,13 +35,13 @@ private:
|
|||
std::map<std::string, bool> all_labels;
|
||||
std::map<std::string, t_string> labels_display;
|
||||
display_context& viewer;
|
||||
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void pre_show(CVideo& video, twindow& window);
|
||||
|
||||
|
||||
/** Callback for toggling a checkbox state. */
|
||||
void toggle_category(twidget& box, std::string category);
|
||||
};
|
||||
|
|
|
@ -219,7 +219,7 @@ public:
|
|||
|
||||
void maybe_update_prefix (const std::string & text) {
|
||||
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;
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ void tunit_create::print_stats(std::stringstream& str, const int row)
|
|||
{
|
||||
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";
|
||||
|
||||
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())
|
||||
{
|
||||
str << "<span color='#f5e6c1'>" << a.num_attacks()
|
||||
str << "<span color='#f5e6c1'>" << a.num_attacks()
|
||||
<< 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";
|
||||
|
||||
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)
|
||||
{
|
||||
const int selected_row
|
||||
const int selected_row
|
||||
= find_widget<tlistbox>(&window, "unit_type_list", false).get_selected_row();
|
||||
|
||||
if(selected_row == -1) {
|
||||
|
|
|
@ -484,7 +484,7 @@ void tvertical_list::handle_key_down_arrow(SDLMod /*modifier*/, bool& handled)
|
|||
handled = true;
|
||||
|
||||
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?
|
||||
if(item_ordered(i).get_visible() == twidget::tvisible::invisible
|
||||
|| !get_item_shown(get_item_at_ordered(i))) {
|
||||
|
|
|
@ -364,7 +364,7 @@ protected:
|
|||
|
||||
/** Gets the grid of an item. */
|
||||
virtual const tgrid& item_ordered(const unsigned index) const = 0;
|
||||
|
||||
|
||||
virtual unsigned get_ordered_index(unsigned index) const = 0;
|
||||
virtual unsigned get_item_at_ordered(unsigned index_ordered) const = 0;
|
||||
};
|
||||
|
|
|
@ -1047,7 +1047,7 @@ private:
|
|||
typedef boost::function<bool (unsigned, unsigned)> torder_func;
|
||||
torder_func order_func_;
|
||||
|
||||
|
||||
|
||||
virtual void set_order(const torder_func& order) OVERRIDE
|
||||
{
|
||||
order_func_ = order;
|
||||
|
@ -1071,7 +1071,7 @@ private:
|
|||
return order_func_(a, b);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
virtual unsigned get_ordered_index(unsigned index) const
|
||||
{
|
||||
assert(index < items_.size());
|
||||
|
@ -1101,7 +1101,7 @@ private:
|
|||
for(size_t i = 0; i < order_.size(); ++i) {
|
||||
items_[order_[i]]->ordered_index = i;
|
||||
}
|
||||
|
||||
|
||||
order_dirty_ = false;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
/** The number of states, that is 2 for normal buttons, 3 for tristate buttons. */
|
||||
virtual unsigned num_states() const = 0;
|
||||
|
||||
|
||||
bool get_value_bool() const
|
||||
{
|
||||
assert(num_states() == 2);
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
/** Inherited from tselectable_ */
|
||||
void set_value(const unsigned selected);
|
||||
|
||||
|
||||
/** Inherited from tselectable_ */
|
||||
unsigned num_states() const OVERRIDE;
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ std::string unit_topic_generator::operator()() const {
|
|||
}
|
||||
|
||||
ss << "\n\n";
|
||||
|
||||
|
||||
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> ";
|
||||
}
|
||||
|
|
|
@ -476,7 +476,7 @@ std::string get_names(std::string id)
|
|||
names.push_back(item->get_name());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// These are hard-coded, non-rebindable hotkeys
|
||||
if (id == "quit") {
|
||||
names.push_back("escape");
|
||||
|
|
|
@ -430,7 +430,7 @@ void play_controller::hotkey_handler::show_menu(const std::vector<std::string>&
|
|||
while(i != items.end()) {
|
||||
if (*i == "AUTOSAVES") {
|
||||
// Autosave visibility is similar to LOAD_GAME hotkey
|
||||
|
||||
|
||||
++i; continue; //cmd = &hotkey::hotkey_command::get_command_by_command(hotkey::HOTKEY_LOAD_GAME);
|
||||
} else {
|
||||
cmd = &hotkey::get_hotkey_command(*i);
|
||||
|
|
|
@ -221,15 +221,15 @@ bool playsingle_controller::hotkey_handler::can_execute_command(const hotkey::ho
|
|||
return (!browse() || linger()) && !events::commands_disabled;
|
||||
|
||||
case hotkey::HOTKEY_DELAY_SHROUD:
|
||||
return !linger()
|
||||
return !linger()
|
||||
&& (viewing_team().uses_fog() || viewing_team().uses_shroud())
|
||||
&& viewing_team_is_playing()
|
||||
&& viewing_team().is_local_human()
|
||||
&& viewing_team().is_local_human()
|
||||
&& !events::commands_disabled;
|
||||
case hotkey::HOTKEY_UPDATE_SHROUD:
|
||||
return !linger()
|
||||
&& viewing_team_is_playing()
|
||||
&& viewing_team().is_local_human()
|
||||
&& viewing_team().is_local_human()
|
||||
&& !events::commands_disabled
|
||||
&& viewing_team().auto_shroud_updates() == false;
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ public:
|
|||
|
||||
//replay
|
||||
replay_controller& get_replay_controller()
|
||||
{
|
||||
assert(playsingle_controller_.get_replay_controller());
|
||||
{
|
||||
assert(playsingle_controller_.get_replay_controller());
|
||||
return *playsingle_controller_.get_replay_controller();
|
||||
}
|
||||
virtual void stop_replay() OVERRIDE
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
if (surf.null()) {
|
||||
if (surf.null()) {
|
||||
return false;
|
||||
}
|
||||
#ifdef HAVE_LIBPNG
|
||||
|
|
|
@ -1059,7 +1059,7 @@ static lu_mem singlestep (lua_State *L) {
|
|||
g->gcstate = GCSatomic; /* finish mark phase */
|
||||
g->GCestimate = g->GCmemtrav; /* save what was counted */;
|
||||
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);
|
||||
return work + sw * GCSWEEPCOST;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace make_enum_detail
|
|||
#define ADD_PAREN_2( A, B ) ((A, B)) ADD_PAREN_1
|
||||
#define ADD_PAREN_1_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))
|
||||
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ void terrain_label::read(const config &cfg)
|
|||
visible_in_shroud_ = cfg["visible_in_shroud"].to_bool();
|
||||
immutable_ = cfg["immutable"].to_bool(true);
|
||||
category_ = cfg["category"].str();
|
||||
|
||||
|
||||
int side = cfg["side"].to_int(-1);
|
||||
if(side >= 0) {
|
||||
creator_ = side - 1;
|
||||
|
@ -603,14 +603,14 @@ bool terrain_label::hidden() const
|
|||
std::string category = "cat:" + category_;
|
||||
std::string creator = "side:" + str_cast(creator_ + 1);
|
||||
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())
|
||||
return true;
|
||||
if(creator_ >= 0 && std::find(hidden_categories.begin(), hidden_categories.end(), creator) != hidden_categories.end())
|
||||
return true;
|
||||
if(!team_name().empty() && std::find(hidden_categories.begin(), hidden_categories.end(), "team") != hidden_categories.end())
|
||||
return true;
|
||||
|
||||
|
||||
// Fog can hide some labels.
|
||||
if ( !visible_in_fog_ && is_fogged(parent_->disp(), loc_) )
|
||||
return true;
|
||||
|
|
|
@ -94,7 +94,7 @@ private:
|
|||
|
||||
team_label_map labels_;
|
||||
bool enabled_;
|
||||
|
||||
|
||||
mutable std::vector<std::string> categories;
|
||||
mutable bool categories_dirty;
|
||||
};
|
||||
|
|
|
@ -72,12 +72,12 @@ map_location::DIRECTION map_location::parse_direction(const std::string& str)
|
|||
if(str.empty()) {
|
||||
return NDIRECTIONS;
|
||||
}
|
||||
|
||||
|
||||
// Syntax: [-] (n|ne|se|s|sw|nw) [:cw|:ccw]
|
||||
// - means "take opposite direction" and has higher precedence
|
||||
// :cw and :ccw mean "one step (counter-)clockwise"
|
||||
// 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(')');
|
||||
if (open != std::string::npos && close != std::string::npos) {
|
||||
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));
|
||||
return parse_direction(sub);
|
||||
}
|
||||
|
||||
|
||||
const size_t start = str[0] == '-' ? 1 : 0;
|
||||
const size_t end = str.find_first_of(':');
|
||||
const std::string& main_dir = str.substr(start, end - start);
|
||||
map_location::DIRECTION dir;
|
||||
|
||||
|
||||
if (main_dir == "n") {
|
||||
dir = NORTH;
|
||||
} else if (main_dir == "ne") {
|
||||
|
@ -107,11 +107,11 @@ map_location::DIRECTION map_location::parse_direction(const std::string& str)
|
|||
} else {
|
||||
return NDIRECTIONS;
|
||||
}
|
||||
|
||||
|
||||
if (start == 1) {
|
||||
dir = get_opposite_dir(dir);
|
||||
}
|
||||
|
||||
|
||||
if (end != std::string::npos) {
|
||||
const std::string rel_dir = str.substr(end + 1);
|
||||
if (rel_dir == "cw") {
|
||||
|
@ -122,7 +122,7 @@ map_location::DIRECTION map_location::parse_direction(const std::string& str)
|
|||
return NDIRECTIONS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
|
|
@ -1071,7 +1071,7 @@ void menu_handler::clear_labels()
|
|||
resources::recorder->clear_labels(gui_->current_team_name(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void menu_handler::label_settings() {
|
||||
// TODO: I think redraw_everything might be a bit too much? It causes a flicker.
|
||||
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;
|
||||
} else {
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
size_t moves = actions::move_unit_and_record(steps, &pc_.get_undo_stack(), false, true, &interrupted);
|
||||
|
||||
|
||||
cursor::set(cursor::NORMAL);
|
||||
gui().invalidate_game_status();
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ mt_rng::mt_rng() :
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
mt_rng::mt_rng(boost::uint32_t seed)
|
||||
: random_seed_(seed)
|
||||
, mt_(random_seed_)
|
||||
|
@ -47,15 +47,15 @@ mt_rng::mt_rng(boost::uint32_t seed)
|
|||
|
||||
mt_rng::mt_rng(const config& cfg) :
|
||||
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)
|
||||
{
|
||||
config::attribute_value seed = cfg["random_seed"];
|
||||
seed_random(seed.str(), cfg["random_calls"].to_int(0));
|
||||
}
|
||||
}
|
||||
|
||||
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_
|
||||
&& 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)
|
||||
{
|
||||
uint32_t new_seed;
|
||||
std::istringstream s(seed_str);
|
||||
uint32_t new_seed;
|
||||
std::istringstream s(seed_str);
|
||||
if (!(s >> std::hex >> new_seed)) {
|
||||
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";
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace rand_rng
|
|||
{
|
||||
|
||||
/*
|
||||
This class provides an interface, similar to simple_rng, to the
|
||||
boost mt19937 generator.
|
||||
This class provides an interface, similar to simple_rng, to the
|
||||
boost mt19937 generator.
|
||||
*/
|
||||
|
||||
class mt_rng
|
||||
|
@ -41,10 +41,10 @@ public:
|
|||
|
||||
/**
|
||||
* Same as uint32_t version, but uses a stringstream to convert given
|
||||
* hex string.
|
||||
* @param seed A hex string. Should not have 0x leading.
|
||||
* hex string.
|
||||
* @param seed A hex string. Should not have 0x leading.
|
||||
* @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);
|
||||
|
||||
/**
|
||||
|
@ -73,9 +73,9 @@ private:
|
|||
/** Number of time a random number is generated. */
|
||||
unsigned int random_calls_;
|
||||
|
||||
/** 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,
|
||||
following description here: http://www.boost.org/doc/libs/1_51_0/doc/html/boost/random/mersenne_twister_engine.html#id1408119-bb
|
||||
/** 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,
|
||||
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);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ struct persist_choice: mp_sync::user_choice {
|
|||
, side(side_num) {
|
||||
}
|
||||
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
|
||||
config ret;
|
||||
ret["side"] = side;
|
||||
|
@ -53,10 +53,10 @@ struct persist_choice: mp_sync::user_choice {
|
|||
virtual config random_choice(int /*side_for*/) const {
|
||||
return config();
|
||||
}
|
||||
|
||||
|
||||
virtual std::string description() const
|
||||
{
|
||||
return "a global variable";
|
||||
{
|
||||
return "a global variable";
|
||||
}
|
||||
virtual bool is_visible() const { return false; }
|
||||
};
|
||||
|
|
|
@ -183,7 +183,7 @@ play_controller::play_controller(const config& level, saved_game& state_of_game,
|
|||
, player_type_changed_(false)
|
||||
{
|
||||
copy_persistent(level, level_);
|
||||
|
||||
|
||||
resources::controller = this;
|
||||
resources::persist = &persist_;
|
||||
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;
|
||||
gamestate_.reset(new game_state(level, *this, tdata_));
|
||||
|
||||
|
||||
resources::gameboard = &gamestate().board_;
|
||||
resources::gamedata = &gamestate().gamedata_;
|
||||
resources::teams = &gamestate().board_.teams_;
|
||||
|
@ -245,7 +245,7 @@ void play_controller::init(CVideo& video, const config& level)
|
|||
resources::filter_con = &gamestate();
|
||||
resources::undo_stack = &undo_stack();
|
||||
resources::game_events = gamestate().events_manager_.get();
|
||||
|
||||
|
||||
gamestate_->init(level, *this);
|
||||
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 ((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);
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ config play_controller::to_config() const
|
|||
|
||||
//Write the soundsources.
|
||||
soundsources_manager_->write_sourcespecs(cfg);
|
||||
|
||||
|
||||
gui_->labels().write(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");
|
||||
// This is where we refog, after all of a side's events are done.
|
||||
actions::recalculate_fog(current_side());
|
||||
check_victory();
|
||||
check_victory();
|
||||
sync.do_final_checkup();
|
||||
}
|
||||
|
||||
|
@ -651,7 +651,7 @@ void play_controller::tab()
|
|||
BOOST_FOREACH(const std::string& o, gui_->observers()){
|
||||
dictionary.insert(o);
|
||||
}
|
||||
|
||||
|
||||
// Add nicks who whispered you
|
||||
BOOST_FOREACH(const std::string& w, gui_->get_chat_manager().whisperers()){
|
||||
dictionary.insert(w);
|
||||
|
@ -1086,7 +1086,7 @@ void play_controller::start_game(const config& level)
|
|||
gamestate().start_event_fired_ = true;
|
||||
resources::recorder->add_start_if_not_there_yet();
|
||||
resources::recorder->get_next_action();
|
||||
|
||||
|
||||
set_scontext_synced sync;
|
||||
|
||||
fire_prestart();
|
||||
|
@ -1096,7 +1096,7 @@ void play_controller::start_game(const config& level)
|
|||
|
||||
for ( int side = gamestate().board_.teams().size(); side != 0; --side )
|
||||
actions::clear_shroud(side, false, false);
|
||||
|
||||
|
||||
init_gui();
|
||||
LOG_NG << "first_time..." << (is_skipping_replay() ? "skipping" : "no skip") << "\n";
|
||||
|
||||
|
@ -1148,7 +1148,7 @@ void play_controller::play_side()
|
|||
gui_->parse_team_overlays();
|
||||
do {
|
||||
update_viewing_player();
|
||||
{
|
||||
{
|
||||
save_blocker blocker;
|
||||
maybe_do_init_side();
|
||||
if(is_regular_game_end()) {
|
||||
|
|
|
@ -139,7 +139,7 @@ public:
|
|||
void reset_end_level_data() {
|
||||
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;
|
||||
}
|
||||
const end_level_data& get_end_level_data_const() const {
|
||||
|
@ -366,7 +366,7 @@ private:
|
|||
|
||||
protected:
|
||||
bool player_type_changed_;
|
||||
|
||||
|
||||
virtual void sync_end_turn() {};
|
||||
virtual void check_time_over();
|
||||
virtual void update_viewing_player() = 0;
|
||||
|
|
|
@ -43,7 +43,7 @@ static lg::log_domain log_engine("engine");
|
|||
#define LOG_NG LOG_STREAM(info, log_engine)
|
||||
|
||||
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,
|
||||
mp_campaign_info* mp_info)
|
||||
: playsingle_controller(level, state_of_game,
|
||||
|
@ -104,7 +104,7 @@ void playmp_controller::play_linger_turn()
|
|||
if (is_host()) {
|
||||
end_turn_enable(true);
|
||||
}
|
||||
|
||||
|
||||
while(end_turn_ == END_TURN_NONE) {
|
||||
config cfg;
|
||||
if(network_reader_.read(cfg)) {
|
||||
|
@ -310,7 +310,7 @@ void playmp_controller::after_human_turn(){
|
|||
if(saved_game_.mp_settings().mp_countdown)
|
||||
{
|
||||
//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_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);
|
||||
|
@ -460,7 +460,7 @@ void playmp_controller::process_network_data()
|
|||
turn_info::PROCESS_DATA_RESULT res = turn_info::PROCESS_CONTINUE;
|
||||
config cfg;
|
||||
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)) {
|
||||
res = turn_data_.process_network_data(cfg);
|
||||
|
|
|
@ -25,7 +25,7 @@ class playmp_controller : public playsingle_controller, public syncmp_handler
|
|||
{
|
||||
public:
|
||||
playmp_controller(const config& level, saved_game& state_of_game,
|
||||
const config& game_config,
|
||||
const config& game_config,
|
||||
const tdata_cache & tdata, CVideo& video,
|
||||
mp_campaign_info* mp_info);
|
||||
virtual ~playmp_controller();
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
// game may need to start in linger mode
|
||||
linger_ = this->is_regular_game_end();
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
|
||||
class hotkey_handler;
|
||||
std::string describe_result() const;
|
||||
|
||||
|
||||
bool get_player_type_changed() const { return player_type_changed_; }
|
||||
void set_player_type_changed() { player_type_changed_ = true; }
|
||||
virtual bool should_return_to_play_side();
|
||||
|
|
|
@ -79,11 +79,11 @@ namespace random_new
|
|||
return next_random_impl();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 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
|
||||
* 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.
|
||||
* The simplified version I have written should work the same on all
|
||||
* platforms, which is the most important thing for us.
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace random_new
|
|||
{
|
||||
public:
|
||||
rng();
|
||||
/**
|
||||
/**
|
||||
* Provides the next random draw. This is raw PRG output.
|
||||
*/
|
||||
uint32_t next_random();
|
||||
|
@ -40,14 +40,14 @@ namespace random_new
|
|||
*/
|
||||
unsigned int get_random_calls();
|
||||
|
||||
/**
|
||||
/**
|
||||
* This helper method provides a random int from the underlying generator,
|
||||
* using results of next_random in a manner guaranteed to be cross platform.
|
||||
* The result will be random in range [min,max] inclusive.
|
||||
* @param min The minimum 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); }
|
||||
static rng& default_instance();
|
||||
protected:
|
||||
|
@ -55,7 +55,7 @@ namespace random_new
|
|||
unsigned int random_calls_;
|
||||
|
||||
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.
|
||||
* @param max The maximum value produced.
|
||||
*/
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace random_new
|
|||
private:
|
||||
void initialize();
|
||||
bool has_valid_seed_;
|
||||
boost::function0<std::string> seed_generator_;
|
||||
boost::function0<std::string> seed_generator_;
|
||||
rand_rng::mt_rng gen_;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -494,7 +494,7 @@ void replay::undo_cut(config& dst)
|
|||
//"async"=yes means rename_unit
|
||||
//"dependent"=true means user input
|
||||
const config &c = command(cmd_index);
|
||||
|
||||
|
||||
if(c["undo"].to_bool(true) && !c["async"].to_bool(false) && !c["dependent"].to_bool(false))
|
||||
{
|
||||
if(c["sent"].to_bool(false))
|
||||
|
@ -511,7 +511,7 @@ void replay::undo_cut(config& dst)
|
|||
|
||||
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;
|
||||
}
|
||||
//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
|
||||
: events::chat_handler::MESSAGE_PRIVATE),
|
||||
preferences::message_bell());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (const config &child = cfg->child("label"))
|
||||
|
@ -841,7 +841,7 @@ REPLAY_RETURN do_replay_handle(bool one_move)
|
|||
else
|
||||
{
|
||||
LOG_REPLAY << "found commandname " << commandname << "in replay";
|
||||
|
||||
|
||||
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";
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class replay
|
|||
public:
|
||||
explicit replay(replay_recorder_base& base);
|
||||
|
||||
|
||||
|
||||
void add_start();
|
||||
void add_countdown_update(int value,int team);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ struct replay_play_turn : public replay_play_moves_base
|
|||
int 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)
|
||||
{
|
||||
{
|
||||
if (turn != turn_begin_) {
|
||||
start();
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ struct replay_play_side : public replay_play_moves_base
|
|||
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) {}
|
||||
virtual void new_side_turn(int side , int turn)
|
||||
{
|
||||
{
|
||||
if (turn != turn_begin_ || side != side_begin_) {
|
||||
start();
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ void replay_controller::update_replay_ui()
|
|||
|
||||
if (play_move_b) {
|
||||
play_move_b->enable(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ REPLAY_RETURN replay_controller::play_side_impl()
|
|||
return res;
|
||||
}
|
||||
if(res == REPLAY_RETURN_AT_END) {
|
||||
new replay_stop_condition();
|
||||
new replay_stop_condition();
|
||||
}
|
||||
}
|
||||
controller_.play_slice(false);
|
||||
|
|
|
@ -84,7 +84,7 @@ private:
|
|||
play_controller& controller_;
|
||||
boost::scoped_ptr<replay_stop_condition> stop_condition_;
|
||||
events::command_disabler disabler_;
|
||||
|
||||
|
||||
enum REPLAY_VISION
|
||||
{
|
||||
HUMAN_TEAM,
|
||||
|
|
|
@ -26,8 +26,8 @@ void replay_recorder_base::swap(replay_recorder_base& other)
|
|||
}
|
||||
|
||||
int replay_recorder_base::get_pos() const
|
||||
{
|
||||
return pos_;
|
||||
{
|
||||
return pos_;
|
||||
}
|
||||
|
||||
int replay_recorder_base::size() const
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace events {
|
|||
class mouse_handler;
|
||||
}
|
||||
|
||||
class reports
|
||||
class reports
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class play_controller;
|
|||
* 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,
|
||||
* 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
|
||||
*
|
||||
* As a temporary fix the destructor has been changed to swallow all exceptions.
|
||||
|
|
|
@ -310,7 +310,7 @@ void saved_game::expand_mp_events()
|
|||
{ mods.push_back(modevents_entry("era", mp_settings_.mp_era)); }
|
||||
if(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
|
||||
do {
|
||||
BOOST_FOREACH(modevents_entry& mod, mods)
|
||||
|
@ -380,7 +380,7 @@ void saved_game::expand_random_scenario()
|
|||
{
|
||||
scenario_new.add_child("story", story);
|
||||
}
|
||||
scenario_new["id"] = starting_pos_["id"];
|
||||
scenario_new["id"] = starting_pos_["id"];
|
||||
starting_pos_ = scenario_new;
|
||||
update_label();
|
||||
set_defaults();
|
||||
|
@ -494,7 +494,7 @@ config saved_game::to_config() const
|
|||
r.add_child("replay_start", replay_start_);
|
||||
}
|
||||
replay_data_.write(r.add_child("replay"));
|
||||
|
||||
|
||||
if(starting_pos_type_ == STARTINGPOS_SNAPSHOT)
|
||||
{
|
||||
r.add_child("snapshot", starting_pos_);
|
||||
|
@ -644,7 +644,7 @@ void saved_game::set_data(config& cfg)
|
|||
statistics::fresh_stats();
|
||||
statistics::read_stats(stats);
|
||||
}
|
||||
|
||||
|
||||
classification_ = game_classification(cfg);
|
||||
mp_settings_ = mp_game_settings(cfg.child_or_empty("multiplayer"));
|
||||
cfg.clear();
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
|
||||
private:
|
||||
bool 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 false: The carryover information for all sides from the previous scenario.
|
||||
|
|
|
@ -166,7 +166,7 @@ private:
|
|||
//before_save (write replay data) changes this so it cannot be const
|
||||
saved_game& gamestate_;
|
||||
/** Filename of the savegame file on disk */
|
||||
std::string filename_;
|
||||
std::string filename_;
|
||||
|
||||
const std::string title_; /** Title of the savegame dialog */
|
||||
|
||||
|
|
|
@ -2262,7 +2262,7 @@ int game_lua_kernel::intf_print(lua_State *L) {
|
|||
color = string_to_color(cfg["color"]);
|
||||
} else if(cfg.has_attribute("red") || cfg.has_attribute("green") || cfg.has_attribute("blue")) {
|
||||
color = create_color(cfg["red"], cfg["green"], cfg["blue"]);
|
||||
}
|
||||
}
|
||||
|
||||
const SDL_Rect& rect = game_display_->map_outside_area();
|
||||
|
||||
|
|
|
@ -405,9 +405,9 @@ std::string register_vconfig_metatable(lua_State *L)
|
|||
|
||||
lua_pushstring(L, "wml object");
|
||||
lua_setfield(L, -2, "__metatable");
|
||||
|
||||
|
||||
// Metatables for the iterator userdata
|
||||
|
||||
|
||||
// I don't bother setting __metatable because this
|
||||
// userdata is only ever stored in the iterator's
|
||||
// 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_pushcfunction(L, &impl_vconfig_pairs_collect);
|
||||
lua_rawset(L, -3);
|
||||
|
||||
|
||||
luaL_newmetatable(L, vconfigipairsKey);
|
||||
lua_pushstring(L, "__gc");
|
||||
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_explicit:
|
||||
return luaL_typerror(L, n, "WML table or scalar") != 0;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (const invalid_variablename_exception&)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* Using this, for example, C++ method functions may be boost::bind'ed and
|
||||
* 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
|
||||
* 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
|
||||
|
@ -50,7 +50,7 @@
|
|||
* 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
|
||||
* 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.
|
||||
*
|
||||
* This approach is often quite good for small objects. Wesnoth uses full userdata
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#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.
|
||||
*/
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue