Пример #1
0
void Creature::removeCondition(ConditionType_t type, ConditionId_t id, bool force/* = false*/)
{
	ConditionList::iterator it = conditions.begin();
	while (it != conditions.end()) {
		Condition* condition = *it;
		if (condition->getType() != type || condition->getId() != id) {
			++it;
			continue;
		}

		if (!force && condition->getType() == CONDITION_PARALYZE) {
			int64_t walkDelay = getWalkDelay();
			if (walkDelay > 0) {
				g_scheduler.addEvent(createSchedulerTask(walkDelay, boost::bind(&Game::forceRemoveCondition, &g_game, getID(), type)));
				return;
			}
		}

		it = conditions.erase(it);

		condition->endCondition(this, CONDITIONEND_ABORT);
		delete condition;

		onEndCondition(type);
	}
}
Пример #2
0
 /**
  * Checks if the given condition (right hand side) is greater than this condition (left hand side).
  *
  * @param _condition The condition to compare with (rhs).
  *
  * @return  true    ,if the given substitution is greater than this substitution;
  *          false   ,otherwise.
  */
 bool Condition::operator<( const Condition& _condition ) const
 {
     return mId < _condition.getId();
 }
Пример #3
0
 /**
  * Checks the equality of a given condition (right hand side) with this condition (left hand side).
  *
  * @param _condition The condition to compare with (rhs).
  *
  * @return  true    ,if the given condition is equal to this condition;
  *          false   ,otherwise.
  */
 bool Condition::operator==( const Condition& _condition ) const
 {
     return mId == _condition.getId();
 }