added insertIntoContainer function to class hierarchy
parent
10a63b10b5
commit
0a60bde834
@ -0,0 +1,31 @@
|
||||
#ifndef GAME_MWCLASS_CONTAINERUTIL_H
|
||||
#define GAME_MWCLASS_CONTAINERUTIL_H
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
template<typename T>
|
||||
void insertIntoContainerStore (const MWWorld::Ptr& ptr,
|
||||
ESMS::CellRefList<T, MWWorld::RefData>& containerStore)
|
||||
{
|
||||
if (!ptr.isEmpty())
|
||||
{
|
||||
// TODO check stacking
|
||||
|
||||
ESMS::LiveCellRef<T, MWWorld::RefData> cellRef;
|
||||
|
||||
cellRef.base = ptr.get<T>()->base;
|
||||
cellRef.ref = ptr.getCellRef();
|
||||
cellRef.mData = ptr.getRefData();
|
||||
|
||||
containerStore.list.push_back (cellRef);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue