The Battle for Wesnoth  1.19.4+dev
Public Member Functions | Private Attributes | List of all members
temporary_unit_remover Struct Reference

This object is used to temporary remove a unit from the unit map. More...

#include <game_board.hpp>

Public Member Functions

 temporary_unit_remover (unit_map &m, const map_location &loc)
 
 temporary_unit_remover (game_board &m, const map_location &loc)
 
virtual ~temporary_unit_remover ()
 

Private Attributes

unit_mapm_
 
const map_location loc_
 
unit_ptr temp_
 

Detailed Description

This object is used to temporary remove a unit from the unit map.

On destruction, it restores the unit map to its original. unit_map iterators to this unit must not be accessed while the unit is temporarily removed, otherwise a collision will happen when trying to reinsert the unit.

Definition at line 206 of file game_board.hpp.

Constructor & Destructor Documentation

◆ temporary_unit_remover() [1/2]

temporary_unit_remover::temporary_unit_remover ( unit_map m,
const map_location loc 
)

Definition at line 441 of file game_board.cpp.

◆ temporary_unit_remover() [2/2]

temporary_unit_remover::temporary_unit_remover ( game_board m,
const map_location loc 
)

Definition at line 448 of file game_board.cpp.

◆ ~temporary_unit_remover()

temporary_unit_remover::~temporary_unit_remover ( )
virtual

Definition at line 455 of file game_board.cpp.

References DBG_RG, utils::get_unknown_exception_type(), unit_map::insert(), m_, and temp_.

Member Data Documentation

◆ loc_

const map_location temporary_unit_remover::loc_
private

Definition at line 214 of file game_board.hpp.

◆ m_

unit_map& temporary_unit_remover::m_
private

Definition at line 213 of file game_board.hpp.

Referenced by ~temporary_unit_remover().

◆ temp_

unit_ptr temporary_unit_remover::temp_
private

Definition at line 215 of file game_board.hpp.

Referenced by ~temporary_unit_remover().


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