00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(BASEACTIONS_H)
00023 #define BASEACTIONS_H
00024
00025 #include "BaseClasses.h"
00026
00027 class MHParseNode;
00028 class MHRoot;
00029
00030
00031
00032
00033
00034 class MHElemAction
00035 {
00036 public:
00037 MHElemAction(const char *name): m_ActionName(name) {}
00038 virtual ~MHElemAction() {}
00039 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00040 virtual void PrintMe(FILE *fd, int nTabs) const;
00041 virtual void Perform(MHEngine *engine) = 0;
00042 protected:
00043 virtual void PrintArgs(FILE *, int) const {}
00044 MHRoot *Target(MHEngine *engine);
00045 const char *m_ActionName;
00046 MHGenericObjectRef m_Target;
00047 };
00048
00049
00050
00051 class MHActionInt: public MHElemAction
00052 {
00053 public:
00054 MHActionInt(const char *name): MHElemAction(name) {}
00055 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00056 virtual void PrintArgs(FILE *fd, int) const { m_Argument.PrintMe(fd, 0); }
00057 virtual void Perform(MHEngine *engine);
00058 virtual void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg) = 0;
00059 protected:
00060 MHGenericInteger m_Argument;
00061 };
00062
00063
00064 class MHActionIntInt: public MHElemAction
00065 {
00066 public:
00067 MHActionIntInt(const char *name): MHElemAction(name) {}
00068 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00069 virtual void PrintArgs(FILE *fd, int) const { m_Argument1.PrintMe(fd, 0); m_Argument2.PrintMe(fd, 0); }
00070 virtual void Perform(MHEngine *engine);
00071 virtual void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2) = 0;
00072 protected:
00073 MHGenericInteger m_Argument1, m_Argument2;
00074 };
00075
00076
00077 class MHActionInt3: public MHElemAction
00078 {
00079 public:
00080 MHActionInt3(const char *name): MHElemAction(name) {}
00081 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00082 virtual void PrintArgs(FILE *fd, int nTabs) const;
00083 virtual void Perform(MHEngine *engine);
00084 virtual void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3) = 0;
00085 protected:
00086 MHGenericInteger m_Argument1, m_Argument2, m_Argument3;
00087 };
00088
00089
00090 class MHActionInt4: public MHElemAction
00091 {
00092 public:
00093 MHActionInt4(const char *name): MHElemAction(name) {}
00094 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00095 virtual void PrintArgs(FILE *fd, int nTabs) const;
00096 virtual void Perform(MHEngine *engine);
00097 virtual void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3, int nArg4) = 0;
00098 protected:
00099 MHGenericInteger m_Argument1, m_Argument2, m_Argument3, m_Argument4;
00100 };
00101
00102
00103 class MHActionInt6: public MHElemAction
00104 {
00105 public:
00106 MHActionInt6(const char *name): MHElemAction(name) {}
00107 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00108 virtual void PrintArgs(FILE *fd, int nTabs) const;
00109 virtual void Perform(MHEngine *engine);
00110 virtual void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3, int nArg4, int nArg5, int nArg6) = 0;
00111 protected:
00112 MHGenericInteger m_Argument1, m_Argument2, m_Argument3, m_Argument4, m_Argument5, m_Argument6;
00113 };
00114
00115
00116
00117 class MHActionObjectRef: public MHElemAction
00118 {
00119 public:
00120 MHActionObjectRef(const char *name): MHElemAction(name) {}
00121 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00122 virtual void Perform(MHEngine *engine);
00123 virtual void CallAction(MHEngine *engine, MHRoot *pTarget, MHRoot *pArg) = 0;
00124 private:
00125 virtual void PrintArgs(FILE *fd, int) const { m_ResultVar.PrintMe(fd, 0); }
00126 MHObjectRef m_ResultVar;
00127 };
00128
00129
00130 class MHActionObjectRef2: public MHElemAction
00131 {
00132 public:
00133 MHActionObjectRef2(const char *name): MHElemAction(name) {}
00134 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00135 virtual void Perform(MHEngine *engine);
00136 virtual void CallAction(MHEngine *engine, MHRoot *pTarget, MHRoot *pArg1, MHRoot *pArg2) = 0;
00137 private:
00138 virtual void PrintArgs(FILE *fd, int) const { m_ResultVar1.PrintMe(fd, 0); m_ResultVar2.PrintMe(fd, 0);}
00139 MHObjectRef m_ResultVar1, m_ResultVar2;
00140 };
00141
00142 class MHActionGenericObjectRef: public MHElemAction
00143 {
00144 public:
00145 MHActionGenericObjectRef(const char *name): MHElemAction(name) {}
00146 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00147 virtual void Perform(MHEngine *engine);
00148 virtual void CallAction(MHEngine *engine, MHRoot *pTarget, MHRoot *pObj) = 0;
00149 protected:
00150 virtual void PrintArgs(FILE *fd, int) const { m_RefObject.PrintMe(fd, 0); }
00151 MHGenericObjectRef m_RefObject;
00152 };
00153
00154
00155
00156 class MHActionBool: public MHElemAction
00157 {
00158 public:
00159 MHActionBool(const char *name): MHElemAction(name) {}
00160 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00161 virtual void PrintArgs(FILE *fd, int) const { m_Argument.PrintMe(fd, 0); }
00162 virtual void Perform(MHEngine *engine);
00163 virtual void CallAction(MHEngine *engine, MHRoot *pTarget, bool fArg) = 0;
00164 protected:
00165 MHGenericBoolean m_Argument;
00166 };
00167
00168 #endif