Cornwallis
Member
- Joined
- Jan 3, 2010
- Messages
- 480
- Reaction score
- 16
Hello, I'm trying to make it so that when you cast a spell that adds a condition, it checks the sub-id of the old condition and the sub-id of the new, and if the new condition has a sub-id that's >= the old sub-id then it adds then new condition, and otherwise returns false. Am I on the right track here?
creature.cpp -> bool Creature::addCondition(Condition* condition, bool force/* = false*/)
I'm getting the error that condition isn't indentified, and that is must have a class/struct/union. So how do I differentiate the previous condition from the condition being added, and compare their sub-id's.
creature.cpp -> bool Creature::addCondition(Condition* condition, bool force/* = false*/)
Code:
Condition* prevCond = getCondition(condition->getType(), condition->getId(), condition->getSubId());
if (prevCond) {
prevCond->addCondition(this, condition);
delete condition;
return true;
}
if (conditon->getSubId() >= prevCond->getSubId()) {
return true;
else
return false;
}