Code/ConditionMgr: cleanup

--HG--
branch : trunk
This commit is contained in:
Rat
2010-10-05 18:07:41 +02:00
parent f733d8b224
commit f745705ef9
2 changed files with 16 additions and 6 deletions
+6 -6
View File
@@ -160,19 +160,19 @@ bool Condition::Meets(Player * player, Unit* invoker)
{ {
switch (mConditionValue2) switch (mConditionValue2)
{ {
case 0: case LVL_COND_EQ:
condMeets = player->getLevel() == mConditionValue1; condMeets = player->getLevel() == mConditionValue1;
break; break;
case 1: case LVL_COND_HIGH:
condMeets = player->getLevel() > mConditionValue1; condMeets = player->getLevel() > mConditionValue1;
break; break;
case 2: case LVL_COND_LOW:
condMeets = player->getLevel() < mConditionValue1; condMeets = player->getLevel() < mConditionValue1;
break; break;
case 3: case LVL_COND_HIGH_EQ:
condMeets = player->getLevel() >= mConditionValue1; condMeets = player->getLevel() >= mConditionValue1;
break; break;
case 4: case LVL_COND_LOW_EQ:
condMeets = player->getLevel() <= mConditionValue1; condMeets = player->getLevel() <= mConditionValue1;
break; break;
} }
@@ -1265,7 +1265,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
} }
case CONDITION_LEVEL: case CONDITION_LEVEL:
{ {
if (cond->mConditionValue2 > 4) if (cond->mConditionValue2 >= LVL_COND_MAX)
{ {
sLog.outErrorDb("Level condition has invalid option (%u), skipped", cond->mConditionValue2); sLog.outErrorDb("Level condition has invalid option (%u), skipped", cond->mConditionValue2);
return false; return false;
+10
View File
@@ -60,6 +60,16 @@ enum ConditionType
CONDITION_MAX = 28 // MAX CONDITION_MAX = 28 // MAX
}; };
enum LevelConditionType
{
LVL_COND_EQ = 0,
LVL_COND_HIGH = 1,
LVL_COND_LOW = 2,
LVL_COND_HIGH_EQ = 3,
LVL_COND_LOW_EQ = 4,
LVL_COND_MAX = 5,
};
enum ConditionSourceType enum ConditionSourceType
{ {
CONDITION_SOURCE_TYPE_NONE = 0,//DONE CONDITION_SOURCE_TYPE_NONE = 0,//DONE