The Battle for Wesnoth  1.19.0-dev
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
n_unit::id_manager Class Reference

#include <id.hpp>

Public Member Functions

 id_manager (std::size_t next_id)
unit_id next_id ()
 returns id for unit that is created More...
unit_id next_fake_id ()
std::size_t get_save_id () const
 Used for saving id to savegame. More...
void set_save_id (std::size_t)
void clear ()
 Clears id counter after game. More...
void reset_fake ()

Static Public Member Functions

static id_managerglobal_instance ()

Private Attributes

std::size_t next_id_
std::size_t fake_id_

Static Private Attributes

static id_manager manager_

Detailed Description

Definition at line 42 of file id.hpp.

Constructor & Destructor Documentation

◆ id_manager()

n_unit::id_manager::id_manager ( std::size_t  next_id)

Definition at line 49 of file id.hpp.

Member Function Documentation

◆ clear()

void n_unit::id_manager::clear ( )

Clears id counter after game.

Definition at line 59 of file id.cpp.

References next_id_, and reset_fake().

Referenced by set_save_id().

◆ get_save_id()

std::size_t n_unit::id_manager::get_save_id ( ) const

Used for saving id to savegame.

Definition at line 42 of file id.cpp.

References next_id_.

Referenced by set_scontext_synced::do_final_checkup(), synced_context::get_unit_id_diff(), actions::undo_list::undo(), and game_board::write_config().

◆ global_instance()

static id_manager& n_unit::id_manager::global_instance ( )

Definition at line 61 of file id.hpp.

References manager_.

Referenced by unit::init(), and unit::mark_clone().

◆ next_fake_id()

unit_id n_unit::id_manager::next_fake_id ( )

◆ next_id()

unit_id n_unit::id_manager::next_id ( )

returns id for unit that is created

Definition at line 28 of file id.cpp.

References n_unit::unit_id::create_real(), DBG_UT, n_unit::unit_id::highest_bit, and next_id_.

Referenced by unit::mark_clone(), and unit::set_underlying_id().

◆ reset_fake()

void n_unit::id_manager::reset_fake ( )

Definition at line 54 of file id.cpp.

References fake_id_.

Referenced by clear().

◆ set_save_id()

void n_unit::id_manager::set_save_id ( std::size_t  id)

Definition at line 47 of file id.cpp.

References clear(), DBG_UT, id, and next_id_.

Referenced by actions::undo_list::undo().

Member Data Documentation

◆ fake_id_

std::size_t n_unit::id_manager::fake_id_

Definition at line 46 of file id.hpp.

Referenced by next_fake_id(), and reset_fake().

◆ manager_

id_manager n_unit::id_manager::manager_

Definition at line 47 of file id.hpp.

Referenced by global_instance().

◆ next_id_

std::size_t n_unit::id_manager::next_id_

Definition at line 45 of file id.hpp.

Referenced by clear(), get_save_id(), next_id(), and set_save_id().

The documentation for this class was generated from the following files: