37 class move_unit_spectator;
46 const team & view_team);
58 std::unique_ptr<movetype::terrain_costs>
costs;
98 std::size_t viewer_id,
int sight_range,
bool slowed,
101 const std::set<map_location>* known_units =
nullptr,
102 std::size_t * enemy_count =
nullptr, std::size_t * friend_count =
nullptr,
109 const unit &viewer,
team &view_team,
110 const std::set<map_location>* known_units =
nullptr,
111 std::size_t * enemy_count =
nullptr, std::size_t * friend_count =
nullptr,
119 team &view_team,
bool instant)
120 {
return clear_unit(view_loc, viewer, view_team,
nullptr,
nullptr,
nullptr,
nullptr, instant); }
132 bool can_delay =
false,
bool invalidate =
true,
133 bool instant =
true);
156 const map_location &event_non_loc, std::size_t viewer_id,
157 bool check_units, std::size_t &enemy_count, std::size_t &friend_count,
162 std::size_t sighter_id,
const map_location & sighter_loc);
182 bool clear_shroud(
int side,
bool reset_fog =
false,
bool fire_events =
true);
Class to encapsulate fog/shroud clearing and the resultant sighted events.
void record_sighting(const unit &seen, const map_location &seen_loc, std::size_t sighter_id, const map_location &sighter_loc)
Convenience wrapper for adding sighting data to the sightings_ vector.
bool clear_loc(team &tm, const map_location &loc, const map_location &view_loc, const map_location &event_non_loc, std::size_t viewer_id, bool check_units, std::size_t &enemy_count, std::size_t &friend_count, move_unit_spectator *spectator=nullptr)
Clears shroud from a single location.
void invalidate_after_clear()
The invalidations that should occur after invoking clear_unit().
shroud_clearer(const shroud_clearer &)=delete
shroud_clearer & operator=(const shroud_clearer &)=delete
void drop_events()
Erases the record of sighted events from earlier fog/shroud clearing.
const team * view_team_
Keeps track of the team associated with jamming_.
void calculate_jamming(const team *new_team)
Causes this object's "jamming" map to be recalculated.
std::vector< sight_data > sightings_
void cache_units(const team *new_team=nullptr)
Function to be called if units have moved or otherwise changed.
shroud_clearer()
Default constructor.
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.
~shroud_clearer()
Destructor.
std::map< map_location, int > jamming_
bool clear_dest(const map_location &dest, const unit &viewer)
Clears shroud (and fog) at the provided location and its immediate neighbors.
game_events::pump_result_t fire_events()
Fires the sighted events that were earlier recorded by fog/shroud clearing.
bool clear_unit(const map_location &view_loc, team &view_team, std::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, std::size_t *enemy_count=nullptr, std::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,...
A config object defines a single node in a WML file, with access to child nodes.
A const-only interface for how many (movement, vision, or "jamming") points a unit needs for each hex...
This class stores all the data for a single 'side' (in game nomenclature).
This class represents a single unit of a specific type.
std::vector< int > get_sides_not_seeing(const unit &target)
Returns the sides that cannot currently see target.
bool clear_shroud(int side, bool reset_fog, bool fire_events)
Function that will clear shroud (and fog) based on current unit positions.
game_events::pump_result_t actor_sighted(const unit &target, const std::vector< int > *cache)
Fires sighted events for the sides that can see target.
void create_jamming_map(std::map< map_location, int > &jamming, const team &view_team)
Helper function that creates the map of enemy anti-vision that's needed when creating a pathfinding::...
void recalculate_fog(int side)
Function that recalculates the fog of war.
std::tuple< bool, bool > pump_result_t
Class that stores the part of a unit's data that is needed for fog clearing.
void write(config &cfg) const
Writes to a config.
std::size_t underlying_id
clearer_info(const unit &viewer)
Constructor from a unit.
std::unique_ptr< movetype::terrain_costs > costs
costs is always non-null, all of the constructors initialize it
Encapsulates the map of the game.