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 33 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 29 of file particlecontainer.cpp.

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

◆ ~ParticleContainer()

ParticleContainer::~ParticleContainer ( )
virtual

Definition at line 36 of file particlecontainer.cpp.

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

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

Member Function Documentation

◆ clear()

void ParticleContainer::clear ( )

Kills and removes all particle effects

Definition at line 44 of file particlecontainer.cpp.

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

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

45 {
46  clearLocally();
47  if (mNext != nullptr)
48  mNext->clear();
49 }
ParticleContainer * mNext
virtual void clearLocally()

◆ clearLocally()

virtual void ParticleContainer::clearLocally ( )
inlinevirtual

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

Reimplemented in ParticleVector, and ParticleList.

Definition at line 58 of file particlecontainer.h.

References moveTo(), x, and y.

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

59  { }

◆ 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 51 of file particlecontainer.cpp.

References mNext, and moveTo().

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

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

Field Documentation

◆ mDelParent

bool ParticleContainer::mDelParent
protected

Delete mNext in destructor

Definition at line 68 of file particlecontainer.h.

Referenced by ~ParticleContainer().

◆ mNext

ParticleContainer* ParticleContainer::mNext
protected

Contained container, if any

Definition at line 67 of file particlecontainer.h.

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


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