00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #if !defined(__INCLUDE_LandscapeEventsh_INCLUDE__)
00022 #define __INCLUDE_LandscapeEventsh_INCLUDE__
00023
00024 #include <common/fixed.h>
00025 #include <common/ModelID.h>
00026
00027 class ScorchedContext;
00028 class LandscapeCondition
00029 {
00030 public:
00031 virtual fixed getNextEventTime(ScorchedContext &context,
00032 int eventNumber) = 0;
00033 virtual bool fireEvent(ScorchedContext &context,
00034 fixed timeLeft, int eventNumber) = 0;
00035 virtual bool readXML(XMLNode *node) = 0;
00036
00037 static LandscapeCondition *create(const char *name);
00038 };
00039
00040 class LandscapeConditionGroupSize : public LandscapeCondition
00041 {
00042 public:
00043 int groupsize;
00044 std::string groupname;
00045
00046 virtual fixed getNextEventTime(ScorchedContext &context,
00047 int eventNumber);
00048 virtual bool fireEvent(ScorchedContext &context,
00049 fixed timeLeft, int eventNumber);
00050 virtual bool readXML(XMLNode *node);
00051 };
00052
00053 class LandscapeConditionTime : public LandscapeCondition
00054 {
00055 public:
00056 fixed mintime;
00057 fixed maxtime;
00058 bool singletimeonly;
00059
00060 virtual fixed getNextEventTime(ScorchedContext &context,
00061 int eventNumber);
00062 virtual bool fireEvent(ScorchedContext &context,
00063 fixed timeLeft, int eventNumber);
00064 virtual bool readXML(XMLNode *node);
00065 };
00066
00067 class LandscapeConditionRandom : public LandscapeCondition
00068 {
00069 public:
00070 fixed randomchance;
00071 fixed randomdelay;
00072
00073 virtual fixed getNextEventTime(ScorchedContext &context,
00074 int eventNumber);
00075 virtual bool fireEvent(ScorchedContext &context,
00076 fixed timeLeft, int eventNumber);
00077 virtual bool readXML(XMLNode *node);
00078 };
00079
00080 class LandscapeAction
00081 {
00082 public:
00083 virtual bool readXML(XMLNode *node) = 0;
00084 virtual void fireAction(ScorchedContext &context) = 0;
00085
00086 static LandscapeAction *create(const char *name);
00087 };
00088
00089 class LandscapeActionFireWeapon : public LandscapeAction
00090 {
00091 public:
00092 std::string weapon;
00093
00094 virtual void fireAction(ScorchedContext &context);
00095 virtual bool readXML(XMLNode *node);
00096 };
00097
00098 class LandscapeEvent
00099 {
00100 public:
00101 virtual ~LandscapeEvent();
00102
00103 LandscapeCondition *condition;
00104 LandscapeAction *action;
00105
00106 virtual bool readXML(XMLNode *node);
00107 };
00108
00109 #endif // __INCLUDE_LandscapeEventsh_INCLUDE__