codespell fixes to /src

This commit is contained in:
Matthias Krüger 2018-02-08 11:39:08 +01:00 committed by Charles Dang
parent 17738ba646
commit a2168d2e24
130 changed files with 206 additions and 215 deletions

View file

@ -178,7 +178,7 @@ GetSources("lua" lua_STAT_SRC)
set_source_files_properties(${lua_STAT_SRC} PROPERTIES LANGUAGE CXX)
# Inject a header into the Lua sources for Wesnoth-specific changes
# makedepend won't see it so we have to specifically add it as a dependancy.
# makedepend won't see it so we have to specifically add it as a dependency.
file(GLOB wesnoth_lua_config wesnoth_lua_config.h)
set_source_files_properties(${lua_STAT_SRC} PROPERTIES COMPILE_FLAGS "-include ${wesnoth_lua_config}")
set_source_files_properties(${lua_STAT_SRC} PROPERTIES OBJECT_DEPENDS ${wesnoth_lua_config})

View file

@ -33,7 +33,7 @@ output*. Each call to `SDL_PNGFormatAlpha` produces a **new** SDL_Surface that
**must** be freed using `SDL_FreeSurface`.
```
//safest way, usefull for 'screen' surface
//safest way, useful for 'screen' surface
SDL_Surface *tmp = SDL_PNGFormatAlpha(screen);
SDL_SavePNG(tmp, "screenshot.png");
SDL_FreeSurface(tmp)

View file

@ -891,7 +891,7 @@ namespace { // Private helpers for move_unit()
if (spectator_) {
spectator_->set_ambusher(ambusher);
}
// Override the default ambushed messge?
// Override the default ambushed message?
if ( update_alert ) {
// Observers don't get extra information.
if ( playing_team_is_viewing_ || !disp.fogged(hex) ) {

View file

@ -95,7 +95,7 @@ private:
/**
* Makes it so the village at the given location is owned by the given side.
* Returns true if getting the village triggered a mutating event.
* side can be 0 to make teh village uncaptured.
* side can be 0 to make the village uncaptured.
*/
game_events::pump_result_t get_village(const map_location& loc, int side, bool *time_bonus = nullptr, bool fire_event = true);

View file

@ -413,7 +413,7 @@ void undo_list::redo()
resources::recorder->redo(const_cast<const config&>(*action));
// synced_context::run readds the undo command with the normal undo_lis::add function whihc clears the
// synced_context::run readds the undo command with the normal undo_lis::add function which clears the
// redo stack which makes redoign of more than one move impossible. to work around that we save redo stack here and set it later.
redos_list temp;
temp.swap(redos_);
@ -473,7 +473,7 @@ bool undo_list::apply_shroud_changes() const
// If we clear fog or shroud outside a synced context we get OOS
// Note that it can happen that we call this function from ouside a synced context
// when we reload a game and want to prevent undoing. But in this case this is
// preceeded by a manual update_shroud call so that cleared_shroud is false.
// preceded by a manual update_shroud call so that cleared_shroud is false.
assert(synced_context::is_synced());
// The entire stack needs to be cleared in order to preserve replays.

View file

@ -60,8 +60,8 @@ namespace actions {
struct undo_action : undo_action_base
{
/// Default constructor.
/// It is assumed that undo actions are contructed after the action is performed
/// so that the unit id diff does not change after this contructor.
/// It is assumed that undo actions are constructed after the action is performed
/// so that the unit id diff does not change after this constructor.
undo_action();
undo_action(const config& cfg);
// Virtual destructor to support derived classes.

View file

@ -473,7 +473,7 @@ void move_result::do_execute()
size_t num_steps = ::actions::move_unit_and_record(
/*std::vector<map_location> steps*/ route_->steps,
/*::actions::undo_list* undo_stack*/ nullptr,
/*bool continue_move*/ true, ///@todo 1.9 set to false after implemeting interrupt awareness
/*bool continue_move*/ true, ///@todo 1.9 set to false after implementing interrupt awareness
/*bool show_move*/ !preferences::skip_ai_moves(),
/*bool* interrupted*/ nullptr,
/*::actions::move_unit_spectator* move_spectator*/ &move_spectator);

View file

@ -273,7 +273,7 @@ void protect_goal::add_targets(std::back_insert_iterator< std::vector< target >
} else {
filter_ptr_->get_locations(items);
}
DBG_AI_GOAL << "side " << get_side() << ": seaching for threats in "+goal_type+" goal" << std::endl;
DBG_AI_GOAL << "side " << get_side() << ": searching for threats in "+goal_type+" goal" << std::endl;
// Look for directions to protect a specific location or specific unit.
for (const map_location &loc : items)
{

View file

@ -130,7 +130,7 @@ carryover_info::carryover_info(const config& cfg, bool from_snpashot)
{
if(side["lost"].to_bool(false) || !side["persistent"].to_bool(true))
{
//this shouldnt happen outside a snpshot.
//this shouldn't happen outside a snpshot.
assert(from_snpashot);
continue;
}

View file

@ -118,7 +118,7 @@ struct color_t
/**
* Returns the stored color in rrggbb hex format.
*
* @return The string in hex format. The preceeding '#' needed for pango markup
* @return The string in hex format. The preceding '#' needed for pango markup
* is prepended.
*/
std::string to_hex_string() const;

View file

@ -147,9 +147,9 @@ public:
bool preprocess;
/// Defines that were given to the --preprocess option.
boost::optional<std::vector<std::string> > preprocess_defines;
/// Non-empty if --preprocess-input-macros was given on the command line. Specifies a file that contains [preproc_define]s to be included before preprocessing. Dependant on --preprocess.
/// Non-empty if --preprocess-input-macros was given on the command line. Specifies a file that contains [preproc_define]s to be included before preprocessing. Dependent on --preprocess.
boost::optional<std::string> preprocess_input_macros;
/// Non-empty if --preprocess-output-macros was given on the command line. Outputs all preprocessed macros to the specified file. Dependant on --preprocess.
/// Non-empty if --preprocess-output-macros was given on the command line. Outputs all preprocessed macros to the specified file. Dependent on --preprocess.
boost::optional<std::string> preprocess_output_macros;
/// Path to parse that was given to the --preprocess option.
boost::optional<std::string> preprocess_path;
@ -191,7 +191,7 @@ public:
bool headless_unit_test;
/// Non-empty if --timeout was given on the command line. Dependent on --unit.
boost::optional<unsigned int> timeout;
/// True if --noreplaycheck was given on the comand line. Dependent on --unit.
/// True if --noreplaycheck was given on the command line. Dependent on --unit.
bool noreplaycheck;
/// True if --mp-test was given on the command line.
bool mptest;

View file

@ -43,7 +43,7 @@ static lg::log_domain log_config("config");
namespace
{
// std::map::operator[] does not support heterogenous lookup so we need this to work around.
// std::map::operator[] does not support heterogeneous lookup so we need this to work around.
template<typename Map, typename Key>
typename Map::mapped_type& map_get(Map& map, Key&& key)
{
@ -56,7 +56,7 @@ typename Map::mapped_type& map_get(Map& map, Key&& key)
return res->second;
}
// std::map::erase does not support heterogenous lookup so we need this to work around.
// std::map::erase does not support heterogeneous lookup so we need this to work around.
template<typename Map, typename Key>
int map_erase_key(Map& map, Key&& key)
{
@ -302,7 +302,7 @@ void config::append(config&& cfg)
}
else {
for(const attribute& v : cfg.values_) {
//TODO: move the attributes aswell?
//TODO: move the attributes as well?
values_[v.first] = v.second;
}
}

View file

@ -147,13 +147,13 @@ namespace
template<typename To>
bool from_string_verify(const std::string& source, To& res)
{
// Check 1: convertable to the target type.
// Check 1: convertible to the target type.
std::istringstream in_str(source);
if(!(in_str >> res)) {
return false;
}
// Check 2: convertable back to the same string.
// Check 2: convertible back to the same string.
std::ostringstream out_str;
out_str << res;
return out_str.str() == source;
@ -413,7 +413,7 @@ bool config_attribute_value::equals(const std::string& str) const
config_attribute_value v;
v = str;
return *this == v;
// if c["a"] = "1" then this solution would have resulted in c["a"] == "1" beeing false
// if c["a"] = "1" then this solution would have resulted in c["a"] == "1" being false
// because a["a"] is '1' and not '"1"'.
// return boost::apply_visitor(std::bind( equality_visitor(), _1, std::cref(str) ), value_);
// that's why we don't use it.

View file

@ -495,7 +495,7 @@ void display::reload_map()
void display::change_display_context(const display_context * dc)
{
dc_ = dc;
builder_->change_map(&dc_->map()); //TODO: Should display_context own and initalize the builder object?
builder_->change_map(&dc_->map()); //TODO: Should display_context own and initialize the builder object?
}
void display::reset_halo_manager()
@ -692,7 +692,7 @@ const display::rect_of_hexes display::hexes_under_rect(const SDL_Rect& r) const
// we minus "0.(3)", for horizontal imbrication.
// reason is: two adjacent hexes each overlap 1/4 of their width, so for
// grid calculation 3/4 of tile width is used, which by default gives
// 18/54=0.(3). Note that, while tile_width is zoom dependand, 0.(3) is not.
// 18/54=0.(3). Note that, while tile_width is zoom dependent, 0.(3) is not.
res.left = static_cast<int>(std::floor(-border + x / tile_width - 0.3333333));
// we remove 1 pixel of the rectangle dimensions
// (the rounded division take one pixel more than needed)
@ -2012,7 +2012,7 @@ bool display::zoom_at_min()
bool display::set_zoom(bool increase)
{
// Ensure we don't try to access nonexistant vector indices.
// Ensure we don't try to access nonexistent vector indices.
zoom_index_ = utils::clamp(increase ? zoom_index_ + 1 : zoom_index_ - 1, 0, final_zoom_index);
// No validation check is needed in the next step since we've already set the index here and

View file

@ -72,7 +72,7 @@ public:
parent_.select_item(id_);
}
if (e.button == SDL_BUTTON_RIGHT) {
//TODO: add a context menu with the follwing options:
//TODO: add a context menu with the following options:
// 1) 'copy it to clipboard'
// 2) 'jump to item'
// 3) 'delete item'.
@ -254,7 +254,7 @@ void location_palette::adjust_size(const SDL_Rect& target)
}));
button_add_.reset(new location_palette_button(video(), SDL_Rect{ target.x , bottom -= button_y, target.w - 10, button_height }, _("Add"), [this]() {
std::string newid;
if (gui2::dialogs::edit_text::execute(_("New Location Identifer"), "", newid)) {
if (gui2::dialogs::edit_text::execute(_("New Location Identifier"), "", newid)) {
add_item(newid);
}
}));

View file

@ -100,7 +100,7 @@ private:
protected:
int item_size_;
// the heigh of a row, the size of an item including borders.
// the height of a row, the size of an item including borders.
int item_space_;
private:

View file

@ -770,7 +770,7 @@ std::vector<std::string> pango_text::find_links(utils::string_view text) const {
int last_delim = -1;
for (size_t index = 0; index < text.size(); ++index) {
if (delim.find(text[index]) != std::string::npos) {
// want to include chars from range since last token, dont want to include any delimiters
// want to include chars from range since last token, don't want to include any delimiters
utils::string_view token = text.substr(last_delim + 1, index - last_delim - 1);
if(looks_like_url(token)) {
links.push_back(token.to_string());

View file

@ -385,7 +385,7 @@ private:
* If needed frees the other surface and then creates a new buffer and
* initializes the entire buffer with values 0.
*
* NOTE eventhough we're clearly modifying function we don't change the
* NOTE even though we're clearly modifying function we don't change the
* state of the object. The const is needed so other functions can also be
* marked const (those also don't change the state of the object.
*

View file

@ -28,7 +28,7 @@
namespace font {
/**
* Retuns a Pango formatting string using the provided color_t object.
* Returns a Pango formatting string using the provided color_t object.
*
* The string returned will be in format: &lt;span foreground=#color>
* Callers will need to manually append the closing &lt;/span>' tag.

View file

@ -23,7 +23,7 @@ namespace tokenizer
typedef std::string::const_iterator iterator;
/// TOKEN_TYPE is already defined in a Winnt.h (a windows header wich is included under some conditions.)
/// TOKEN_TYPE is already defined in a Winnt.h (a windows header which is included under some conditions.)
enum TOKEN_TYPE { TOKEN_OPERATOR, TOKEN_STRING_LITERAL,
TOKEN_IDENTIFIER, TOKEN_INTEGER, TOKEN_DECIMAL,
TOKEN_LPARENS, TOKEN_RPARENS,

View file

@ -31,9 +31,9 @@ public:
{
/// Always reload config
FORCE_RELOAD,
/// Dont reload if the previous defines equal the new defines
/// Don't reload if the previous defines equal the new defines
NO_FORCE_RELOAD,
/// Dont reload if the previous defines include the new defines
/// Don't reload if the previous defines include the new defines
NO_INCLUDE_RELOAD,
};

View file

@ -327,9 +327,9 @@ WML_HANDLER_FUNCTION(do_command,, cfg)
continue;
}
// TODO: afaik run_in_synced_context_if_not_already thows exceptions when the executed action end the scenario or the turn.
// This could cause problems, specially when its unclear whether that excetion is caught by lua or not...
// This could cause problems, specially when its unclear whether that exception is caught by lua or not...
//Note that this fires related events and everthing else that also happen normally.
//Note that this fires related events and everything else that also happens normally.
//have to watch out with the undo stack, therefore forbid [auto_shroud] and [update_shroud] here...
synced_context::run_in_synced_context_if_not_already(
/*commandname*/ i.get_key(),
@ -546,7 +546,7 @@ namespace {
std::string filename_;
virtual config query_user(int /*side*/) const
{
//Do a regex check for the file format to prevent sending aribitary files to other clients.
//Do a regex check for the file format to prevent sending arbitrary files to other clients.
//Note: this allows only the new format.
static const std::string s_simple_terrain = R"""([A-Za-z\\|/]{1,4})""";
static const std::string s_terrain = s_simple_terrain + R"""((\^)""" + s_simple_terrain + ")?";
@ -971,4 +971,3 @@ WML_HANDLER_FUNCTION(on_undo, event_info, cfg)
}
} // end namespace game_events

View file

@ -179,7 +179,7 @@ private:
bool use_wml_menu_;
/**
* If true, this item will be sent ot ther clients.
* If true, this item will be sent to the clients.
* The command shall not change the gamestate if !is_synced_
*/
bool is_synced_;

View file

@ -64,7 +64,7 @@ public:
* Gets the menu item with the specified ID.
*
* @param id Item id.
* @returns Pointer to the relavent item, or nullptr if not found.
* @returns Pointer to the relevant item, or nullptr if not found.
*/
item_ptr get_item(const std::string& id) const;

View file

@ -23,7 +23,7 @@ namespace ng
/**
* configure_engine
*
* this class wraps the parameters relevent to mp_configure,
* this class wraps the parameters relevant to mp_configure,
* as well as providing defaults for these parameters.
*/
class configure_engine

View file

@ -907,16 +907,16 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine, const
cfg_.remove_attribute("controller");
cfg_["previous_save_id"] = parent_.side_engines()[side_cntr_index]->previous_save_id();
ERR_MP << "contoller=<number> is deperecated\n";
ERR_MP << "controller=<number> is deperecated\n";
}
if(!parent_.params_.saved_game && cfg_["save_id"].str().empty()) {
assert(cfg_["id"].empty()); // we already setted "save_id" to "id" if "id" existed.
assert(cfg_["id"].empty()); // we already set "save_id" to "id" if "id" existed.
cfg_["save_id"] = parent_.scenario()["id"].str() + "_" + std::to_string(index);
}
if(cfg_["controller"] != "human" && cfg_["controller"] != "ai" && cfg_["controller"] != "null") {
//an invalid contoller type was specified. Remove it to prevent asertion failures later.
//an invalid controller type was specified. Remove it to prevent asertion failures later.
cfg_.remove_attribute("controller");
}
@ -1007,7 +1007,7 @@ config side_engine::new_config() const
{
config res = cfg_;
// In case of 'shuffle sides' the side index in cfg_ might be wrong which will confuse the team constuctor later.
// In case of 'shuffle sides' the side index in cfg_ might be wrong which will confuse the team constructor later.
res["side"] = index_ + 1;
// If the user is allowed to change type, faction, leader etc, then import their new values in the config.

View file

@ -264,8 +264,8 @@ private:
// set during create_engines constructor never set after that.
// 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
// by the player who controlls that side
// can also be a number of a side if this side should be controlled
// by the player who controls that side
std::string reserved_for_;
std::string player_id_;
std::string ai_algorithm_;

View file

@ -221,7 +221,7 @@ bool manager::conflicts(const elem& elem1, const elem& elem2, bool directonly) c
return false;
}
// We ignore nonexistant elements at this point, they will generate
// We ignore nonexistent elements at this point, they will generate
// errors in change_era()/change_scenario() anyways.
if(!exists(elem1) || !exists(elem2)) {
return false;

View file

@ -143,7 +143,7 @@ void campaign_controller::show_carryover_message(playsingle_controller& playcont
report << _("You have been defeated!");
}
//We need to write the carryover amount to the team thats why we need non const
//We need to write the carryover amount to the team that's why we need non const
std::vector<team>& teams = resources::gameboard->teams();
int persistent_teams = 0;
for (const team &t : teams) {

View file

@ -204,7 +204,7 @@ void game_state::init(const config& level, play_controller & pc)
build_team_stage_one(tb_ptr);
team_builders.push_back(tb_ptr);
}
//Initilize the lua kernel before the units are created.
//Initialize the lua kernel before the units are created.
lua_kernel_->initialize(level);
{

View file

@ -133,7 +133,7 @@ std::string default_map_generator::generate_map(std::map<map_location,std::strin
std::map<map_location,std::string> labels_copy;
std::map<map_location,std::string>* labels_ptr = labels ? &labels_copy : nullptr;
// Iinitilize the job outside the loop so that we really get a different result everytime we run the loop.
// Iinitilize the job outside the loop so that we really get a different result every time we run the loop.
default_map_generator_job job(seed);
int tries = 10;

View file

@ -341,11 +341,11 @@ height_map default_map_generator_job::generate_height_map(size_t width, size_t h
}
// Find the highest and lowest points on the map for normalization:
int heighest = 0, lowest = 100000, x;
int highest = 0, lowest = 100000, x;
for(x = 0; size_t(x) != res.size(); ++x) {
for(int y = 0; size_t(y) != res[x].size(); ++y) {
if(res[x][y] > heighest) {
heighest = res[x][y];
if(res[x][y] > highest) {
highest = res[x][y];
}
if(res[x][y] < lowest) {
@ -355,13 +355,13 @@ height_map default_map_generator_job::generate_height_map(size_t width, size_t h
}
// Normalize the heights to the range 0-1000:
heighest -= lowest;
highest -= lowest;
for(x = 0; size_t(x) != res.size(); ++x) {
for(int y = 0; size_t(y) != res[x].size(); ++y) {
res[x][y] -= lowest;
res[x][y] *= 1000;
if(heighest != 0) {
res[x][y] /= heighest;
if(highest != 0) {
res[x][y] /= highest;
}
}
}

View file

@ -479,7 +479,7 @@ inline bool fire_event(const ui_event event,
* @pre w != nullptr
*
* @tparam T The signal type of the event to handle.
* @tparam F The paramater pack type.
* @tparam F The parameter pack type.
*
*
* @param event The event to fire.

View file

@ -14,7 +14,7 @@
/**
* @file
* This file contains the defintions for the @ref gui2::event::message class.
* This file contains the definitions for the @ref gui2::event::message class.
*
* The class is used in the @ref gui2::event::signal_message_function
*/

View file

@ -25,7 +25,7 @@ class config;
namespace gui2
{
/**
* A GUI theme definiton.
* A GUI theme definition.
*
* Each theme defines the appearance and layout of widgets and windows. At least one theme
* (the default) must exist for the game to run. That theme is expected to contain at least
@ -33,7 +33,7 @@ namespace gui2
* static registry. Do note that a widget type may have any number of definitions defined
* per theme, but a window may only have one layout.
*
* Non-default themes may omit a default widget defintion or a window layout, in which case
* Non-default themes may omit a default widget definition or a window layout, in which case
* the game will fall back on the default definition (for widgets) or the layout (for windows)
* specified in the default theme.
*
@ -126,12 +126,12 @@ struct window_builder_invalid_id
*/
const builder_window::window_resolution& get_window_builder(const std::string& type);
/** Adds a widget definiton to the default GUI. */
/** Adds a widget definition to the default GUI. */
bool add_single_widget_definition(const std::string& widget_type,
const std::string& definition_id,
const config& cfg);
/** Removes a widget definiton from the default GUI. */
/** Removes a widget definition from the default GUI. */
void remove_single_widget_definition(const std::string& widget_type,
const std::string& definition_id);

View file

@ -103,7 +103,7 @@ std::set<std::string>& registered_window_types();
struct registered_widget_parser
{
/** The widget definiton WML parser function. */
/** The widget definition WML parser function. */
widget_parser_t parser;
/** The tag containing the definition WML. */

View file

@ -140,7 +140,7 @@ namespace {
* It fails an @a assert() check or throws an exception if the requested element
* does not exist.
*
* @return An element from the container that is guranteed to have existed
* @return An element from the container that is guaranteed to have existed
* before running this function.
*/
template <typename MapT>

View file

@ -31,7 +31,7 @@ public:
* Constructor.
*
* @param name the type of which we want to select a new item
* @param options the names of the components which can be choosed
* @param options the names of the components which can be chosen
*/
depcheck_select_new(ng::depcheck::component_type name,
const std::vector<std::string>& options);

View file

@ -41,7 +41,7 @@ namespace dialogs
REGISTER_DIALOG(edit_text)
//TODO: add a way to disallow certain chracters (like spaces or ")
//TODO: add a way to disallow certain characters (like spaces or ")
edit_text::edit_text(const std::string& title,
const std::string& label,
std::string& text)

View file

@ -631,7 +631,7 @@ void file_dialog::on_bookmark_selected(window& window)
if(new_selection < 0) {
if(current_bookmark_ >= 0) {
// Don't allow the user to unselect the selected bookmark. That wouldn't
// Don't allow the user to deselect the selected bookmark. That wouldn't
// make any sense.
bookmarks_bar.select_row(unsigned(current_bookmark_));
}

View file

@ -287,7 +287,7 @@ void game_load::filter_text_changed(text_box_base* textbox, const std::string& t
// Disable Load button if no games are available
find_widget<button>(&window, "ok", false).set_active(any_shown);
// Diable 'Enter' loading if no games are available
// Disable 'Enter' loading if no games are available
window.set_enter_disabled(!any_shown);
}

View file

@ -623,7 +623,7 @@ void lua_interpreter::controller::tab()
}
//bool line_start = utils::word_completion(text, matches);
if (text.size() > 0) { // this if is to avoid wierd behavior in word_completion, where it thinks nothing matches the empty string
if (text.size() > 0) { // this if is to avoid weird behavior in word_completion, where it thinks nothing matches the empty string
utils::word_completion(text, matches);
}

View file

@ -123,7 +123,7 @@ private:
*
* This assembles the game request for the server and handles any applicable
* pre-join actions, such as prompting the player for the game's password or
* informing them additonal content needs installing.
* informing them additional content needs installing.
*
* The lobby window will be closed on completion, assuming an error wasn't
* encountered.

View file

@ -39,7 +39,7 @@ namespace preferences {
};
/**
* Map containing page mappings that can be used to set the initally displayed page
* Map containing page mappings that can be used to set the initially displayed page
* of the dialog. The pair is in an 0-indexed toplevel stack/substack format, where
* the first is the list of main Preference categories (such as General and Display)
* and the second is any sub-stack found on that page.

View file

@ -128,7 +128,7 @@ void debug_layout_graph::set_level(const std::string& level)
{
if(param == "all") {
level_ = ALL;
// No need to look further eventhough invalid items are now
// No need to look further even though invalid items are now
// ignored.
return;
} else if(param == "size") {
@ -156,7 +156,7 @@ void debug_layout_graph::set_domain(const std::string& domain)
{
if(param == "all") {
domain_ = ALL;
// No need to look further eventhough invalid items are now
// No need to look further even though invalid items are now
// ignored.
return;
} else if(param == "show") {

View file

@ -133,7 +133,7 @@ struct one_item : public virtual generator_base
* function should always call do_select_item() so the new item does get
* selected.
*
* Since this funcion controls the maximum selection count it should only
* Since this function controls the maximum selection count it should only
* be used to select items, not to deselect them.
*
* @pre @p select == @c true

View file

@ -147,7 +147,7 @@ void multimenu_button::signal_handler_left_button_click(const event::ui_event ev
}
}
/* In order to allow toggle button states to be specified by verious dialogs in the values config, we write the state
/* In order to allow toggle button states to be specified by various dialogs in the values config, we write the state
* bools to the values_ config here, but only if a checkbox= key was already provided. The value of the checkbox= key
* is handled by the drop_down_menu widget.
*

View file

@ -344,7 +344,7 @@ private:
/**
* Updates the scrollbar.
*
* Needs to be called when someting changes eg number of items
* Needs to be called when something changes eg number of items
* or available size. It can only be called once we have a size
* otherwise we can't calculate a thing.
*/

View file

@ -32,7 +32,7 @@ struct builder_styled_widget;
/**
* Base class for creating containers with one or two scrollbar(s).
*
* For now users can't instanciate this class directly and needs to use small
* For now users can't instantiate this class directly and needs to use small
* wrapper classes. Maybe in the future users can use the class directly.
*
* @todo events are not yet send to the content grid.

View file

@ -291,7 +291,7 @@ private:
/**
* Updates the slider.
*
* Needs to be called when someting changes eg number of items or available size.
* Needs to be called when something changes eg number of items or available size.
* It can only be called once we have a size otherwise we can't calculate a thing.
*/
void recalculate();

View file

@ -446,7 +446,7 @@ point styled_widget::get_best_text_size(point minimum_size, point maximum_size)
/*
* NOTE: text rendering does *not* happen here. That happens in the text_shape
* canvas class. Instead, this just leverages the pango text rendering engine to
* calculate the area this widget will need to sucessfully render its text later.
* calculate the area this widget will need to successfully render its text later.
*/
renderer_
.set_link_aware(get_link_aware())

View file

@ -231,7 +231,7 @@ void text_box::delete_selection()
}
// If we have a negative range change it to a positive range.
// This makes the rest of the algoritms easier.
// This makes the rest of the algorithms easier.
int len = get_selection_length();
unsigned start = get_selection_start();
if(len < 0) {

View file

@ -108,7 +108,7 @@ tree_view_node::tree_view_node(
return;
}
// Only reached if no matching node definiton was found in the above loop
// Only reached if no matching node definition was found in the above loop
FAIL_WITH_DEV_MESSAGE(_("Unknown builder id for tree view node."), id);
}

View file

@ -198,7 +198,7 @@ public:
tree_view_node& get_child_at(int index);
/**
* Calculates the node indicies needed to get from the root node to this node.
* Calculates the node indices needed to get from the root node to this node.
*/
std::vector<int> describe_path();

View file

@ -545,7 +545,7 @@ public:
*
* The clipping rectangle is used then the @ref redraw_action_ is
* @ref redraw_action::partly. Since the drawing can be offsetted it also
* needs offset paramters.
* needs offset parameters.
*
* @param x_offset The offset in the x-direction when drawn.
* @param y_offset The offset in the y-direction when drawn.

View file

@ -436,7 +436,7 @@ public:
*
* A window will only close if this function returns true.
*
* @param func A function taking a window reference and returing a boolean result.
* @param func A function taking a window reference and returning a boolean result.
*/
void set_exit_hook(std::function<bool(window&)> func)
{

View file

@ -50,7 +50,7 @@ static std::string best_str(bool best) {
}
typedef t_translation::ter_list::const_iterator ter_iter;
// Gets an english desription of a terrain ter_list alias behavior: "Best of cave, hills", "Worst of Swamp, Forest" etc.
// Gets an english description of a terrain ter_list alias behavior: "Best of cave, hills", "Worst of Swamp, Forest" etc.
static std::string print_behavior_description(ter_iter start, ter_iter end, const ter_data_cache & tdata, bool first_level = true, bool begin_best = true)
{

View file

@ -121,7 +121,7 @@ public:
virtual void set_button_state() {}
virtual void recalculate_minimap() {}
// execute_command's parameter is changed to "hotkey_command& command" and this not maybe that is too inconsitent.
// execute_command's parameter is changed to "hotkey_command& command" and this not maybe that is too inconsistent.
// Gets the action's image (if any). Displayed left of the action text in menus.
virtual std::string get_action_image(hotkey::HOTKEY_COMMAND /*command*/, int /*index*/) const { return ""; }
// Does the action control a toggle switch? If so, return the state of the action (on or off).

View file

@ -97,7 +97,7 @@ public:
}
/**
* Used to indicate that a hotkey is overriden and should be treated as
* Used to indicate that a hotkey is overridden and should be treated as
* a user-set hotkey.
*/
void unset_default()

View file

@ -1061,7 +1061,7 @@ static void codecomp (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) {
/*
** Aplly prefix operation 'op' to expression 'e'.
** Apply prefix operation 'op' to expression 'e'.
*/
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) {
static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP};

View file

@ -266,7 +266,7 @@ static const char *l_str2dloc (const char *s, lua_Number *result, int mode) {
** - 'n'/'N' means 'inf' or 'nan' (which should be rejected)
** - '.' just optimizes the search for the common case (nothing special)
** This function accepts both the current locale or a dot as the radix
** mark. If the convertion fails, it may mean number has a dot but
** mark. If the conversion fails, it may mean number has a dot but
** locale accepts something else. In that case, the code copies 's'
** to a buffer (because 's' is read-only), changes the dot to the
** current locale radix mark, and tries to convert again.

View file

@ -75,7 +75,7 @@ private:
* @param seed The initial value for the random engine.
* @param call_count Upon loading we need to restore the state at saving
* so set the number of times a random number is
* generated for replays the orginal value is
* generated for replays the original value is
* required.
*/
void seed_random(const uint32_t seed, const unsigned int call_count = 0);

View file

@ -85,7 +85,7 @@ map_location find_vacant_tile(const map_location& loc, VACANT_TILE_TYPE vacancy,
&& pass_check->movement_cost(map[l]) == movetype::UNREACHABLE;
//If the unit can't reach the tile and we have searched
//an area of at least radius 10 (arbitrary), skip the tile.
//Neccessary for cases such as an unreachable
//Necessary for cases such as an unreachable
//starting hex surrounded by 6 other unreachable hexes, in which case
//the algorithm would not even search distance==1
//even if there's a reachable hex for distance==2.

View file

@ -138,7 +138,7 @@ namespace { // Helpers for get_tiles_radius() without a radius filter.
/**
* Function that interprets @a collected_tiles and adds to @a result those
* whose y-coordinate satisifies row_begin <= y < row_end.
* whose y-coordinate satisfies row_begin <= y < row_end.
* When passed to this function, @a result must not be empty. (This allows
* a code simplification and is currently always the case anyway.)
*/

View file

@ -696,7 +696,7 @@ static int modulo(int num, int mod, int min)
//n is now in [0, mod)
n = n + min;
return n;
// the folowing properties are easy to verify:
// the following properties are easy to verify:
// 1) For all m: modulo(num, mod, min) == modulo(num + mod*m, mod, min)
// 2) For all 0 <= m < mod: modulo(min + m, mod, min) == min + m
}

View file

@ -42,7 +42,7 @@ public:
PROCESS_END_LINGER,
/** When we couldn't process the network data because we found a dependent command, this should only happen if we were called playmp_controller::from handle_generic_event -> sync_network*/
PROCESS_FOUND_DEPENDENT,
/** We foudn a player action in the replay that caused the game to end*/
/** We found a player action in the replay that caused the game to end*/
PROCESS_END_LEVEL
};

View file

@ -132,7 +132,7 @@ base_manager::~base_manager()
void prefs_event_handler::handle_window_event(const SDL_Event& event)
{
// Saftey check to make sure this is a window event
// Safety check to make sure this is a window event
if (event.type != SDL_WINDOWEVENT) return;
switch(event.window.event) {
@ -1086,4 +1086,3 @@ void set_damage_prediction_allow_monte_carlo_simulation(bool value)
}
} // end namespace preferences

View file

@ -838,7 +838,7 @@ REPLAY_RETURN do_replay_handle(bool one_move)
//this means user choice.
// it never makes sense to try to execute a user choice.
// but we are called from
// the only other option for "dependent" command is checksum wich is already checked.
// the only other option for "dependent" command is checksum which is already checked.
assert(cfg->all_children_count() == 1);
std::string child_name = cfg->all_children_range().front().key;
DBG_REPLAY << "got an dependent action name = " << child_name <<"\n";

View file

@ -31,7 +31,7 @@ class play_controller;
* NOTE: This class is broken and you probably shouldn't use it. Calling a save
* 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
* or there is a filesystem error. If the destructor throws exceptions, it will
* cause memory leaks and crashes.
* http://wiki.wesnoth.org/CodingStandards#Destructors_must_not_throw_exceptions
*

View file

@ -16,7 +16,7 @@
*
* A savefile can contain:
*
* - General information (toplevel atributes, [multiplayer])
* - General information (toplevel attributes, [multiplayer])
* This is present in all savefiles
*
* - [statistics]
@ -562,7 +562,7 @@ std::string saved_game::get_scenario_id()
scenario_id = carryover_["next_scenario"].str();
} else {
assert(!"cannot figure out scenario_id");
throw "assertion ingnored";
throw "assertion ignored";
}
return scenario_id == "null" ? "" : scenario_id;

View file

@ -95,7 +95,7 @@ public:
void convert_to_start_save();
/// sets the random seed if that didn't already happen.
void set_random_seed();
/// @return the starting pos for replays. Usualy this is [replay_start] but it can also be a [scenario] if no [replay_start] is present
/// @return the starting pos for replays. Usually this is [replay_start] but it can also be a [scenario] if no [replay_start] is present
const config& get_replay_starting_pos();
/// @return the id of the currently played scenario or the id of the next scenario if this is a between-scenaios-save (also called start-of-scenario-save).
std::string get_scenario_id();

View file

@ -2769,7 +2769,7 @@ static int intf_synchronize_choice(lua_State *L)
}
/**
* Ensures a value is synchronized among all the clients.
* - Arg 1: optional string the id of this type of user input, may only contain chracters a-z and '_'
* - Arg 1: optional string the id of this type of user input, may only contain characters a-z and '_'
* - Arg 2: function to compute the value, called if the client is the master.
* - Arg 3: an optional function to compute the value, if the side was null/empty controlled.
* - Arg 4: an array of integers specifying, on which side the function should be evaluated.
@ -2805,7 +2805,7 @@ static int intf_synchronize_choices(lua_State *L)
/**
* Calls a function in an unsynced context (this specially means that all random calls used by that function will be unsynced).
* This is usualy used together with an unsynced if like 'if controller != network'
* This is usually used together with an unsynced if like 'if controller != network'
* - Arg 1: function that will be called during the unsynced context.
*/
static int intf_do_unsynced(lua_State *L)

View file

@ -186,7 +186,7 @@ public:
note that we don't check for the dtor of lua owned units because we assume that
we operate on such a unit that the lua function that invoked the operation on that unit
(like wesnoth.add_modification, wesnoth.match_unit ..) have a local copy of that
lua_unit* userdata in its stack that prevents it from beeing collected.
lua_unit* userdata in its stack that prevents it from being collected.
*/
int map_locked_;
game_lua_kernel(game_state &, play_controller &, reports &);

View file

@ -758,7 +758,7 @@ bool luaW_toconfig(lua_State *L, int index, config &cfg)
if (i > 1) str << ',';
str << item;
}
// If there are any string keys, it's misformed
// If there are any string keys, it's malformed
for (lua_pushnil(L); lua_next(L, subindex); lua_pop(L, 1)) {
if (lua_type(L, -2) != LUA_TNUMBER) return_misformed();
}

View file

@ -71,7 +71,7 @@
* Circa 2012, the solution was to implement every callback function in the wesnoth
* table simply as a C function, which grabs whatever engine features it needs from
* a collection of pointers with external linkage in resources.hpp. The pointers
* must be reset by the play controller object whenver it is created or destroyed...
* must be reset by the play controller object whenever it is created or destroyed...
* or reset (replay controller), and always in a particular order because eventually
* all of the objects themselves are also grabbing these pointers, leading to segfaults
* if they are initialized in the wrong order, or left with danging pointers...

View file

@ -61,7 +61,7 @@ static std::string get_calling_file(lua_State* L)
return currentdir;
}
/// resolves @a filename to an absolute path
/// @returns true if the filename was sucessfully resolved.
/// @returns true if the filename was successfully resolved.
static bool resolve_filename(std::string& filename, std::string currentdir, std::string* rel = nullptr)
{
if(filename.size() < 2) {
@ -201,7 +201,7 @@ public:
*size = lfs->pistream_->gcount();
#if 0
ERR_LUA << "read bytes from " << startpos << " to " << newpos << " in total " *size << " from steam\n";
ERR_LUA << "streamstate beeing "
ERR_LUA << "streamstate being "
<< " goodbit:" << lfs->pistream_->good()
<< " endoffile:" << lfs->pistream_->eof()
<< " badbit:" << lfs->pistream_->bad()

View file

@ -826,7 +826,7 @@ int lua_kernel_base::impl_game_config_set(lua_State* L)
* Loads the "package" package into the Lua environment.
* This action is inherently unsafe, as Lua scripts will now be able to
* load C libraries on their own, hence granting them the same privileges
* as the Wesnoth binary itsef.
* as the Wesnoth binary itself.
*/
void lua_kernel_base::load_package()
{

View file

@ -309,7 +309,7 @@ static int impl_unit_get(lua_State *L)
if(strcmp(m, "upkeep") == 0) {
unit::upkeep_t upkeep = u.upkeep_raw();
// Need to keep these seperate in order to ensure an int value is always used if applicable.
// Need to keep these separate in order to ensure an int value is always used if applicable.
if(int* v = boost::get<int>(&upkeep)) {
lua_push(L, *v);
} else {

View file

@ -238,7 +238,7 @@ namespace lua_check_impl
else
{
luaL_argerror(L, n, "Table expected");
throw "luaL_argerror returned"; //shouldnt happen, luaL_argerror always throws.
throw "luaL_argerror returned"; //shouldn't happen, luaL_argerror always throws.
}
}

View file

@ -340,7 +340,7 @@ surface scale_surface(const surface &surf, int w, int h)
// That is, the bilin array holds the
// "geometric" weights. I.E. If I'm scaling
// a 2 x 2 block a 10 x 10 block, then for
// pixel (2,2) of ouptut, the upper left
// pixel (2,2) of output, the upper left
// pixel should be 10:1 more influential than
// the upper right, and also 10:1 more influential
// than lower left, and 100:1 more influential

View file

@ -89,7 +89,7 @@ public:
* For the most part, this seems to return the same result as @ref get_output_size. However,
* SDL indicates for high DPI displays these two functions could differ. I could not observe
* any change in behavior with DPI virtualization on or off, but to be safe, I'm keeping the
* two functions seperate and using this for matters of window resolution.
* two functions separate and using this for matters of window resolution.
*
* - vultraz, 6/27/2017
*/
@ -159,7 +159,7 @@ public:
uint32_t get_flags();
/**
* Set mimimum size of the window.
* Set minimum size of the window.
*
* This is a wrapper for @ref SDL_SetWindowMinimumWindowSize.
*/

View file

@ -38,7 +38,7 @@ static std::string at(const std::string & file, int line){
static void print_output(const std::string & message,bool flag_exception = false ){
#ifndef VALIDATION_ERRORS_LOG
if(flag_exception){
throw wml_exception("Validation error occured",message);
throw wml_exception("Validation error occurred",message);
}else{
ERR_VL << message;
}

View file

@ -119,7 +119,7 @@ private:
*/
bool read_config_file(const std::string & filename);
/**
* Shows, if validator is intialized with schema file;
* Shows, if validator is initialized with schema file;
*/
bool config_read_;
/**

View file

@ -117,7 +117,7 @@ std::vector<std::string> square_parenthetical_split(const std::string& val,
if (i1 == val.end()) return res;
if (!separator) {
ERR_GENERAL << "Separator must be specified for square bracket split funtion." << std::endl;
ERR_GENERAL << "Separator must be specified for square bracket split function." << std::endl;
return res;
}

View file

@ -174,8 +174,8 @@ void class_tag::remove_keys_by_type (const std::string & type){
* @begin{tag}{name="tag"}{min=0}{max=1}
* @begin{table}{config}
* name & string & & The name of tag. $
* min & int & & The min number of occurences. $
* max & int & & The max number of occurences. $
* min & int & & The min number of occurrences. $
* max & int & & The max number of occurrences. $
* super & string & "" & The super-tag of this tag $
* @end{table}
* @begin{tag}{name="link"}{min=0}{max=-1}

View file

@ -235,12 +235,12 @@ public:
/**
* Tags are usually organized in tree.
* This fuction helps to add tag to his exact place in tree
* This function helps to add a tag to his exact place in tree
* @param path - path in subtree to exact place of tag
* @param tag - tag to add
* @param root - root of schema tree - use to support of adding to link.
* Path is getting shotter and shoter with each call.
* Path schould look like tag1/tag2/parent/ Slash at end is mandatory.
* Path should look like tag1/tag2/parent/ Slash at end is mandatory.
*/
void add_tag (const std::string & path,const class_tag & tag,
class_tag &root);
@ -310,7 +310,7 @@ private:
* name of tag to extend "super-tag"
* Extension is smth like inheritance and is used in case
* when you need to use another tag with all his
* keys, childs, etc. But you also want to allow extra subtags of that tags,
* keys, children, etc. But you also want to allow extra subtags of that tags,
* so just linking that tag wouldn't help at all.
*/
std::string super_;

View file

@ -106,7 +106,7 @@ private:
current_ = in_.get();
} while (current_ == '\r');
#if 0
/// @todo disabled untill campaign server is fixed
/// @todo disabled until the campaign server is fixed
if(in_.good()) {
current_ = in_.get();
if (current_ == '\r')

View file

@ -77,7 +77,7 @@ typename ucs4_convert_impl::enableif<TD, typename TS::value_type>::type unicode_
}
catch(utf8::invalid_utf8_exception&)
{
// TODO: use a ERR_.. stream but i dont know whether i can so to in header easily.
// TODO: use a ERR_.. stream but I don't know whether I can do so in header easily.
std::cerr << "Failed to convert a string from " << impl_reader::get_name() << " to " << impl_writer::get_name() << "\n";
return res;
}
@ -106,7 +106,7 @@ TD unicode_cast(ucs4::char_t onechar)
}
catch(utf8::invalid_utf8_exception&)
{
// TODO: use a ERR_.. stream but i dont know whether i can so to in header easily.
// TODO: use a ERR_.. stream but I don't know whether I can do so in header easily.
std::cerr << "Failed to convert a string from " << impl_reader::get_name() << " to " << impl_writer::get_name() << "\n";
return res;
}

View file

@ -273,7 +273,7 @@ void game::perform_controller_tweaks()
user_name = username(user->socket());
}
// Issue change_controller command, transfering this side to its owner with proper name and controller.
// Issue change_controller command, transferring this side to its owner with proper name and controller.
// Ensures that what the server now thinks is true is effected on all of the clients.
//
// We use the "player_left" field as follows. Normally change_controller sends one message to the owner,
@ -572,7 +572,7 @@ void game::transfer_side_control(const socket_ptr& sock, const simple_wml::node&
// Not supported anymore.
if(newplayer_name.empty()) {
std::stringstream msg;
msg << "Recived invalid [change_controller] with no player= attribute specified";
msg << "Received invalid [change_controller] with no player= attribute specified";
DBG_GAME << msg.str() << "\n";
send_server_message(msg.str(), sock);
return;
@ -1321,7 +1321,7 @@ void game::process_change_turns_wml(simple_wml::document& data, const socket_ptr
assert(static_cast<int>(this->current_turn()) == current_turn);
description_->set_attr_dup("turn", describe_turns(current_turn, num_turns_).c_str());
// Dont send or store this change, all players should have gotten it by wml.
// Don't send or store this change, all players should have gotten it by wml.
}
bool game::end_turn()
@ -1813,15 +1813,15 @@ void game::save_replay()
const bool has_old_replay = level_.child("replay") != nullptr;
// If there is already a replay in the level_, which means this is a reloaded game,
// then we dont need to add the [start] in the replay.
// then we don't need to add the [start] in the replay.
replay_data
<< level_.output()
// This can result in having 2 [replay] at toplevel since level_ can contain one already. But the
// client can handle this (simply merges them).
<< "[replay]\n"
// The [start] is generated at the clients and not sent over the network so we add it here.
// It usualy contains some checkup data that is used to check whether the calculated results
// match the ones calculated in the replay. But thats not necessary
// It usually contains some checkup data that is used to check whether the calculated results
// match the ones calculated in the replay. But that's not necessary
<< (has_old_replay ? "" : "\t[command]\n\t\t[start]\n\t\t[/start]\n\t[/command]\n")
<< replay_commands << "[/replay]\n";

View file

@ -481,7 +481,7 @@ private:
(like controller == null) that are definitely needed by the server and
in this case we should try to modify the client to inform the server if
a change of those properties occur. Ofc we shouldn't update level_
then, but rather store that information in a seperate object
then, but rather store that information in a separate object
(like in side_controllers_).
*/
simple_wml::document level_;

View file

@ -205,7 +205,7 @@ const std::string help_msg = "Available commands are: adminmsg <msg>,"
" netstats [all], [lobby]msg <message>, motd [<message>],"
" pm|privatemsg <nickname> <message>, requests, sample, searchlog <mask>,"
" signout, stats, status [<mask>], unban <ipmask>\n"
"Specific strings (those not inbetween <> like the command names)"
"Specific strings (those not in between <> like the command names)"
" are case insensitive.";
server::server(int port, bool keep_alive, const std::string& config_file, size_t /*min_threads*/,
@ -467,7 +467,7 @@ void server::load_config() {
// If there is a [user_handler] tag in the config file
// allow nick registration, otherwise we set user_handler_
// to nullptr. Thus we must check user_handler_ for not being
// nullptr everytime we want to use it.
// nullptr every time we want to use it.
user_handler_.reset();
if (const config &user_handler = cfg_.child("user_handler")) {
@ -1071,7 +1071,7 @@ void server::handle_nickserv(socket_ptr socket, simple_wml::node& nickserv)
}
// With the current policy of dissallowing to log in with a
// registerd username without the password we should never get
// registered username without the password we should never get
// to call this
if(!(player_connections_.find(socket)->info().registered())) {
send_server_message(socket, "You are not logged in.");
@ -1352,7 +1352,7 @@ void server::handle_player_in_game(socket_ptr socket, std::shared_ptr<simple_wml
send_to_lobby(diff);
/** @todo FIXME: Why not save the level data in the history_? */
return;
// Everything below should only be processed if the game is already intialized.
// Everything below should only be processed if the game is already initialized.
} else if (!g.level_init()) {
WRN_SERVER << client_address(socket) << "\tReceived unknown data from: "
<< player.name() << " (socket:" << socket

View file

@ -80,7 +80,7 @@ private:
};
public:
// nonempty return is an error mesage
// nonempty return is an error message
std::string parse_header(const std::string & header) {
const char * const default_charset = SPIRIT_PO_DEFAULT_CHARSET;
#undef SPIRIT_PO_DEFAULT_CHARSET

View file

@ -14,7 +14,7 @@ index a9b154d..271d080 100644
+++ b/src/spirit_po/catalog.hpp
@@ -49,7 +49,7 @@ class catalog {
hashmap_type hashmap_;
public:
- static constexpr char EOT = static_cast<char>(4);
+ static const char EOT = '\x4';
@ -27,13 +27,12 @@ index 1ff2439..d2f02c0 100644
+++ b/src/spirit_po/catalog_metadata.hpp
@@ -82,7 +82,7 @@ private:
public:
// nonempty return is an error mesage
// nonempty return is an error message
std::string parse_header(const std::string & header) {
- constexpr const char * default_charset = DEFAULT_CHARSET;
+ const char * default_charset = DEFAULT_CHARSET;
#undef DEFAULT_CHARSET
project_id = find_header_line(header, "Project-Id-Version:");
--
2.10.1.windows.1
project_id = find_header_line(header, "Project-Id-Version:");
--
2.10.1.windows.1

View file

@ -17,7 +17,7 @@
class config;
/**
A class to check whether the results that were calculated in the replay match the results calculated during the original game.
note, that you shouldn't add new checkups to existent user actions or you might break replay compability by bringing the [checkups] tag of older saves in unorder.
note, that you shouldn't add new checkups to existent user actions or you might break replay compatibility by bringing the [checkups] tag of older saves in unorder.
so if you really want to add new checkups, you should wrap your checkup_instance->... call in a if(resources::state_of_game->classification.version ....) or similar.
*/

View file

@ -75,7 +75,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(recruit, child, use_undo, show, error_handler)
if ( !from.valid() ) {
// This will be the case for AI recruits in replays saved
// before 1.11.2, so it is not more severe than a warning.
// EDIT: we broke compability with 1.11.2 anyway so we should give an error.
// EDIT: we broke compatibility with 1.11.2 anyway so we should give an error.
error_handler("Missing leader location for recruitment.\n", false);
}
else if ( resources::gameboard->units().find(from) == resources::gameboard->units().end() ) {
@ -140,7 +140,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(recall, child, use_undo, show, error_handler)
if ( !actions::recall_unit(unit_id, current_team, loc, from, map_location::NDIRECTIONS, show, use_undo) ) {
error_handler("illegal recall: unit_id '" + unit_id + "' could not be found within the recall list.\n", true);
//when recall_unit returned false nothing happend so we can safety return false;
//when recall_unit returned false nothing happened so we can safety return false;
return false;
}
return true;
@ -333,7 +333,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(fire_event, child, use_undo, /*show*/, /*error_
undoable = undoable & !std::get<0>(resources::game_events->pump().fire(event_name));
}
// Not clearing the undo stack here casues OOS because we added an entry to the replay but no entry to the undo stack.
// Not clearing the undo stack here causes OOS because we added an entry to the replay but no entry to the undo stack.
if(use_undo) {
if(!undoable) {
resources::undo_stack->clear();

View file

@ -32,7 +32,7 @@ class synced_command {
*/
typedef std::function<void(const std::string&, bool)> error_handler_function;
/*
returns: true if the action succeeded correclty,
returns: true if the action succeeded correctly,
*/
typedef bool (*handler)(const config &, bool use_undo, bool show, error_handler_function error_handler);

View file

@ -122,7 +122,7 @@ bool synced_context::run_in_synced_context_if_not_already(const std::string& com
}
case(synced_context::LOCAL_CHOICE):
ERR_REPLAY << "trying to execute action while being in a local_choice" << std::endl;
//we reject it because such actions usually change the gamestate badly which is not intented during a local_choice.
//we reject it because such actions usually change the gamestate badly which is not intended during a local_choice.
//Also we cannot invoke synced commands here, because multiple clients might run local choices
//simultaniously so it could result in invoking different synced commands simultaniously.
return false;
@ -280,7 +280,7 @@ void synced_context::server_choice::send_request() const
config synced_context::ask_server_choice(const server_choice& sch)
{
if (!is_synced()) {
ERR_REPLAY << "Trying to ask the server for a '" << sch.name() << "' choice in a unsynced context, doing the choice locally. This can casue OOS.\n";
ERR_REPLAY << "Trying to ask the server for a '" << sch.name() << "' choice in a unsynced context, doing the choice locally. This can cause OOS.\n";
return sch.local_choice();
}
set_is_simultaneously();
@ -423,7 +423,7 @@ checkup* set_scontext_synced::generate_checkup(const std::string& tagname)
}
/*
so we dont have to write the same code 3 times.
so we don't have to write the same code 3 times.
*/
void set_scontext_synced::init()
{

View file

@ -44,13 +44,13 @@ public:
however, if you cannot call this function you can also use set_scontext_synced directly (use it like it's used in this method).
movement commands are currently treated specially,
thats because actions::move_unit returns a value and some function use that value.
that's because actions::move_unit returns a value and some function use that value.
maybe i should add a way here to return a value.
ai's attacks are also treated special because the ai wants to pass advancement_aspects.
redoing does normaly not take place in a synced context, because we saved the dependent=true replaycommands in the replaystack data.
redoing does normally not take place in a synced context, because we saved the dependent=true replaycommands in the replaystack data.
also there are no events of similar fired when redoing an action (in most cases).
@param use_undo this parameter is used to ignore undos during an ai move to optimize.
@ -192,14 +192,14 @@ class set_scontext_synced : set_scontext_synced_base
public:
set_scontext_synced();
/*
use this contructor if you have multiple synced_context but only one replay entry.
use this constructor if you have multiple synced_context but only one replay entry.
*/
set_scontext_synced(int num);
~set_scontext_synced();
int get_random_calls();
void do_final_checkup(bool dont_throw = false);
private:
//only called by contructors.
//only called by constructors.
void init();
static checkup* generate_checkup(const std::string& tagname);
checkup* old_checkup_;

View file

@ -213,7 +213,7 @@ config mp_sync::get_user_choice(const std::string &name, const mp_sync::user_cho
std::map<int, config> retv = user_choice_manager::get_user_choice_internal(name, uch, sides);
if(retv.find(side) == retv.end())
{
//An error occured, get_user_choice_internal should have given an oos error message
//An error occurred, get_user_choice_internal should have given an oos error message
return config();
}
return retv[side];
@ -309,7 +309,7 @@ void user_choice_manager::update_local_choice()
std::string sides_str;
for(int side : required_)
{
//and we havent already received our answer from that side
//and we haven't already received our answer from that side
if(res_.find(side) == res_.end())
{
sides_str += " ";
@ -340,7 +340,7 @@ void user_choice_manager::ask_local_choice()
config cfg = uch_.query_user(local_choice_);
if(res_.find(local_choice_) != res_.end()) {
// It might be possible that we this choice was already made by another client while we were in uch_.query_user
// becase our side might be ressigned while we made our choice.
// because our side might be ressigned while we made our choice.
WRN_REPLAY << "Discarding a local choice because we found it already on the replay";
return;
}
@ -348,7 +348,7 @@ void user_choice_manager::ask_local_choice()
res_[local_choice_] = cfg;
//send data to others.
//but if there wasn't any data sent during this turn, we don't want to bein wth that now.
//but if there wasn't any data sent during this turn, we don't want to begin with that now.
//TODO: we should send user choices during nonundoable actions immideatley.
if(synced_context::is_simultaneously() || current_side_ != local_choice_)
{
@ -380,7 +380,7 @@ static void wait_ingame(user_choice_manager& man)
if(resources::gamedata->phase() == game_data::PLAY || resources::gamedata->phase() == game_data::START)
{
//during the prestart/preload event the screen is locked and we shouldn't call user_interact.
//because that might result in crashs if someone clicks anywhere during screenlock.
//because that might result in crashes if someone clicks anywhere during screenlock.
// calls man.pull via events.cpp -> pump_monitor::process
resources::controller->play_slice();
@ -430,5 +430,3 @@ void user_choice_manager::process(events::pump_info&)
pull();
}
}

View file

@ -62,8 +62,8 @@ struct user_choice
config get_user_choice(const std::string &name, const user_choice &uch,
int side = 0);
/**
* Performs a choice for mutiple sides for WML events.
* uch is called on all sides specified in sides, this in done simultaneously on all those sides (or one after another if one client controlls mutiple sides)
* Performs a choice for multiple sides for WML events.
* uch is called on all sides specified in sides, this in done simultaneously on all those sides (or one after another if one client controls multiple sides)
* and after all calls are executed the results are returned.
*/
std::map<int, config> get_user_choice_multiple_sides(const std::string &name, const user_choice &uch,

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