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_map & | m_ |
const map_location | src_ |
const map_location | dst_ |
int | old_moves_ |
unit_ptr | temp_ |
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.
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_.
|
virtual |
Definition at line 473 of file game_board.cpp.
References dst_, unit_map::insert(), m_, unit_map::move(), old_moves_, src_, and temp_.
|
private |
Definition at line 216 of file game_board.hpp.
Referenced by temporary_unit_mover(), and ~temporary_unit_mover().
|
private |
Definition at line 214 of file game_board.hpp.
Referenced by temporary_unit_mover(), and ~temporary_unit_mover().
|
private |
Definition at line 217 of file game_board.hpp.
Referenced by temporary_unit_mover(), and ~temporary_unit_mover().
|
private |
Definition at line 215 of file game_board.hpp.
Referenced by temporary_unit_mover(), and ~temporary_unit_mover().
|
private |
Definition at line 218 of file game_board.hpp.
Referenced by ~temporary_unit_mover().