1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00

Finished bugfix #691

This commit is contained in:
Glorf 2013-04-08 17:50:03 +02:00
parent 48d9885554
commit 50932a7a6b
3 changed files with 49 additions and 71 deletions

View File

@ -321,15 +321,10 @@ namespace MWClass
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
if(race->mData.mFlags & ESM::Race::Beast)
{
std::vector<ESM::PartReference> parts = it->get<ESM::Armor>()->mBase->mParts.mParts;
if(*slot == MWWorld::InventoryStore::Slot_Helmet)
{
std::vector<ESM::PartReference> parts;
if(it.getType() == MWWorld::ContainerStore::Type_Clothing)
parts = it->get<ESM::Clothing>()->mBase->mParts.mParts;
else
parts = it->get<ESM::Armor>()->mBase->mParts.mParts;
bool allow = true;
for(std::vector<ESM::PartReference>::iterator itr = parts.begin(); itr != parts.end(); ++itr)
{
if((*itr).mPart == ESM::PRT_Head)
@ -337,41 +332,41 @@ namespace MWClass
if(npc == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage13}");
allow = false;
break;
return false;
}
}
if(!allow)
break;
}
if (*slot == MWWorld::InventoryStore::Slot_Boots)
{
bool allow = true;
std::vector<ESM::PartReference> parts;
if(it.getType() == MWWorld::ContainerStore::Type_Clothing)
parts = it->get<ESM::Clothing>()->mBase->mParts.mParts;
else
parts = it->get<ESM::Armor>()->mBase->mParts.mParts;
for(std::vector<ESM::PartReference>::iterator itr = parts.begin(); itr != parts.end(); ++itr)
{
if((*itr).mPart == ESM::PRT_LFoot || (*itr).mPart == ESM::PRT_RFoot)
{
allow = false;
// Only notify the player, not npcs
if(npc == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
{
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage14}");
}
break;
return false;
}
}
if(!allow)
return false;
}
}
if(*slot == MWWorld::InventoryStore::Slot_CarriedLeft)
{
MWWorld::ContainerStoreIterator weapon = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
if(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)
{
//unequip twohanded item
invStore.equip(MWWorld::InventoryStore::Slot_CarriedRight, invStore.end());
}
return true;
}
}
return true;

View File

@ -267,32 +267,37 @@ namespace MWClass
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
if(race->mData.mFlags & ESM::Race::Beast)
{
std::vector<ESM::PartReference> parts = it->get<ESM::Clothing>()->mBase->mParts.mParts;
if(*slot == MWWorld::InventoryStore::Slot_Helmet)
{
for(std::vector<ESM::PartReference>::iterator itr = parts.begin(); itr != parts.end(); ++itr)
{
if((*itr).mPart == ESM::PRT_Head)
{
if(npc == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage13}");
return false;
}
}
}
if (*slot == MWWorld::InventoryStore::Slot_Boots)
{
bool allow = true;
std::vector<ESM::PartReference> parts;
if(it.getType() == MWWorld::ContainerStore::Type_Clothing)
parts = it->get<ESM::Clothing>()->mBase->mParts.mParts;
else
parts = it->get<ESM::Armor>()->mBase->mParts.mParts;
for(std::vector<ESM::PartReference>::iterator itr = parts.begin(); itr != parts.end(); ++itr)
{
if((*itr).mPart == ESM::PRT_LFoot || (*itr).mPart == ESM::PRT_RFoot)
{
allow = false;
// Only notify the player, not npcs
if(npc == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
{
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage15}");
}
break;
return false;
}
}
if(!allow)
return false;
}
}
}
return true;

View File

@ -411,41 +411,19 @@ namespace MWClass
{
if(*slot == MWWorld::InventoryStore::Slot_CarriedRight)
{
if (it.getType() == MWWorld::ContainerStore::Type_Weapon)
if(it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::LongBladeTwoHand ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoClose ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoWide ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::SpearTwoWide ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::AxeTwoHand ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanBow ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow)
{
if(it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::LongBladeTwoHand ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoClose ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoWide ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::SpearTwoWide ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::AxeTwoHand ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanBow ||
it->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow)
{
//unequip lefthand item
invStore.equip(MWWorld::InventoryStore::Slot_CarriedLeft, invStore.end());
}
}
}
if(*slot == MWWorld::InventoryStore::Slot_CarriedLeft)
{
MWWorld::ContainerStoreIterator weapon = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
if (weapon.getType() == MWWorld::ContainerStore::Type_Weapon)
{
if(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)
{
//unequip twohanded item
invStore.equip(MWWorld::InventoryStore::Slot_CarriedRight, invStore.end());
}
//unequip lefthand item
invStore.equip(MWWorld::InventoryStore::Slot_CarriedLeft, invStore.end());
}
return true;
}
return true;
}
return false;
}