Mana
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Friends | List of all members
ActorSpriteManager Class Reference

#include <actorspritemanager.h>

Inheritance diagram for ActorSpriteManager:
EventListener

Public Member Functions

 ActorSpriteManager ()
 
 ~ActorSpriteManager ()
 
void setMap (Map *map)
 Sets the map on which ActorSprites are created.
 
void setPlayer (LocalPlayer *player)
 Sets the current player.
 
BeingcreateBeing (int id, ActorSprite::Type type, int subtype)
 Create a Being and add it to the list of ActorSprites.
 
FloorItemcreateItem (int id, int itemId, const Vector &position)
 Create a FloorItem and add it to the list of ActorSprites.
 
void destroyActor (ActorSprite *actor)
 Immediately destroys the given actor.
 
void scheduleDelete (ActorSprite *actor)
 Destroys the given ActorSprite at the end of ActorSpriteManager::logic.
 
BeingfindBeing (int id) const
 Returns a specific Being, by id;.
 
BeingfindBeing (int x, int y, ActorSprite::Type type=ActorSprite::UNKNOWN) const
 Returns a being at specific coordinates.
 
BeingfindBeingByPixel (int x, int y) const
 Returns a being at the specific pixel.
 
FloorItemfindItem (int id) const
 Returns a specific FloorItem, by id.
 
FloorItemfindItem (int x, int y, int maxDist=0) const
 Returns a FloorItem at specific coordinates.
 
BeingfindNearestLivingBeing (int x, int y, int maxTileDist, ActorSprite::Type type=Being::UNKNOWN, Being *excluded=nullptr) const
 Returns a being nearest to specific coordinates.
 
BeingfindNearestLivingBeing (Being *aroundBeing, int maxTileDist, ActorSprite::Type type=Being::UNKNOWN) const
 Returns a being nearest to another being.
 
BeingfindBeingByName (const std::string &name, ActorSprite::Type type=Being::UNKNOWN) const
 Finds a being by name and (optionally) by type.
 
const ActorSpritesgetAll () const
 Returns the whole list of beings.
 
bool hasActorSprite (ActorSprite *someActor) const
 Returns true if the given ActorSprite is in the manager's list, false otherwise.
 
void logic ()
 Performs ActorSprite logic and deletes ActorSprite scheduled to be deleted.
 
void clear ()
 Destroys all ActorSprites except the local player.
 
AutoCompleteListergetPlayerNameLister () const
 
AutoCompleteListergetPlayerNPCNameLister () const
 
void updatePlayerNames ()
 
void event (Event::Channel channel, const Event &event) override
 
- Public Member Functions inherited from EventListener
virtual ~EventListener ()
 
void listen (Event::Channel channel)
 
void ignore (Event::Channel channel)
 

Protected Attributes

std::unique_ptr< AutoCompleteListermPlayerNames
 
std::unique_ptr< AutoCompleteListermPlayerNPCNames
 
ActorSprites mActors
 
ActorSprites mDeleteActors
 
MapmMap
 

Friends

class PlayerNamesLister
 
class PlayerNPCNamesLister
 

Detailed Description

Definition at line 38 of file actorspritemanager.h.

Constructor & Destructor Documentation

◆ ActorSpriteManager()

ActorSpriteManager::ActorSpriteManager ( )

Definition at line 66 of file actorspritemanager.cpp.

◆ ~ActorSpriteManager()

ActorSpriteManager::~ActorSpriteManager ( )

Definition at line 74 of file actorspritemanager.cpp.

Member Function Documentation

◆ clear()

void ActorSpriteManager::clear ( )

Destroys all ActorSprites except the local player.

Definition at line 275 of file actorspritemanager.cpp.

◆ createBeing()

Being * ActorSpriteManager::createBeing ( int  id,
ActorSprite::Type  type,
int  subtype 
)

Create a Being and add it to the list of ActorSprites.

Definition at line 93 of file actorspritemanager.cpp.

◆ createItem()

FloorItem * ActorSpriteManager::createItem ( int  id,
int  itemId,
const Vector position 
)

Create a FloorItem and add it to the list of ActorSprites.

Parameters
idthe unique ID of this item instance
itemIdthe item ID
positionthe position in pixels

Definition at line 101 of file actorspritemanager.cpp.

◆ destroyActor()

void ActorSpriteManager::destroyActor ( ActorSprite actor)

Immediately destroys the given actor.

Definition at line 109 of file actorspritemanager.cpp.

◆ event()

void ActorSpriteManager::event ( Event::Channel  channel,
const Event event 
)
overridevirtual

Implements EventListener.

Definition at line 366 of file actorspritemanager.cpp.

◆ findBeing() [1/2]

Being * ActorSpriteManager::findBeing ( int  id) const

Returns a specific Being, by id;.

Definition at line 124 of file actorspritemanager.cpp.

◆ findBeing() [2/2]

Being * ActorSpriteManager::findBeing ( int  x,
int  y,
ActorSprite::Type  type = ActorSprite::UNKNOWN 
) const

