20 #ifndef ACTIONS_VISION_H_INCLUDED
21 #define ACTIONS_VISION_H_INCLUDED
29 #include <boost/noncopyable.hpp>
37 class move_unit_spectator;
77 size_t viewer_id,
int sight_range,
bool slowed,
80 const std::set<map_location>* known_units =
nullptr,
81 size_t * enemy_count =
nullptr,
size_t * friend_count =
nullptr,
87 const std::set<map_location>* known_units =
nullptr,
88 size_t * enemy_count =
nullptr,
size_t * friend_count =
nullptr,
94 team &view_team,
bool instant)
95 {
return clear_unit(view_loc, viewer, view_team,
nullptr,
nullptr,
nullptr,
nullptr, instant); }
103 bool can_delay =
false,
bool invalidate =
true,
104 bool instant =
true);
128 bool check_units,
size_t &enemy_count,
size_t &friend_count,
153 bool clear_shroud(
int side,
bool reset_fog =
false,
bool fire_events =
true);
Class that stores the part of a unit's data that is needed for fog clearing.
Stores a set of terrain costs (for movement, vision, or "jamming").
std::vector< sight_data > sightings_
bool clear_unit(const map_location &view_loc, team &view_team, size_t viewer_id, int sight_range, bool slowed, const movetype::terrain_costs &costs, const map_location &real_loc, const std::set< map_location > *known_units=nullptr, size_t *enemy_count=nullptr, size_t *friend_count=nullptr, move_unit_spectator *spectator=nullptr, bool instant=true)
Clears shroud (and fog) around the provided location for view_team based on sight_range, costs, and slowed.
bool clear_unit(const map_location &view_loc, const unit &viewer, team &view_team, bool instant)
Clears shroud (and fog) around the provided location for view_team as if viewer was standing there...
bool actor_sighted(const unit &target, const std::vector< int > *cache)
Fires sighted events for the sides that can see target.
~shroud_clearer()
Destructor.
void record_sighting(const unit &seen, const map_location &seen_loc, size_t sighter_id, const map_location &sighter_loc)
Convenience wrapper for adding sighting data to the sightings_ vector.
clearer_info(const unit &viewer)
Constructor from a unit.
void calculate_jamming(const team *new_team)
Causes this object's "jamming" map to be recalculated.
bool clear_dest(const map_location &dest, const unit &viewer)
Clears shroud (and fog) at the provided location and its immediate neighbors.
bool clear_loc(team &tm, const map_location &loc, const map_location &view_loc, const map_location &event_non_loc, size_t viewer_id, bool check_units, size_t &enemy_count, size_t &friend_count, move_unit_spectator *spectator=nullptr)
Clears shroud from a single location.
This class stores all the data for a single 'side' (in game nomenclature).
void recalculate_fog(int side)
Function that recalculates the fog of war.
Encapsulates the map of the game.
void drop_events()
Erases the record of sighted events from earlier fog/shroud clearing.
bool clear_shroud(int side, bool reset_fog, bool fire_events)
Function that will clear shroud (and fog) based on current unit positions.
bool fire_events()
Fires the sighted events that were earlier recorded by fog/shroud clearing.
const team * view_team_
Keeps track of the team associated with jamming_.
void write(config &cfg) const
Writes to a config.
std::map< map_location, int > jamming_
void cache_units(const team *new_team=nullptr)
Function to be called if units have moved or otherwise changed.
Class to encapsulate fog/shroud clearing and the resultant sighted events.
movetype::terrain_costs costs
void invalidate_after_clear()
The invalidations that should occur after invoking clear_unit().
A config object defines a single node in a WML file, with access to child nodes.
shroud_clearer()
Default constructor.
std::vector< int > get_sides_not_seeing(const unit &target)
Returns the sides that cannot currently see target.