diff --git a/src/ai/default/recruitment.cpp b/src/ai/default/recruitment.cpp index ba32e32cc43e..4677631267fe 100644 --- a/src/ai/default/recruitment.cpp +++ b/src/ai/default/recruitment.cpp @@ -655,7 +655,7 @@ void recruitment::compare_cost_maps_and_update_important_hexes( MAP_BORDER_THICKNESS * average_local_cost_[loc]) { double border_movecost = (my_cost_average + enemy_cost_average) / 2; important_hexes_candidates[loc] = border_movecost; - + if (border_movecost < smallest_border_movecost) { smallest_border_movecost = border_movecost; } diff --git a/src/ai/lua/lua_object.hpp b/src/ai/lua/lua_object.hpp index 1e69fd9b7725..c0db1e91370e 100644 --- a/src/ai/lua/lua_object.hpp +++ b/src/ai/lua/lua_object.hpp @@ -60,7 +60,7 @@ class lua_object : public lua_object_base { // empty } - + lua_object(const T& init) : value_(std::make_shared(init)) { @@ -76,7 +76,7 @@ class lua_object : public lua_object_base { this->value_ = to_type(L, lua_absindex(L, n)); } - + void push(lua_State* L) { from_type(L, this->value_); @@ -89,7 +89,7 @@ class lua_object : public lua_object_base { return std::shared_ptr(); } - + // A group of functions that deal with the translations of values back to Lua void from_type(lua_State* L, std::shared_ptr) { diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 5ddadea8c3d4..b5994ae2e93f 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -869,7 +869,7 @@ std::vector find_other_version_saves_dirs() #elif defined(__APPLE__) path = get_user_data_path().parent_path() / ("Wesnoth_" + suffix) / "saves"; #endif - + if(bfs::exists(path)) { result.emplace_back(suffix, path.string()); } diff --git a/src/formula/function_gamestate.cpp b/src/formula/function_gamestate.cpp index 499d7afee451..6cba085f154d 100644 --- a/src/formula/function_gamestate.cpp +++ b/src/formula/function_gamestate.cpp @@ -110,10 +110,10 @@ DEFINE_WFL_FUNCTION(defense_on, 2, 2) auto u_call = u.try_convert(); auto u_type = u.try_convert(); - + const auto& tdata = resources::gameboard->map().tdata(); t_translation::terrain_code ter; - + if(loc_var.is_string()) { ter = t_translation::read_terrain_code(loc_var.as_string()); } else if(auto tc = loc_var.try_convert()) { @@ -159,10 +159,10 @@ DEFINE_WFL_FUNCTION(chance_to_hit, 2, 2) auto u_call = u.try_convert(); auto u_type = u.try_convert(); - + const auto& tdata = resources::gameboard->map().tdata(); t_translation::terrain_code ter; - + if(loc_var.is_string()) { ter = t_translation::read_terrain_code(loc_var.as_string()); } else if(auto tc = loc_var.try_convert()) { @@ -208,10 +208,10 @@ DEFINE_WFL_FUNCTION(movement_cost, 2, 2) //we can pass to this function either unit_callable or unit_type callable auto u_call = u.try_convert(); auto u_type = u.try_convert(); - + const auto& tdata = resources::gameboard->map().tdata(); t_translation::terrain_code ter; - + if(loc_var.is_string()) { ter = t_translation::read_terrain_code(loc_var.as_string()); } else if(auto tc = loc_var.try_convert()) { @@ -257,10 +257,10 @@ DEFINE_WFL_FUNCTION(vision_cost, 2, 2) //we can pass to this function either unit_callable or unit_type callable auto u_call = u.try_convert(); auto u_type = u.try_convert(); - + const auto& tdata = resources::gameboard->map().tdata(); t_translation::terrain_code ter; - + if(loc_var.is_string()) { ter = t_translation::read_terrain_code(loc_var.as_string()); } else if(auto tc = loc_var.try_convert()) { @@ -306,10 +306,10 @@ DEFINE_WFL_FUNCTION(jamming_cost, 2, 2) //we can pass to this function either unit_callable or unit_type callable auto u_call = u.try_convert(); auto u_type = u.try_convert(); - + const auto& tdata = resources::gameboard->map().tdata(); t_translation::terrain_code ter; - + if(loc_var.is_string()) { ter = t_translation::read_terrain_code(loc_var.as_string()); } else if(auto tc = loc_var.try_convert()) { diff --git a/src/game_config_manager.cpp b/src/game_config_manager.cpp index a0f4481aa7e6..8c9c1d8dc02b 100644 --- a/src/game_config_manager.cpp +++ b/src/game_config_manager.cpp @@ -149,8 +149,8 @@ void game_config_manager::load_game_config_with_loadscreen(FORCE_RELOAD_CONFIG f out << "\n Everything:"; } out << "\n"; - } - + } + game_config::scoped_preproc_define debug_mode("DEBUG_MODE", game_config::debug || game_config::mp_debug); @@ -512,7 +512,7 @@ void game_config_manager::load_addons_cfg() {1, 17, 0}, _("Use [modify_unit_type]\n") + modify_unit_type.debug() + "\n [/modify_unit_type] instead in [campaign]" ); - + advancefroms.add_child("modify_unit_type", modify_unit_type); } unit_type.remove_children("advancefrom", [](const config&){return true;}); @@ -726,7 +726,7 @@ void game_config_manager::set_enabled_addon(std::set addon_ids) } void game_config_manager::set_enabled_addon_all() { - + auto& vec = game_config_view_.data(); vec.clear(); vec.push_back(game_config_); diff --git a/src/game_config_manager.hpp b/src/game_config_manager.hpp index dd8fc44f989e..132384ecb45d 100644 --- a/src/game_config_manager.hpp +++ b/src/game_config_manager.hpp @@ -78,7 +78,7 @@ class game_config_manager std::map addon_cfgs_; boost::optional> active_addons_; - + preproc_map old_defines_map_; filesystem::binary_paths_manager paths_manager_; diff --git a/src/game_config_view.hpp b/src/game_config_view.hpp index 8cf7a2f3e102..ec0031b2fe46 100644 --- a/src/game_config_view.hpp +++ b/src/game_config_view.hpp @@ -44,7 +44,7 @@ class game_config_view game_config_view merged_children_view(config_key_type key) const; - + config_array_view& data() { return cfgs_; diff --git a/src/game_initialization/mp_game_utils.cpp b/src/game_initialization/mp_game_utils.cpp index 2d9378c91463..0d4e4f2ff49e 100644 --- a/src/game_initialization/mp_game_utils.cpp +++ b/src/game_initialization/mp_game_utils.cpp @@ -47,7 +47,7 @@ static void add_multiplayer_classification(config& multiplayer, saved_game& stat multiplayer["mp_campaign_name"] = state.classification().campaign_name; multiplayer["mp_era"] = state.classification().era_id; multiplayer["active_mods"] = utils::join(state.classification().active_mods, ","); - + } config initial_level_config(saved_game& state) diff --git a/src/gui/dialogs/server_info_dialog.cpp b/src/gui/dialogs/server_info_dialog.cpp index c60eac14346a..a21c0a55eb86 100644 --- a/src/gui/dialogs/server_info_dialog.cpp +++ b/src/gui/dialogs/server_info_dialog.cpp @@ -32,7 +32,7 @@ server_info::server_info(const std::string& info, const std::string& announcemen : server_information_(info) , announcements_(announcements) { - + } void server_info::pre_show(window& window) diff --git a/src/gui/widgets/generator.cpp b/src/gui/widgets/generator.cpp index 083e95ee22a6..5a5c308e18f6 100644 --- a/src/gui/widgets/generator.cpp +++ b/src/gui/widgets/generator.cpp @@ -1027,7 +1027,7 @@ namespace select_action void selection::select(grid& grid, const bool select) { selectable_item* selectable = dynamic_cast(grid.get_widget(0, 0)); - //the check in selection::init is not strict enouth to guaranetee this. + //the check in selection::init is not strict enouth to guaranetee this. VALIDATE(selectable, "Only toggle buttons and panels are allowed as the cells of a list definition."); selectable->set_value(select); diff --git a/src/save_index.cpp b/src/save_index.cpp index 054af5b38f85..83985fa69fe9 100644 --- a/src/save_index.cpp +++ b/src/save_index.cpp @@ -277,7 +277,7 @@ bool save_info_less_time::operator()(const save_info& a, const save_info& b) con } } -static filesystem::scoped_istream find_save_file(const std::string& dir, +static filesystem::scoped_istream find_save_file(const std::string& dir, const std::string& name, const std::vector& suffixes) { for(const std::string& suf : suffixes) { diff --git a/src/saved_game.cpp b/src/saved_game.cpp index 5f93e261c414..a36fc1f07ebf 100644 --- a/src/saved_game.cpp +++ b/src/saved_game.cpp @@ -229,7 +229,7 @@ void saved_game::set_defaults() bool require_campaign = campaign["require_campaign"].to_bool(true); starting_point_["require_scenario"] = require_campaign; } - + for(config& side : starting_point_.child_range("side")) { // Set save_id default value directly after loading to its default to prevent different default behaviour in // mp_connect code and sp code. @@ -470,7 +470,7 @@ void saved_game::expand_map_file(config& scenario) else { //we have an plain map_data file scenario["map_data"]= map_data; - } + } } } diff --git a/src/scripting/game_lua_kernel.cpp b/src/scripting/game_lua_kernel.cpp index b348363c0986..82e514aa052f 100644 --- a/src/scripting/game_lua_kernel.cpp +++ b/src/scripting/game_lua_kernel.cpp @@ -2415,7 +2415,7 @@ static int intf_unit_resistance(lua_State *L) char const *m = luaL_checkstring(L, 2); bool a = false; map_location loc = u.get_location(); - + if(lua_isboolean(L, 3)) { a = luaW_toboolean(L, 3); if(!lua_isnoneornil(L, 4)) { @@ -4294,7 +4294,7 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports } lua_setglobal(L, "wesnoth"); - + lua_getglobal(L, "gui"); lua_pushcfunction(L, &dispatch<&game_lua_kernel::intf_gamestate_inspector>); lua_setfield(L, -2, "show_inspector"); @@ -4337,13 +4337,13 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports lua_setmetatable(L, -2); lua_setfield(L, -2, "current"); lua_pop(L, 1); - + // Add tovconfig to the WML module lua_getglobal(L, "wml"); lua_pushcfunction(L, &lua_common::intf_tovconfig); lua_setfield(L, -2, "tovconfig"); lua_pop(L, 1); - + // Create the units module cmd_log_ << "Adding units module...\n"; static luaL_Reg const unit_callbacks[] { @@ -4356,14 +4356,14 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports {"to_map", &dispatch<&game_lua_kernel::intf_put_unit>}, {"to_recall", &dispatch<&game_lua_kernel::intf_put_recall_unit>}, {"transform", &intf_transform_unit}, - + {"ability", &dispatch<&game_lua_kernel::intf_unit_ability>}, {"defense_on", &intf_unit_defense}, {"jamming_on", &intf_unit_jamming_cost}, {"movement_on", &intf_unit_movement_cost}, {"resistance_against", intf_unit_resistance}, {"vision_on", &intf_unit_vision_cost}, - + {"add_modification", &intf_add_modification}, {"remove_modifications", &intf_remove_modifications}, // Static functions @@ -4379,7 +4379,7 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports luaL_setfuncs(L, unit_callbacks, 0); lua_setfield(L, -2, "units"); lua_pop(L, 1); - + // Create sides module cmd_log_ << "Adding sides module...\n"; static luaL_Reg const side_callbacks[] { @@ -4400,14 +4400,14 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports {"change_ai_component", std::bind(intf_modify_ai, _1, "change")}, {nullptr, nullptr} }; - + lua_getglobal(L, "wesnoth"); lua_newtable(L); luaL_setfuncs(L, side_callbacks, 0); lua_cpp::set_functions(L, cpp_side_callbacks); lua_setfield(L, -2, "sides"); lua_pop(L, 1); - + // Create the interface module cmd_log_ << "Adding interface module...\n"; static luaL_Reg const intf_callbacks[] { @@ -4864,7 +4864,7 @@ bool game_lua_kernel::run_filter(char const *name, const map_location& l) */ bool game_lua_kernel::run_filter(char const *name, const team& t) { - //TODO: instead of passing the lua team object we coudl also jsut pass its + //TODO: instead of passing the lua team object we coudl also jsut pass its // number. then we wouldn't need this const cast. luaW_pushteam(mState, const_cast(t)); return run_filter(name, 1); diff --git a/src/scripting/lua_common.cpp b/src/scripting/lua_common.cpp index d539faa99771..b08565ab56b0 100644 --- a/src/scripting/lua_common.cpp +++ b/src/scripting/lua_common.cpp @@ -442,7 +442,7 @@ std::string register_tstring_metatable(lua_State *L) { nullptr, nullptr } }; luaL_setfuncs(L, callbacks, 0); - + lua_createtable(L, 0, 1); luaW_getglobal(L, "string", "format"); lua_setfield(L, -2, "format"); diff --git a/src/scripting/lua_kernel_base.cpp b/src/scripting/lua_kernel_base.cpp index f4cbeeac7626..5d26c98236ee 100644 --- a/src/scripting/lua_kernel_base.cpp +++ b/src/scripting/lua_kernel_base.cpp @@ -425,7 +425,7 @@ lua_kernel_base::lua_kernel_base() lua_setfield(L, -3, function); } lua_pop(L, 1); - + // Delete dofile and loadfile. lua_pushnil(L); lua_setglobal(L, "dofile"); diff --git a/src/scripting/lua_ptr.hpp b/src/scripting/lua_ptr.hpp index 6996b00d4ad7..7d0431afc39e 100644 --- a/src/scripting/lua_ptr.hpp +++ b/src/scripting/lua_ptr.hpp @@ -33,7 +33,7 @@ class lua_ptr { public: lua_ptr(enable_lua_ptr& o) : self_(o.self_) { } - T* get_ptr() + T* get_ptr() { if(auto pp = self_.lock()) { return *pp; diff --git a/src/scripting/lua_stringx.cpp b/src/scripting/lua_stringx.cpp index 80c3e8fa0566..ad6a48982397 100644 --- a/src/scripting/lua_stringx.cpp +++ b/src/scripting/lua_stringx.cpp @@ -352,7 +352,7 @@ int luaW_open(lua_State* L) { lua_getglobal(L, "string"); lua_setfield(L, -2, "__index"); lua_setmetatable(L, -2); - + // Set the metatable of strings to index the stringx module instead of the string module lua_pushliteral(L, ""); lua_getmetatable(L, -1); @@ -360,7 +360,7 @@ int luaW_open(lua_State* L) { lua_setfield(L, -2, "__index"); lua_setmetatable(L, -2); lua_pop(L, 1); - + // Override string.format so it can accept a t_string lua_getglobal(L, "string"); lua_getfield(L, -1, "format"); diff --git a/src/scripting/lua_team.cpp b/src/scripting/lua_team.cpp index ed7040f95604..5fab3d07215f 100644 --- a/src/scripting/lua_team.cpp +++ b/src/scripting/lua_team.cpp @@ -260,7 +260,7 @@ static int impl_side_variables_get(lua_State *L) } lua_rawgeti(L, 1, 1); const team& side = luaW_checkteam(L, -1); - + char const *m = luaL_checkstring(L, 2); return_cfgref_attrib("__cfg", side.variables()); @@ -281,7 +281,7 @@ static int impl_side_variables_set(lua_State *L) } lua_rawgeti(L, 1, 1); team& side = luaW_checkteam(L, -1); - + char const *m = luaL_checkstring(L, 2); if(strcmp(m, "__cfg") == 0) { side.variables() = luaW_checkconfig(L, 3); @@ -307,7 +307,7 @@ namespace lua_team { std::ostringstream cmd_out; cmd_out << "Adding getside metatable...\n"; - + luaL_newmetatable(L, Team); static luaL_Reg const callbacks[] { @@ -332,7 +332,7 @@ namespace lua_team { lua_setfield(L, -2, "__newindex"); lua_pushstring(L, "side variables"); lua_setfield(L, -2, "__metatable"); - + return cmd_out.str(); } } diff --git a/src/scripting/lua_widget_attributes.cpp b/src/scripting/lua_widget_attributes.cpp index 4e26c9fab8d5..c26b3ca1879f 100644 --- a/src/scripting/lua_widget_attributes.cpp +++ b/src/scripting/lua_widget_attributes.cpp @@ -479,12 +479,12 @@ int impl_widget_get(lua_State* L) { gui2::widget& w = luaW_checkwidget(L, 1); if(lua_isinteger(L, 2)) { - + if(auto pwidget = find_child_by_index(w, luaL_checkinteger(L, 2))) { luaW_pushwidget(L, *pwidget); return 1; } - + } utils::string_view str = lua_check(L, 2); diff --git a/src/scripting/lua_widget_methods.cpp b/src/scripting/lua_widget_methods.cpp index 4888caacf84e..4e60b1784403 100644 --- a/src/scripting/lua_widget_methods.cpp +++ b/src/scripting/lua_widget_methods.cpp @@ -386,7 +386,7 @@ static int intf_add_item_of_type(lua_State* L) */ static int intf_add_dialog_item(lua_State* L) { - + gui2::widget* w = &luaW_checkwidget(L, 1); gui2::widget* res = nullptr; static const std::map data; diff --git a/src/server/campaignd/server.cpp b/src/server/campaignd/server.cpp index 1bfce75434a0..a041d067a7fb 100644 --- a/src/server/campaignd/server.cpp +++ b/src/server/campaignd/server.cpp @@ -674,17 +674,17 @@ void server::handle_request_campaign(const server::request& req) send_error("Add-on '" + req.cfg["name"].str() + "' not found.", req.sock); return; } - + const int size = filesystem::file_size(campaign["filename"]); if(size < 0) { send_error("Add-on '" + req.cfg["name"].str() + "' could not be read by the server.", req.sock); return; } - + LOG_CS << "sending campaign '" << req.cfg["name"] << "' to " << req.addr << " size: " << size/1024 << "KiB\n"; async_send_file(req.sock, campaign["filename"], std::bind(&server::handle_new_client, this, _1), null_handler); - + // Clients doing upgrades or some other specific thing shouldn't bump // the downloads count. Default to true for compatibility with old // clients that won't tell us what they are trying to do. diff --git a/src/server/common/dbconn.hpp b/src/server/common/dbconn.hpp index b2e2646b698b..02a6e6e41722 100644 --- a/src/server/common/dbconn.hpp +++ b/src/server/common/dbconn.hpp @@ -45,7 +45,7 @@ class dbconn void insert_game_player_info(const std::string& uuid, int game_id, const std::string& username, int side_number, int is_host, const std::string& faction, const std::string& version, const std::string& source, const std::string& current_user); void insert_modification_info(const std::string& uuid, int game_id, const std::string& modification_name, const std::string& modification_source, const std::string& modification_version); void set_oos_flag(const std::string& uuid, int game_id); - + private: mariadb::account_ref account_; mariadb::connection_ref connection_; diff --git a/src/server/common/resultsets/ban_check.hpp b/src/server/common/resultsets/ban_check.hpp index ba89365f3eb4..5bba0e66bff7 100644 --- a/src/server/common/resultsets/ban_check.hpp +++ b/src/server/common/resultsets/ban_check.hpp @@ -26,7 +26,7 @@ class ban_check : public rs_base int get_ban_duration(); int get_user_id(); std::string get_email(); - + private: long ban_type; int ban_duration; diff --git a/src/server/common/resultsets/tournaments.hpp b/src/server/common/resultsets/tournaments.hpp index d71a920339b6..a0eefc5be932 100644 --- a/src/server/common/resultsets/tournaments.hpp +++ b/src/server/common/resultsets/tournaments.hpp @@ -31,7 +31,7 @@ class tournaments : public rs_base public: void read(mariadb::result_set_ref rslt); std::string str(); - + private: std::vector rows; }; diff --git a/src/server/wesnothd/server.hpp b/src/server/wesnothd/server.hpp index 42c0ef0734e0..cffc3bb3769c 100644 --- a/src/server/wesnothd/server.hpp +++ b/src/server/wesnothd/server.hpp @@ -125,7 +125,7 @@ class server : public server_base #endif std::string uuid_; - + const std::string config_file_; config cfg_; diff --git a/src/side_filter.cpp b/src/side_filter.cpp index e0d05e71ae09..413d07b14022 100644 --- a/src/side_filter.cpp +++ b/src/side_filter.cpp @@ -253,7 +253,7 @@ bool side_filter::match_internal(const team &t) const } } } - + return true; } diff --git a/src/tod_manager.cpp b/src/tod_manager.cpp index e9ae373d6754..c3417e8e732f 100644 --- a/src/tod_manager.cpp +++ b/src/tod_manager.cpp @@ -314,7 +314,7 @@ void tod_manager::replace_local_schedule(const std::vector& schedul if(area.times.empty() || schedule.empty()) { //If one of those is empty then their 'prievious' time of day might depend on other areas_, - //its better to just assume the illimination has changes than to do the explicit computation. + //its better to just assume the illimination has changes than to do the explicit computation. has_tod_bonus_changed_ = true; } else if(area.times[area.currentTime].lawful_bonus != schedule.front().lawful_bonus) @@ -326,7 +326,7 @@ void tod_manager::replace_local_schedule(const std::vector& schedul area.currentTime = 0; } -void tod_manager::set_area_id(int area_index, const std::string& id) +void tod_manager::set_area_id(int area_index, const std::string& id) { assert(area_index < static_cast(areas_.size())); areas_[area_index].id = id; diff --git a/src/units/filter.cpp b/src/units/filter.cpp index 909407f81b3a..41f395001bcd 100644 --- a/src/units/filter.cpp +++ b/src/units/filter.cpp @@ -433,7 +433,7 @@ void unit_filter_compound::fill(vconfig cfg) return gender == args.u.gender(); } ); - + create_attribute(literal["upkeep"], [](const config::attribute_value& c) -> unit::upkeep_t { diff --git a/src/utils/math.hpp b/src/utils/math.hpp index c59ee13384e3..0c1efaca02ad 100644 --- a/src/utils/math.hpp +++ b/src/utils/math.hpp @@ -54,7 +54,7 @@ inline int bounded_add(int base, int increment, int max_sum, int min_sum = 0) } -/** +/** * @returns: the number n in [min, min+mod ) so that (n - num) is a multiple of mod. */ template diff --git a/src/variable.cpp b/src/variable.cpp index b2d0f5f548ec..b0c40b95a356 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -49,7 +49,7 @@ namespace return as_nonempty_range_default.child_range("_"); } - + struct : public variable_set { config::attribute_value get_variable_const(const std::string&) const override diff --git a/src/video.cpp b/src/video.cpp index bd93181c29cc..c631ff05a38f 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -417,10 +417,10 @@ std::pair CVideo::get_dpi() const // For more info see issue: https://github.com/wesnoth/wesnoth/issues/5019 SDL_version sdl_version; SDL_GetVersion(&sdl_version); - + const version_info sdl_version_info(sdl_version.major, sdl_version.minor, sdl_version.patch); const version_info version_to_compare(2, 0, 12); - + if (sdl_version_info >= version_to_compare) { float scale_factor = desktop::apple::get_scale_factor(window->get_display_index()); hdpi /= scale_factor;