Skip to content

Commit

Permalink
Removed trailing tabs and whitespaces from C++ source
Browse files Browse the repository at this point in the history
[ci skip]

I ran the same command from 9b7b175.

Excludes:
* lua/
* spirit_po/
  • Loading branch information
Vultraz committed Oct 9, 2020
1 parent 5a24414 commit 6b89bf8
Show file tree
Hide file tree
Showing 31 changed files with 64 additions and 64 deletions.
2 changes: 1 addition & 1 deletion src/ai/default/recruitment.cpp
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/ai/lua/lua_object.hpp
Expand Up @@ -60,7 +60,7 @@ class lua_object : public lua_object_base
{
// empty
}

lua_object(const T& init)
: value_(std::make_shared<T>(init))
{
Expand All @@ -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_);
Expand All @@ -89,7 +89,7 @@ class lua_object : public lua_object_base
{
return std::shared_ptr<T>();
}

// A group of functions that deal with the translations of values back to Lua
void from_type(lua_State* L, std::shared_ptr<T>)
{
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem.cpp
Expand Up @@ -869,7 +869,7 @@ std::vector<other_version_dir> 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());
}
Expand Down
20 changes: 10 additions & 10 deletions src/formula/function_gamestate.cpp
Expand Up @@ -110,10 +110,10 @@ DEFINE_WFL_FUNCTION(defense_on, 2, 2)

auto u_call = u.try_convert<unit_callable>();
auto u_type = u.try_convert<unit_type_callable>();

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<terrain_callable>()) {
Expand Down Expand Up @@ -159,10 +159,10 @@ DEFINE_WFL_FUNCTION(chance_to_hit, 2, 2)

auto u_call = u.try_convert<unit_callable>();
auto u_type = u.try_convert<unit_type_callable>();

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<terrain_callable>()) {
Expand Down Expand Up @@ -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<unit_callable>();
auto u_type = u.try_convert<unit_type_callable>();

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<terrain_callable>()) {
Expand Down Expand Up @@ -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<unit_callable>();
auto u_type = u.try_convert<unit_type_callable>();

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<terrain_callable>()) {
Expand Down Expand Up @@ -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<unit_callable>();
auto u_type = u.try_convert<unit_type_callable>();

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<terrain_callable>()) {
Expand Down
8 changes: 4 additions & 4 deletions src/game_config_manager.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;});
Expand Down Expand Up @@ -726,7 +726,7 @@ void game_config_manager::set_enabled_addon(std::set<std::string> addon_ids)
}
void game_config_manager::set_enabled_addon_all()
{

auto& vec = game_config_view_.data();
vec.clear();
vec.push_back(game_config_);
Expand Down
2 changes: 1 addition & 1 deletion src/game_config_manager.hpp
Expand Up @@ -78,7 +78,7 @@ class game_config_manager

std::map<std::string, config> addon_cfgs_;
boost::optional<std::set<std::string>> active_addons_;

preproc_map old_defines_map_;

filesystem::binary_paths_manager paths_manager_;
Expand Down
2 changes: 1 addition & 1 deletion src/game_config_view.hpp
Expand Up @@ -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_;
Expand Down
2 changes: 1 addition & 1 deletion src/game_initialization/mp_game_utils.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/server_info_dialog.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/generator.cpp
Expand Up @@ -1027,7 +1027,7 @@ namespace select_action
void selection::select(grid& grid, const bool select)
{
selectable_item* selectable = dynamic_cast<selectable_item*>(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);
Expand Down
2 changes: 1 addition & 1 deletion src/save_index.cpp
Expand Up @@ -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<std::string>& suffixes)
{
for(const std::string& suf : suffixes) {
Expand Down
4 changes: 2 additions & 2 deletions src/saved_game.cpp
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/scripting/game_lua_kernel.cpp
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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[] {
Expand All @@ -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
Expand All @@ -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[] {
Expand All @@ -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[] {
Expand Down Expand Up @@ -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<team&>(t));
return run_filter(name, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/scripting/lua_common.cpp
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/scripting/lua_kernel_base.cpp
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/scripting/lua_ptr.hpp
Expand Up @@ -33,7 +33,7 @@ class lua_ptr
{
public:
lua_ptr(enable_lua_ptr<T>& o) : self_(o.self_) { }
T* get_ptr()
T* get_ptr()
{
if(auto pp = self_.lock()) {
return *pp;
Expand Down
4 changes: 2 additions & 2 deletions src/scripting/lua_stringx.cpp
Expand Up @@ -352,15 +352,15 @@ 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);
lua_pushcfunction(L, &impl_str_index);
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");
Expand Down
8 changes: 4 additions & 4 deletions src/scripting/lua_team.cpp
Expand Up @@ -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());

Expand All @@ -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);
Expand All @@ -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[] {
Expand All @@ -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();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/scripting/lua_widget_attributes.cpp
Expand Up @@ -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<utils::string_view>(L, 2);

Expand Down

0 comments on commit 6b89bf8

Please sign in to comment.