Skip to content

Commit

Permalink
codespell fixes to /src
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr authored and Vultraz committed Feb 8, 2018
1 parent 17738ba commit a2168d2
Show file tree
Hide file tree
Showing 130 changed files with 205 additions and 214 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion src/SDL_SavePNG/README.md
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/actions/move.cpp
Expand Up @@ -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) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/move.hpp
Expand Up @@ -95,7 +95,7 @@ class move_unit_spectator {
/**
* 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);

Expand Down
4 changes: 2 additions & 2 deletions src/actions/undo.cpp
Expand Up @@ -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_);
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/actions/undo_action.hpp
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/ai/actions.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/ai/composite/goal.cpp
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/carryover.cpp
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/color.hpp
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/commandline_options.hpp
Expand Up @@ -147,9 +147,9 @@ friend std::ostream& operator<<(std::ostream &os, const commandline_options& cmd
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;
Expand Down Expand Up @@ -191,7 +191,7 @@ friend std::ostream& operator<<(std::ostream &os, const commandline_options& cmd
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;
Expand Down
6 changes: 3 additions & 3 deletions src/config.cpp
Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/config_attribute_value.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/display.cpp
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/editor/palette/location_palette.cpp
Expand Up @@ -72,7 +72,7 @@ class location_palette_item : public gui::widget
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'.
Expand Down Expand Up @@ -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);
}
}));
Expand Down
2 changes: 1 addition & 1 deletion src/editor/palette/location_palette.hpp
Expand Up @@ -100,7 +100,7 @@ class location_palette : public common_palette {
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:
Expand Down
2 changes: 1 addition & 1 deletion src/font/text.cpp
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/font/text.hpp
Expand Up @@ -385,7 +385,7 @@ class pango_text
* 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.
*
Expand Down
2 changes: 1 addition & 1 deletion src/font/text_formatting.hpp
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/formula/tokenizer.hpp
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/game_config_manager.hpp
Expand Up @@ -31,9 +31,9 @@ class game_config_manager
{
/// 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,
};

Expand Down
7 changes: 3 additions & 4 deletions src/game_events/action_wml.cpp
Expand Up @@ -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(),
Expand Down Expand Up @@ -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 + ")?";
Expand Down Expand Up @@ -971,4 +971,3 @@ WML_HANDLER_FUNCTION(on_undo, event_info, cfg)
}

} // end namespace game_events

2 changes: 1 addition & 1 deletion src/game_events/menu_item.hpp
Expand Up @@ -179,7 +179,7 @@ class wml_menu_item
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_;
Expand Down
2 changes: 1 addition & 1 deletion src/game_events/wmi_manager.hpp
Expand Up @@ -64,7 +64,7 @@ class wmi_manager
* 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;

Expand Down
2 changes: 1 addition & 1 deletion src/game_initialization/configure_engine.hpp
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/game_initialization/connect_engine.cpp
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/game_initialization/connect_engine.hpp
Expand Up @@ -264,8 +264,8 @@ class side_engine
// 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_;
Expand Down
2 changes: 1 addition & 1 deletion src/game_initialization/depcheck.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/game_initialization/playcampaign.cpp
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/game_state.cpp
Expand Up @@ -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);

{
Expand Down

0 comments on commit a2168d2

Please sign in to comment.