mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-21 07:11:33 +00:00
Sixth minor fix
This commit is contained in:
parent
bd93e63150
commit
ad49d1ecab
10 changed files with 22 additions and 22 deletions
|
@ -292,12 +292,12 @@ namespace MWClass
|
||||||
ref->mBase = record;
|
ref->mBase = record;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Armor::canBeEquipped(const MWWorld::Ptr &npc, const MWWorld::Ptr &item) const
|
int Armor::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc);
|
MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc);
|
||||||
|
|
||||||
// slots that this item can be equipped in
|
// slots that this item can be equipped in
|
||||||
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(item).getEquipmentSlots(item);
|
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
|
||||||
|
|
||||||
std::string npcRace = npc.get<ESM::NPC>()->mBase->mRace;
|
std::string npcRace = npc.get<ESM::NPC>()->mBase->mRace;
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ namespace MWClass
|
||||||
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
|
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
|
||||||
if(race->mData.mFlags & ESM::Race::Beast)
|
if(race->mData.mFlags & ESM::Race::Beast)
|
||||||
{
|
{
|
||||||
std::vector<ESM::PartReference> parts = item.get<ESM::Armor>()->mBase->mParts.mParts;
|
std::vector<ESM::PartReference> parts = ptr.get<ESM::Armor>()->mBase->mParts.mParts;
|
||||||
|
|
||||||
if(*slot == MWWorld::InventoryStore::Slot_Helmet)
|
if(*slot == MWWorld::InventoryStore::Slot_Helmet)
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace MWClass
|
||||||
|
|
||||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||||
|
|
||||||
virtual int canBeEquipped(const MWWorld::Ptr &npc, const MWWorld::Ptr &item) const;
|
virtual int canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||||
|
|
|
@ -238,10 +238,10 @@ namespace MWClass
|
||||||
ref->mBase = record;
|
ref->mBase = record;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clothing::canBeEquipped(const MWWorld::Ptr &npc, const MWWorld::Ptr &item) const
|
int Clothing::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||||
{
|
{
|
||||||
// slots that this item can be equipped in
|
// slots that this item can be equipped in
|
||||||
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(item).getEquipmentSlots(item);
|
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
|
||||||
|
|
||||||
std::string npcRace = npc.get<ESM::NPC>()->mBase->mRace;
|
std::string npcRace = npc.get<ESM::NPC>()->mBase->mRace;
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ namespace MWClass
|
||||||
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
|
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
|
||||||
if(race->mData.mFlags & ESM::Race::Beast)
|
if(race->mData.mFlags & ESM::Race::Beast)
|
||||||
{
|
{
|
||||||
std::vector<ESM::PartReference> parts = item.get<ESM::Clothing>()->mBase->mParts.mParts;
|
std::vector<ESM::PartReference> parts = ptr.get<ESM::Clothing>()->mBase->mParts.mParts;
|
||||||
|
|
||||||
if(*slot == MWWorld::InventoryStore::Slot_Helmet)
|
if(*slot == MWWorld::InventoryStore::Slot_Helmet)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace MWClass
|
||||||
|
|
||||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||||
|
|
||||||
virtual int canBeEquipped(const MWWorld::Ptr &npc, const MWWorld::Ptr &item) const;
|
virtual int canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||||
|
|
|
@ -384,9 +384,9 @@ namespace MWClass
|
||||||
ref->mBase = record;
|
ref->mBase = record;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Weapon::canBeEquipped(const MWWorld::Ptr &npc, const MWWorld::Ptr &item) const
|
int Weapon::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||||
{
|
{
|
||||||
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(item).getEquipmentSlots(item);
|
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
|
||||||
|
|
||||||
// equip the item in the first free slot
|
// equip the item in the first free slot
|
||||||
for (std::vector<int>::const_iterator slot=slots.first.begin();
|
for (std::vector<int>::const_iterator slot=slots.first.begin();
|
||||||
|
@ -394,13 +394,13 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
if(*slot == MWWorld::InventoryStore::Slot_CarriedRight)
|
if(*slot == MWWorld::InventoryStore::Slot_CarriedRight)
|
||||||
{
|
{
|
||||||
if(item.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::LongBladeTwoHand ||
|
if(ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::LongBladeTwoHand ||
|
||||||
item.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoClose ||
|
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoClose ||
|
||||||
item.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoWide ||
|
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoWide ||
|
||||||
item.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::SpearTwoWide ||
|
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::SpearTwoWide ||
|
||||||
item.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::AxeTwoHand ||
|
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::AxeTwoHand ||
|
||||||
item.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanBow ||
|
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanBow ||
|
||||||
item.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow)
|
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow)
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace MWClass
|
||||||
|
|
||||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||||
|
|
||||||
virtual int canBeEquipped(const MWWorld::Ptr &npc, const MWWorld::Ptr &item) const;
|
virtual int canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace MWWorld
|
||||||
MWWorld::Ptr object = getTarget();
|
MWWorld::Ptr object = getTarget();
|
||||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor);
|
MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor);
|
||||||
|
|
||||||
switch(MWWorld::Class::get (object).canBeEquipped (actor, object))
|
switch(MWWorld::Class::get (object).canBeEquipped (object, actor))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -259,7 +259,7 @@ namespace MWWorld
|
||||||
throw std::runtime_error ("class can't be enchanted");
|
throw std::runtime_error ("class can't be enchanted");
|
||||||
}
|
}
|
||||||
|
|
||||||
int Class::canBeEquipped(const MWWorld::Ptr &npc, const MWWorld::Ptr &item) const
|
int Class::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||||
|
|
||||||
virtual int canBeEquipped(const MWWorld::Ptr &npc, const MWWorld::Ptr &item) const;
|
virtual int canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
||||||
|
|
||||||
virtual Ptr
|
virtual Ptr
|
||||||
|
|
|
@ -186,7 +186,7 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& npc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(MWWorld::Class::get (test).canBeEquipped (npc, test))
|
switch(MWWorld::Class::get (test).canBeEquipped (test, npc))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue