The Battle for Wesnoth  1.19.0-dev
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
 
bool empty () 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. More...
 

Friends

class fake_unit_ptr
 

Detailed Description

Manages a list of fake units for the display object.

Definition at line 24 of file fake_unit_manager.hpp.

Member Typedef Documentation

◆ const_iterator

Definition at line 37 of file fake_unit_manager.hpp.

◆ internal_ptr_type

Definition at line 33 of file fake_unit_manager.hpp.

◆ iterator

Definition at line 36 of file fake_unit_manager.hpp.

Constructor & Destructor Documentation

◆ fake_unit_manager()

fake_unit_manager::fake_unit_manager ( display disp)
inline

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

Definition at line 27 of file fake_unit_manager.hpp.

Member Function Documentation

◆ begin() [1/2]

iterator fake_unit_manager::begin ( )
inline

Definition at line 39 of file fake_unit_manager.hpp.

References fake_units_.

◆ begin() [2/2]

const_iterator fake_unit_manager::begin ( ) const
inline

Definition at line 42 of file fake_unit_manager.hpp.

References fake_units_.

◆ empty()

bool fake_unit_manager::empty ( ) const
inline

Definition at line 44 of file fake_unit_manager.hpp.

References fake_units_.

Referenced by game_lua_kernel::intf_find_cost_map().

◆ end() [1/2]

iterator fake_unit_manager::end ( )
inline

Definition at line 40 of file fake_unit_manager.hpp.

References fake_units_.

◆ end() [2/2]

const_iterator fake_unit_manager::end ( ) const
inline

Definition at line 43 of file fake_unit_manager.hpp.

References fake_units_.

◆ place_temporary_unit()

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_, display::invalidate(), and my_display_.

Referenced by fake_unit_ptr::place_on_fake_unit_manager().

◆ remove_temporary_unit()

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 gui2::dialogs::tip::remove().

Referenced by fake_unit_ptr::remove_from_fake_unit_manager().

Friends And Related Function Documentation

◆ fake_unit_ptr

friend class fake_unit_ptr
friend

Definition at line 30 of file fake_unit_manager.hpp.

Member Data Documentation

◆ fake_units_

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 55 of file fake_unit_manager.hpp.

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

◆ my_display_

display& fake_unit_manager::my_display_
private

Reference to my display.

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: