forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'zini/master' into animation-state
This commit is contained in:
commit
e5e9c83ed5
2 changed files with 25 additions and 0 deletions
|
@ -215,4 +215,27 @@ namespace MWClass
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
return ref->mBase->mData.mWeight;
|
return ref->mBase->mData.mWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::pair<int, std::string> Light::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||||
|
{
|
||||||
|
MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc);
|
||||||
|
MWWorld::ContainerStoreIterator weapon = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||||
|
|
||||||
|
if(weapon == invStore.end())
|
||||||
|
return std::make_pair(1,"");
|
||||||
|
|
||||||
|
/// \todo the 2h check is repeated many times; put it in a function
|
||||||
|
if(weapon->getTypeName() == typeid(ESM::Weapon).name() &&
|
||||||
|
(weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::LongBladeTwoHand ||
|
||||||
|
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoClose ||
|
||||||
|
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoWide ||
|
||||||
|
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::SpearTwoWide ||
|
||||||
|
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::AxeTwoHand ||
|
||||||
|
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanBow ||
|
||||||
|
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow))
|
||||||
|
{
|
||||||
|
return std::make_pair(3,"");
|
||||||
|
}
|
||||||
|
return std::make_pair(1,"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,8 @@ namespace MWClass
|
||||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||||
|
|
||||||
|
std::pair<int, std::string> canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue