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

This object is used to temporary move a unit in the unit map, swapping out any unit that is already there. More...

#include <game_board.hpp>

Public Member Functions

 temporary_unit_mover (unit_map &m, const map_location &src, const map_location &dst, int new_moves, bool stand)
 Constructor This version will change the unit's current movement to new_moves while the unit is moved (and restored to its previous value upon this object's destruction). More...
 
virtual ~temporary_unit_mover ()
 

Private Attributes

unit_mapm_
 
const map_location src_
 
const map_location dst_
 
int old_moves_
 
unit_ptr temp_
 
bool stand_
 

Detailed Description

This object is used to temporary move a unit in the unit map, swapping out any unit that is already there.

On destruction, it restores the unit map to its original.

Definition at line 224 of file game_board.hpp.

Constructor & Destructor Documentation

◆ temporary_unit_mover()

temporary_unit_mover::temporary_unit_mover ( unit_map m,
const map_location src,
const map_location dst,
int  new_moves,
bool  stand 
)

Constructor This version will change the unit's current movement to new_moves while the unit is moved (and restored to its previous value upon this object's destruction).

Definition at line 472 of file game_board.cpp.

References dst_, unit_map::find_unit_ptr(), m_, unit_map::move(), old_moves_, src_, and stand_.

◆ ~temporary_unit_mover()

temporary_unit_mover::~temporary_unit_mover ( )
virtual

Member Data Documentation

◆ dst_

const map_location temporary_unit_mover::dst_
private

Definition at line 232 of file game_board.hpp.

Referenced by temporary_unit_mover(), and ~temporary_unit_mover().

◆ m_

unit_map& temporary_unit_mover::m_
private

Definition at line 230 of file game_board.hpp.

Referenced by temporary_unit_mover(), and ~temporary_unit_mover().

◆ old_moves_

int temporary_unit_mover::old_moves_
private

Definition at line 233 of file game_board.hpp.

Referenced by temporary_unit_mover(), and ~temporary_unit_mover().

◆ src_

const map_location temporary_unit_mover::src_
private

Definition at line 231 of file game_board.hpp.

Referenced by temporary_unit_mover(), and ~temporary_unit_mover().

◆ stand_

bool temporary_unit_mover::stand_
private

Definition at line 235 of file game_board.hpp.

Referenced by temporary_unit_mover(), and ~temporary_unit_mover().

◆ temp_

unit_ptr temporary_unit_mover::temp_
private

Definition at line 234 of file game_board.hpp.

Referenced by ~temporary_unit_mover().


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