The Battle for Wesnoth  1.15.5+dev
Classes | Namespaces | Functions
unit.hpp File Reference
#include "movetype.hpp"
#include "units/id.hpp"
#include "units/ptr.hpp"
#include "units/attack_type.hpp"
#include "units/race.hpp"
#include "units/alignment.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.


struct  unit_ability
 Data typedef for unit_ability_list. More...
class  unit_ability_list
class  unit
 This class represents a single unit of a specific type. More...
struct  unit::unit_ctor_t
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...




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...

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 2675 of file unit.cpp.

References config::add_child(), c, config::child_range(), DBG_UT, config::hash(), config::recursive_clear_value(), mariadb::value::string, 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 2770 of file unit.cpp.

References unit::swap().

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