The Battle for Wesnoth  1.17.10+dev
Classes | Functions
unit.hpp File Reference
#include "movetype.hpp"
#include "units/unit_alignments.hpp"
#include "units/id.hpp"
#include "units/ptr.hpp"
#include "units/attack_type.hpp"
#include "units/race.hpp"
#include "utils/variant.hpp"
#include <boost/dynamic_bitset_fwd.hpp>
#include <bitset>
#include <optional>
Include dependency graph for unit.hpp:
This graph shows which files directly or indirectly include this file:

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


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

References unit::swap().

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