The Battle for Wesnoth  1.19.5+dev
Classes | Namespaces | Enumerations | 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/optional_fwd.hpp"
#include "utils/variant.hpp"
#include <bitset>
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.

Classes

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...
 
class  unit::recursion_guard
 Helper similar to std::unique_lock for detecting when calculations such as abilities have entered infinite recursion. More...
 
struct  unit_movement_resetter
 Object which temporarily resets a unit's movement. More...
 

Namespaces

 backwards_compatibility
 

Enumerations

enum class  backwards_compatibility::unit_checksum_version { backwards_compatibility::current , backwards_compatibility::version_1_16_or_older }
 Optional parameter for get_checksum to use the algorithm of an older version of Wesnoth, thus preventing spurious OOS warnings while watching old replays. More...
 

Functions

std::string get_checksum (const unit &u, backwards_compatibility::unit_checksum_version version=backwards_compatibility::unit_checksum_version::current)
 Gets a checksum for a unit. More...
 

Function Documentation

◆ get_checksum()

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.

Parameters
uthis unit
versionallows the checksum expected in older replays to be used
Returns
the checksum for a unit

Definition at line 2829 of file unit.cpp.

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

Referenced by replay::add_unit_checksum().