[Client] Add MechanicsHelper::assignAttackTarget()

0.6.1
David Cernat 8 years ago
parent 17c4b6d4de
commit c3375ba86f

@ -54,7 +54,24 @@ Attack *MechanicsHelper::getDedicatedAttack(const MWWorld::Ptr& ptr)
return NULL;
}
void MechanicsHelper::processAttack(const MWWorld::Ptr& attacker, Attack attack)
void MechanicsHelper::assignAttackTarget(Attack* attack, const MWWorld::Ptr& target)
{
if (mwmp::PlayerList::isDedicatedPlayer(target))
{
attack->target.guid = mwmp::PlayerList::getPlayer(target)->guid;
attack->target.refId.clear();
}
else
{
MWWorld::CellRef *targetRef = &target.getCellRef();
attack->target.refId = targetRef->getRefId();
attack->target.refNumIndex = targetRef->getRefNum().mIndex;
attack->target.mpNum = targetRef->getMpNum();
}
}
void MechanicsHelper::processAttack(Attack attack, const MWWorld::Ptr& attacker)
{
if (attack.pressed == false)
{

@ -19,7 +19,9 @@ namespace mwmp
Attack *getLocalAttack(const MWWorld::Ptr& ptr);
Attack *getDedicatedAttack(const MWWorld::Ptr& ptr);
void processAttack(const MWWorld::Ptr& attacker, Attack attack);
void assignAttackTarget(Attack* attack, const MWWorld::Ptr& target);
void processAttack(Attack attack, const MWWorld::Ptr& attacker);
};
}

@ -27,7 +27,7 @@ namespace mwmp
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
Main::get().getMechanicsHelper()->processAttack(static_cast<DedicatedPlayer*>(player)->getPtr(), player->attack);
Main::get().getMechanicsHelper()->processAttack(player->attack, static_cast<DedicatedPlayer*>(player)->getPtr());
}
};
}

Loading…
Cancel
Save