DropConfig.cpp 737 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "DropConfig.h"
  2. DropConfig::DropConfig()
  3. : ReferenceCounter(),
  4. condition(0)
  5. {}
  6. DropConfig::~DropConfig()
  7. {
  8. delete condition;
  9. }
  10. void DropConfig::setCondition(DropCondition* condition)
  11. {
  12. if (this->condition)
  13. {
  14. delete this->condition;
  15. }
  16. this->condition = condition;
  17. }
  18. void DropConfig::initialize() {}
  19. const DropCondition* DropConfig::zCondition() const
  20. {
  21. return condition;
  22. }
  23. void DropConfig::onObjectDestroyed(Entity* zActor,
  24. Item* zItem,
  25. ItemSkill* zUsedSkill,
  26. Framework::Either<Block*, Entity*> zDestroyedObject) const
  27. {
  28. if (condition->evaluate(zActor, zItem, zUsedSkill, zDestroyedObject))
  29. {
  30. doDrop(zActor, zItem, zUsedSkill, zDestroyedObject);
  31. }
  32. }