Planeshift
Overridable< T > Class Template Reference

Overridables. More...

#include <buffable.h>

Public Member Functions

Base () const
 
virtual void Cancel (const ActiveSpell *owner)
 
Current () const
 
 Overridable (T x)
 
void Override (const ActiveSpell *owner, T x)
 
void SetBase (T x)
 
virtual ~Overridable ()
 
- Public Member Functions inherited from iSpellModifier
virtual ~iSpellModifier ()
 

Protected Member Functions

virtual void OnChange ()
 Called whenever the current value changes; implemented in derived classes. More...
 

Protected Attributes

csList< csTuple2< const ActiveSpell *, T > > values
 

Detailed Description

template<typename T>
class Overridable< T >

Overridables.

Overridables provide a straightforward way for the scripting system to temporarily override some opaque value (like a string or position), yet be able to undo the change at some later time.

Note that having spells simply set the new value and reset it to the old one on expiration does not work - consider overlapping intervals:

                    [====CAST CLACKERFORM====]
    [========CAST ULBERFORM=======] (wrong!) | (wrong until relog!)

enkim.. | ..ulbernaut.. | ..clacker.. | enkim!! | ...ulbernaut!! <------------------------------------------------------------------—> time

An overridable is basically a list of key-value pairs. For example: (B, clacker) | (A, ulbernaut) | (NULL, enkim) Here, the character is normally an enkim; spell A turned him into an ulbernaut, and spell B made him look like a clacker. When A expires, it simply removes the middle link, leaving: (B, clacker) | (NULL, enkim) ...which is correct.

Definition at line 70 of file buffable.h.

Constructor & Destructor Documentation

template<typename T>
Overridable< T >::Overridable ( x)
inline

Definition at line 74 of file buffable.h.

template<typename T>
virtual Overridable< T >::~Overridable ( )
inlinevirtual

Definition at line 79 of file buffable.h.

Member Function Documentation

template<typename T>
T Overridable< T >::Base ( ) const
inline

Definition at line 86 of file buffable.h.

template<typename T>
virtual void Overridable< T >::Cancel ( const ActiveSpell owner)
inlinevirtual

Implements iSpellModifier.

Definition at line 115 of file buffable.h.

template<typename T>
T Overridable< T >::Current ( ) const
inline

Definition at line 81 of file buffable.h.

template<typename T>
virtual void Overridable< T >::OnChange ( )
inlineprotectedvirtual

Called whenever the current value changes; implemented in derived classes.

Reimplemented in OverridableRace.

Definition at line 135 of file buffable.h.

template<typename T>
void Overridable< T >::Override ( const ActiveSpell owner,
x 
)
inline

Definition at line 105 of file buffable.h.

template<typename T>
void Overridable< T >::SetBase ( x)
inline

Definition at line 92 of file buffable.h.

Member Data Documentation

template<typename T>
csList< csTuple2<const ActiveSpell*, T> > Overridable< T >::values
protected

Definition at line 139 of file buffable.h.


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