The Battle for Wesnoth  1.15.3+dev
Classes | Namespaces | Typedefs | Functions
unit.hpp File Reference
#include "units/id.hpp"
#include "units/ptr.hpp"
#include "units/types.hpp"
#include <bitset>
#include <boost/dynamic_bitset_fwd.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/variant.hpp>
Include dependency graph for unit.hpp:

Go to the source code of this file.


class  unit_ability_list
class  unit
 This class represents a single unit of a specific type. More...
struct  unit::upkeep_full
struct  unit::upkeep_loyal
class  unit::upkeep_value_visitor
 Visitor helper class to fetch the appropriate upkeep value. More...
struct  unit::upkeep_type_visitor
 Visitor helper struct to fetch the upkeep type flag if applicable, or the the value otherwise. More...
class  unit::upkeep_parser_visitor
 Visitor helper class to parse the upkeep value from a config. More...
struct  unit_movement_resetter
 Object which temporarily resets a unit's movement. More...




using unit_ability = std::pair< const config *, map_location >


template<typename T >
const T & unit_detail::get_or_default (const std::unique_ptr< T > &v)
void swap (unit &lhs, unit &rhs)
 Implement non-member swap function for std::swap (calls unit::swap). More...
std::string get_checksum (const unit &u)
 Gets a checksum for a unit. More...

Typedef Documentation

◆ unit_ability

using unit_ability = std::pair<const config*, map_location>

Definition at line 48 of file unit.hpp.

Function Documentation

◆ get_checksum()

std::string get_checksum ( const unit u)

Gets a checksum for a unit.

In MP games the descriptions are locally generated and might differ, so it should be possible to discard them. Not sure whether replays suffer the same problem.

uthis unit
the checksum for a unit

Definition at line 2695 of file unit.cpp.

References config::add_child(), c, config::child_range(), DBG_UT, config::hash(), config::recursive_clear_value(), and unit::write().

Referenced by replay::add_unit_checksum(), and actions::find_recruit_location().

◆ swap()

void swap ( unit lhs,
unit rhs 

Implement non-member swap function for std::swap (calls unit::swap).

Definition at line 2790 of file unit.cpp.

References unit::swap().

Referenced by unit::clear_visibility_cache(), unit::shared_from_this(), and unit::swap().