The Battle for Wesnoth  1.19.0-dev
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
n_unit::unit_id Struct Reference

#include <id.hpp>

Public Member Functions

 unit_id ()
 
 unit_id (std::size_t val)
 
bool is_fake () const
 
bool is_empty () const
 

Static Public Member Functions

static unit_id create_real (std::size_t val)
 
static unit_id create_fake (std::size_t val)
 

Public Attributes

std::size_t value
 

Static Public Attributes

static const std::size_t highest_bit = static_cast<std::size_t>(1) << (sizeof(std::size_t) * 8 - 1)
 

Friends

bool operator< (unit_id a, unit_id b)
 
bool operator<= (unit_id a, unit_id b)
 
bool operator== (unit_id a, unit_id b)
 
bool operator>= (unit_id a, unit_id b)
 
bool operator> (unit_id a, unit_id b)
 

Detailed Description

Definition at line 22 of file id.hpp.

Constructor & Destructor Documentation

◆ unit_id() [1/2]

n_unit::unit_id::unit_id ( )
inline

Definition at line 24 of file id.hpp.

Referenced by create_fake(), and create_real().

◆ unit_id() [2/2]

n_unit::unit_id::unit_id ( std::size_t  val)
inlineexplicit

Definition at line 25 of file id.hpp.

Member Function Documentation

◆ create_fake()

static unit_id n_unit::unit_id::create_fake ( std::size_t  val)
inlinestatic

Definition at line 33 of file id.hpp.

References highest_bit, and unit_id().

Referenced by n_unit::id_manager::next_fake_id().

◆ create_real()

static unit_id n_unit::unit_id::create_real ( std::size_t  val)
inlinestatic

Definition at line 32 of file id.hpp.

References unit_id().

Referenced by n_unit::id_manager::next_id().

◆ is_empty()

bool n_unit::unit_id::is_empty ( ) const
inline

Definition at line 30 of file id.hpp.

References value.

◆ is_fake()

bool n_unit::unit_id::is_fake ( ) const
inline

Definition at line 29 of file id.hpp.

References highest_bit, and value.

Referenced by unit::is_visible_to_team().

Friends And Related Function Documentation

◆ operator<

bool operator< ( unit_id  a,
unit_id  b 
)
friend

Definition at line 35 of file id.hpp.

◆ operator<=

bool operator<= ( unit_id  a,
unit_id  b 
)
friend

Definition at line 36 of file id.hpp.

◆ operator==

bool operator== ( unit_id  a,
unit_id  b 
)
friend

Definition at line 37 of file id.hpp.

◆ operator>

bool operator> ( unit_id  a,
unit_id  b 
)
friend

Definition at line 39 of file id.hpp.

◆ operator>=

bool operator>= ( unit_id  a,
unit_id  b 
)
friend

Definition at line 38 of file id.hpp.

Member Data Documentation

◆ highest_bit

const std::size_t n_unit::unit_id::highest_bit = static_cast<std::size_t>(1) << (sizeof(std::size_t) * 8 - 1)
static

◆ value

std::size_t n_unit::unit_id::value

Definition at line 27 of file id.hpp.

Referenced by is_empty(), is_fake(), unit::set_underlying_id(), unit::underlying_id(), and unit::write().


The documentation for this struct was generated from the following file: