1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 15:39:02 +00:00
OpenMW/apps/openmw/mwclass/container.cpp
Marc Zinnschlag 10a63b10b5 Merge branch 'master' into container
Conflicts:
	apps/openmw/mwclass/container.cpp
	apps/openmw/mwclass/container.hpp
	apps/openmw/mwclass/creature.cpp
	apps/openmw/mwclass/creature.hpp
	apps/openmw/mwclass/npc.cpp
	apps/openmw/mwclass/npc.hpp
	apps/openmw/mwworld/class.cpp
	apps/openmw/mwworld/class.hpp
2010-08-06 14:37:53 +02:00

51 lines
1.3 KiB
C++

#include "container.hpp"
#include <components/esm/loadcont.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Container::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
ptr.get<ESM::Container>();
return ref->base->name;
}
MWWorld::ContainerStore<MWWorld::RefData>& Container::getContainerStore (const MWWorld::Ptr& ptr)
const
{
if (!ptr.getRefData().getContainerStore().get())
{
boost::shared_ptr<MWWorld::ContainerStore<MWWorld::RefData> > store (
new MWWorld::ContainerStore<MWWorld::RefData>);
// TODO add initial content
ptr.getRefData().getContainerStore() = store;
}
return *ptr.getRefData().getContainerStore();
}
std::string Container::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
ptr.get<ESM::Container>();
return ref->base->script;
}
void Container::registerSelf()
{
boost::shared_ptr<Class> instance (new Container);
registerClass (typeid (ESM::Container).name(), instance);
}
}