KoduConditionScored.h
Go to the documentation of this file.00001 #ifndef KODU_CONDITION_SCORED_H_
00002 #define KODU_CONDITION_SCORED_H_
00003
00004
00005 #include "Kodu/Generators/KoduGenerators.h"
00006 #include "Kodu/Primitives/KoduCondition.h"
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 namespace Kodu {
00020
00021 class KoduWorld;
00022
00023
00024 class KoduConditionScored : public KoduCondition {
00025 public:
00026
00027 enum CompareType_t {
00028 INVALID = 0L,
00029 CT_EQUALS = 1L << 0,
00030 CT_NOT_EQUALS = 1L << 1,
00031 CT_GT_EQUAL = 1L << 2,
00032 CT_LT_EQUAL = 1L << 3,
00033 CT_ABOVE = 1L << 4,
00034 CT_BELOW = 1L << 5
00035 };
00036
00037
00038 KoduConditionScored(bool useNot, CompareType_t compType, const NumericGenerator& kNumericGen,
00039 const std::string& kDesignator, bool numericModWasSpecified)
00040 : KoduCondition ("KoduConditionScored", KoduCondition::CT_SCORED),
00041 notModifierEnabled(useNot),
00042 type(compType),
00043 numericGen(kNumericGen),
00044 designator(kDesignator),
00045 numericsWereSpecified(numericModWasSpecified),
00046 lastRecordedValue(0)
00047 { }
00048
00049
00050 KoduConditionScored(const KoduConditionScored& kCondition)
00051 : KoduCondition(kCondition),
00052 notModifierEnabled(kCondition.notModifierEnabled),
00053 type(kCondition.type),
00054 numericGen(kCondition.numericGen),
00055 designator(kCondition.designator),
00056 numericsWereSpecified(kCondition.numericsWereSpecified),
00057 lastRecordedValue(kCondition.lastRecordedValue)
00058 { }
00059
00060
00061 ~KoduConditionScored() {
00062
00063 }
00064
00065
00066 KoduConditionScored& operator=(const KoduConditionScored& kCondition) {
00067 if (this != &kCondition) {
00068 KoduCondition::operator=(kCondition);
00069 notModifierEnabled = kCondition.notModifierEnabled;
00070 type = kCondition.type;
00071 numericGen = kCondition.numericGen;
00072 designator = kCondition.designator;
00073 numericsWereSpecified = kCondition.numericsWereSpecified;
00074 lastRecordedValue = kCondition.lastRecordedValue;
00075 }
00076 return *this;
00077 }
00078
00079
00080 virtual bool evaluate(const KoduWorld&);
00081
00082
00083 static bool isSameTypeAs(const KoduPrimitive*);
00084
00085
00086 virtual void reinitialize();
00087
00088
00089 virtual void printAttrs() const;
00090
00091 private:
00092 bool notModifierEnabled;
00093 CompareType_t type;
00094 NumericGenerator numericGen;
00095 std::string designator;
00096 bool numericsWereSpecified;
00097 int lastRecordedValue;
00098 };
00099 }
00100
00101 #endif // KODU_CONDITION_SCORED_H_