Removed trailing tabs and whitespaces from C++ source
[ci skip]
I ran the same command from 9b7b1751fd
.
Excludes:
* lua/
* spirit_po/
This commit is contained in:
parent
33a029633d
commit
4a3be684f4
48 changed files with 131 additions and 131 deletions
|
@ -387,7 +387,7 @@ battle_context::battle_context(
|
|||
|
||||
const_attack_ptr a_wep(a_wep_uindex < attacker.attacks().size() ? attacker.attacks()[a_wep_index].shared_from_this() : nullptr);
|
||||
const_attack_ptr d_wep(d_wep_uindex < defender.attacks().size() ? defender.attacks()[d_wep_index].shared_from_this() : nullptr);
|
||||
|
||||
|
||||
attacker_stats_.reset(new battle_context_unit_stats(attacker, a_loc, a_wep_index, true , defender, d_loc, d_wep, units));
|
||||
defender_stats_.reset(new battle_context_unit_stats(defender, d_loc, d_wep_index, false, attacker, a_loc, a_wep, units));
|
||||
}
|
||||
|
@ -975,7 +975,7 @@ bool attack::perform_hit(bool attacker_turn, statistics::attack_context& stats)
|
|||
bool& update_fog = attacker_turn ? update_def_fog_ : update_att_fog_;
|
||||
|
||||
int ran_num;
|
||||
|
||||
|
||||
if(use_prng_) {
|
||||
|
||||
std::vector<bool>& prng_seq = attacker_turn ? prng_attacker_ : prng_defender_;
|
||||
|
|
|
@ -543,9 +543,9 @@ size_t config::find_total_first_of(config_key_type key, size_t start)
|
|||
{
|
||||
assert(start <= ordered_children.size());
|
||||
const size_t npos = static_cast<size_t>(-1);
|
||||
|
||||
|
||||
auto pos = std::find_if(ordered_begin() + start, ordered_end(), [&](const config::any_child& can){ return can.key == key; });
|
||||
|
||||
|
||||
if(pos == ordered_end()) {
|
||||
return npos;
|
||||
}
|
||||
|
@ -564,7 +564,7 @@ config& config::add_child_at_total(config_key_type key, const config &val, size_
|
|||
auto end = ordered_children.end();
|
||||
auto pos_it = ordered_children.begin() + pos;
|
||||
auto next = std::find_if(pos_it, end,[&](const child_pos& p){ return p.pos->first == key; });
|
||||
|
||||
|
||||
if(next == end) {
|
||||
config& res = config::add_child(key, val);
|
||||
//rotate the just inserted element to position pos.
|
||||
|
@ -576,7 +576,7 @@ config& config::add_child_at_total(config_key_type key, const config &val, size_
|
|||
child_list& l = pl->second;
|
||||
unsigned int index = next->index;
|
||||
config& res = **(l.emplace(l.begin() + index, new config(val)));
|
||||
|
||||
|
||||
for(auto ord = next; ord != end; ++ord) {
|
||||
//this changes next->index and all later refernces to that tag.
|
||||
if(ord->pos == pl) {
|
||||
|
|
|
@ -178,7 +178,7 @@ protected:
|
|||
virtual void execute_action(const std::vector<std::string>& items_arg, int xloc, int yloc, bool context_menu);
|
||||
|
||||
virtual bool in_context_menu(hotkey::HOTKEY_COMMAND command) const;
|
||||
|
||||
|
||||
void long_touch_callback(int x, int y);
|
||||
|
||||
const config& game_config_;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*
|
||||
Copyright (C) 2018 by Martin Hrubý <hrubymar10@gmail.com>
|
||||
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*
|
||||
Copyright (C) 2018 by Martin Hrubý <hrubymar10@gmail.com>
|
||||
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
|||
|
||||
namespace desktop {
|
||||
namespace apple {
|
||||
|
||||
|
||||
std::string os_version();
|
||||
|
||||
|
||||
} // end namespace apple
|
||||
} // end namespace desktop
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*
|
||||
Copyright (C) 2018 by Martin Hrubý <hrubymar10@gmail.com>
|
||||
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*
|
||||
Copyright (C) 2018 by Martin Hrubý <hrubymar10@gmail.com>
|
||||
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ std::string os_version()
|
|||
//
|
||||
// Standard Mac OS X version
|
||||
//
|
||||
|
||||
|
||||
return desktop::apple::os_version();
|
||||
|
||||
#elif defined(_X11)
|
||||
|
|
|
@ -114,7 +114,7 @@ fake_unit_ptr::~fake_unit_ptr()
|
|||
// fake_unit from the managers's fake_units_ dequeue in the event of an
|
||||
// exception.
|
||||
if(my_manager_) {
|
||||
//my_manager_ points to resources::fake_units, the next line fixes a bug whre this code would attempt to access a freed fake_unit_manager object, see https://github.com/wesnoth/wesnoth/issues/3008
|
||||
//my_manager_ points to resources::fake_units, the next line fixes a bug whre this code would attempt to access a freed fake_unit_manager object, see https://github.com/wesnoth/wesnoth/issues/3008
|
||||
if(resources::fake_units != nullptr) {
|
||||
remove_from_fake_unit_manager();
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ static const std::string& get_version_path_suffix()
|
|||
old_saves_dir += get_version_path_suffix();
|
||||
boost::filesystem::path new_saves_dir = home / "Library/Containers/org.wesnoth.Wesnoth/Data/Library/Application Support/Wesnoth_";
|
||||
new_saves_dir += get_version_path_suffix();
|
||||
|
||||
|
||||
if(bfs::is_directory(new_saves_dir)) {
|
||||
if(!bfs::exists(old_saves_dir)) {
|
||||
std::cout << "Apple developer's userdata migration: ";
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
|
||||
/**
|
||||
* Get maximum length.
|
||||
*
|
||||
*
|
||||
* @returns The maximum length of the text. The length of text
|
||||
* should not exceed this value.
|
||||
*/
|
||||
|
|
|
@ -102,7 +102,7 @@ flg_manager::flg_manager(const std::vector<const config*>& era_factions,
|
|||
update_available_factions();
|
||||
|
||||
select_default_faction();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void flg_manager::set_current_faction(const unsigned index)
|
||||
|
|
|
@ -142,7 +142,7 @@ public:
|
|||
return users_;
|
||||
}
|
||||
|
||||
bool gamelist_initialized() const
|
||||
bool gamelist_initialized() const
|
||||
{
|
||||
return gamelist_initialized_;
|
||||
}
|
||||
|
|
|
@ -370,7 +370,7 @@ LEVEL_RESULT campaign_controller::play_game()
|
|||
if(state_.mp_settings().saved_game == mp_game_settings::SAVED_GAME_MODE::MIDGAME) {
|
||||
state_.mp_settings().saved_game = mp_game_settings::SAVED_GAME_MODE::SCENARIO_START;
|
||||
}
|
||||
|
||||
|
||||
state_.mp_settings().use_map_settings = starting_pos["force_lock_settings"].to_bool(!is_mp);
|
||||
|
||||
ng::connect_engine_ptr connect_engine(new ng::connect_engine(state_, false, mp_info_));
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
height_map generate_height_map(size_t width, size_t height,
|
||||
size_t iterations, size_t hill_size,
|
||||
size_t island_size, size_t island_off_center);
|
||||
|
||||
|
||||
height_map generate_height_map(size_t width, size_t height,
|
||||
size_t iterations, size_t hill_size,
|
||||
size_t island_size, size_t center_x, size_t center_y);
|
||||
|
|
|
@ -490,7 +490,7 @@ int icompare(const std::string& s1, const std::string& s2)
|
|||
|
||||
if(!bad_cast_once) {
|
||||
ERR_G << "locale set-up for icompare() is broken, falling back to std::string::compare()\n";
|
||||
|
||||
|
||||
try { //just to be safe.
|
||||
ERR_G << get_manager().debug_description() << "\n";
|
||||
} catch (const std::exception& e) {
|
||||
|
|
|
@ -230,14 +230,14 @@ private:
|
|||
* @param distance The distance moved.
|
||||
*/
|
||||
void touch_motion(const point& position, const point& distance);
|
||||
|
||||
|
||||
/**
|
||||
* Fires a touch "finger down" event.
|
||||
*
|
||||
* @param position The position touched.
|
||||
*/
|
||||
void touch_down(const point& position);
|
||||
|
||||
|
||||
/**
|
||||
* Fires a touch "finger up" event.
|
||||
*
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
* @param scroll 'step size' to scroll.
|
||||
*/
|
||||
void scroll(const scroll_mode scroll);
|
||||
|
||||
|
||||
void scroll_by(const int pixels);
|
||||
|
||||
/** Is the positioner at the beginning of the scrollbar? */
|
||||
|
|
|
@ -168,13 +168,13 @@ size_t text_box_base::get_composition_length() const
|
|||
if(!is_composing()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
size_t text_length = utf8::size(text_.text());
|
||||
size_t text_cached_length = utf8::size(text_cached_);
|
||||
if(text_length < text_cached_length) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return utf8::size(text_.text()) - utf8::size(text_cached_);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
protected:
|
||||
/** Get length of composition text by IME **/
|
||||
size_t get_composition_length() const;
|
||||
|
||||
|
||||
/**
|
||||
* Moves the cursor to the end of the line.
|
||||
*
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** Overlays another map onto this one at the given position. */
|
||||
void overlay(const gamemap& m, map_location loc, const std::vector<overlay_rule>& rules = std::vector<overlay_rule>(), bool is_odd = false, bool ignore_special_locations = false);
|
||||
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
const std::vector<overlay_rule>& rules,
|
||||
bool is_odd,
|
||||
bool ignore_special_locations);
|
||||
|
||||
|
||||
/** Effective map width. */
|
||||
int w() const { return w_; }
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ void get_tiles_radius(const gamemap& map, const std::vector<map_location>& locs,
|
|||
typedef std::set<map_location> location_set;
|
||||
location_set not_visited(locs.begin(), locs.end());
|
||||
|
||||
get_tiles_radius(std::move(not_visited), radius, result,
|
||||
get_tiles_radius(std::move(not_visited), radius, result,
|
||||
[&](const map_location& l) {
|
||||
return with_border ? map.on_board_with_border(l) : map.on_board(l);
|
||||
},
|
||||
|
|
|
@ -24,22 +24,22 @@
|
|||
* that are connected to elements of
|
||||
* locs by a chain of at most @a radius tiles, each of which matches @a pred2.
|
||||
* @a result must be a std::set of locations.
|
||||
*
|
||||
*
|
||||
* @a pred1 a fast predicate (used before cachecheck).
|
||||
* @a pred2 a slow predicate (used after cachecheck).
|
||||
*/
|
||||
template<typename FPred1, typename FPred2>
|
||||
void get_tiles_radius(std::set<map_location>&& locs, size_t radius, std::set<map_location>& result, const FPred1& pred1, const FPred2& pred2)
|
||||
{
|
||||
{
|
||||
typedef std::set<map_location> location_set;
|
||||
location_set must_visit, filtered_out;
|
||||
location_set not_visited = std::move(locs);
|
||||
|
||||
|
||||
for ( ; radius != 0 && !not_visited.empty(); --radius )
|
||||
{
|
||||
location_set::const_iterator it = not_visited.begin();
|
||||
location_set::const_iterator it_end = not_visited.end();
|
||||
|
||||
|
||||
result.insert(it, it_end);
|
||||
for(; it != it_end; ++it) {
|
||||
adjacent_loc_array_t adj;
|
||||
|
@ -58,10 +58,10 @@ void get_tiles_radius(std::set<map_location>&& locs, size_t radius, std::set<map
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
not_visited.swap(must_visit);
|
||||
must_visit.clear();
|
||||
}
|
||||
|
||||
|
||||
result.insert(not_visited.begin(), not_visited.end());
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ public:
|
|||
bool is_networked_mp() const override;
|
||||
void send_to_wesnothd(const config& cfg, const std::string& packet_type = "unknown") const override;
|
||||
bool receive_from_wesnothd(config& cfg) const override;
|
||||
|
||||
|
||||
|
||||
|
||||
void play_slice(bool is_delay_enabled = true) override;
|
||||
protected:
|
||||
virtual void handle_generic_event(const std::string& name) override;
|
||||
|
|
|
@ -195,7 +195,7 @@ turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg
|
|||
auto disp_set_team = [](int side_index) {
|
||||
const bool side_changed = static_cast<int>(display::get_singleton()->viewing_team()) != side_index;
|
||||
display::get_singleton()->set_team(side_index);
|
||||
|
||||
|
||||
if(side_changed) {
|
||||
display::get_singleton()->redraw_everything();
|
||||
display::get_singleton()->recalculate_minimap();
|
||||
|
|
|
@ -130,7 +130,7 @@ playturn_network_adapter::playturn_network_adapter(source_type source)
|
|||
, data_front_()
|
||||
, next_(data_.front().ordered_end())
|
||||
, next_command_num_(0)
|
||||
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ private:
|
|||
// note: all of the following could be replaced by a simple std::list<config> if we would
|
||||
// split incoming tags right after we rechived them from network_reader_ the reason
|
||||
// why we currently don'T do that is for performance.
|
||||
|
||||
|
||||
//this always contains one empty config because we want a valid value for next_.
|
||||
std::list<config> data_;
|
||||
//packages that the client could not process at that point.
|
||||
|
|
|
@ -297,7 +297,7 @@ static secure_buffer rc4_crypt(const secure_buffer& text, const secure_buffer& k
|
|||
result.data(),
|
||||
result.size(),
|
||||
&outWritten);
|
||||
|
||||
|
||||
assert(ccStatus == kCCSuccess);
|
||||
assert(outWritten == text.size());
|
||||
#endif
|
||||
|
|
|
@ -603,7 +603,7 @@ REPORT_GENERATOR(unit_defense,rc)
|
|||
const team &viewing_team = rc.teams()[rc.screen().viewing_team()];
|
||||
const map_location& mouseover_hex = rc.screen().mouseover_hex();
|
||||
const map_location& displayed_unit_hex = rc.screen().displayed_unit_hex();
|
||||
const map_location& hex = (mouseover_hex.valid() && !viewing_team.shrouded(mouseover_hex)) ? mouseover_hex : displayed_unit_hex;
|
||||
const map_location& hex = (mouseover_hex.valid() && !viewing_team.shrouded(mouseover_hex)) ? mouseover_hex : displayed_unit_hex;
|
||||
return unit_defense(rc, u, hex);
|
||||
}
|
||||
REPORT_GENERATOR(selected_unit_defense, rc)
|
||||
|
@ -938,7 +938,7 @@ static int attack_info(reports::context & rc, const attack_type &at, config &res
|
|||
bool attacking = (u.side() == rc.screen().playing_side());
|
||||
auto ctx = (sec_u == nullptr) ? at.specials_context_for_listing(attacking) :
|
||||
at.specials_context(unit_const_ptr(&u), unit_const_ptr(sec_u), hex, sec_u->get_location(), attacking, sec_u_weapon);
|
||||
|
||||
|
||||
boost::dynamic_bitset<> active;
|
||||
const std::vector<std::pair<t_string, t_string>> &specials = at.special_tooltips(&active);
|
||||
const std::size_t specials_size = specials.size();
|
||||
|
|
|
@ -340,7 +340,7 @@ void saved_game::load_mod(const std::string& type, const std::string& id, size_t
|
|||
for(const config& modlua : cfg.child_range("lua")) {
|
||||
this->starting_point_.add_child_at_total("lua", modlua, pos++);
|
||||
}
|
||||
|
||||
|
||||
// Copy unit_type_fix
|
||||
for(const config& modlua : cfg.child_range("unit_type_fix")) {
|
||||
this->starting_point_.add_child_at_total("unit_type_fix", modlua, pos++);
|
||||
|
|
|
@ -1093,7 +1093,7 @@ int game_lua_kernel::intf_terrain_mask(lua_State *L)
|
|||
lua_pop(L, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
gamemap mask_map(board().map().tdata(), "");
|
||||
mask_map.read(t_str, false);
|
||||
|
@ -1743,7 +1743,7 @@ int game_lua_kernel::intf_find_path(lua_State *L)
|
|||
ignore_units = luaW_table_get_def<bool>(L, arg, "ignore_units", false);
|
||||
|
||||
ignore_teleport = luaW_table_get_def<bool>(L, arg, "ignore_teleport", false);
|
||||
|
||||
|
||||
stop_at = luaW_table_get_def<double>(L, arg, "stop_at", stop_at);
|
||||
|
||||
|
||||
|
|
|
@ -643,7 +643,7 @@ lua_kernel_base::lua_kernel_base()
|
|||
luaL_setfuncs(L, callbacks, 0);
|
||||
//lua_cpp::set_functions(L, cpp_callbacks, 0);
|
||||
lua_setglobal(L, "wesnoth");
|
||||
|
||||
|
||||
static luaL_Reg const wml_callbacks[]= {
|
||||
{ "load", &intf_load_wml},
|
||||
{ "parse", &intf_parse_wml},
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
Copyright (C) 2018 the Battle for Wesnoth Project https://www.wesnoth.org/
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
|
@ -99,18 +99,18 @@ namespace {
|
|||
}
|
||||
f(s);
|
||||
}
|
||||
|
||||
|
||||
int atoi(string_view s)
|
||||
{
|
||||
if(s.empty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char** end = 0;
|
||||
int res = strtol(&s[0], end, 10);
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::pair<int, int> parse_single_range(string_view s)
|
||||
{
|
||||
int dash_pos = s.find('-');
|
||||
|
@ -124,7 +124,7 @@ namespace {
|
|||
return {atoi(first), atoi(second)};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dynamic_bitset parse_range(string_view s)
|
||||
{
|
||||
dynamic_bitset res;
|
||||
|
@ -185,7 +185,7 @@ namespace {
|
|||
even.emplace_back(se, s + (se + 1)/2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void parse_rel_sequence(string_view s, offset_list_t& even, offset_list_t& odd)
|
||||
{
|
||||
split_foreach(s, ',', [&](string_view part){
|
||||
|
@ -219,7 +219,7 @@ static int luaW_push_locationset(lua_State* L, const std::set<map_location>& loc
|
|||
++i;
|
||||
}
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static std::set<map_location> luaW_to_locationset(lua_State* L, int index)
|
||||
|
@ -274,7 +274,7 @@ public:
|
|||
{
|
||||
LOG_LMG << "created and filter\n";
|
||||
}
|
||||
|
||||
|
||||
bool matches(const mapgen_gamemap& m, map_location l) override
|
||||
{
|
||||
LOG_MATCHES(and);
|
||||
|
@ -295,7 +295,7 @@ public:
|
|||
{
|
||||
LOG_LMG << "created or filter\n";
|
||||
}
|
||||
|
||||
|
||||
bool matches(const mapgen_gamemap& m, map_location l) override
|
||||
{
|
||||
LOG_MATCHES(or);
|
||||
|
@ -316,7 +316,7 @@ public:
|
|||
{
|
||||
LOG_LMG << "created nand filter\n";
|
||||
}
|
||||
|
||||
|
||||
bool matches(const mapgen_gamemap& m, map_location l) override
|
||||
{
|
||||
LOG_MATCHES(nand);
|
||||
|
@ -337,7 +337,7 @@ public:
|
|||
{
|
||||
LOG_LMG << "created nor filter\n";
|
||||
}
|
||||
|
||||
|
||||
bool matches(const mapgen_gamemap& m, map_location l) override
|
||||
{
|
||||
LOG_MATCHES(nor);
|
||||
|
@ -362,13 +362,13 @@ public:
|
|||
filter_ = build_filter(L, res_index, ks);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
|
||||
bool matches(const mapgen_gamemap& m, map_location l) override
|
||||
{
|
||||
LOG_MATCHES(cached);
|
||||
int cache_size = 2 * m.total_width() * m.total_height();
|
||||
int loc_index = 2 * (l.wml_x() + l.wml_y() * m.total_width());
|
||||
|
||||
|
||||
if(int(cache_.size()) != cache_size) {
|
||||
cache_ = dynamic_bitset(cache_size);
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ public:
|
|||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<filter_impl> filter_;
|
||||
mutable dynamic_bitset cache_;
|
||||
};
|
||||
|
@ -417,13 +417,13 @@ public:
|
|||
filter_ = parse_range(luaW_tostring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
|
||||
bool matches(const mapgen_gamemap&, map_location l) override
|
||||
{
|
||||
LOG_MATCHES(y);
|
||||
return l.y >= 0 && l.y < int(filter_.size()) && filter_[l.y];
|
||||
}
|
||||
|
||||
|
||||
dynamic_bitset filter_;
|
||||
};
|
||||
|
||||
|
@ -434,7 +434,7 @@ public:
|
|||
{
|
||||
LOG_LMG << "creating onborder filter\n";
|
||||
}
|
||||
|
||||
|
||||
bool matches(const mapgen_gamemap& m, map_location l) override
|
||||
{
|
||||
LOG_MATCHES(onborder);
|
||||
|
@ -454,14 +454,14 @@ public:
|
|||
filter_ = t_translation::ter_match(luaW_tostring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
|
||||
bool matches(const mapgen_gamemap& m, map_location l) override
|
||||
{
|
||||
LOG_MATCHES(terrain);
|
||||
const t_translation::terrain_code letter = m[l];
|
||||
return t_translation::terrain_matches(letter, filter_);
|
||||
}
|
||||
|
||||
|
||||
t_translation::ter_match filter_;
|
||||
};
|
||||
|
||||
|
@ -491,7 +491,7 @@ public:
|
|||
filter_ = build_filter(L, res_index, ks);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
|
||||
bool matches(const mapgen_gamemap& m, map_location l) override
|
||||
{
|
||||
LOG_MATCHES(adjacent);
|
||||
|
@ -533,7 +533,7 @@ public:
|
|||
if(luaW_tableget(L, res_index, id.c_str())) {
|
||||
insert_res.first->second = luaW_to_locationset(L, -1);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
set_ = &insert_res.first->second;
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ public:
|
|||
class radius_filter : public filter_impl
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
radius_filter(lua_State* L, int res_index, knows_sets_t& ks)
|
||||
: radius_()
|
||||
, filter_radius_()
|
||||
|
@ -569,7 +569,7 @@ public:
|
|||
filter_ = build_filter(L, res_index, ks);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
|
||||
bool matches(const mapgen_gamemap& m, map_location l) override
|
||||
{
|
||||
LOG_MATCHES(radius);
|
||||
|
@ -591,7 +591,7 @@ public:
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int radius_;
|
||||
std::unique_ptr<filter_impl> filter_radius_;
|
||||
std::unique_ptr<filter_impl> filter_;
|
||||
|
@ -634,10 +634,10 @@ enum filter_keys { F_AND, F_OR, F_NAND, F_NOR, F_X, F_Y, F_FIND_IN, F_ADJACENT,
|
|||
//todoc++14: std::unordered_map doesn'tsupport herterogrnous lookup.
|
||||
//todo consider renaming and -> all ,or ->any, nor -> none, nand -> notall
|
||||
static const std::unordered_map<std::string, filter_keys> keys {
|
||||
{ "all", F_AND },
|
||||
{ "any", F_OR },
|
||||
{ "not_all", F_NAND },
|
||||
{ "none", F_NOR },
|
||||
{ "all", F_AND },
|
||||
{ "any", F_OR },
|
||||
{ "not_all", F_NAND },
|
||||
{ "none", F_NOR },
|
||||
{ "x", F_X },
|
||||
{ "y", F_Y },
|
||||
{ "find_in", F_FIND_IN },
|
||||
|
@ -656,7 +656,7 @@ std::unique_ptr<filter_impl> build_filter(lua_State* L, int res_index, knows_set
|
|||
}
|
||||
lua_rawgeti(L, -1, 1);
|
||||
std::string s = std::string(luaW_tostring(L, -1));
|
||||
LOG_LMG << "buildfilter: got: " << s << "\n";
|
||||
LOG_LMG << "buildfilter: got: " << s << "\n";
|
||||
auto it = keys.find(s);
|
||||
if(it == keys.end()) {
|
||||
//fixme use proper exception type.
|
||||
|
@ -718,7 +718,7 @@ bool filter::matches(const mapgen_gamemap& m, map_location l)
|
|||
|
||||
filter::~filter()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ static int intf_mg_get_locations_part2(lua_State* L, mapgen_gamemap& m, lua_mapg
|
|||
luaW_push_locationset(L, res);
|
||||
LOG_LMG << "map:get_locations end\n";
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
int intf_mg_get_locations(lua_State* L)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace lua_mapgen
|
|||
//moving is ok though.
|
||||
filter(filter&&) = default;
|
||||
filter& operator=(filter&&) = default;
|
||||
|
||||
|
||||
~filter();
|
||||
|
||||
bool matches(const mapgen_gamemap& m, map_location l);
|
||||
|
|
|
@ -47,7 +47,7 @@ mapgen_gamemap* luaW_toslocs(lua_State *L, int index)
|
|||
if(!lua_istable(L, index)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
lua_rawgeti(L, index, 1);
|
||||
mapgen_gamemap* m = luaW_toterrainmap(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
@ -103,7 +103,7 @@ int impl_slocs_get(lua_State* L)
|
|||
//functions with variable return numbers have been causing problem in the past
|
||||
lua_pushnil(L);
|
||||
}
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int impl_slocs_set(lua_State* L)
|
||||
|
@ -134,7 +134,7 @@ mapgen_gamemap::mapgen_gamemap(int w, int h, terrain_code t)
|
|||
: tiles_(w, h, t)
|
||||
, starting_positions_()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
std::string mapgen_gamemap::to_string() const
|
||||
|
@ -148,7 +148,7 @@ void mapgen_gamemap::set_terrain(const map_location& loc, const terrain_code & t
|
|||
terrain_code old = t;
|
||||
t = terrain;
|
||||
simplemerge(old, t, mode);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void mapgen_gamemap::simplemerge(terrain_code old_t, terrain_code& new_t, const terrain_type_data::merge_mode mode)
|
||||
|
@ -160,7 +160,7 @@ void mapgen_gamemap::simplemerge(terrain_code old_t, terrain_code& new_t, const
|
|||
new_t = t_translation::terrain_code(new_t.base, old_t.overlay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mapgen_gamemap::set_special_location(const std::string& id, const map_location& loc)
|
||||
{
|
||||
bool valid = loc.valid();
|
||||
|
@ -270,12 +270,12 @@ static int impl_terainmap_get(lua_State *L)
|
|||
{
|
||||
mapgen_gamemap& tm = luaW_checkterrainmap(L, 1);
|
||||
char const *m = luaL_checkstring(L, 2);
|
||||
|
||||
|
||||
// Find the corresponding attribute.
|
||||
return_int_attrib("width", tm.total_width());
|
||||
return_int_attrib("height", tm.total_height());
|
||||
return_string_attrib("data", tm.to_string());
|
||||
|
||||
|
||||
if(strcmp(m, "special_locations") == 0) {
|
||||
luaW_pushslocs(L, 1);
|
||||
return 1;
|
||||
|
@ -314,10 +314,10 @@ static int intf_set_terrain(lua_State *L)
|
|||
mapgen_gamemap& tm = luaW_checkterrainmap(L, 1);
|
||||
map_location loc = luaW_checklocation(L, 2);
|
||||
string_view t_str = luaL_checkstring(L, 3);
|
||||
|
||||
|
||||
auto terrain = t_translation::read_terrain_code(t_str);
|
||||
auto mode = terrain_type_data::BOTH;
|
||||
|
||||
|
||||
if(!lua_isnoneornil(L, 4)) {
|
||||
string_view mode_str = luaL_checkstring(L, 4);
|
||||
if(mode_str == "base") {
|
||||
|
@ -438,7 +438,7 @@ int mapgen_gamemap::intf_mg_terrain_mask(lua_State *L)
|
|||
is_odd,
|
||||
ignore_special_locations
|
||||
);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ struct lua_State;
|
|||
class lua_unit;
|
||||
struct map_location;
|
||||
|
||||
// this clas is similar to the orginal gamemap class but they have no 'is' rlation:
|
||||
// this clas is similar to the orginal gamemap class but they have no 'is' rlation:
|
||||
// mapgen_gamemap, unlike gamemap offers 'raw' access to the data
|
||||
// gamemap, unlike mapgen_gamemap uses terain type data.
|
||||
class mapgen_gamemap
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
mapgen_gamemap(int w, int h, terrain_code);
|
||||
|
||||
std::string to_string() const;
|
||||
|
||||
|
||||
/** Effective map width. */
|
||||
int w() const { return total_width() - 2; }
|
||||
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
static int intf_mg_terrain_mask(lua_State *L);
|
||||
private:
|
||||
t_translation::ter_map tiles_;
|
||||
starting_positions starting_positions_;
|
||||
starting_positions starting_positions_;
|
||||
};
|
||||
|
||||
bool luaW_isslocs(lua_State* L, int index);
|
||||
|
|
|
@ -85,7 +85,7 @@ static int intf_random(lua_State *L)
|
|||
static int intf_default_generate(lua_State *L)
|
||||
{
|
||||
std::mt19937& rng = lua_kernel_base::get_lua_kernel<mapgen_lua_kernel>(L).get_default_rng();
|
||||
|
||||
|
||||
int width = luaL_checkinteger(L, 1);
|
||||
int height = luaL_checkinteger(L, 2);
|
||||
|
||||
|
@ -104,7 +104,7 @@ static int intf_default_generate(lua_State *L)
|
|||
arg.max_lakes = cfg["max_lakes"].to_int(0);
|
||||
arg.link_castles = cfg["link_castles"].to_bool();
|
||||
arg.show_labels = cfg["show_labels"].to_bool(0);
|
||||
|
||||
|
||||
uint32_t seed = cfg["seed"].to_int(0);
|
||||
if(!cfg.has_attribute("seed")) {
|
||||
seed = rng();
|
||||
|
@ -123,7 +123,7 @@ static int intf_default_generate(lua_State *L)
|
|||
static int intf_default_generate_height_map(lua_State *L)
|
||||
{
|
||||
std::mt19937& rng = lua_kernel_base::get_lua_kernel<mapgen_lua_kernel>(L).get_default_rng();
|
||||
|
||||
|
||||
int width = luaL_checkinteger(L, 1);
|
||||
int height = luaL_checkinteger(L, 2);
|
||||
|
||||
|
@ -235,8 +235,8 @@ mapgen_lua_kernel::mapgen_lua_kernel(const config* vars)
|
|||
luaL_setfuncs(L, callbacks, 0);
|
||||
lua_pop(L, 1);
|
||||
assert(lua_gettop(L) == 0);
|
||||
|
||||
|
||||
|
||||
|
||||
cmd_log_ << lua_terrainmap::register_metatables(L);
|
||||
cmd_log_ << lua_terrainfilter::register_metatables(L);
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
bool is_fuzzy() const {
|
||||
return fuzzy_;
|
||||
}
|
||||
|
||||
|
||||
bool accepts_any_tag() const {
|
||||
return any_tag_;
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ public:
|
|||
{
|
||||
super_ = s;
|
||||
}
|
||||
|
||||
|
||||
void set_fuzzy(bool f) {
|
||||
fuzzy_ = f;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public:
|
|||
void set_any_tag(bool any) {
|
||||
any_tag_ = any;
|
||||
}
|
||||
|
||||
|
||||
void add_key(const wml_key& new_key)
|
||||
{
|
||||
keys_.emplace(new_key.get_name(), new_key);
|
||||
|
|
|
@ -92,6 +92,6 @@ public:
|
|||
struct error : public game::error {
|
||||
error(const std::string& message) : game::error(message) {}
|
||||
};
|
||||
|
||||
|
||||
const std::string name_;
|
||||
};
|
||||
|
|
|
@ -281,7 +281,7 @@ public:
|
|||
{
|
||||
password_ = passwd;
|
||||
}
|
||||
|
||||
|
||||
void set_name_bans(const std::vector<std::string> name_bans)
|
||||
{
|
||||
name_bans_ = name_bans;
|
||||
|
|
|
@ -416,7 +416,7 @@ namespace
|
|||
} else {
|
||||
message = VGETTEXT(text.c_str(), i18n_vars);
|
||||
}
|
||||
|
||||
|
||||
if(show_long_message && !ignore) {
|
||||
play_controller::scoped_savegame_snapshot snapshot(controller);
|
||||
std::stringstream sbuilder;
|
||||
|
|
|
@ -979,7 +979,7 @@ void unit::advance_to(const unit_type& u_type, bool use_traits)
|
|||
max_attacks_ = new_type.max_attacks();
|
||||
|
||||
flag_rgb_ = new_type.flag_rgb();
|
||||
|
||||
|
||||
upkeep_ = upkeep_full();
|
||||
parse_upkeep(new_type.get_cfg()["upkeep"]);
|
||||
|
||||
|
@ -1410,7 +1410,7 @@ bool unit::get_attacks_changed() const
|
|||
if(a_ptr->get_changed()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -2049,7 +2049,7 @@ void unit::apply_builtin_effect(std::string apply_to, const config& effect)
|
|||
movement_type_.merge(ap, apply_to, effect["replace"].to_bool());
|
||||
}
|
||||
} else if(apply_to == "zoc") {
|
||||
if(const config::attribute_value* v = effect.get("value")) {
|
||||
if(const config::attribute_value* v = effect.get("value")) {
|
||||
set_attr_changed(UA_ZOC);
|
||||
emit_zoc_ = v->to_bool();
|
||||
}
|
||||
|
@ -2604,7 +2604,7 @@ void unit::clear_changed_attributes()
|
|||
{
|
||||
changed_attributes_.reset();
|
||||
for(const auto& a_ptr : attacks_) {
|
||||
a_ptr->set_changed(false);
|
||||
a_ptr->set_changed(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ public:
|
|||
{
|
||||
return unit_ptr(new unit(*this));
|
||||
}
|
||||
|
||||
|
||||
unit_ptr shared_from_this()
|
||||
{
|
||||
return unit_ptr(this);
|
||||
|
|
|
@ -497,7 +497,7 @@ static int process_command_args(const commandline_options& cmdline_opts)
|
|||
std::cout << "\n========= BUILD INFORMATION =========\n\n" << game_config::full_build_report();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(cmdline_opts.validate_schema) {
|
||||
schema_validation::schema_self_validator validator;
|
||||
validator.set_create_exceptions(false); // Don't crash if there's an error, just go ahead anyway
|
||||
|
@ -510,7 +510,7 @@ static int process_command_args(const commandline_options& cmdline_opts)
|
|||
handle_preprocess_command(cmdline_opts);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(cmdline_opts.validate_wml) {
|
||||
std::string schema_path;
|
||||
if(cmdline_opts.validate_with) {
|
||||
|
|
|
@ -86,7 +86,7 @@ private:
|
|||
unit_ptr temp_unit_;
|
||||
map_location recall_hex_;
|
||||
fake_unit_ptr fake_unit_;
|
||||
|
||||
|
||||
int original_mp_;
|
||||
int original_ap_;
|
||||
int original_recall_pos_;
|
||||
|
|
|
@ -87,7 +87,7 @@ void recruit::init()
|
|||
{
|
||||
temp_unit_->set_movement(0, true);
|
||||
temp_unit_->set_attacks(0);
|
||||
|
||||
|
||||
fake_unit_->set_location(recruit_hex_);
|
||||
fake_unit_->set_movement(0, true);
|
||||
fake_unit_->set_attacks(0);
|
||||
|
@ -145,7 +145,7 @@ void recruit::apply_temp_modifier(unit_map& unit_map)
|
|||
// unit map takes ownership of temp_unit
|
||||
const size_t old_id = temp_unit_->underlying_id();
|
||||
unit_map.insert(temp_unit_);
|
||||
|
||||
|
||||
//in the past there was a bug where the map changed the unit ids here (because a unit with that id already existed) which caused crashes later.
|
||||
assert(temp_unit_->underlying_id() == old_id);
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ std::size_t side_actions_container::get_turn_impl(std::size_t begin, std::size_t
|
|||
ERR_WB << "get_turn: begin >= end\n";
|
||||
}
|
||||
else if(it < turn_beginnings_[begin]) {
|
||||
ERR_WB << "get_turn failed\n";
|
||||
ERR_WB << "get_turn failed\n";
|
||||
}
|
||||
return begin;
|
||||
}
|
||||
|
@ -564,18 +564,18 @@ side_actions::iterator side_actions::remove_action(side_actions::iterator positi
|
|||
|
||||
LOG_WB << "Erasing action at turn #" << get_turn(position) << " position #" << actions_.position_in_turn(position) << "\n";
|
||||
|
||||
|
||||
|
||||
if(resources::gameboard->get_team(team_index_ + 1).is_local()) {
|
||||
position = synced_erase(position);
|
||||
}
|
||||
else {
|
||||
// don't sync actions of sides that we don't control, this would only generate
|
||||
// don't sync actions of sides that we don't control, this would only generate
|
||||
// 'illegal whiteboard data' server wanrings.
|
||||
// it might be better to instead don't even erase the action in this case to keep
|
||||
// the actionlist in sync with the owner client.
|
||||
position = safe_erase(position);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(validate_after_delete) {
|
||||
resources::whiteboard->validate_viewer_actions();
|
||||
|
|
|
@ -166,17 +166,17 @@ void scrollarea::handle_event(const SDL_Event& event)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (event.type == SDL_FINGERUP) {
|
||||
swipe_dy_ = 0;
|
||||
}
|
||||
|
||||
|
||||
if (event.type == SDL_FINGERDOWN || event.type == SDL_FINGERMOTION) {
|
||||
SDL_Rect r = video().screen_area();
|
||||
auto tx = static_cast<int>(event.tfinger.x * r.w);
|
||||
auto ty = static_cast<int>(event.tfinger.y * r.h);
|
||||
auto dy = static_cast<int>(event.tfinger.dy * r.h);
|
||||
|
||||
|
||||
if (event.type == SDL_FINGERDOWN) {
|
||||
swipe_dy_ = 0;
|
||||
swipe_origin_.x = tx;
|
||||
|
@ -184,7 +184,7 @@ void scrollarea::handle_event(const SDL_Event& event)
|
|||
}
|
||||
|
||||
if (event.type == SDL_FINGERMOTION) {
|
||||
|
||||
|
||||
swipe_dy_ += dy;
|
||||
if (scrollbar_.get_max_position() == 0) {
|
||||
return;
|
||||
|
@ -194,7 +194,7 @@ void scrollarea::handle_event(const SDL_Event& event)
|
|||
if (scrollbar_step <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (sdl::point_in_rect(swipe_origin_.x, swipe_origin_.y, inner_location())
|
||||
&& abs(swipe_dy_) >= scrollbar_step)
|
||||
{
|
||||
|
@ -206,7 +206,7 @@ void scrollarea::handle_event(const SDL_Event& event)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // end namespace gui
|
||||
|
|
Loading…
Add table
Reference in a new issue