The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
fake_unit_manager Class Reference

Manages a list of fake units for the display object. More...

#include <fake_unit_manager.hpp>

Public Types

typedef unit const * internal_ptr_type
 
typedef std::deque
< internal_ptr_type >
::const_iterator 
iterator
 
typedef std::deque
< internal_ptr_type >
::const_iterator 
const_iterator
 

Public Member Functions

 fake_unit_manager (display &disp)
 Construct a fake unit manager from a display which owns it. More...
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 

Private Member Functions

void place_temporary_unit (internal_ptr_type)
 Register a unit with this manager. More...
 
int remove_temporary_unit (internal_ptr_type)
 Deregister a unit from this manager. More...
 

Private Attributes

std::deque< internal_ptr_typefake_units_
 collection of units destined to be drawn but not put into the unit map More...
 
displaymy_display_
 Reference to my display. The display owns me in a scoped_ptr, so this should never be a dangling reference. More...
 

Friends

class fake_unit_ptr
 

Detailed Description

Manages a list of fake units for the display object.

Definition at line 25 of file fake_unit_manager.hpp.

Member Typedef Documentation

Definition at line 38 of file fake_unit_manager.hpp.

Definition at line 34 of file fake_unit_manager.hpp.

Definition at line 37 of file fake_unit_manager.hpp.

Constructor & Destructor Documentation

fake_unit_manager::fake_unit_manager ( display disp)
inline

Construct a fake unit manager from a display which owns it.

Definition at line 28 of file fake_unit_manager.hpp.

Member Function Documentation

iterator fake_unit_manager::begin ( )
inline

Definition at line 40 of file fake_unit_manager.hpp.

References fake_units_.

const_iterator fake_unit_manager::begin ( ) const
inline

Definition at line 43 of file fake_unit_manager.hpp.

References fake_units_.

iterator fake_unit_manager::end ( )
inline

Definition at line 41 of file fake_unit_manager.hpp.

References fake_units_.

const_iterator fake_unit_manager::end ( ) const
inline

Definition at line 44 of file fake_unit_manager.hpp.

References fake_units_.

void fake_unit_manager::place_temporary_unit ( internal_ptr_type  u)
private

Register a unit with this manager.

Temporarily register a unit to be drawn on the map (moving: can overlap others).

private, should only be called by fake_unit_ptr.

The temp unit is added at the end of the temporary unit dequeue, and therefore gets drawn last, over other units and temp units. Adding the same unit twice isn't allowed.

Definition at line 31 of file fake_unit_manager.cpp.

References ERR_NG, fake_units_, gui2::event::find(), display::invalidate(), and my_display_.

Referenced by fake_unit_ptr::place_on_fake_unit_manager().

int fake_unit_manager::remove_temporary_unit ( internal_ptr_type  u)
private

Deregister a unit from this manager.

Removes any instances of this unit from the temporary unit database.

private, should only be called by fake_unit_ptr.

Returns
the number of temp units deleted (0 or 1, any other number indicates an error).

Definition at line 42 of file fake_unit_manager.cpp.

References ERR_NG, fake_units_, display::invalidate(), my_display_, and schema_validation::remove.

Referenced by fake_unit_ptr::remove_from_fake_unit_manager().

Friends And Related Function Documentation

friend class fake_unit_ptr
friend

Definition at line 31 of file fake_unit_manager.hpp.

Member Data Documentation

std::deque<internal_ptr_type> fake_unit_manager::fake_units_
private

collection of units destined to be drawn but not put into the unit map

Definition at line 56 of file fake_unit_manager.hpp.

Referenced by begin(), end(), place_temporary_unit(), and remove_temporary_unit().

display& fake_unit_manager::my_display_
private

Reference to my display. The display owns me in a scoped_ptr, so this should never be a dangling reference.

Definition at line 57 of file fake_unit_manager.hpp.

Referenced by place_temporary_unit(), and remove_temporary_unit().


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