The Battle for Wesnoth  1.15.12+dev
Classes | Namespaces | Macros | Functions | Variables
vision.cpp File Reference

Sighting. More...

#include "actions/vision.hpp"
#include "actions/move.hpp"
#include "config.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 <boost/dynamic_bitset.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 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< int > actions::get_sides_not_seeing (const unit &target)
 Returns the sides that cannot currently see target. More...
 
game_events::pump_result_t 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

◆ DBG_NG

#define DBG_NG   LOG_STREAM(debug, log_engine)

Definition at line 41 of file vision.cpp.

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

◆ ERR_NG

#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

◆ can_see()

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 76 of file vision.cpp.

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

Referenced by actions::actor_sighted().

◆ sighted_str()

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

Variable Documentation

◆ log_engine

lg::log_domain log_engine("engine")
static