From 7c5caec443d2cbe445f791deb1be107ba652a21a Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 8 Sep 2023 08:30:06 +0400 Subject: [PATCH] Allow creatures to be companions again --- apps/openmw/mwgui/companionwindow.cpp | 12 ++++++------ apps/openmw/mwgui/companionwindow.hpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwgui/companionwindow.cpp b/apps/openmw/mwgui/companionwindow.cpp index ff6cf2d5f7..240198eddc 100644 --- a/apps/openmw/mwgui/companionwindow.cpp +++ b/apps/openmw/mwgui/companionwindow.cpp @@ -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(npc); + auto model = std::make_unique(actor); mModel = model.get(); auto sortModel = std::make_unique(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) diff --git a/apps/openmw/mwgui/companionwindow.hpp b/apps/openmw/mwgui/companionwindow.hpp index c85044b472..97f3a0072e 100644 --- a/apps/openmw/mwgui/companionwindow.hpp +++ b/apps/openmw/mwgui/companionwindow.hpp @@ -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(); }