43 #include <boost/scoped_ptr.hpp>
46 #define DBG_NG LOG_STREAM(debug, log_engine)
47 #define LOG_NG LOG_STREAM(info, log_engine)
48 #define ERR_NG LOG_STREAM(err, log_engine)
51 : add_to_recall_(false)
57 , start_pos_(start_pos)
108 DBG_NG <<
"finding location for unit with id=["<<cfg[
"id"]<<
"] placement=["<<cfg[
"placement"]<<
"] x=["<<cfg[
"x"]<<
"] y=["<<cfg[
"y"]<<
"] for side " <<
team_.
side() <<
"\n";
110 std::vector<std::string> placements =
utils::split(cfg[
"placement"]);
112 placements.push_back(
"map");
113 placements.push_back(
"recall");
119 if ( place ==
"recall" ) {
123 else if ( place ==
"leader" || place ==
"leader_passable" ) {
126 if (leader.
valid()) {
127 loc = leader->get_location();
134 else if ( place ==
"map" || place.compare(0, 4,
"map_") == 0 ) {
142 const bool pass((place ==
"leader_passable") || (place ==
"map_passable"));
143 if ( place !=
"map_overwrite" ) {
145 pass ? pass_check :
nullptr,
nullptr,
board_);
164 bool animate = temp_cfg[
"animate"].to_bool();
169 if ( !recall_list_element ) {
176 LOG_NG <<
"inserting unit for side " << new_unit->side() <<
"\n";
182 DBG_NG <<
"inserting unit with id=["<<
id<<
"] on recall list for side " << new_unit->side() <<
"\n";
190 LOG_NG <<
"inserting unit from recall list for side " << recall_list_element->side()<<
" with id="<<
id <<
"\n";
196 LOG_NG <<
"wanted to insert unit on recall list, but recall list for side " << (cfg)[
"side"] <<
"already contains id=" <<
id<<
"\n";
211 bool animate = show && anim;
unit_creator & allow_rename_side(bool b)
void remove_attribute(const std::string &key)
virtual const unit_map & units() const
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
bool get_village(const map_location &loc, int side, bool *action_timebonus, bool fire_event)
Makes it so the village at the given location is owned by the given side.
static lg::log_domain log_engine("engine")
unit_creator & allow_invalidate(bool b)
unit_creator & allow_show(bool b)
unit_iterator find_leader(int side)
bool is_village(const map_location &loc) const
map_location find_vacant_tile(const map_location &loc, VACANT_TILE_TYPE vacancy, const unit *pass_check, const team *shroud_check, const game_board *board)
Function that will find a location on the board that is as near to loc as possible, but which is unoccupied by any units.
unit_creator & allow_discover(bool b)
bool fire(const std::string &event, const entity_location &loc1=entity_location::null_entity, const entity_location &loc2=entity_location::null_entity, const config &data=config())
Function to fire an event.
virtual void draw()
Draws invalidated items.
Definitions for the interface to Wesnoth Markup Language (WML).
unit_creator & allow_add_to_recall(bool b)
GLdouble GLdouble GLdouble b
const std::string & type_id() const
The id of the type of the unit.
This class stores all the data for a single 'side' (in game nomenclature).
unit_ptr find_if_matches_id(const std::string &unit_id)
Find a unit by id. Null pointer if not found.
const map_location start_pos_
static const map_location & null_location()
std::pair< unit_iterator, bool > replace(const map_location &l, const unit &u)
Works like unit_map::add; but l is emptied first, if needed.
game_events::manager * game_events
void erase_if_matches_id(const std::string &unit_id)
Erase any unit with this id.
void show(CVideo &video, const std::string &window_id, const t_string &message, const tpoint &mouse)
Shows a tip.
Encapsulates the map of the game.
Various functions related to moving units.
map_location special_location(const std::string &id) const
unit_creator & allow_get_village(bool b)
Various functions related to the creation of units (recruits, recalls, and placed units)...
Define the game's event mechanism.
std::set< std::string > & encountered_units()
game_events::t_pump & pump()
virtual const gamemap & map() const
bool on_board(const map_location &loc) const
Tell if a location is on the map.
void add_unit(const config &cfg, const vconfig *vcfg=nullptr)
adds a unit on map without firing any events (so, usable during team construction in gamestatus) ...
n_unit::id_manager & unit_id_manager()
map_location find_location(const config &cfg, const unit *pass_check=nullptr)
finds a suitable location for unit
void unit_recruited(const map_location &loc, const map_location &leader_loc)
A variable-expanding proxy for the config class.
Standard logging facilities (interface).
recall_list_manager & recall_list()
void add(const unit_ptr &ptr)
Add a unit to the list.
game_lua_kernel * lua_kernel
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
unit_iterator find(size_t id)
unit_creator(team &tm, const map_location &start_pos, game_board *board=nullptr)
void post_create(const map_location &loc, const unit &new_unit, bool anim)
A config object defines a single node in a WML file, with access to child nodes.
This module contains various pathfinding functions and utilities.
GLsizei const GLcharARB ** string
Display units performing various actions: moving, attacking, and dying.