From d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Wed, 10 Apr 2013 23:04:42 +0200 Subject: Converted Being into a Component I did not really care too much about staying consistent with the use of static_casts to Actors since they are only temporary anyway until Actor is a component too. --- src/game-server/item.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/game-server/item.cpp') diff --git a/src/game-server/item.cpp b/src/game-server/item.cpp index 7295b95..2b2d462 100644 --- a/src/game-server/item.cpp +++ b/src/game-server/item.cpp @@ -33,28 +33,33 @@ #include #include -bool ItemEffectAttrMod::apply(Being *itemUser) +bool ItemEffectAttrMod::apply(Entity *itemUser) { LOG_DEBUG("Applying modifier."); - itemUser->applyModifier(mAttributeId, mMod, mAttributeLayer, - mDuration, mId); + itemUser->getComponent()->applyModifier(*itemUser, + mAttributeId, mMod, + mAttributeLayer, + mDuration, mId); return false; } -void ItemEffectAttrMod::dispell(Being *itemUser) +void ItemEffectAttrMod::dispell(Entity *itemUser) { LOG_DEBUG("Dispelling modifier."); - itemUser->removeModifier(mAttributeId, mMod, mAttributeLayer, - mId, !mDuration); + itemUser->getComponent()->removeModifier(*itemUser, + mAttributeId, + mMod, + mAttributeLayer, + mId, !mDuration); } -bool ItemEffectAttack::apply(Being *itemUser) +bool ItemEffectAttack::apply(Entity *itemUser) { itemUser->getComponent()->addAttack(mAttackInfo); return false; } -void ItemEffectAttack::dispell(Being *itemUser) +void ItemEffectAttack::dispell(Entity *itemUser) { itemUser->getComponent()->removeAttack(mAttackInfo); } @@ -63,7 +68,7 @@ ItemEffectScript::~ItemEffectScript() { } -bool ItemEffectScript::apply(Being *itemUser) +bool ItemEffectScript::apply(Entity *itemUser) { if (mActivateEventName.empty()) return false; @@ -82,7 +87,7 @@ bool ItemEffectScript::apply(Being *itemUser) return false; } -void ItemEffectScript::dispell(Being *itemUser) +void ItemEffectScript::dispell(Entity *itemUser) { if (mDispellEventName.empty()) return; @@ -123,7 +128,7 @@ void ItemClass::addEffect(ItemEffectInfo *effect, mDispells.insert(std::make_pair(dispell, effect)); } -bool ItemClass::useTrigger(Being *itemUser, ItemTriggerType trigger) +bool ItemClass::useTrigger(Entity *itemUser, ItemTriggerType trigger) { if (!trigger) return false; -- cgit