Returns a being at specific coordinates.

Definition at line 134 of file actorspritemanager.cpp.

◆ findBeingByName()

Being * ActorSpriteManager::findBeingByName ( const std::string &  name,
ActorSprite::Type  type = Being::UNKNOWN 
) const

Finds a being by name and (optionally) by type.

Definition at line 240 of file actorspritemanager.cpp.

◆ findBeingByPixel()

Being * ActorSpriteManager::findBeingByPixel ( int  x,
int  y 
) const

Returns a being at the specific pixel.

Definition at line 166 of file actorspritemanager.cpp.

◆ findItem() [1/2]

FloorItem * ActorSpriteManager::findItem ( int  id) const

Returns a specific FloorItem, by id.

Definition at line 210 of file actorspritemanager.cpp.

◆ findItem() [2/2]

FloorItem * ActorSpriteManager::findItem ( int  x,
int  y,
int  maxDist = 0 
) const

Returns a FloorItem at specific coordinates.

Definition at line 221 of file actorspritemanager.cpp.

◆ findNearestLivingBeing() [1/2]

Being * ActorSpriteManager::findNearestLivingBeing ( Being aroundBeing,
int  maxTileDist,
ActorSprite::Type  type = Being::UNKNOWN 
) const

Returns a being nearest to another being.

Parameters
aroundBeingThe being to search around.
maxTileDistMaximal distance in tiles. If minimal distance is larger, no being is returned.
typeThe type of being to look for.

Definition at line 329 of file actorspritemanager.cpp.

◆ findNearestLivingBeing() [2/2]

Being * ActorSpriteManager::findNearestLivingBeing ( int  x,
int  y,
int  maxTileDist,
ActorSprite::Type  type = Being::UNKNOWN,
Being excluded = nullptr 
) const

Returns a being nearest to specific coordinates.

Parameters
xX coordinate in pixels.
yY coordinate in pixels.
maxTileDistMaximal distance in tiles. If minimal distance is larger, no being is returned.
typeThe type of being to look for.
excludedThe being to exclude from the search.

Definition at line 289 of file actorspritemanager.cpp.

◆ getAll()

const ActorSprites & ActorSpriteManager::getAll ( ) const

Returns the whole list of beings.

Definition at line 256 of file actorspritemanager.cpp.

◆ getPlayerNameLister()

AutoCompleteLister * ActorSpriteManager::getPlayerNameLister ( ) const

Definition at line 343 of file actorspritemanager.cpp.

◆ getPlayerNPCNameLister()

AutoCompleteLister * ActorSpriteManager::getPlayerNPCNameLister ( ) const

Definition at line 348 of file actorspritemanager.cpp.

◆ hasActorSprite()

bool ActorSpriteManager::hasActorSprite ( ActorSprite someActor) const

Returns true if the given ActorSprite is in the manager's list, false otherwise.

Parameters
someActorthe ActorSprite to search for

Definition at line 338 of file actorspritemanager.cpp.

◆ logic()

void ActorSpriteManager::logic ( )

Performs ActorSprite logic and deletes ActorSprite scheduled to be deleted.

Definition at line 261 of file actorspritemanager.cpp.

◆ scheduleDelete()

void ActorSpriteManager::scheduleDelete ( ActorSprite actor)

Destroys the given ActorSprite at the end of ActorSpriteManager::logic.

Definition at line 116 of file actorspritemanager.cpp.

◆ setMap()

void ActorSpriteManager::setMap ( Map map)

Sets the map on which ActorSprites are created.

Definition at line 79 of file actorspritemanager.cpp.

◆ setPlayer()

void ActorSpriteManager::setPlayer ( LocalPlayer player)

Sets the current player.

Definition at line 87 of file actorspritemanager.cpp.

◆ updatePlayerNames()

void ActorSpriteManager::updatePlayerNames ( )

Definition at line 353 of file actorspritemanager.cpp.

Friends And Related Symbol Documentation

◆ PlayerNamesLister

friend class PlayerNamesLister
friend

Definition at line 170 of file actorspritemanager.h.

◆ PlayerNPCNamesLister

friend class PlayerNPCNamesLister
friend

Definition at line 171 of file actorspritemanager.h.

Member Data Documentation

◆ mActors

ActorSprites ActorSpriteManager::mActors
protected

Definition at line 175 of file actorspritemanager.h.

◆ mDeleteActors

ActorSprites ActorSpriteManager::mDeleteActors
protected

Definition at line 176 of file actorspritemanager.h.

◆ mMap

Map* ActorSpriteManager::mMap
protected

Definition at line 177 of file actorspritemanager.h.

◆ mPlayerNames

std::unique_ptr<AutoCompleteLister> ActorSpriteManager::mPlayerNames
protected

Definition at line 173 of file actorspritemanager.h.

◆ mPlayerNPCNames

std::unique_ptr<AutoCompleteLister> ActorSpriteManager::mPlayerNPCNames
protected

Definition at line 174 of file actorspritemanager.h.


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