#include "container.hpp" #include #include #include "../mwworld/ptr.hpp" #include "../mwrender/cellimp.hpp" namespace MWClass { void Container::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender, MWWorld::Environment& environment) const { ESMS::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); const std::string &model = ref->base->model; if (!model.empty()) { MWRender::Rendering rendering (cellRender, ref->ref, ref->mData); cellRender.insertMesh ("meshes\\" + model); cellRender.insertObjectPhysics(); ref->mData.setHandle (rendering.end (ref->mData.isEnabled())); } } std::string Container::getName (const MWWorld::Ptr& ptr) const { ESMS::LiveCellRef *ref = ptr.get(); return ref->base->name; } MWWorld::ContainerStore& Container::getContainerStore (const MWWorld::Ptr& ptr) const { if (!ptr.getRefData().getContainerStore().get()) { boost::shared_ptr > store ( new MWWorld::ContainerStore); // TODO add initial content ptr.getRefData().getContainerStore() = store; } return *ptr.getRefData().getContainerStore(); } std::string Container::getScript (const MWWorld::Ptr& ptr) const { ESMS::LiveCellRef *ref = ptr.get(); return ref->base->script; } void Container::registerSelf() { boost::shared_ptr instance (new Container); registerClass (typeid (ESM::Container).name(), instance); } }