Merge branch 'companion_creatures' into 'master'

Allow creatures to be companions again

See merge request OpenMW/openmw!3409
macos_ci_fix
psi29a 1 year ago
commit cadb166b58
No known key found for this signature in database

@ -71,7 +71,7 @@ namespace MWGui
const ItemStack& item = mSortModel->getItem(index);
// We can't take conjured items from a companion NPC
// We can't take conjured items from a companion actor
if (item.mFlags & ItemStack::Flag_Bound)
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}");
@ -119,13 +119,13 @@ namespace MWGui
}
}
void CompanionWindow::setPtr(const MWWorld::Ptr& npc)
void CompanionWindow::setPtr(const MWWorld::Ptr& actor)
{
if (npc.isEmpty() || npc.getType() != ESM::REC_NPC_)
if (actor.isEmpty() || !actor.getClass().isActor())
throw std::runtime_error("Invalid argument in CompanionWindow::setPtr");
mPtr = npc;
mPtr = actor;
updateEncumbranceBar();
auto model = std::make_unique<CompanionItemModel>(npc);
auto model = std::make_unique<CompanionItemModel>(actor);
mModel = model.get();
auto sortModel = std::make_unique<SortFilterItemModel>(std::move(model));
mSortModel = sortModel.get();
@ -133,7 +133,7 @@ namespace MWGui
mItemView->setModel(std::move(sortModel));
mItemView->resetScrollBars();
setTitle(npc.getClass().getName(npc));
setTitle(actor.getClass().getName(actor));
}
void CompanionWindow::onFrame(float dt)

@ -26,7 +26,7 @@ namespace MWGui
void resetReference() override;
void setPtr(const MWWorld::Ptr& npc) override;
void setPtr(const MWWorld::Ptr& actor) override;
void onFrame(float dt) override;
void clear() override { resetReference(); }

Loading…
Cancel
Save