Ares
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes

SWStateMachine Class Reference

#include <src/Misc/SWTypes.h>

Inheritance diagram for SWStateMachine:
ChronoWarpStateMachine PsychicDominatorStateMachine UnitDeliveryStateMachine

List of all members.

Public Member Functions

bool Finished ()
int TimePassed ()
 SWStateMachine (int Duration, CellStruct XY, SuperClass *pSuper, NewSWType *pSWType)
virtual ~SWStateMachine ()
virtual void Update ()
virtual void PointerGotInvalid (void *ptr)
SWTypeExt::ExtDataFindExtData ()

Static Public Member Functions

static void UpdateAll ()
static void InvalidatePointer (void *ptr)

Static Public Attributes

static DynamicVectorClass
< SWStateMachine * > 
Array

Protected Attributes

TimerStruct Clock
SuperClass * Super
NewSWTypeType
CellStruct Coords

Constructor & Destructor Documentation

SWStateMachine::SWStateMachine ( int  Duration,
CellStruct  XY,
SuperClass *  pSuper,
NewSWType pSWType 
) [inline]
                        : Type(pSWType), Super(pSuper), Coords(XY) {
                        Clock.Start(Duration);
                        Array.AddItem(this);
                }
virtual SWStateMachine::~SWStateMachine ( ) [inline, virtual]
                                          {
                        auto t = this;
                        Array.RemoveItem(Array.FindItemIndex(&t));
                }

Member Function Documentation

SWTypeExt::ExtData* SWStateMachine::FindExtData ( ) [inline]
                                                  {
                        return SWTypeExt::ExtMap.Find(this->Super->Type);
                }
bool SWStateMachine::Finished ( ) [inline]
{ return Clock.IsDone(); }
void SWStateMachine::InvalidatePointer ( void *  ptr) [static]
{
        for(int i = SWStateMachine::Array.Count - 1; i >= 0; --i) {
                SWStateMachine* Machine = SWStateMachine::Array[i];
                Machine->PointerGotInvalid(ptr);
        }
}
virtual void SWStateMachine::PointerGotInvalid ( void *  ptr) [inline, virtual]

Reimplemented in ChronoWarpStateMachine.

{};
int SWStateMachine::TimePassed ( ) [inline]
{ return Unsorted::CurrentFrame - Clock.StartTime; }
virtual void SWStateMachine::Update ( ) [inline, virtual]
void SWStateMachine::UpdateAll ( ) [static]
{
        for(int i = SWStateMachine::Array.Count - 1; i >= 0; --i) {
                SWStateMachine* Machine = SWStateMachine::Array[i];
                Machine->Update();
                if(Machine->Finished()) {
                        SWStateMachine::Array.RemoveItem(i);
                        delete Machine;
                }
        }
}

Member Data Documentation

DynamicVectorClass< SWStateMachine * > SWStateMachine::Array [static]
TimerStruct SWStateMachine::Clock [protected]
CellStruct SWStateMachine::Coords [protected]
SuperClass* SWStateMachine::Super [protected]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines