#include <action.h>
Inheritance diagram for TAction:
Public Methods | |
TAction (const string &name, TActionType *type) | |
virtual | ~TAction () |
virtual bool | load (TDataPackageList *in) |
virtual bool | loadAttributes (TDataPackageList *in) |
virtual bool | save (TDataPackageList *out) const |
virtual bool | saveAttributes (TDataPackageList *out) const |
void | markAsExecuted () |
void | objectValidationIsNeeded () |
virtual bool | validateObjects () |
virtual bool | checkActionConflicts () |
virtual bool | resolveActionConflicts () |
virtual bool | canUndo () const |
virtual bool | execute ()=0 |
void | setActor (TActionObject *actor) |
void | setCreator (TRace *creator) |
bool | is (const TActionType type) const |
virtual bool | isPlayerAction () const |
const TActionType | getActionType () const |
const string & | getActionName () const |
int2 | getType () const |
const string & | getTypeName () const |
TRace * | getCreator () const |
Static Public Methods | |
TAction * | create (const string &actname) |
Protected Methods | |
TAction (const TActionType type, const string *tn) | |
virtual TAction * | _new () const=0 |
Protected Attributes | |
TActionType | Type |
const string * | TypeName |
TLink< TRace > | fCreator |
TLink< TActionObject > | fActor |
list< TLink< TActionObject > *> | Objects |
list< TLink< TActionObject > *> | Observers |
Static Private Methods | |
TAction * | protoManager (TAction *act, const string &actname) |
Private Attributes | |
bool | Executed |
bool | ObjectsAreValid |
bool | IsPrototype |
Static Private Attributes | |
uint4 | iNumActionTypes |
The three classes TAction, TActionObject and TActionSequencer are used to have the game objects perform "action" in the game world.
TAction is an abstract class which is to be used as base for deriving the specific actions which may take place in the universe.
TActionObject is an abstract class which is to be used as a base for any game object which can be involved in an action (either because it performs or is affected by one).
TActionSequencer is just a container for a list of action to be performed "simultaneously". The aim of TActionSequencer is to make sure that the action are executed in a way as to avoid or resolve any possible conflict resulting from the execution of actions (example, two fleets loading "all minerals" from a limited resource).
Actions are used for two main purposes:
Actions are useful when:
|
The action object now is allowed to execute an action. |
|
Reimplemented from TLinkable. |
|
Reimplemented from TLinkable. |
|
Loads a TLinkable. Note that classes that are derived from this class must call TLinkable::Load explicitly to load the data correctly.
Reimplemented from TLinkable. |
|
The attributes which a specific |
|
Saves a TLinkable object by adding the data packages to the list. Note that classes that are derived from this class must call TLinkable::Save explicitly to save the data correctly.
Reimplemented from TLinkable. |
|
Sets a actor for this action. Note that an existing actor can not be changed--the method simply will ignore the parameter.
|
|
Sets a creator for this action. Note that an existing creator can not be changed--the method simply will ignore the parameter.
|