74 return unit.get_shared_ptr();
87 && u.side() ==
static_cast<int>(team_index+1)
100 if(u.can_recruit() && u.side() == team_num &&
dynamic_cast<game_state&
>(*resources::filter_con).
can_recruit_on(u, loc)) {
114 ERR_WB <<
"future_visible_unit cannot find unit, future unit map failed to build.";
124 if (unit && unit->
side() == on_side)
143 for(
const map_location& loc : std::pair(path.begin()+1,path.end())) {
174 if (!
t.get_side_actions()->empty())
189 for(std::size_t turn=0; !end; ++turn) {
195 function(iter->get());
206 std::size_t result_turn = std::numeric_limits<std::size_t>::max();
212 if(chall == actions.
end()) {
216 std::size_t chall_turn = actions.
get_turn(chall);
217 if(chall_turn < result_turn) {
219 result_turn = chall_turn;
bool enemy_zoc(const team ¤t_team, const map_location &loc, const team &viewing_team, bool see_all)
Determines if a given location is in an enemy zone of control.
container::iterator iterator
play_controller * controller
std::shared_ptr< wb::side_actions > get_side_actions() const
get the whiteboard planned actions for this team
bool team_has_visible_plan(team &t)
Returns whether a given team's plan is visible.
iterator end()
Returns the iterator for the position after the last executed action within the actions queue...
static display * get_singleton()
Returns the display object if a display object exists.
virtual const std::vector< team > & teams() const override
std::deque< action_ptr > find_actions_of(const unit &target)
Find the actions of an unit.
virtual const unit_map & units() const override
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
This class represents a single unit of a specific type.
int movement_cost(const t_translation::terrain_code &terrain) const
Get the unit's movement cost on a particular terrain.
void set_disabled_ghosted(bool with_bars=true)
Whiteboard related somehow.
bool can_recruit_on(const map_location &leader_loc, const map_location &recruit_loc, int side) const
Checks to see if a leader at leader_loc could recruit on recruit_loc.
std::shared_ptr< side_actions > side_actions_ptr
unit * find_recruiter(std::size_t team_index, const map_location &hex)
bool has_actions()
Return whether the whiteboard has actions.
virtual const gamemap & map() const override
temporary_unit_hider(unit &u)
std::size_t get_turn(const_iterator it) const
Returns the turn of a given iterator planned execution.
void unghost_owner_unit(unit *unit)
std::shared_ptr< const unit > unit_const_ptr
iterator find_first_action_at(map_location hex)
Find the first action occurring at a given hex.
This class stores all the data for a single 'side' (in game nomenclature).
const std::string & id() const
Gets this unit's id.
unit * get_visible_unit(const map_location &loc, const team ¤t_team, bool see_all=false)
Applies the planned unit map for the duration of the struct's life.
filter_context * filter_con
Encapsulates the map of the game.
std::shared_ptr< action > action_ptr
void set_hidden(bool state) const
Sets whether the unit is hidden on the map.
map_display and display: classes which take care of displaying the map and game-data on the screen...
void ghost_owner_unit(unit *unit)
void for_each_action(std::function< void(action *)> function, team_filter team_filter)
Apply a function to all the actions of the whiteboard.
iterator turn_begin(std::size_t turn_num)
Encapsulates the map of the game.
std::shared_ptr< wb::manager > whiteboard
Various functions related to the creation of units (recruits, recalls, and placed units)...
int path_cost(const std::vector< map_location > &path, const unit &u)
Computes the MP cost for u to travel path.
unit_animation_component & anim_comp() const
bool can_recruit() const
Whether this unit can recruit other units - ie, are they a leader unit.
unit_const_ptr find_backup_leader(const unit &leader)
For a given leader on a keep, find another leader on another keep in the same castle.
side_actions_ptr viewer_actions()
bool any_recruiter(int team_num, const map_location &loc, std::function< bool(unit &)> func)
executes func for each unti of side of side_num that can recruit on loc.
iterator turn_end(std::size_t turn_num)
std::function< bool(team &)> team_filter
Callable object class to filter teams.
const map_location & get_location() const
The current map location this unit is at.
std::size_t viewing_team() const
The viewing team is the team currently viewing the game.
int total_movement() const
The maximum moves this unit has.
unit * future_visible_unit(map_location hex, int viewer_side)
Applies the future unit map and.
int side() const
The side this unit belongs to.
void set_standing(bool with_bars=true)
Sets the animation state to standing.
std::size_t num_turns() const
Returns the number of turns that have plans.
bool owns_village(const map_location &loc) const
Abstract base class for all the whiteboard planned actions.
action_ptr find_action_at(map_location hex, team_filter team_filter)
Find the first action occurring on a given hex.
This internal whiteboard class holds the planned action queues for a team, and offers many utility me...
std::size_t viewer_team()
side_actions_ptr current_side_actions()