The Nebula Device 3: Actions::SequenceAction Class Reference

The Nebula Device 3

Actions::SequenceAction Class Reference

#include <sequenceaction.h>

Inheritance diagram for Actions::SequenceAction:

Actions::Action Messaging::Message Core::RefCounted

Detailed Description

Executes a sequence of masterEvents.

(C) 2006 Radon Labs GmbH

Public Member Functions

 SequenceAction ()
 constructor
virtual ~SequenceAction ()
 destructor
virtual void Notify (const Ptr< Messaging::Message > &msg)
 notify about incoming message
virtual void OnActivate ()
 called when state is activated
virtual void OnDeactivate ()
 called when state is deactivated
virtual bool Assert (const Ptr< Script::InfoLog > &infoLog)
 like Assert() but adds errors to the info log object instead of closing the application
virtual bool Start ()
 start the action
virtual void Stop ()
 stop the action
virtual bool Trigger ()
virtual void Execute ()
void AppendAction (const Ptr< Action > &action, bool isEffectiveAction=true)
Util::Array< Ptr< Actions::Action > > GetActionList () const
 gets the whole action list
virtual void Write (const Ptr< Script::ActionReader > &actionReader)
 write to action reader
virtual void Read (const Ptr< Script::ActionReader > &actionReader)
 read from action reader
virtual void OnLoad ()
 any setup stuff that needs to be done on load
void FromList (const Ptr< Actions::Action > &actionOrList)
 insert an action, it will flatten an inserted sequence action
void FromList (const Util::Array< Ptr< Actions::Action > > &actions)
 append an array of actions, it will flatten sequence actions
virtual Timing::Time GetTimeLeft ()
 get time left of all actions
virtual void SetEntity (const Ptr< Game::Entity > &v)
 overridden set entity method to set entities to sequenced actions
void SetSaveActionsFlag (bool s)
 set save actions flag (wether or not action list should be saved)
bool GetSaveActionsFlag () const
 get save actions flag (wether or not action list should be saved)
virtual void Assert ()
 assert that all required data is present in the world database
virtual void ParseArgs (const Util::CommandLineArgs &args)
 parse arguments from command line args object
virtual void ShowActionInfo ()
 make the action show information what would happen if executed; default: do nothing
virtual Util::String GetDebugTxt ()
 get current debug txt
const Ptr< Game::Entity > & GetEntity () const
 Target entity if exists.
bool HasEntity () const
 Does this contain a target entity?
virtual void Init ()
 init after creation, parse args and set entity
bool CheckId (const Messaging::Id &id) const
 return true if message is of the given id
virtual void Encode (const Ptr< IO::BinaryWriter > &writer)
 encode message into a stream
virtual void Decode (const Ptr< IO::BinaryReader > &reader)
 decode message from a stream
void SetHandled (bool b)
 set the handled flag
bool Handled () const
 return true if the message has been handled
void SetDeferred (bool b)
 set deferred flag
bool IsDeferred () const
 get deferred flag
void SetDeferredHandled (bool b)
 set the deferred handled flag
bool DeferredHandled () const
 get the deferred handled flag
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Static Public Member Functions

static Ptr< ActionCreateActionFromString (const Util::String &cmd)
 create complete action from command string
static Util::Array< Ptr< Action > > CreateActionsFromString (const Util::String &cmd)
 create several actions from semicolon-separated commands
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Protected Member Functions

bool StartCurrAction ()
 start the current action, return false if out of actions or action returned false

Member Function Documentation

void Actions::SequenceAction::Notify ( const Ptr< Messaging::Message > &  msg  )  [virtual]

notify about incoming message

The state machine will forward any incoming messages to the action.

Reimplemented from Actions::Action.

bool Actions::SequenceAction::Start (  )  [virtual]

start the action

Called from action player property if action will be started

Reimplemented from Actions::Action.

void Actions::SequenceAction::Stop (  )  [virtual]

stop the action

Called from action player property if action will be stoped

Reimplemented from Actions::Action.

bool Actions::SequenceAction::Trigger (  )  [virtual]

trigger the actions. use this for sequencially executing the actions within e.g. a FSM

Reimplemented from Actions::Action.

void Actions::SequenceAction::Execute (  )  [virtual]

trigger the actions. will call execute on all actions. use this for action lists that shall instantly be executed

Reimplemented from Actions::Action.

void Actions::SequenceAction::AppendAction ( const Ptr< Action > &  action,
bool  isEffectiveAction = true 
) [inline]

append an action to the sequence (NOT allowed if action is running) by default the added action will be noted as the effective action (flag) the effective action will be used to evaluate "ShowActionInfow" (s.b.)

void Actions::SequenceAction::FromList ( const Ptr< Actions::Action > &  actionOrList  ) 

insert an action, it will flatten an inserted sequence action

insert an action, or flaten and insert a sequence

bool Actions::SequenceAction::StartCurrAction (  )  [protected]

start the current action, return false if out of actions or action returned false

Called from action player property if action will be started

Ptr< Action > Actions::Action::CreateActionFromString ( const Util::String cmd  )  [static, inherited]

create complete action from command string

Static method which creates any action object from a command string of the form:

cmd key0=value0 key1=value1 key2=value2

So you would create an action for instance like this:

Action::CreateFromCmdString("UnlockQuest quest=Testquest");

Util::Array< Ptr< Action > > Actions::Action::CreateActionsFromString ( const Util::String cmd  )  [static, inherited]

create several actions from semicolon-separated commands

Static method which creates many action from a string of the form accepted by CreateActionFromString() where several actions are separated by a semicolon.

void Actions::Action::Assert (  )  [virtual, inherited]

assert that all required data is present in the world database

Make sure the data required by the action is valid. This may not change the state of the world.

Reimplemented in Actions::ActionList, and Actions::IfThenElseAction.

void Actions::Action::ParseArgs ( const Util::CommandLineArgs args  )  [virtual, inherited]

parse arguments from command line args object

Initialize the action from a CmdLineArgs object. This is necessary for the automatic scripting support.

void Actions::Action::ShowActionInfo (  )  [virtual, inherited]

make the action show information what would happen if executed; default: do nothing

override in special action

int Core::RefCounted::GetRefCount (  )  const [inline, inherited]

get the current refcount

Return the current refcount of the object.

void Core::RefCounted::AddRef (  )  [inline, inherited]

increment refcount by one

Increment the refcount of the object.

void Core::RefCounted::Release (  )  [inline, inherited]

decrement refcount and destroy object if refcount is zero

Decrement the refcount and destroy object if refcount is zero.

const Util::String & Core::RefCounted::GetClassName (  )  const [inline, inherited]

get the class name

Get the class name of the object.

Util::FourCC Core::RefCounted::GetClassFourCC (  )  const [inline, inherited]

get the class FourCC code

Get the class FourCC of the object.

void Core::RefCounted::DumpRefCountingLeaks (  )  [static, inherited]

dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

This method should be called as the very last before an application exits.