The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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)
 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...
 
 temporary_unit_mover (unit_map &m, const map_location &src, const map_location &dst)
 Constructor This version does not change (nor restore) the unit's movement. More...
 
 temporary_unit_mover (game_board &b, const map_location &src, const map_location &dst, int new_moves)
 
 temporary_unit_mover (game_board &b, const map_location &src, const map_location &dst)
 
virtual ~temporary_unit_mover ()
 

Private Attributes

unit_mapm_
 
const map_location src_
 
const map_location dst_
 
int old_moves_
 
unit_ptr temp_
 

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 201 of file game_board.hpp.

Constructor & Destructor Documentation

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

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 423 of file game_board.cpp.

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

temporary_unit_mover::temporary_unit_mover ( unit_map m,
const map_location src,
const map_location dst 
)

Constructor This version does not change (nor restore) the unit's movement.

Definition at line 457 of file game_board.cpp.

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

temporary_unit_mover::temporary_unit_mover ( game_board b,
const map_location src,
const map_location dst,
int  new_moves 
)

Definition at line 438 of file game_board.cpp.

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

temporary_unit_mover::temporary_unit_mover ( game_board b,
const map_location src,
const map_location dst 
)

Definition at line 465 of file game_board.cpp.

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

temporary_unit_mover::~temporary_unit_mover ( )
virtual

Definition at line 473 of file game_board.cpp.

References dst_, unit_map::insert(), m_, unit_map::move(), old_moves_, src_, and temp_.

Member Data Documentation

const map_location temporary_unit_mover::dst_
private

Definition at line 216 of file game_board.hpp.

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

unit_map& temporary_unit_mover::m_
private

Definition at line 214 of file game_board.hpp.

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

int temporary_unit_mover::old_moves_
private

Definition at line 217 of file game_board.hpp.

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

const map_location temporary_unit_mover::src_
private

Definition at line 215 of file game_board.hpp.

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

unit_ptr temporary_unit_mover::temp_
private

Definition at line 218 of file game_board.hpp.

Referenced by ~temporary_unit_mover().


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