2010-08-03 13:24:44 +00:00
|
|
|
#include "container.hpp"
|
|
|
|
|
|
|
|
#include <components/esm/loadcont.hpp>
|
2014-01-31 12:25:32 +00:00
|
|
|
#include <components/esm/containerstate.hpp>
|
2010-08-03 13:24:44 +00:00
|
|
|
|
2012-04-23 13:27:03 +00:00
|
|
|
#include "../mwbase/environment.hpp"
|
2012-07-03 10:30:50 +00:00
|
|
|
#include "../mwbase/world.hpp"
|
2012-08-12 16:11:09 +00:00
|
|
|
#include "../mwbase/windowmanager.hpp"
|
2014-12-05 19:58:33 +00:00
|
|
|
#include "../mwbase/mechanicsmanager.hpp"
|
2016-07-10 12:42:03 +00:00
|
|
|
#include "../mwbase/soundmanager.hpp"
|
2012-04-23 13:27:03 +00:00
|
|
|
|
2010-08-03 15:11:41 +00:00
|
|
|
#include "../mwworld/ptr.hpp"
|
2012-11-17 17:17:08 +00:00
|
|
|
#include "../mwworld/failedaction.hpp"
|
2013-02-17 14:56:22 +00:00
|
|
|
#include "../mwworld/nullaction.hpp"
|
2012-01-27 13:55:58 +00:00
|
|
|
#include "../mwworld/containerstore.hpp"
|
|
|
|
#include "../mwworld/customdata.hpp"
|
2012-06-29 14:48:50 +00:00
|
|
|
#include "../mwworld/cellstore.hpp"
|
2014-12-19 10:26:54 +00:00
|
|
|
#include "../mwworld/esmstore.hpp"
|
2012-07-03 11:15:20 +00:00
|
|
|
#include "../mwworld/actionopen.hpp"
|
2013-11-13 13:02:15 +00:00
|
|
|
#include "../mwworld/actiontrap.hpp"
|
2015-05-09 23:09:00 +00:00
|
|
|
#include "../mwphysics/physicssystem.hpp"
|
2012-09-10 15:44:59 +00:00
|
|
|
#include "../mwworld/inventorystore.hpp"
|
2012-04-16 20:58:16 +00:00
|
|
|
|
|
|
|
#include "../mwgui/tooltips.hpp"
|
2012-01-27 13:55:58 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
#include "../mwrender/objects.hpp"
|
2012-07-03 11:15:20 +00:00
|
|
|
#include "../mwrender/renderinginterface.hpp"
|
2012-01-27 14:11:02 +00:00
|
|
|
|
2013-08-09 05:34:53 +00:00
|
|
|
#include "../mwmechanics/npcstats.hpp"
|
|
|
|
|
2015-11-29 13:13:14 +00:00
|
|
|
namespace MWClass
|
2012-01-27 13:55:58 +00:00
|
|
|
{
|
2015-11-29 13:13:14 +00:00
|
|
|
class ContainerCustomData : public MWWorld::CustomData
|
2012-01-27 13:55:58 +00:00
|
|
|
{
|
2015-11-29 13:13:14 +00:00
|
|
|
public:
|
2012-01-28 10:45:55 +00:00
|
|
|
MWWorld::ContainerStore mContainerStore;
|
2012-01-27 13:55:58 +00:00
|
|
|
|
|
|
|
virtual MWWorld::CustomData *clone() const;
|
2015-11-29 13:13:14 +00:00
|
|
|
|
|
|
|
virtual ContainerCustomData& asContainerCustomData()
|
|
|
|
{
|
|
|
|
return *this;
|
|
|
|
}
|
2012-01-27 13:55:58 +00:00
|
|
|
};
|
|
|
|
|
2014-03-16 22:38:51 +00:00
|
|
|
MWWorld::CustomData *ContainerCustomData::clone() const
|
2012-01-27 13:55:58 +00:00
|
|
|
{
|
2014-03-16 22:38:51 +00:00
|
|
|
return new ContainerCustomData (*this);
|
2012-01-27 13:55:58 +00:00
|
|
|
}
|
2010-08-03 15:11:41 +00:00
|
|
|
|
2012-01-27 13:55:58 +00:00
|
|
|
void Container::ensureCustomData (const MWWorld::Ptr& ptr) const
|
|
|
|
{
|
|
|
|
if (!ptr.getRefData().getCustomData())
|
|
|
|
{
|
2014-03-16 22:38:51 +00:00
|
|
|
std::auto_ptr<ContainerCustomData> data (new ContainerCustomData);
|
2012-01-27 13:55:58 +00:00
|
|
|
|
2013-07-30 22:02:24 +00:00
|
|
|
MWWorld::LiveCellRef<ESM::Container> *ref =
|
|
|
|
ptr.get<ESM::Container>();
|
|
|
|
|
2015-02-04 20:18:43 +00:00
|
|
|
// setting ownership not needed, since taking items from a container inherits the
|
|
|
|
// container's owner automatically
|
2013-07-30 22:02:24 +00:00
|
|
|
data->mContainerStore.fill(
|
2015-02-04 20:18:43 +00:00
|
|
|
ref->mBase->mInventory, "");
|
2012-01-27 13:55:58 +00:00
|
|
|
|
|
|
|
// store
|
|
|
|
ptr.getRefData().setCustomData (data.release());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-17 07:05:41 +00:00
|
|
|
void Container::respawn(const MWWorld::Ptr &ptr) const
|
|
|
|
{
|
|
|
|
MWWorld::LiveCellRef<ESM::Container> *ref =
|
|
|
|
ptr.get<ESM::Container>();
|
|
|
|
if (ref->mBase->mFlags & ESM::Container::Respawn)
|
|
|
|
{
|
2015-12-14 01:57:55 +00:00
|
|
|
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
|
2014-05-17 07:05:41 +00:00
|
|
|
ptr.getRefData().setCustomData(NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-17 12:30:31 +00:00
|
|
|
void Container::restock(const MWWorld::Ptr& ptr) const
|
|
|
|
{
|
|
|
|
MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
|
|
|
|
const ESM::InventoryList& list = ref->mBase->mInventory;
|
2014-05-18 10:53:21 +00:00
|
|
|
MWWorld::ContainerStore& store = getContainerStore(ptr);
|
2015-02-04 20:18:43 +00:00
|
|
|
|
|
|
|
// setting ownership not needed, since taking items from a container inherits the
|
|
|
|
// container's owner automatically
|
|
|
|
store.restock(list, ptr, "");
|
2014-05-17 12:30:31 +00:00
|
|
|
}
|
|
|
|
|
2015-01-12 10:29:56 +00:00
|
|
|
void Container::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
2010-08-14 08:02:54 +00:00
|
|
|
{
|
2012-07-24 16:22:11 +00:00
|
|
|
if (!model.empty()) {
|
2015-04-12 13:34:50 +00:00
|
|
|
renderingInterface.getObjects().insertModel(ptr, model, true);
|
2010-08-14 08:02:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-09 23:09:00 +00:00
|
|
|
void Container::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const
|
2012-07-24 16:22:11 +00:00
|
|
|
{
|
2012-11-05 18:40:02 +00:00
|
|
|
if(!model.empty())
|
2015-01-12 10:29:56 +00:00
|
|
|
physics.addObject(ptr, model);
|
2014-12-05 19:58:33 +00:00
|
|
|
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
2012-07-24 16:22:11 +00:00
|
|
|
}
|
2012-08-09 12:33:21 +00:00
|
|
|
|
2015-12-18 14:51:05 +00:00
|
|
|
std::string Container::getModel(const MWWorld::ConstPtr &ptr) const
|
2011-11-12 04:01:12 +00:00
|
|
|
{
|
2015-12-18 14:51:05 +00:00
|
|
|
const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
|
2011-11-12 04:01:12 +00:00
|
|
|
|
2012-11-05 12:07:59 +00:00
|
|
|
const std::string &model = ref->mBase->mModel;
|
2012-07-24 16:22:11 +00:00
|
|
|
if (!model.empty()) {
|
|
|
|
return "meshes\\" + model;
|
2011-11-12 04:01:12 +00:00
|
|
|
}
|
2012-07-24 16:22:11 +00:00
|
|
|
return "";
|
2011-11-12 04:01:12 +00:00
|
|
|
}
|
|
|
|
|
2012-02-27 14:37:05 +00:00
|
|
|
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
|
2012-04-23 13:27:03 +00:00
|
|
|
const MWWorld::Ptr& actor) const
|
2012-02-27 14:37:05 +00:00
|
|
|
{
|
2013-02-17 14:56:22 +00:00
|
|
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
|
|
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
|
|
|
|
2014-05-22 18:37:22 +00:00
|
|
|
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
|
2013-08-09 05:34:53 +00:00
|
|
|
{
|
2013-08-11 07:35:19 +00:00
|
|
|
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
|
|
|
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfContainer");
|
|
|
|
|
2013-08-09 05:34:53 +00:00
|
|
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction("#{sWerewolfRefusal}"));
|
2013-08-11 07:35:19 +00:00
|
|
|
if(sound) action->setSound(sound->mId);
|
|
|
|
|
2013-08-09 05:34:53 +00:00
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
2012-02-27 14:37:05 +00:00
|
|
|
const std::string lockedSound = "LockedChest";
|
|
|
|
const std::string trapActivationSound = "Disarm Trap Fail";
|
|
|
|
|
2014-01-08 17:39:44 +00:00
|
|
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
2014-05-22 18:37:22 +00:00
|
|
|
MWWorld::InventoryStore& invStore = player.getClass().getInventoryStore(player);
|
2012-09-10 15:44:59 +00:00
|
|
|
|
2016-07-10 13:29:21 +00:00
|
|
|
bool isLocked = ptr.getCellRef().getLockLevel() > 0;
|
|
|
|
bool isTrapped = !ptr.getCellRef().getTrap().empty();
|
2012-09-10 15:44:59 +00:00
|
|
|
bool hasKey = false;
|
|
|
|
std::string keyName;
|
2012-11-02 21:21:32 +00:00
|
|
|
|
|
|
|
// make key id lowercase
|
2014-05-25 12:13:07 +00:00
|
|
|
std::string keyId = ptr.getCellRef().getKey();
|
2015-12-07 21:49:15 +00:00
|
|
|
Misc::StringUtils::lowerCaseInPlace(keyId);
|
2012-09-10 15:44:59 +00:00
|
|
|
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
|
2012-02-27 14:37:05 +00:00
|
|
|
{
|
2014-05-25 12:13:07 +00:00
|
|
|
std::string refId = it->getCellRef().getRefId();
|
2015-12-07 21:49:15 +00:00
|
|
|
Misc::StringUtils::lowerCaseInPlace(refId);
|
2012-11-02 21:18:37 +00:00
|
|
|
if (refId == keyId)
|
2012-09-10 15:44:59 +00:00
|
|
|
{
|
|
|
|
hasKey = true;
|
2014-05-22 18:37:22 +00:00
|
|
|
keyName = it->getClass().getName(*it);
|
2012-09-10 15:44:59 +00:00
|
|
|
}
|
2012-02-27 14:37:05 +00:00
|
|
|
}
|
2012-09-10 15:44:59 +00:00
|
|
|
|
2016-07-10 13:29:21 +00:00
|
|
|
if ((isLocked || isTrapped) && hasKey)
|
2012-09-10 15:44:59 +00:00
|
|
|
{
|
2013-03-30 11:56:37 +00:00
|
|
|
MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}");
|
2016-07-10 13:29:21 +00:00
|
|
|
if(isLocked)
|
|
|
|
unlock(ptr);
|
2012-09-10 15:44:59 +00:00
|
|
|
// using a key disarms the trap
|
2016-07-10 13:29:21 +00:00
|
|
|
if(isTrapped)
|
2016-07-10 12:42:03 +00:00
|
|
|
{
|
|
|
|
ptr.getCellRef().setTrap("");
|
|
|
|
MWBase::Environment::get().getSoundManager()->playSound3D(ptr,
|
|
|
|
"Disarm Trap", 1.0f, 1.0f, MWBase::SoundManager::Play_TypeSfx,
|
|
|
|
MWBase::SoundManager::Play_Normal);
|
2016-07-10 13:29:21 +00:00
|
|
|
isTrapped = false;
|
2016-07-10 12:42:03 +00:00
|
|
|
}
|
2012-09-10 15:44:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-07-10 13:29:21 +00:00
|
|
|
if (!isLocked || hasKey)
|
2012-02-27 14:37:05 +00:00
|
|
|
{
|
2016-07-10 13:29:21 +00:00
|
|
|
if(!isTrapped)
|
2012-02-27 14:37:05 +00:00
|
|
|
{
|
2012-09-04 13:42:41 +00:00
|
|
|
boost::shared_ptr<MWWorld::Action> action (new MWWorld::ActionOpen(ptr));
|
|
|
|
return action;
|
2012-02-27 14:37:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-13 13:02:15 +00:00
|
|
|
// Activate trap
|
2016-07-10 12:22:48 +00:00
|
|
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTrap(ptr.getCellRef().getTrap(), ptr));
|
2012-08-19 23:11:50 +00:00
|
|
|
action->setSound(trapActivationSound);
|
|
|
|
return action;
|
2012-02-27 14:37:05 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-10 15:44:59 +00:00
|
|
|
else
|
|
|
|
{
|
2016-08-10 12:02:17 +00:00
|
|
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction(std::string(), ptr));
|
2012-09-10 15:44:59 +00:00
|
|
|
action->setSound(lockedSound);
|
|
|
|
return action;
|
|
|
|
}
|
2012-02-27 14:37:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-18 14:27:06 +00:00
|
|
|
std::string Container::getName (const MWWorld::ConstPtr& ptr) const
|
2010-08-03 15:11:41 +00:00
|
|
|
{
|
2015-12-18 14:27:06 +00:00
|
|
|
const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
|
2010-08-03 15:11:41 +00:00
|
|
|
|
2012-11-05 12:07:59 +00:00
|
|
|
return ref->mBase->mName;
|
2010-08-03 15:11:41 +00:00
|
|
|
}
|
|
|
|
|
2012-01-28 10:45:55 +00:00
|
|
|
MWWorld::ContainerStore& Container::getContainerStore (const MWWorld::Ptr& ptr)
|
2010-08-04 12:37:23 +00:00
|
|
|
const
|
|
|
|
{
|
2012-01-27 13:55:58 +00:00
|
|
|
ensureCustomData (ptr);
|
2010-08-04 12:37:23 +00:00
|
|
|
|
2015-11-29 13:13:14 +00:00
|
|
|
return ptr.getRefData().getCustomData()->asContainerCustomData().mContainerStore;
|
2010-08-04 12:37:23 +00:00
|
|
|
}
|
|
|
|
|
2015-12-17 23:12:03 +00:00
|
|
|
std::string Container::getScript (const MWWorld::ConstPtr& ptr) const
|
2010-08-05 13:40:03 +00:00
|
|
|
{
|
2015-12-17 23:12:03 +00:00
|
|
|
const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
|
2010-08-05 13:40:03 +00:00
|
|
|
|
2012-11-05 12:07:59 +00:00
|
|
|
return ref->mBase->mScript;
|
2010-08-05 13:40:03 +00:00
|
|
|
}
|
|
|
|
|
2010-08-03 13:24:44 +00:00
|
|
|
void Container::registerSelf()
|
|
|
|
{
|
|
|
|
boost::shared_ptr<Class> instance (new Container);
|
|
|
|
|
|
|
|
registerClass (typeid (ESM::Container).name(), instance);
|
|
|
|
}
|
2012-04-15 15:52:39 +00:00
|
|
|
|
2015-12-19 15:13:00 +00:00
|
|
|
bool Container::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
2012-04-16 20:58:16 +00:00
|
|
|
{
|
2015-12-19 15:13:00 +00:00
|
|
|
const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
|
2012-04-16 20:58:16 +00:00
|
|
|
|
2012-11-05 12:07:59 +00:00
|
|
|
return (ref->mBase->mName != "");
|
2012-04-16 20:58:16 +00:00
|
|
|
}
|
|
|
|
|
2015-12-19 15:29:07 +00:00
|
|
|
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
2012-04-16 20:58:16 +00:00
|
|
|
{
|
2015-12-18 14:27:06 +00:00
|
|
|
const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
|
2012-04-16 20:58:16 +00:00
|
|
|
|
|
|
|
MWGui::ToolTipInfo info;
|
2012-11-05 12:07:59 +00:00
|
|
|
info.caption = ref->mBase->mName;
|
2012-04-16 20:58:16 +00:00
|
|
|
|
|
|
|
std::string text;
|
2014-05-25 12:13:07 +00:00
|
|
|
if (ptr.getCellRef().getLockLevel() > 0)
|
|
|
|
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ptr.getCellRef().getLockLevel());
|
|
|
|
else if (ptr.getCellRef().getLockLevel() < 0)
|
2014-04-23 17:02:51 +00:00
|
|
|
text += "\n#{sUnlocked}";
|
2014-05-25 12:13:07 +00:00
|
|
|
if (ptr.getCellRef().getTrap() != "")
|
2012-09-22 19:35:57 +00:00
|
|
|
text += "\n#{sTrapped}";
|
2012-04-15 15:52:39 +00:00
|
|
|
|
2012-04-24 00:02:03 +00:00
|
|
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
2014-07-22 18:03:35 +00:00
|
|
|
text += MWGui::ToolTips::getCellRefString(ptr.getCellRef());
|
2012-11-05 12:07:59 +00:00
|
|
|
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
2012-04-16 20:58:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
info.text = text;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
2012-05-15 19:17:00 +00:00
|
|
|
|
2012-05-15 20:31:52 +00:00
|
|
|
float Container::getCapacity (const MWWorld::Ptr& ptr) const
|
2012-05-15 19:17:00 +00:00
|
|
|
{
|
2012-06-29 16:54:23 +00:00
|
|
|
MWWorld::LiveCellRef<ESM::Container> *ref =
|
2012-05-15 19:17:00 +00:00
|
|
|
ptr.get<ESM::Container>();
|
|
|
|
|
2012-11-05 12:07:59 +00:00
|
|
|
return ref->mBase->mWeight;
|
2012-05-15 19:17:00 +00:00
|
|
|
}
|
2012-05-15 19:34:00 +00:00
|
|
|
|
|
|
|
float Container::getEncumbrance (const MWWorld::Ptr& ptr) const
|
|
|
|
{
|
|
|
|
return getContainerStore (ptr).getWeight();
|
|
|
|
}
|
2012-06-17 22:21:55 +00:00
|
|
|
|
|
|
|
void Container::lock (const MWWorld::Ptr& ptr, int lockLevel) const
|
|
|
|
{
|
2014-04-23 17:02:51 +00:00
|
|
|
if(lockLevel!=0)
|
2014-05-25 12:13:07 +00:00
|
|
|
ptr.getCellRef().setLockLevel(abs(lockLevel)); //Changes lock to locklevel, in positive
|
2014-04-23 17:02:51 +00:00
|
|
|
else
|
2014-05-25 12:13:07 +00:00
|
|
|
ptr.getCellRef().setLockLevel(abs(ptr.getCellRef().getLockLevel())); //No locklevel given, just flip the original one
|
2012-06-17 22:21:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Container::unlock (const MWWorld::Ptr& ptr) const
|
|
|
|
{
|
2014-05-25 12:13:07 +00:00
|
|
|
ptr.getCellRef().setLockLevel(-abs(ptr.getCellRef().getLockLevel())); //Makes lockLevel negative
|
2014-04-23 09:12:07 +00:00
|
|
|
}
|
|
|
|
|
2015-12-18 15:50:32 +00:00
|
|
|
bool Container::canLock(const MWWorld::ConstPtr &ptr) const
|
2015-08-04 15:33:34 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2012-07-25 13:18:17 +00:00
|
|
|
|
2015-12-18 15:24:24 +00:00
|
|
|
MWWorld::Ptr Container::copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const
|
2012-07-25 13:18:17 +00:00
|
|
|
{
|
2015-12-18 15:24:24 +00:00
|
|
|
const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
|
2012-07-25 13:18:17 +00:00
|
|
|
|
2015-11-14 16:12:05 +00:00
|
|
|
return MWWorld::Ptr(cell.insert(ref), &cell);
|
2012-07-25 13:18:17 +00:00
|
|
|
}
|
2014-01-31 12:25:32 +00:00
|
|
|
|
2015-08-04 15:33:34 +00:00
|
|
|
void Container::readAdditionalState (const MWWorld::Ptr& ptr, const ESM::ObjectState& state) const
|
2014-01-31 12:25:32 +00:00
|
|
|
{
|
2015-12-17 23:07:13 +00:00
|
|
|
if (!state.mHasCustomState)
|
|
|
|
return;
|
2014-01-31 12:25:32 +00:00
|
|
|
const ESM::ContainerState& state2 = dynamic_cast<const ESM::ContainerState&> (state);
|
|
|
|
|
2014-06-18 20:59:18 +00:00
|
|
|
if (!ptr.getRefData().getCustomData())
|
|
|
|
{
|
|
|
|
// Create a CustomData, but don't fill it from ESM records (not needed)
|
|
|
|
std::auto_ptr<ContainerCustomData> data (new ContainerCustomData);
|
|
|
|
ptr.getRefData().setCustomData (data.release());
|
|
|
|
}
|
2014-01-31 12:25:32 +00:00
|
|
|
|
2014-03-16 22:38:51 +00:00
|
|
|
dynamic_cast<ContainerCustomData&> (*ptr.getRefData().getCustomData()).mContainerStore.
|
2014-01-31 12:25:32 +00:00
|
|
|
readState (state2.mInventory);
|
|
|
|
}
|
|
|
|
|
2015-12-17 23:18:06 +00:00
|
|
|
void Container::writeAdditionalState (const MWWorld::ConstPtr& ptr, ESM::ObjectState& state) const
|
2014-01-31 12:25:32 +00:00
|
|
|
{
|
|
|
|
ESM::ContainerState& state2 = dynamic_cast<ESM::ContainerState&> (state);
|
|
|
|
|
2015-12-17 23:07:13 +00:00
|
|
|
if (!ptr.getRefData().getCustomData())
|
|
|
|
{
|
|
|
|
state.mHasCustomState = false;
|
|
|
|
return;
|
|
|
|
}
|
2014-01-31 12:25:32 +00:00
|
|
|
|
2015-12-17 23:18:06 +00:00
|
|
|
dynamic_cast<const ContainerCustomData&> (*ptr.getRefData().getCustomData()).mContainerStore.
|
2014-01-31 12:25:32 +00:00
|
|
|
writeState (state2.mInventory);
|
|
|
|
}
|
2010-08-03 13:24:44 +00:00
|
|
|
}
|