Planeshift
|
Overridables. More...
#include <buffable.h>
Public Member Functions | |
T | Base () const |
virtual void | Cancel (const ActiveSpell *owner) |
T | Current () const |
Overridable (T x) | |
void | Override (const ActiveSpell *owner, T x) |
void | SetBase (T x) |
virtual | ~Overridable () |
Protected Member Functions | |
virtual void | OnChange () |
Called whenever the current value changes; implemented in derived classes. | |
Protected Attributes | |
csList< csTuple2< const ActiveSpell *, T > > | values |
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.
Overridable< T >::Overridable | ( | T | x | ) | [inline] |
Definition at line 74 of file buffable.h.
virtual Overridable< T >::~Overridable | ( | ) | [inline, virtual] |
Definition at line 79 of file buffable.h.
T Overridable< T >::Base | ( | ) | const [inline] |
Definition at line 86 of file buffable.h.
virtual void Overridable< T >::Cancel | ( | const ActiveSpell * | owner | ) | [inline, virtual] |
Implements iSpellModifier.
Definition at line 115 of file buffable.h.
T Overridable< T >::Current | ( | ) | const [inline] |
Definition at line 81 of file buffable.h.
virtual void Overridable< T >::OnChange | ( | ) | [inline, protected, virtual] |
Called whenever the current value changes; implemented in derived classes.
Reimplemented in OverridableRace.
Definition at line 135 of file buffable.h.
void Overridable< T >::Override | ( | const ActiveSpell * | owner, |
T | x | ||
) | [inline] |
Definition at line 105 of file buffable.h.
void Overridable< T >::SetBase | ( | T | x | ) | [inline] |
Definition at line 92 of file buffable.h.
csList< csTuple2<const ActiveSpell*, T> > Overridable< T >::values [protected] |
Definition at line 139 of file buffable.h.