The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Namespaces | Macros | Functions | Variables
vision.cpp File Reference

Sighting. More...

#include "vision.hpp"
#include "move.hpp"
#include "config.hpp"
#include "game_display.hpp"
#include "game_events/manager.hpp"
#include "game_events/pump.hpp"
#include "log.hpp"
#include "map/map.hpp"
#include "map/label.hpp"
#include "map/location.hpp"
#include "pathfind/pathfind.hpp"
#include "play_controller.hpp"
#include "resources.hpp"
#include "team.hpp"
#include "units/unit.hpp"
Include dependency graph for vision.cpp:

Go to the source code of this file.

Classes

struct  actions::shroud_clearer::sight_data
 A record of a sighting event. More...
 

Namespaces

 actions
 

Macros

#define DBG_NG   LOG_STREAM(debug, log_engine)
 
#define ERR_NG   LOG_STREAM(err, log_engine)
 

Functions

static const std::string sighted_str ("sighted")
 
static void create_jamming_map (std::map< map_location, int > &jamming, const team &view_team)
 Sets jamming to the (newly calculated) "jamming" map for view_team. More...
 
static bool can_see (const unit &viewer, const map_location &loc, const std::map< map_location, int > *jamming=nullptr)
 Determines if loc is within viewer's visual range. More...
 
std::vector< intactions::get_sides_not_seeing (const unit &target)
 Returns the sides that cannot currently see target. More...
 
bool actions::actor_sighted (const unit &target, const std::vector< int > *cache)
 Fires sighted events for the sides that can see target. More...
 
void actions::recalculate_fog (int side)
 Function that recalculates the fog of war. More...
 
bool actions::clear_shroud (int side, bool reset_fog, bool fire_events)
 Function that will clear shroud (and fog) based on current unit positions. More...
 

Variables

static lg::log_domain log_engine ("engine")
 

Detailed Description

Sighting.

Definition in file vision.cpp.

Macro Definition Documentation

#define DBG_NG   LOG_STREAM(debug, log_engine)

Definition at line 41 of file vision.cpp.

Referenced by actions::shroud_clearer::drop_events().

#define ERR_NG   LOG_STREAM(err, log_engine)

Definition at line 42 of file vision.cpp.

Referenced by actions::shroud_clearer::~shroud_clearer().

Function Documentation

static bool can_see ( const unit viewer,
const map_location loc,
const std::map< map_location, int > *  jamming = nullptr 
)
static

Determines if loc is within viewer's visual range.

This is a moderately expensive function (vision is recalculated with each call), so avoid using it heavily. If jamming is left as nullptr, the jamming map is also calculated with each invocation.

Definition at line 79 of file vision.cpp.

References pathfind::paths::dest_vect::contains(), create_jamming_map(), pathfind::paths::destinations, unit::get_location(), unit::side(), and resources::teams.

Referenced by actions::actor_sighted().

static void create_jamming_map ( std::map< map_location, int > &  jamming,
const team view_team 
)
static

Sets jamming to the (newly calculated) "jamming" map for view_team.

Definition at line 51 of file vision.cpp.

References pathfind::paths::step::curr, team::is_enemy(), pathfind::paths::step::move_left, and resources::units.

Referenced by actions::actor_sighted(), actions::shroud_clearer::calculate_jamming(), and can_see().

static const std::string sighted_str ( "sighted"  )
static

Variable Documentation

lg::log_domain log_engine("engine")
static