ManaPlus
Public Member Functions | Protected Attributes
ParticleContainer Class Reference

#include <particlecontainer.h>

Inheritance diagram for ParticleContainer:
ParticleList ParticleVector

Public Member Functions

 ParticleContainer (ParticleContainer *const parent, const bool delParent)
 
virtual ~ParticleContainer ()
 
void clear ()
 
virtual void clearLocally ()
 
virtual void moveTo (const float x, const float y)
 

Protected Attributes

ParticleContainermNext
 
bool mDelParent
 

Detailed Description

Set of particle effects. May be stacked with other ParticleContainers. All operations herein affect such stacked containers, unless the operations end in ‘Locally’.

Definition at line 34 of file particlecontainer.h.

Constructor & Destructor Documentation

◆ ParticleContainer()

ParticleContainer::ParticleContainer ( ParticleContainer *const  parent,
const bool  delParent 
)

Constructs a new particle container and assumes responsibility for its parent (for all operations defined herein, except when ending in ‘Locally’)

delParent means that the destructor should also free the parent.

Definition at line 30 of file particlecontainer.cpp.

31  :
32  mNext(parent),
33  mDelParent(delParent)
34 {
35 }
ParticleContainer * mNext

◆ ~ParticleContainer()

ParticleContainer::~ParticleContainer ( )
virtual

Definition at line 37 of file particlecontainer.cpp.

38 {
39  // +++ call virtul method in destructor
40  clearLocally();
41  if (mDelParent)
42  delete2(mNext)
43 }
virtual void clearLocally()
#define delete2(var)
Definition: delete2.h:25

References clearLocally(), delete2, mDelParent, and mNext.

Member Function Documentation

◆ clear()

void ParticleContainer::clear ( )

Kills and removes all particle effects

Definition at line 45 of file particlecontainer.cpp.

46 {
47  clearLocally();
48  if (mNext != nullptr)
49  mNext->clear();
50 }

References clear(), clearLocally(), and mNext.

Referenced by clear(), ActorSprite::setMap(), ActorSprite::setupSpriteDisplay(), and ActorSprite::~ActorSprite().

◆ clearLocally()

virtual void ParticleContainer::clearLocally ( )
inlinevirtual

Kills and removes all particle effects (only in this container)

Reimplemented in ParticleVector, and ParticleList.

Definition at line 59 of file particlecontainer.h.

60  { }

Referenced by clear(), and ~ParticleContainer().

◆ moveTo()

void ParticleContainer::moveTo ( const float  x,
const float  y 
)
virtual

Sets the positions of all elements

Reimplemented in ParticleVector, and ParticleList.

Definition at line 52 of file particlecontainer.cpp.

53 {
54  if (mNext != nullptr)
55  mNext->moveTo(x, y);
56 }
virtual void moveTo(const float x, const float y)

References mNext, moveTo(), x, and y.

Referenced by moveTo(), ParticleList::moveTo(), and ParticleVector::moveTo().

Field Documentation

◆ mDelParent

bool ParticleContainer::mDelParent
protected

Delete mNext in destructor

Definition at line 69 of file particlecontainer.h.

Referenced by ~ParticleContainer().

◆ mNext

ParticleContainer* ParticleContainer::mNext
protected

Contained container, if any

Definition at line 68 of file particlecontainer.h.

Referenced by clear(), moveTo(), and ~ParticleContainer().


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