Removed trailing tabs and whitespaces from C++ source
[ci skip] I ran the command used in9b7b1751fd
, excluding results in lua/ and spirit_po/. Also, once again, for some reason actions/vision.hpp gets registered as massively changed (similar tof11fa0652a
) despite nothing really having changed at all.
This commit is contained in:
parent
9eb28eb70d
commit
96ea0eb6b9
45 changed files with 258 additions and 258 deletions
|
@ -67,7 +67,7 @@ using advancement_option = boost::variant<std::string /*change type*/, const con
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function which will advance the unit at @a loc to 'advance_to'.
|
* Function which will advance the unit at @a loc to 'advance_to'.
|
||||||
* which is eigher a type to advance to or a config containing the
|
* which is eigher a type to advance to or a config containing the
|
||||||
* [advancement] to perform an amla.
|
* [advancement] to perform an amla.
|
||||||
* Note that 'loc' is not a reference, because if it were a reference,
|
* Note that 'loc' is not a reference, because if it were a reference,
|
||||||
* we couldn't safely pass in a reference to the item in the map
|
* we couldn't safely pass in a reference to the item in the map
|
||||||
|
|
|
@ -62,12 +62,12 @@ struct shroud_clearing_action
|
||||||
int original_village_owner;
|
int original_village_owner;
|
||||||
/// Whether this actions got a timebonus becasue it took a village.
|
/// Whether this actions got a timebonus becasue it took a village.
|
||||||
bool take_village_timebonus;
|
bool take_village_timebonus;
|
||||||
|
|
||||||
/// Change village owner on undo.
|
/// Change village owner on undo.
|
||||||
void return_village();
|
void return_village();
|
||||||
/// Change village owner on redo.
|
/// Change village owner on redo.
|
||||||
void take_village();
|
void take_village();
|
||||||
|
|
||||||
void write(config & cfg) const
|
void write(config & cfg) const
|
||||||
{
|
{
|
||||||
write_locations(route, cfg);
|
write_locations(route, cfg);
|
||||||
|
|
|
@ -413,7 +413,7 @@ void undo_list::redo()
|
||||||
|
|
||||||
resources::recorder->redo(const_cast<const config&>(*action));
|
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 whihc 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.
|
// 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;
|
redos_list temp;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
namespace actions {
|
namespace actions {
|
||||||
class undo_list;
|
class undo_list;
|
||||||
|
|
||||||
struct undo_event {
|
struct undo_event {
|
||||||
config commands, data;
|
config commands, data;
|
||||||
map_location loc1, loc2, filter_loc1, filter_loc2;
|
map_location loc1, loc2, filter_loc1, filter_loc2;
|
||||||
|
|
|
@ -1,157 +1,157 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2003 - 2017 by David White <dave@whitevine.net>
|
Copyright (C) 2003 - 2017 by David White <dave@whitevine.net>
|
||||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY.
|
but WITHOUT ANY WARRANTY.
|
||||||
|
|
||||||
See the COPYING file for more details.
|
See the COPYING file for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Various functions implementing vision (through fog of war and shroud).
|
* Various functions implementing vision (through fog of war and shroud).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "movetype.hpp"
|
#include "movetype.hpp"
|
||||||
|
|
||||||
struct map_location;
|
struct map_location;
|
||||||
class team;
|
class team;
|
||||||
class unit;
|
class unit;
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace actions {
|
namespace actions {
|
||||||
class move_unit_spectator;
|
class move_unit_spectator;
|
||||||
|
|
||||||
/// Class that stores the part of a unit's data that is needed for fog clearing.
|
/// Class that stores the part of a unit's data that is needed for fog clearing.
|
||||||
/// (Used by the undo stack as that cannot rely on a unit sticking around, and
|
/// (Used by the undo stack as that cannot rely on a unit sticking around, and
|
||||||
/// we do not really need to copy the entire unit.)
|
/// we do not really need to copy the entire unit.)
|
||||||
struct clearer_info {
|
struct clearer_info {
|
||||||
size_t underlying_id;
|
size_t underlying_id;
|
||||||
int sight_range;
|
int sight_range;
|
||||||
bool slowed;
|
bool slowed;
|
||||||
movetype::terrain_costs costs;
|
movetype::terrain_costs costs;
|
||||||
|
|
||||||
clearer_info(const unit & viewer);
|
clearer_info(const unit & viewer);
|
||||||
clearer_info(const config & cfg);
|
clearer_info(const config & cfg);
|
||||||
|
|
||||||
void write(config & cfg) const;
|
void write(config & cfg) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Class to encapsulate fog/shroud clearing and the resultant sighted events.
|
/// Class to encapsulate fog/shroud clearing and the resultant sighted events.
|
||||||
/// Note: This class uses teams as parameters (instead of sides) since a
|
/// Note: This class uses teams as parameters (instead of sides) since a
|
||||||
/// function using this should first check to see if fog/shroud is in use (to
|
/// function using this should first check to see if fog/shroud is in use (to
|
||||||
/// save processing when it is not), which implies the team is readily available.
|
/// save processing when it is not), which implies the team is readily available.
|
||||||
class shroud_clearer {
|
class shroud_clearer {
|
||||||
public:
|
public:
|
||||||
shroud_clearer(const shroud_clearer&) = delete;
|
shroud_clearer(const shroud_clearer&) = delete;
|
||||||
shroud_clearer& operator=(const shroud_clearer&) = delete;
|
shroud_clearer& operator=(const shroud_clearer&) = delete;
|
||||||
|
|
||||||
shroud_clearer();
|
shroud_clearer();
|
||||||
~shroud_clearer();
|
~shroud_clearer();
|
||||||
|
|
||||||
/// Function to be called if units have moved or otherwise changed.
|
/// Function to be called if units have moved or otherwise changed.
|
||||||
/// It can also be called if it is desirable to calculate the cache
|
/// It can also be called if it is desirable to calculate the cache
|
||||||
/// in advance of fog clearing.
|
/// in advance of fog clearing.
|
||||||
/// @param[in] new_team The team whose vision will be used. If left as
|
/// @param[in] new_team The team whose vision will be used. If left as
|
||||||
/// nullptr, the cache will be just be cleared (to be
|
/// nullptr, the cache will be just be cleared (to be
|
||||||
/// recalculated later as needed).
|
/// recalculated later as needed).
|
||||||
void cache_units(const team * new_team=nullptr) { calculate_jamming(new_team); }
|
void cache_units(const team * new_team=nullptr) { calculate_jamming(new_team); }
|
||||||
// cache_units() is currently a near-synonym for calculate_jamming(). The
|
// cache_units() is currently a near-synonym for calculate_jamming(). The
|
||||||
// reason for the two names is so the private function says what it does,
|
// reason for the two names is so the private function says what it does,
|
||||||
// while the public one says why it might be invoked.
|
// while the public one says why it might be invoked.
|
||||||
|
|
||||||
/// Clears shroud (and fog) around the provided location for @a view_team
|
/// Clears shroud (and fog) around the provided location for @a view_team
|
||||||
/// based on @a sight_range, @a costs, and @a slowed.
|
/// based on @a sight_range, @a costs, and @a slowed.
|
||||||
bool clear_unit(const map_location &view_loc, team &view_team,
|
bool clear_unit(const map_location &view_loc, team &view_team,
|
||||||
size_t viewer_id, int sight_range, bool slowed,
|
size_t viewer_id, int sight_range, bool slowed,
|
||||||
const movetype::terrain_costs & costs,
|
const movetype::terrain_costs & costs,
|
||||||
const map_location & real_loc,
|
const map_location & real_loc,
|
||||||
const std::set<map_location>* known_units = nullptr,
|
const std::set<map_location>* known_units = nullptr,
|
||||||
size_t * enemy_count = nullptr, size_t * friend_count = nullptr,
|
size_t * enemy_count = nullptr, size_t * friend_count = nullptr,
|
||||||
move_unit_spectator * spectator = nullptr, bool instant = true);
|
move_unit_spectator * spectator = nullptr, bool instant = true);
|
||||||
/// Clears shroud (and fog) around the provided location for @a view_team
|
/// Clears shroud (and fog) around the provided location for @a view_team
|
||||||
/// as if @a viewer was standing there.
|
/// as if @a viewer was standing there.
|
||||||
bool clear_unit(const map_location &view_loc,
|
bool clear_unit(const map_location &view_loc,
|
||||||
const unit &viewer, team &view_team,
|
const unit &viewer, team &view_team,
|
||||||
const std::set<map_location>* known_units = nullptr,
|
const std::set<map_location>* known_units = nullptr,
|
||||||
size_t * enemy_count = nullptr, size_t * friend_count = nullptr,
|
size_t * enemy_count = nullptr, size_t * friend_count = nullptr,
|
||||||
move_unit_spectator * spectator = nullptr, bool instant = true);
|
move_unit_spectator * spectator = nullptr, bool instant = true);
|
||||||
/// Clears shroud (and fog) around the provided location for @a view_team
|
/// Clears shroud (and fog) around the provided location for @a view_team
|
||||||
/// as if @a viewer was standing there. Setting @a instant to false
|
/// as if @a viewer was standing there. Setting @a instant to false
|
||||||
/// allows some drawing delays that are used to make movement look better.
|
/// allows some drawing delays that are used to make movement look better.
|
||||||
bool clear_unit(const map_location &view_loc, const unit &viewer,
|
bool clear_unit(const map_location &view_loc, const unit &viewer,
|
||||||
team &view_team, bool instant)
|
team &view_team, bool instant)
|
||||||
{ return clear_unit(view_loc, viewer, view_team, nullptr, nullptr, nullptr, nullptr, instant); }
|
{ return clear_unit(view_loc, viewer, view_team, nullptr, nullptr, nullptr, nullptr, instant); }
|
||||||
/// Clears shroud (and fog) around the provided location for @a view_team
|
/// Clears shroud (and fog) around the provided location for @a view_team
|
||||||
/// as if @a viewer was standing there.
|
/// as if @a viewer was standing there.
|
||||||
bool clear_unit(const map_location &view_loc, team &view_team,
|
bool clear_unit(const map_location &view_loc, team &view_team,
|
||||||
const clearer_info &viewer, bool instant);
|
const clearer_info &viewer, bool instant);
|
||||||
/// Clears shroud (and fog) around the provided location as if @a viewer
|
/// Clears shroud (and fog) around the provided location as if @a viewer
|
||||||
/// was standing there.
|
/// was standing there.
|
||||||
bool clear_unit(const map_location &view_loc, const unit &viewer,
|
bool clear_unit(const map_location &view_loc, const unit &viewer,
|
||||||
bool can_delay = false, bool invalidate = true,
|
bool can_delay = false, bool invalidate = true,
|
||||||
bool instant = true);
|
bool instant = true);
|
||||||
|
|
||||||
/// Clears shroud (and fog) at the provided location and its immediate neighbors.
|
/// Clears shroud (and fog) at the provided location and its immediate neighbors.
|
||||||
bool clear_dest(const map_location &dest, const unit &viewer);
|
bool clear_dest(const map_location &dest, const unit &viewer);
|
||||||
|
|
||||||
/// Erases the record of sighted events from earlier fog/shroud clearing.
|
/// Erases the record of sighted events from earlier fog/shroud clearing.
|
||||||
void drop_events();
|
void drop_events();
|
||||||
|
|
||||||
/// Fires the sighted events that were earlier recorded by fog/shroud clearing.
|
/// Fires the sighted events that were earlier recorded by fog/shroud clearing.
|
||||||
bool fire_events();
|
bool fire_events();
|
||||||
|
|
||||||
/// The invalidations that should occur after invoking clear_unit().
|
/// The invalidations that should occur after invoking clear_unit().
|
||||||
void invalidate_after_clear();
|
void invalidate_after_clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// A record of a sighting event.
|
/// A record of a sighting event.
|
||||||
struct sight_data;
|
struct sight_data;
|
||||||
|
|
||||||
/// Causes this object's "jamming" map to be recalculated.
|
/// Causes this object's "jamming" map to be recalculated.
|
||||||
void calculate_jamming(const team * new_team);
|
void calculate_jamming(const team * new_team);
|
||||||
|
|
||||||
/// Clears shroud from a single location.
|
/// Clears shroud from a single location.
|
||||||
bool clear_loc(team &tm, const map_location &loc, const map_location &view_loc,
|
bool clear_loc(team &tm, const map_location &loc, const map_location &view_loc,
|
||||||
const map_location &event_non_loc, size_t viewer_id,
|
const map_location &event_non_loc, size_t viewer_id,
|
||||||
bool check_units, size_t &enemy_count, size_t &friend_count,
|
bool check_units, size_t &enemy_count, size_t &friend_count,
|
||||||
move_unit_spectator * spectator = nullptr);
|
move_unit_spectator * spectator = nullptr);
|
||||||
|
|
||||||
/// Convenience wrapper for adding sighting data to the sightings_ vector.
|
/// Convenience wrapper for adding sighting data to the sightings_ vector.
|
||||||
inline void record_sighting(const unit & seen, const map_location & seen_loc,
|
inline void record_sighting(const unit & seen, const map_location & seen_loc,
|
||||||
size_t sighter_id, const map_location & sighter_loc);
|
size_t sighter_id, const map_location & sighter_loc);
|
||||||
|
|
||||||
private: // data
|
private: // data
|
||||||
std::map<map_location, int> jamming_;
|
std::map<map_location, int> jamming_;
|
||||||
std::vector<sight_data> sightings_;
|
std::vector<sight_data> sightings_;
|
||||||
/// Keeps track of the team associated with jamming_.
|
/// Keeps track of the team associated with jamming_.
|
||||||
const team * view_team_;
|
const team * view_team_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Returns the sides that cannot currently see @a target.
|
/// Returns the sides that cannot currently see @a target.
|
||||||
std::vector<int> get_sides_not_seeing(const unit & target);
|
std::vector<int> get_sides_not_seeing(const unit & target);
|
||||||
/// Fires sighted events for the sides that can see @a target.
|
/// Fires sighted events for the sides that can see @a target.
|
||||||
bool actor_sighted(const unit & target, const std::vector<int> * cache = nullptr);
|
bool actor_sighted(const unit & target, const std::vector<int> * cache = nullptr);
|
||||||
|
|
||||||
|
|
||||||
/// Function that recalculates the fog of war.
|
/// Function that recalculates the fog of war.
|
||||||
void recalculate_fog(int side);
|
void recalculate_fog(int side);
|
||||||
|
|
||||||
/// Function that will clear shroud (and fog) based on current unit positions.
|
/// Function that will clear shroud (and fog) based on current unit positions.
|
||||||
bool clear_shroud(int side, bool reset_fog = false, bool fire_events = true);
|
bool clear_shroud(int side, bool reset_fog = false, bool fire_events = true);
|
||||||
|
|
||||||
|
|
||||||
}//namespace actions
|
}//namespace actions
|
||||||
|
|
|
@ -212,7 +212,7 @@ namespace {
|
||||||
"*.wesnoth",
|
"*.wesnoth",
|
||||||
"*.project",
|
"*.project",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::vector<std::string> default_ignored_dirs {
|
static const std::vector<std::string> default_ignored_dirs {
|
||||||
".*",
|
".*",
|
||||||
/* macOS metadata-like cruft (http://floatingsun.net/2007/02/07/whats-with-__macosx-in-zip-files/) */
|
/* macOS metadata-like cruft (http://floatingsun.net/2007/02/07/whats-with-__macosx-in-zip-files/) */
|
||||||
|
|
|
@ -107,7 +107,7 @@ public:
|
||||||
virtual std::string get_id() const;
|
virtual std::string get_id() const;
|
||||||
virtual std::string get_name() const;
|
virtual std::string get_name() const;
|
||||||
virtual std::string get_engine() const;
|
virtual std::string get_engine() const;
|
||||||
|
|
||||||
static config preparse_cfg(ai_context& ctx, const config& cfg);
|
static config preparse_cfg(ai_context& ctx, const config& cfg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -147,7 +147,7 @@ readonly_context& engine::get_readonly_context()
|
||||||
{
|
{
|
||||||
return ai_;
|
return ai_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is defined in the source file so that it can easily access the logger
|
// This is defined in the source file so that it can easily access the logger
|
||||||
bool engine_factory::is_duplicate(const std::string& name)
|
bool engine_factory::is_duplicate(const std::string& name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -244,7 +244,7 @@ bool configuration::parse_side_config(side_number side, const config& original_c
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::set<std::string> non_aspect_attributes {"turns", "time_of_day", "engine", "ai_algorithm", "id", "description"};
|
static const std::set<std::string> non_aspect_attributes {"turns", "time_of_day", "engine", "ai_algorithm", "id", "description"};
|
||||||
static const std::set<std::string> just_copy_tags {"engine", "stage", "aspect", "goal", "modify_ai"};
|
static const std::set<std::string> just_copy_tags {"engine", "stage", "aspect", "goal", "modify_ai"};
|
||||||
static const std::set<std::string> old_goal_tags {"target", "target_location", "protect_unit", "protect_location"};
|
static const std::set<std::string> old_goal_tags {"target", "target_location", "protect_unit", "protect_location"};
|
||||||
|
|
|
@ -802,7 +802,7 @@ static int impl_ai_aspect_get(lua_State* L)
|
||||||
if(iter == aspects.end()) {
|
if(iter == aspects.end()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::vector<std::string> string_list;
|
typedef std::vector<std::string> string_list;
|
||||||
if(typesafe_aspect<bool>* aspect_as_bool = try_aspect_as<bool>(iter->second)) {
|
if(typesafe_aspect<bool>* aspect_as_bool = try_aspect_as<bool>(iter->second)) {
|
||||||
lua_pushboolean(L, aspect_as_bool->get());
|
lua_pushboolean(L, aspect_as_bool->get());
|
||||||
|
@ -1036,20 +1036,20 @@ lua_ai_context* lua_ai_context::create(lua_State *L, char const *code, ai::engin
|
||||||
void lua_ai_context::update_state()
|
void lua_ai_context::update_state()
|
||||||
{
|
{
|
||||||
lua_ai_load ctx(*this, true); // [-1: AI state table]
|
lua_ai_load ctx(*this, true); // [-1: AI state table]
|
||||||
|
|
||||||
// Load the AI code and arguments
|
// Load the AI code and arguments
|
||||||
lua_getfield(L, -1, "update_self"); // [-1: AI code -2: AI state]
|
lua_getfield(L, -1, "update_self"); // [-1: AI code -2: AI state]
|
||||||
lua_getfield(L, -2, "params"); // [-1: Arguments -2: AI code -3: AI state]
|
lua_getfield(L, -2, "params"); // [-1: Arguments -2: AI code -3: AI state]
|
||||||
lua_getfield(L, -3, "data"); // [-1: Persistent data -2: Arguments -3: AI code -4: AI state]
|
lua_getfield(L, -3, "data"); // [-1: Persistent data -2: Arguments -3: AI code -4: AI state]
|
||||||
|
|
||||||
// Call the function
|
// Call the function
|
||||||
if (!luaW_pcall(L, 2, 1, true)) { // [-1: Result -2: AI state]
|
if (!luaW_pcall(L, 2, 1, true)) { // [-1: Result -2: AI state]
|
||||||
return; // return with stack size 0 []
|
return; // return with stack size 0 []
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the state for use by components
|
// Store the state for use by components
|
||||||
lua_setfield(L, -2, "self"); // [-1: AI state]
|
lua_setfield(L, -2, "self"); // [-1: AI state]
|
||||||
|
|
||||||
// And return with empty stack.
|
// And return with empty stack.
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
@ -1100,7 +1100,7 @@ lua_ai_load::lua_ai_load(lua_ai_context& ctx, bool read_only) : L(ctx.L), was_re
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, aisKey); // [-1: AI registry]
|
lua_getfield(L, LUA_REGISTRYINDEX, aisKey); // [-1: AI registry]
|
||||||
lua_rawgeti(L, -1, ctx.num_); // [-1: AI state -2: AI registry]
|
lua_rawgeti(L, -1, ctx.num_); // [-1: AI state -2: AI registry]
|
||||||
lua_remove(L,-2); // [-1: AI state]
|
lua_remove(L,-2); // [-1: AI state]
|
||||||
|
|
||||||
// Load the AI functions table into global scope
|
// Load the AI functions table into global scope
|
||||||
lua_getfield(L, -1, "ai"); // [-1: AI functions -2: AI state]
|
lua_getfield(L, -1, "ai"); // [-1: AI functions -2: AI state]
|
||||||
lua_pushstring(L, "read_only"); // [-1: key -2: AI functions -3: AI state]
|
lua_pushstring(L, "read_only"); // [-1: key -2: AI functions -3: AI state]
|
||||||
|
@ -1138,7 +1138,7 @@ lua_ai_context::~lua_ai_context()
|
||||||
void lua_ai_action_handler::handle(const config &cfg, bool read_only, lua_object_ptr l_obj)
|
void lua_ai_action_handler::handle(const config &cfg, bool read_only, lua_object_ptr l_obj)
|
||||||
{
|
{
|
||||||
int initial_top = lua_gettop(L);//get the old stack size
|
int initial_top = lua_gettop(L);//get the old stack size
|
||||||
|
|
||||||
// Load the context
|
// Load the context
|
||||||
lua_ai_load ctx(context_, read_only); // [-1: AI state table]
|
lua_ai_load ctx(context_, read_only); // [-1: AI state table]
|
||||||
|
|
||||||
|
@ -1146,13 +1146,13 @@ void lua_ai_action_handler::handle(const config &cfg, bool read_only, lua_object
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, aisKey); // [-1: AI registry -2: AI state]
|
lua_getfield(L, LUA_REGISTRYINDEX, aisKey); // [-1: AI registry -2: AI state]
|
||||||
lua_rawgeti(L, -1, num_); // [-1: AI action -2: AI registry -3: AI state]
|
lua_rawgeti(L, -1, num_); // [-1: AI action -2: AI registry -3: AI state]
|
||||||
lua_remove(L, -2); // [-1: AI action -2: AI state]
|
lua_remove(L, -2); // [-1: AI action -2: AI state]
|
||||||
|
|
||||||
// Load the arguments
|
// Load the arguments
|
||||||
int iState = lua_absindex(L, -2);
|
int iState = lua_absindex(L, -2);
|
||||||
lua_getfield(L, iState, "self");
|
lua_getfield(L, iState, "self");
|
||||||
luaW_pushconfig(L, cfg);
|
luaW_pushconfig(L, cfg);
|
||||||
lua_getfield(L, iState, "data");
|
lua_getfield(L, iState, "data");
|
||||||
|
|
||||||
// Call the function
|
// Call the function
|
||||||
luaW_pcall(L, 3, l_obj ? 1 : 0, true);
|
luaW_pcall(L, 3, l_obj ? 1 : 0, true);
|
||||||
if (l_obj) {
|
if (l_obj) {
|
||||||
|
|
|
@ -32,10 +32,10 @@ namespace ai {
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// MSVC fails to compile without this line
|
// MSVC fails to compile without this line
|
||||||
template class lua_object<aspect_attacks_lua_filter>;
|
template class lua_object<aspect_attacks_lua_filter>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
std::shared_ptr<aspect_attacks_lua_filter> lua_object<aspect_attacks_lua_filter>::to_type(lua_State *L, int n)
|
std::shared_ptr<aspect_attacks_lua_filter> lua_object<aspect_attacks_lua_filter>::to_type(lua_State *L, int n)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ template<typename Map, typename Key>
|
||||||
typename Map::mapped_type& map_get(Map& map, Key&& key)
|
typename Map::mapped_type& map_get(Map& map, Key&& key)
|
||||||
{
|
{
|
||||||
auto res = map.lower_bound(key);
|
auto res = map.lower_bound(key);
|
||||||
|
|
||||||
if (res == map.end() || key != res->first) {
|
if (res == map.end() || key != res->first) {
|
||||||
res = map.emplace_hint(res, std::piecewise_construct, std::forward_as_tuple(key), std::tuple<>());
|
res = map.emplace_hint(res, std::piecewise_construct, std::forward_as_tuple(key), std::tuple<>());
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ void config::splice_children(config &src, const std::string &key)
|
||||||
|
|
||||||
child_list &dst = map_get(children_, key);
|
child_list &dst = map_get(children_, key);
|
||||||
child_map::iterator i_dst = children_.find(key);
|
child_map::iterator i_dst = children_.find(key);
|
||||||
|
|
||||||
unsigned before = dst.size();
|
unsigned before = dst.size();
|
||||||
dst.insert(dst.end(), std::make_move_iterator(i_src->second.begin()), std::make_move_iterator(i_src->second.end()));
|
dst.insert(dst.end(), std::make_move_iterator(i_src->second.begin()), std::make_move_iterator(i_src->second.end()));
|
||||||
src.children_.erase(i_src);
|
src.children_.erase(i_src);
|
||||||
|
@ -580,7 +580,7 @@ config::attribute_value& config::operator[](config_key_type key)
|
||||||
check_valid();
|
check_valid();
|
||||||
|
|
||||||
auto res = values_.lower_bound(key);
|
auto res = values_.lower_bound(key);
|
||||||
|
|
||||||
if (res == values_.end() || key != res->first) {
|
if (res == values_.end() || key != res->first) {
|
||||||
res = values_.emplace_hint(res, std::piecewise_construct, std::forward_as_tuple(key), std::tuple<>());
|
res = values_.emplace_hint(res, std::piecewise_construct, std::forward_as_tuple(key), std::tuple<>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 - 2017 by Mark de Wever <koraq@xs4all.nl>
|
* Copyright (C) 2008 - 2017 by Mark de Wever <koraq@xs4all.nl>
|
||||||
* Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
* Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY.
|
* but WITHOUT ANY WARRANTY.
|
||||||
*
|
*
|
||||||
* See the COPYING file for more details.
|
* See the COPYING file for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ class key_value_pair : public formula_callable {
|
||||||
void get_inputs(formula_input_vector& inputs) const override;
|
void get_inputs(formula_input_vector& inputs) const override;
|
||||||
public:
|
public:
|
||||||
explicit key_value_pair(const variant& key, const variant& value) : key_(key), value_(value) {}
|
explicit key_value_pair(const variant& key, const variant& value) : key_(key), value_(value) {}
|
||||||
|
|
||||||
void serialize_to_string(std::string& str) const override;
|
void serialize_to_string(std::string& str) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ struct transient_end_level{
|
||||||
bool carryover_report; /**< Should a summary of the scenario outcome be displayed? */
|
bool carryover_report; /**< Should a summary of the scenario outcome be displayed? */
|
||||||
bool linger_mode; /**< Should linger mode be invoked? */
|
bool linger_mode; /**< Should linger mode be invoked? */
|
||||||
bool reveal_map; /**< Should we reveal map when game is ended? (Multiplayer only) */
|
bool reveal_map; /**< Should we reveal map when game is ended? (Multiplayer only) */
|
||||||
|
|
||||||
void write(config& cfg) const;
|
void write(config& cfg) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ WML_HANDLER_FUNCTION(do_command,, cfg)
|
||||||
if(!resources::controller->current_team().is_local() && synced_context::get_synced_state() == synced_context::UNSYNCED)
|
if(!resources::controller->current_team().is_local() && synced_context::get_synced_state() == synced_context::UNSYNCED)
|
||||||
{
|
{
|
||||||
ERR_NG << "[do_command] can only be used from clients that control the currently playing side" << std::endl;
|
ERR_NG << "[do_command] can only be used from clients that control the currently playing side" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(vconfig::all_children_iterator i = cfg.ordered_begin(); i != cfg.ordered_end(); ++i)
|
for(vconfig::all_children_iterator i = cfg.ordered_begin(); i != cfg.ordered_end(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -312,7 +312,7 @@ void wml_menu_item::update(const vconfig & vcfg)
|
||||||
hotkey_updated = true;
|
hotkey_updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( vcfg.has_attribute("needs_select") ) {
|
if ( vcfg.has_attribute("needs_select") ) {
|
||||||
ERR_NG << "needs_select= is deprecated\n";
|
ERR_NG << "needs_select= is deprecated\n";
|
||||||
needs_select_ = vcfg["needs_select"].to_bool();
|
needs_select_ = vcfg["needs_select"].to_bool();
|
||||||
}
|
}
|
||||||
|
|
|
@ -995,7 +995,7 @@ config side_engine::new_config() const
|
||||||
{
|
{
|
||||||
config res = cfg_;
|
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 constuctor later.
|
||||||
res["side"] = index_ + 1;
|
res["side"] = index_ + 1;
|
||||||
|
|
||||||
// If the user is allowed to change type, faction, leader etc, then import their new values in the config.
|
// If the user is allowed to change type, faction, leader etc, then import their new values in the config.
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace
|
||||||
*
|
*
|
||||||
* This works since this click_callback function is called before widgets' left-button-up handlers.
|
* This works since this click_callback function is called before widgets' left-button-up handlers.
|
||||||
*
|
*
|
||||||
* Additionally, this is done before row deselection so selecting/deselecting a toggle button doesn't also leave
|
* Additionally, this is done before row deselection so selecting/deselecting a toggle button doesn't also leave
|
||||||
* the list with no row visually selected. Oddly, the visial deselection doesn't seem to cause any crashes, and
|
* the list with no row visually selected. Oddly, the visial deselection doesn't seem to cause any crashes, and
|
||||||
* the previously selected row is reselected when the menu is opened again. Still, it's odd to see your selection
|
* the previously selected row is reselected when the menu is opened again. Still, it's odd to see your selection
|
||||||
* vanish.
|
* vanish.
|
||||||
|
|
|
@ -132,7 +132,7 @@ void loading_screen::pre_show(window& window)
|
||||||
cursor_setter_.reset(new cursor::setter(cursor::WAIT));
|
cursor_setter_.reset(new cursor::setter(cursor::WAIT));
|
||||||
progress_stage_label_ = &find_widget<label>(&window, "status", false);
|
progress_stage_label_ = &find_widget<label>(&window, "status", false);
|
||||||
animation_label_ = &find_widget<label>(&window, "test_animation", false);
|
animation_label_ = &find_widget<label>(&window, "test_animation", false);
|
||||||
|
|
||||||
window.set_enter_disabled(true);
|
window.set_enter_disabled(true);
|
||||||
window.set_escape_disabled(true);
|
window.set_escape_disabled(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class network_transmission : public modal_dialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//A wrapper of either a wesnothd_connection or a network_asio::connection
|
//A wrapper of either a wesnothd_connection or a network_asio::connection
|
||||||
class connection_data
|
class connection_data
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual size_t total() { return 0; }
|
virtual size_t total() { return 0; }
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
const bool have_campaign_options = std::any_of(campaign_mods.begin(), campaign_mods.end(), [](config& mod) {
|
const bool have_campaign_options = std::any_of(campaign_mods.begin(), campaign_mods.end(), [](config& mod) {
|
||||||
return !mod.empty();
|
return !mod.empty();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check active mod options.
|
// Check active mod options.
|
||||||
bool have_mod_options = false;
|
bool have_mod_options = false;
|
||||||
|
|
||||||
|
|
|
@ -254,7 +254,7 @@ void title_screen::pre_show(window& win)
|
||||||
//
|
//
|
||||||
if(game_config::images::game_title.empty()) {
|
if(game_config::images::game_title.empty()) {
|
||||||
ERR_CF << "No title image defined" << std::endl;
|
ERR_CF << "No title image defined" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
win.get_canvas(0).set_variable("title_image", wfl::variant(game_config::images::game_title));
|
win.get_canvas(0).set_variable("title_image", wfl::variant(game_config::images::game_title));
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ void unit_advance::pre_show(window& window)
|
||||||
string_map column;
|
string_map column;
|
||||||
|
|
||||||
std::string image_string, name = sample.type_name();
|
std::string image_string, name = sample.type_name();
|
||||||
|
|
||||||
// This checks if we've finished iterating over the last unit type advancements
|
// This checks if we've finished iterating over the last unit type advancements
|
||||||
// and are into the modification-based advancements.
|
// and are into the modification-based advancements.
|
||||||
if(i >= last_real_advancement_) {
|
if(i >= last_real_advancement_) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ void one_item::set_item_shown(const unsigned index, const bool show)
|
||||||
do_deselect_item(index);
|
do_deselect_item(index);
|
||||||
|
|
||||||
for(unsigned i = 1; i < get_item_count(); ++i) {
|
for(unsigned i = 1; i < get_item_count(); ++i) {
|
||||||
unsigned new_index = (index + i) % get_item_count();
|
unsigned new_index = (index + i) % get_item_count();
|
||||||
if(get_item_shown(new_index)) {
|
if(get_item_shown(new_index)) {
|
||||||
do_select_item(new_index);
|
do_select_item(new_index);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param type the id of the [page_definition] that shoduol be used
|
* @param type the id of the [page_definition] that shoduol be used
|
||||||
*
|
*
|
||||||
* @param insert_pos the position where th new page is inserted, usually
|
* @param insert_pos the position where th new page is inserted, usually
|
||||||
* -1 for 'at end'
|
* -1 for 'at end'
|
||||||
*
|
*
|
||||||
* @returns The grid of the newly added page.
|
* @returns The grid of the newly added page.
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param type the id of the [page_definition] that shoduol be used
|
* @param type the id of the [page_definition] that shoduol be used
|
||||||
*
|
*
|
||||||
* @param insert_pos the position where th new page is inserted, usually
|
* @param insert_pos the position where th new page is inserted, usually
|
||||||
* -1 for 'at end'
|
* -1 for 'at end'
|
||||||
*
|
*
|
||||||
* @returns The grid of the newly added page.
|
* @returns The grid of the newly added page.
|
||||||
|
|
|
@ -137,8 +137,8 @@ repeating_button::signal_handler_left_button_down(const event::ui_event event,
|
||||||
window* window = get_window();
|
window* window = get_window();
|
||||||
if(window) {
|
if(window) {
|
||||||
repeat_timer_ = add_timer(settings::repeat_button_repeat_time,
|
repeat_timer_ = add_timer(settings::repeat_button_repeat_time,
|
||||||
[this, window](unsigned int) {
|
[this, window](unsigned int) {
|
||||||
window->fire(event::LEFT_BUTTON_DOWN, *this);
|
window->fire(event::LEFT_BUTTON_DOWN, *this);
|
||||||
},true);
|
},true);
|
||||||
|
|
||||||
window->mouse_capture();
|
window->mouse_capture();
|
||||||
|
|
|
@ -168,7 +168,7 @@ void stacked_widget::select_layer(const int layer)
|
||||||
{
|
{
|
||||||
update_selected_layer_index(layer);
|
update_selected_layer_index(layer);
|
||||||
|
|
||||||
select_layer_impl([this](unsigned int i)
|
select_layer_impl([this](unsigned int i)
|
||||||
{
|
{
|
||||||
return i == static_cast<unsigned int>(selected_layer_);
|
return i == static_cast<unsigned int>(selected_layer_);
|
||||||
});
|
});
|
||||||
|
|
|
@ -170,7 +170,7 @@ private:
|
||||||
|
|
||||||
template<tree_view_node* (tree_view_node::*func) ()>
|
template<tree_view_node* (tree_view_node::*func) ()>
|
||||||
tree_view_node* get_next_node();
|
tree_view_node* get_next_node();
|
||||||
|
|
||||||
template<tree_view_node* (tree_view_node::*func) ()>
|
template<tree_view_node* (tree_view_node::*func) ()>
|
||||||
bool handle_up_down_arrow();
|
bool handle_up_down_arrow();
|
||||||
};
|
};
|
||||||
|
|
|
@ -319,7 +319,7 @@ private:
|
||||||
virtual void impl_draw_children(surface& frame_buffer,
|
virtual void impl_draw_children(surface& frame_buffer,
|
||||||
int x_offset,
|
int x_offset,
|
||||||
int y_offset) override;
|
int y_offset) override;
|
||||||
|
|
||||||
/** See selectable_item::set_callback_state_change. */
|
/** See selectable_item::set_callback_state_change. */
|
||||||
std::function<void(widget&)> callback_state_change_;
|
std::function<void(widget&)> callback_state_change_;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ class halo_record
|
||||||
public:
|
public:
|
||||||
halo_record(const halo_record&) = delete;
|
halo_record(const halo_record&) = delete;
|
||||||
halo_record& operator=(const halo_record&) = delete;
|
halo_record& operator=(const halo_record&) = delete;
|
||||||
|
|
||||||
halo_record();
|
halo_record();
|
||||||
halo_record(int id, const std::shared_ptr<halo_impl> & my_manager);
|
halo_record(int id, const std::shared_ptr<halo_impl> & my_manager);
|
||||||
~halo_record();
|
~halo_record();
|
||||||
|
|
|
@ -471,7 +471,7 @@ bool mouse_handler::right_click_show_menu(int x, int y, const bool /*browse*/)
|
||||||
void mouse_handler::select_or_action(bool browse)
|
void mouse_handler::select_or_action(bool browse)
|
||||||
{
|
{
|
||||||
if (!pc_.get_map_const().on_board(last_hex_)){
|
if (!pc_.get_map_const().on_board(last_hex_)){
|
||||||
tooltips::click(drag_from_x_, drag_from_y_);
|
tooltips::click(drag_from_x_, drag_from_y_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg
|
||||||
ERR_NW << "unknown controller type issued from server on side drop: " << side_drop_c["controller"] << std::endl;
|
ERR_NW << "unknown controller type issued from server on side drop: " << side_drop_c["controller"] << std::endl;
|
||||||
throw ingame_wesnothd_error("");
|
throw ingame_wesnothd_error("");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctrl == team::CONTROLLER::AI) {
|
if (ctrl == team::CONTROLLER::AI) {
|
||||||
resources::gameboard->side_drop_to(side_drop, ctrl);
|
resources::gameboard->side_drop_to(side_drop, ctrl);
|
||||||
return restart ? PROCESS_RESTART_TURN:PROCESS_CONTINUE;
|
return restart ? PROCESS_RESTART_TURN:PROCESS_CONTINUE;
|
||||||
|
@ -297,7 +297,7 @@ turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg
|
||||||
|
|
||||||
if (action < control_change_options) {
|
if (action < control_change_options) {
|
||||||
// Grant control to selected ally
|
// Grant control to selected ally
|
||||||
|
|
||||||
{
|
{
|
||||||
// Server thinks this side is ours now so in case of error transferring side we have to make local state to same as what server thinks it is.
|
// Server thinks this side is ours now so in case of error transferring side we have to make local state to same as what server thinks it is.
|
||||||
resources::gameboard->side_drop_to(side_drop, team::CONTROLLER::HUMAN, team::PROXY_CONTROLLER::PROXY_IDLE);
|
resources::gameboard->side_drop_to(side_drop, team::CONTROLLER::HUMAN, team::PROXY_CONTROLLER::PROXY_IDLE);
|
||||||
|
|
|
@ -413,12 +413,12 @@ void replay::redo(const config& cfg, bool set_to_end)
|
||||||
base_->add_child() = cmd;
|
base_->add_child() = cmd;
|
||||||
}
|
}
|
||||||
if(set_to_end) {
|
if(set_to_end) {
|
||||||
//The engine does not execute related wml events so mark ad dpendent actions as handled
|
//The engine does not execute related wml events so mark ad dpendent actions as handled
|
||||||
base_->set_to_end();
|
base_->set_to_end();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//The engine does execute related wml events so it needs to reprocess depndent choices
|
//The engine does execute related wml events so it needs to reprocess depndent choices
|
||||||
base_->set_pos(old_pos + 1);
|
base_->set_pos(old_pos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ public:
|
||||||
{
|
{
|
||||||
return load_data_;
|
return load_data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** GUI Dialog sequence which confirms attempts to load saves from previous game versions. */
|
/** GUI Dialog sequence which confirms attempts to load saves from previous game versions. */
|
||||||
static bool check_version_compatibility(const version_info & version, CVideo & video);
|
static bool check_version_compatibility(const version_info & version, CVideo & video);
|
||||||
|
|
||||||
|
|
|
@ -638,11 +638,11 @@ bool luaW_tolocation(lua_State *L, int index, map_location& loc) {
|
||||||
// Need this special check because luaW_tovconfig returns true in this case
|
// Need this special check because luaW_tovconfig returns true in this case
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
vconfig dummy_vcfg = vconfig::unconstructed_vconfig();
|
vconfig dummy_vcfg = vconfig::unconstructed_vconfig();
|
||||||
|
|
||||||
index = lua_absindex(L, index);
|
index = lua_absindex(L, index);
|
||||||
|
|
||||||
if (lua_istable(L, index) || luaW_tounit(L, index) || luaW_tovconfig(L, index, dummy_vcfg)) {
|
if (lua_istable(L, index) || luaW_tounit(L, index) || luaW_tovconfig(L, index, dummy_vcfg)) {
|
||||||
map_location result;
|
map_location result;
|
||||||
int x_was_num = 0, y_was_num = 0;
|
int x_was_num = 0, y_was_num = 0;
|
||||||
|
|
|
@ -142,7 +142,7 @@ int intf_have_file(lua_State *L)
|
||||||
int intf_read_file(lua_State *L)
|
int intf_read_file(lua_State *L)
|
||||||
{
|
{
|
||||||
std::string p = luaL_checkstring(L, 1);
|
std::string p = luaL_checkstring(L, 1);
|
||||||
|
|
||||||
if(!resolve_filename(p, get_calling_file(L))) {
|
if(!resolve_filename(p, get_calling_file(L))) {
|
||||||
return luaL_argerror(L, -1, "file not found");
|
return luaL_argerror(L, -1, "file not found");
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ int intf_read_file(lua_State *L)
|
||||||
luaL_Buffer b;
|
luaL_Buffer b;
|
||||||
luaL_buffinit(L, &b);
|
luaL_buffinit(L, &b);
|
||||||
//throws an exception if malloc failed.
|
//throws an exception if malloc failed.
|
||||||
char* out = luaL_prepbuffsize(&b, size);
|
char* out = luaL_prepbuffsize(&b, size);
|
||||||
fs->read(out, size);
|
fs->read(out, size);
|
||||||
if(fs->good()) {
|
if(fs->good()) {
|
||||||
luaL_addsize(&b, size);
|
luaL_addsize(&b, size);
|
||||||
|
@ -232,7 +232,7 @@ int load_file(lua_State *L)
|
||||||
{
|
{
|
||||||
std::string p = luaL_checkstring(L, -1);
|
std::string p = luaL_checkstring(L, -1);
|
||||||
std::string rel;
|
std::string rel;
|
||||||
|
|
||||||
if(!resolve_filename(p, get_calling_file(L), &rel)) {
|
if(!resolve_filename(p, get_calling_file(L), &rel)) {
|
||||||
return luaL_argerror(L, -1, "file not found");
|
return luaL_argerror(L, -1, "file not found");
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ static int intf_find_path(lua_State *L)
|
||||||
src.set_wml_y(luaL_checkinteger(L, 2));
|
src.set_wml_y(luaL_checkinteger(L, 2));
|
||||||
dst.set_wml_x(luaL_checkinteger(L, 3));
|
dst.set_wml_x(luaL_checkinteger(L, 3));
|
||||||
dst.set_wml_y(luaL_checkinteger(L, 4));
|
dst.set_wml_y(luaL_checkinteger(L, 4));
|
||||||
if(lua_isfunction(L, arg)) {
|
if(lua_isfunction(L, arg)) {
|
||||||
const char *msg = lua_pushfstring(L, "%s expected, got %s", lua_typename(L, LUA_TFUNCTION), luaL_typename(L, 5));
|
const char *msg = lua_pushfstring(L, "%s expected, got %s", lua_typename(L, LUA_TFUNCTION), luaL_typename(L, 5));
|
||||||
return luaL_argerror(L, 5, msg);
|
return luaL_argerror(L, 5, msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,7 +282,7 @@ namespace {
|
||||||
, const std::string& id)
|
, const std::string& id)
|
||||||
{
|
{
|
||||||
for(const resolution& resolution : resolutions) {
|
for(const resolution& resolution : resolutions) {
|
||||||
|
|
||||||
CVideo& video = test_utils::get_fake_display(resolution.first, resolution.second).video();
|
CVideo& video = test_utils::get_fake_display(resolution.first, resolution.second).video();
|
||||||
|
|
||||||
std::vector<std::string>& list =
|
std::vector<std::string>& list =
|
||||||
|
@ -802,13 +802,13 @@ struct wesnothd_connection_init
|
||||||
wesnothd_connection_init(wesnothd_connection& conn)
|
wesnothd_connection_init(wesnothd_connection& conn)
|
||||||
{
|
{
|
||||||
//Swallow the 'cannot connect' execption so that the connection object doesn't throw while we test the dialog.
|
//Swallow the 'cannot connect' execption so that the connection object doesn't throw while we test the dialog.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while (true) {
|
while (true) {
|
||||||
conn.poll();
|
conn.poll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2008 - 2017
|
Copyright (C) 2008 - 2017
|
||||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY.
|
but WITHOUT ANY WARRANTY.
|
||||||
|
|
||||||
See the COPYING file for more details.
|
See the COPYING file for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class mock_char : public formula_callable {
|
||||||
} else if(key == "agility") {
|
} else if(key == "agility") {
|
||||||
return variant(12);
|
return variant(12);
|
||||||
}
|
}
|
||||||
|
|
||||||
return variant(10);
|
return variant(10);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -46,7 +46,7 @@ class mock_party : public formula_callable {
|
||||||
for(int n = 0; n != 3; ++n) {
|
for(int n = 0; n != 3; ++n) {
|
||||||
members.emplace_back(i_[n].fake_ptr());
|
members.emplace_back(i_[n].fake_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
return variant(members);
|
return variant(members);
|
||||||
} else if(key == "char") {
|
} else if(key == "char") {
|
||||||
return variant(c_.fake_ptr());
|
return variant(c_.fake_ptr());
|
||||||
|
@ -54,10 +54,10 @@ class mock_party : public formula_callable {
|
||||||
return variant(0);
|
return variant(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mock_char c_;
|
mock_char c_;
|
||||||
mutable map_formula_callable i_[3];
|
mutable map_formula_callable i_[3];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
mock_party() {}
|
mock_party() {}
|
||||||
};
|
};
|
||||||
|
@ -71,16 +71,16 @@ BOOST_AUTO_TEST_CASE(test_formula_basic_arithmetic)
|
||||||
{
|
{
|
||||||
BOOST_CHECK_EQUAL(formula("strength").evaluate(c).as_int(), 15);
|
BOOST_CHECK_EQUAL(formula("strength").evaluate(c).as_int(), 15);
|
||||||
BOOST_CHECK_EQUAL(formula("17").evaluate().as_int(), 17);
|
BOOST_CHECK_EQUAL(formula("17").evaluate().as_int(), 17);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("strength/2 + agility").evaluate(c).as_int(), 19);
|
BOOST_CHECK_EQUAL(formula("strength/2 + agility").evaluate(c).as_int(), 19);
|
||||||
BOOST_CHECK_EQUAL(formula("(strength+agility)/2").evaluate(c).as_int(), 13);
|
BOOST_CHECK_EQUAL(formula("(strength+agility)/2").evaluate(c).as_int(), 13);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("20 % 3").evaluate().as_int(), 2);
|
BOOST_CHECK_EQUAL(formula("20 % 3").evaluate().as_int(), 2);
|
||||||
BOOST_CHECK_EQUAL(formula("19.5 % 3").evaluate().as_decimal(),
|
BOOST_CHECK_EQUAL(formula("19.5 % 3").evaluate().as_decimal(),
|
||||||
static_cast<int>(1000.0 * 1.5));
|
static_cast<int>(1000.0 * 1.5));
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("-5").evaluate().as_int(), -5);
|
BOOST_CHECK_EQUAL(formula("-5").evaluate().as_int(), -5);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("4^2").evaluate().as_int(), 16);
|
BOOST_CHECK_EQUAL(formula("4^2").evaluate().as_int(), 16);
|
||||||
BOOST_CHECK_EQUAL(formula("2+3^3").evaluate().as_int(), 29);
|
BOOST_CHECK_EQUAL(formula("2+3^3").evaluate().as_int(), 29);
|
||||||
BOOST_CHECK_EQUAL(formula("2*3^3+2").evaluate().as_int(), 56);
|
BOOST_CHECK_EQUAL(formula("2*3^3+2").evaluate().as_int(), 56);
|
||||||
|
@ -93,14 +93,14 @@ BOOST_AUTO_TEST_CASE(test_formula_basic_logic)
|
||||||
{
|
{
|
||||||
BOOST_CHECK_EQUAL(formula("strength > 12").evaluate(c).as_int(), 1);
|
BOOST_CHECK_EQUAL(formula("strength > 12").evaluate(c).as_int(), 1);
|
||||||
BOOST_CHECK_EQUAL(formula("strength > 18").evaluate(c).as_int(), 0);
|
BOOST_CHECK_EQUAL(formula("strength > 18").evaluate(c).as_int(), 0);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("if(strength > 12, 7, 2)").evaluate(c).as_int(), 7);
|
BOOST_CHECK_EQUAL(formula("if(strength > 12, 7, 2)").evaluate(c).as_int(), 7);
|
||||||
BOOST_CHECK_EQUAL(formula("if(strength > 18, 7, 2)").evaluate(c).as_int(), 2);
|
BOOST_CHECK_EQUAL(formula("if(strength > 18, 7, 2)").evaluate(c).as_int(), 2);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("2 and 1").evaluate().as_int(), 1);
|
BOOST_CHECK_EQUAL(formula("2 and 1").evaluate().as_int(), 1);
|
||||||
BOOST_CHECK_EQUAL(formula("2 and 0").evaluate().as_int(), 0);
|
BOOST_CHECK_EQUAL(formula("2 and 0").evaluate().as_int(), 0);
|
||||||
BOOST_CHECK_EQUAL(formula("2 or 0").evaluate().as_int(), 2);
|
BOOST_CHECK_EQUAL(formula("2 or 0").evaluate().as_int(), 2);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("not 5").evaluate().as_int(), 0);
|
BOOST_CHECK_EQUAL(formula("not 5").evaluate().as_int(), 0);
|
||||||
BOOST_CHECK_EQUAL(formula("not 0").evaluate().as_int(), 1);
|
BOOST_CHECK_EQUAL(formula("not 0").evaluate().as_int(), 1);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(test_formula_callable)
|
||||||
// I wasn't sure how to classify them.
|
// I wasn't sure how to classify them.
|
||||||
BOOST_CHECK_EQUAL(formula("char.strength").evaluate(p).as_int(), 15);
|
BOOST_CHECK_EQUAL(formula("char.strength").evaluate(p).as_int(), 15);
|
||||||
BOOST_CHECK_EQUAL(formula("choose(members,strength).strength").evaluate(p).as_int(), 16);
|
BOOST_CHECK_EQUAL(formula("choose(members,strength).strength").evaluate(p).as_int(), 16);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("char.sum([strength, agility, intelligence])").evaluate(p).as_int(), 37);
|
BOOST_CHECK_EQUAL(formula("char.sum([strength, agility, intelligence])").evaluate(p).as_int(), 37);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE(test_formula_where_clause)
|
||||||
{
|
{
|
||||||
BOOST_CHECK_EQUAL(formula("x*5 where x=1").evaluate().as_int(), 5);
|
BOOST_CHECK_EQUAL(formula("x*5 where x=1").evaluate().as_int(), 5);
|
||||||
BOOST_CHECK_EQUAL(formula("x*5 where x=2").evaluate().as_int(), 10);
|
BOOST_CHECK_EQUAL(formula("x*5 where x=2").evaluate().as_int(), 10);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("x*(a*b where a=2,b=1) where x=5").evaluate().as_int(), 10);
|
BOOST_CHECK_EQUAL(formula("x*(a*b where a=2,b=1) where x=5").evaluate().as_int(), 10);
|
||||||
BOOST_CHECK_EQUAL(formula("char.strength * ability where ability=3").evaluate(p).as_int(), 45);
|
BOOST_CHECK_EQUAL(formula("char.strength * ability where ability=3").evaluate(p).as_int(), 45);
|
||||||
}
|
}
|
||||||
|
@ -128,12 +128,12 @@ BOOST_AUTO_TEST_CASE(test_formula_strings)
|
||||||
{
|
{
|
||||||
BOOST_CHECK_EQUAL(formula("'abcd' = 'abcd'").evaluate().as_bool(), true);
|
BOOST_CHECK_EQUAL(formula("'abcd' = 'abcd'").evaluate().as_bool(), true);
|
||||||
BOOST_CHECK_EQUAL(formula("'abcd' = 'acd'").evaluate().as_bool(), false);
|
BOOST_CHECK_EQUAL(formula("'abcd' = 'acd'").evaluate().as_bool(), false);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("'ab' .. 'cd'").evaluate().as_string(), "abcd");
|
BOOST_CHECK_EQUAL(formula("'ab' .. 'cd'").evaluate().as_string(), "abcd");
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("'strength, agility: [strength], [agility]'").evaluate(c).as_string(),
|
BOOST_CHECK_EQUAL(formula("'strength, agility: [strength], [agility]'").evaluate(c).as_string(),
|
||||||
"strength, agility: 15, 12");
|
"strength, agility: 15, 12");
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("'String with [']quotes['] and [(]brackets[)]!'").evaluate().as_string(),
|
BOOST_CHECK_EQUAL(formula("'String with [']quotes['] and [(]brackets[)]!'").evaluate().as_string(),
|
||||||
"String with 'quotes' and [brackets]!");
|
"String with 'quotes' and [brackets]!");
|
||||||
BOOST_CHECK_EQUAL(formula("'String with ['embedded ' .. 'string']!'").evaluate().as_string(),
|
BOOST_CHECK_EQUAL(formula("'String with ['embedded ' .. 'string']!'").evaluate().as_string(),
|
||||||
|
@ -151,12 +151,12 @@ BOOST_AUTO_TEST_CASE(test_formula_containers) {
|
||||||
BOOST_CHECK_EQUAL(myarray[0].as_int(), 1);
|
BOOST_CHECK_EQUAL(myarray[0].as_int(), 1);
|
||||||
BOOST_CHECK_EQUAL(myarray[1].as_int(), 2);
|
BOOST_CHECK_EQUAL(myarray[1].as_int(), 2);
|
||||||
BOOST_CHECK_EQUAL(myarray[2].as_int(), 3);
|
BOOST_CHECK_EQUAL(myarray[2].as_int(), 3);
|
||||||
|
|
||||||
variant mydict = formula("['foo' -> 5, 'bar' ->7]").evaluate();
|
variant mydict = formula("['foo' -> 5, 'bar' ->7]").evaluate();
|
||||||
BOOST_CHECK_EQUAL(mydict.num_elements(), 2);
|
BOOST_CHECK_EQUAL(mydict.num_elements(), 2);
|
||||||
BOOST_CHECK_EQUAL(mydict[variant("foo")].as_int(), 5);
|
BOOST_CHECK_EQUAL(mydict[variant("foo")].as_int(), 5);
|
||||||
BOOST_CHECK_EQUAL(mydict[variant("bar")].as_int(), 7);
|
BOOST_CHECK_EQUAL(mydict[variant("bar")].as_int(), 7);
|
||||||
|
|
||||||
variant myrange = formula("-2~2").evaluate();
|
variant myrange = formula("-2~2").evaluate();
|
||||||
BOOST_CHECK_EQUAL(myrange.num_elements(), 5);
|
BOOST_CHECK_EQUAL(myrange.num_elements(), 5);
|
||||||
BOOST_CHECK_EQUAL(myrange[0].as_int(), -2);
|
BOOST_CHECK_EQUAL(myrange[0].as_int(), -2);
|
||||||
|
@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE(test_formula_containers) {
|
||||||
BOOST_CHECK_EQUAL(myrange[2].as_int(), 0);
|
BOOST_CHECK_EQUAL(myrange[2].as_int(), 0);
|
||||||
BOOST_CHECK_EQUAL(myrange[3].as_int(), 1);
|
BOOST_CHECK_EQUAL(myrange[3].as_int(), 1);
|
||||||
BOOST_CHECK_EQUAL(myrange[4].as_int(), 2);
|
BOOST_CHECK_EQUAL(myrange[4].as_int(), 2);
|
||||||
|
|
||||||
variant myslice = formula("(10~20)[[1,3,7,9]]").evaluate();
|
variant myslice = formula("(10~20)[[1,3,7,9]]").evaluate();
|
||||||
BOOST_CHECK_EQUAL(myslice.num_elements(), 4);
|
BOOST_CHECK_EQUAL(myslice.num_elements(), 4);
|
||||||
BOOST_CHECK_EQUAL(myslice[0].as_int(), 11);
|
BOOST_CHECK_EQUAL(myslice[0].as_int(), 11);
|
||||||
|
|
|
@ -149,16 +149,16 @@ BOOST_AUTO_TEST_CASE(test_formula_function_math)
|
||||||
BOOST_CHECK_EQUAL(formula("abs(-5)").evaluate().as_int(), 5);
|
BOOST_CHECK_EQUAL(formula("abs(-5)").evaluate().as_int(), 5);
|
||||||
BOOST_CHECK_EQUAL(formula("abs(5.0)").evaluate().as_int(), 5);
|
BOOST_CHECK_EQUAL(formula("abs(5.0)").evaluate().as_int(), 5);
|
||||||
BOOST_CHECK_EQUAL(formula("abs(-5.0)").evaluate().as_int(), 5);
|
BOOST_CHECK_EQUAL(formula("abs(-5.0)").evaluate().as_int(), 5);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("min(3,5)").evaluate().as_int(), 3);
|
BOOST_CHECK_EQUAL(formula("min(3,5)").evaluate().as_int(), 3);
|
||||||
BOOST_CHECK_EQUAL(formula("min(5,2)").evaluate().as_int(), 2);
|
BOOST_CHECK_EQUAL(formula("min(5,2)").evaluate().as_int(), 2);
|
||||||
BOOST_CHECK_EQUAL(formula("max(3,5)").evaluate().as_int(), 5);
|
BOOST_CHECK_EQUAL(formula("max(3,5)").evaluate().as_int(), 5);
|
||||||
BOOST_CHECK_EQUAL(formula("max(5,2)").evaluate().as_int(), 5);
|
BOOST_CHECK_EQUAL(formula("max(5,2)").evaluate().as_int(), 5);
|
||||||
BOOST_CHECK_EQUAL(formula("max(5.5,5)").evaluate().as_decimal(),
|
BOOST_CHECK_EQUAL(formula("max(5.5,5)").evaluate().as_decimal(),
|
||||||
static_cast<int>(1000.0 * 5.5));
|
static_cast<int>(1000.0 * 5.5));
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("max(4,5,[2,18,7])").evaluate().as_int(), 18);
|
BOOST_CHECK_EQUAL(formula("max(4,5,[2,18,7])").evaluate().as_int(), 18);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(formula("log(8,2)").evaluate().as_int(), 3);
|
BOOST_CHECK_EQUAL(formula("log(8,2)").evaluate().as_int(), 3);
|
||||||
BOOST_CHECK_EQUAL(formula("log(12)").evaluate().as_decimal(),
|
BOOST_CHECK_EQUAL(formula("log(12)").evaluate().as_decimal(),
|
||||||
static_cast<int>(round(1000.0 * log(12))));
|
static_cast<int>(round(1000.0 * log(12))));
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
* @param source the definition of the context-free grammar to use
|
* @param source the definition of the context-free grammar to use
|
||||||
*/
|
*/
|
||||||
context_free_grammar_generator(const std::string& source);
|
context_free_grammar_generator(const std::string& source);
|
||||||
|
|
||||||
/** Initialisation
|
/** Initialisation
|
||||||
* @param source A map of nonterminals to lists of possibilities
|
* @param source A map of nonterminals to lists of possibilities
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) by the Battle for Wesnoth Project http://www.wesnoth.org/
|
Copyright (C) by the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY.
|
but WITHOUT ANY WARRANTY.
|
||||||
|
|
||||||
See the COPYING file for more details.
|
See the COPYING file for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -43,47 +43,47 @@ namespace detail {
|
||||||
private:
|
private:
|
||||||
std::function<Ret(T...)> fcn;
|
std::function<Ret(T...)> fcn;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Ret, typename... T>
|
template<typename Ret, typename... T>
|
||||||
apply<Ret, T...> make_apply(std::function<Ret(T...)> fcn) {
|
apply<Ret, T...> make_apply(std::function<Ret(T...)> fcn) {
|
||||||
return apply<Ret, T...>(fcn);
|
return apply<Ret, T...>(fcn);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
struct function_base {
|
struct function_base {
|
||||||
using type = typename function_base<decltype(&F::operator())>::type;
|
using type = typename function_base<decltype(&F::operator())>::type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Ret, typename... P>
|
template<typename Ret, typename... P>
|
||||||
struct function_base<Ret(P...)> {
|
struct function_base<Ret(P...)> {
|
||||||
typedef Ret type(P...);
|
typedef Ret type(P...);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Ret, typename... P>
|
template<typename Ret, typename... P>
|
||||||
struct function_base<Ret(*)(P...)> {
|
struct function_base<Ret(*)(P...)> {
|
||||||
typedef Ret type(P...);
|
typedef Ret type(P...);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Ret, typename Class, typename... P>
|
template<typename Ret, typename Class, typename... P>
|
||||||
struct function_base<Ret(Class::*)(P...)> {
|
struct function_base<Ret(Class::*)(P...)> {
|
||||||
typedef Ret type(Class,P...);
|
typedef Ret type(Class,P...);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Ret, typename Class, typename... P>
|
template<typename Ret, typename Class, typename... P>
|
||||||
struct function_base<Ret(Class::*)(P...)const> {
|
struct function_base<Ret(Class::*)(P...)const> {
|
||||||
typedef Ret type(const Class,P...);
|
typedef Ret type(const Class,P...);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Ret, typename Class, typename... P>
|
template<typename Ret, typename Class, typename... P>
|
||||||
struct function_base<Ret(Class::*)(P...)volatile > {
|
struct function_base<Ret(Class::*)(P...)volatile > {
|
||||||
typedef Ret type(volatile Class,P...);
|
typedef Ret type(volatile Class,P...);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Ret, typename Class, typename... P>
|
template<typename Ret, typename Class, typename... P>
|
||||||
struct function_base<Ret(Class::*)(P...)const volatile> {
|
struct function_base<Ret(Class::*)(P...)const volatile> {
|
||||||
typedef Ret type(const volatile Class,P...);
|
typedef Ret type(const volatile Class,P...);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Ret, typename... P>
|
template<typename Ret, typename... P>
|
||||||
struct function_base<std::function<Ret(P...)>> {
|
struct function_base<std::function<Ret(P...)>> {
|
||||||
typedef Ret type(P...);
|
typedef Ret type(P...);
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2014 - 2017 by David White <dave@whitevine.net>
|
Copyright (C) 2014 - 2017 by David White <dave@whitevine.net>
|
||||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY.
|
but WITHOUT ANY WARRANTY.
|
||||||
|
|
||||||
See the COPYING file for more details.
|
See the COPYING file for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct wesnothd_error : public game::error
|
||||||
wesnothd_error(const std::string& error) : game::error(error) {}
|
wesnothd_error(const std::string& error) : game::error(error) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
///We received invalid data from wesnothd during a game
|
///We received invalid data from wesnothd during a game
|
||||||
///This means we cannot continue with the game but we can stay connected to wesnothd and start a new game
|
///This means we cannot continue with the game but we can stay connected to wesnothd and start a new game
|
||||||
///TODO: find a short name
|
///TODO: find a short name
|
||||||
struct ingame_wesnothd_error : public wesnothd_error ,public lua_jailbreak_exception
|
struct ingame_wesnothd_error : public wesnothd_error ,public lua_jailbreak_exception
|
||||||
|
|
Loading…
Add table
Reference in a new issue