Don't show WerewolfRobe objects in the inventory

Pretty ugly hard-coding, but this is likely what vanilla does since it
has no option to mark clothes or armor as unplayable like Oblivion does.
This commit is contained in:
Chris Robinson 2013-08-08 16:05:26 -07:00
parent d77d60cbc2
commit 5fbfce6d1e
2 changed files with 21 additions and 7 deletions

View file

@ -75,7 +75,14 @@ void InventoryItemModel::update()
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
{ {
ItemStack newItem (*it, this, it->getRefData().getCount()); MWWorld::Ptr item = *it;
// NOTE: Don't show WerewolfRobe objects in the inventory, or allow them to be taken.
// Vanilla likely uses a hack like this since there's no other way to prevent it from
// being shown or taken.
if(item.getCellRef().mRefID == "WerewolfRobe")
continue;
ItemStack newItem (item, this, item.getRefData().getCount());
if (mActor.getTypeName() == typeid(ESM::NPC).name()) if (mActor.getTypeName() == typeid(ESM::NPC).name())
{ {

View file

@ -356,12 +356,19 @@ namespace MWGui
if (slot == -1) if (slot == -1)
return MWWorld::Ptr(); return MWWorld::Ptr();
MWWorld::Ptr player = mPtr; MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player); if(invStore.getSlot(slot) != invStore.end())
if (invStore.getSlot(slot) != invStore.end()) {
return *invStore.getSlot (slot); MWWorld::Ptr item = *invStore.getSlot(slot);
else // NOTE: Don't allow users to select WerewolfRobe objects in the inventory. Vanilla
return MWWorld::Ptr(); // likely uses a hack like this since there's no other way to prevent it from being
// taken.
if(item.getCellRef().mRefID == "WerewolfRobe")
return MWWorld::Ptr();
return item;
}
return MWWorld::Ptr();
} }
void InventoryWindow::unequipItem(const MWWorld::Ptr& item) void InventoryWindow::unequipItem(const MWWorld::Ptr& item)