mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 15:11:36 -04:00
implemented item count
This commit is contained in:
parent
7ba6bdb56c
commit
e0a3b1b1db
@ -61,11 +61,12 @@ void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRef<ESM::NPC, MWWorld::R
|
||||
template<typename T>
|
||||
void insertCellRefList (CellRenderImp& cellRender, const ESMS::ESMStore& store, T& cellRefList)
|
||||
{
|
||||
for(typename T::List::iterator it = cellRefList.list.begin();
|
||||
it != cellRefList.list.end(); it++)
|
||||
{
|
||||
insertObj (cellRender, *it, store);
|
||||
}
|
||||
for(typename T::List::iterator it = cellRefList.list.begin();
|
||||
it != cellRefList.list.end(); it++)
|
||||
{
|
||||
if (it->mData.getCount())
|
||||
insertObj (cellRender, *it, store);
|
||||
}
|
||||
}
|
||||
|
||||
void CellRenderImp::insertCell(ESMS::CellStore<MWWorld::RefData> &cell, const ESMS::ESMStore& store)
|
||||
@ -92,5 +93,3 @@ void CellRenderImp::insertCell(ESMS::CellStore<MWWorld::RefData> &cell, const ES
|
||||
insertCellRefList (*this, store, cell.statics);
|
||||
insertCellRefList (*this, store, cell.weapons);
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@ namespace MWWorld
|
||||
// we can make this a pointer later.
|
||||
bool mHasLocals;
|
||||
bool mEnabled;
|
||||
int mCount; // 0: deleted
|
||||
|
||||
// we are using shared pointer here to avoid having to create custom copy-constructor,
|
||||
// assignment operator and destructor. As a consequence though copying a RefData object
|
||||
@ -37,13 +38,18 @@ namespace MWWorld
|
||||
|
||||
public:
|
||||
|
||||
RefData() : mHasLocals (false), mEnabled (true) {}
|
||||
RefData() : mHasLocals (false), mEnabled (true), mCount (1) {}
|
||||
|
||||
std::string getHandle()
|
||||
{
|
||||
return mHandle;
|
||||
}
|
||||
|
||||
int getCount() const
|
||||
{
|
||||
return mCount;
|
||||
}
|
||||
|
||||
void setLocals (const ESM::Script& script)
|
||||
{
|
||||
if (!mHasLocals)
|
||||
@ -58,6 +64,11 @@ namespace MWWorld
|
||||
mHandle = handle;
|
||||
}
|
||||
|
||||
void setCount (int count)
|
||||
{
|
||||
mCount = count;
|
||||
}
|
||||
|
||||
MWScript::Locals& getLocals()
|
||||
{
|
||||
return mLocals;
|
||||
|
@ -25,7 +25,7 @@ namespace
|
||||
cellRefList.list.begin());
|
||||
iter!=cellRefList.list.end(); ++iter)
|
||||
{
|
||||
if (!iter->base->script.empty())
|
||||
if (!iter->base->script.empty() && iter->mData.getCount())
|
||||
{
|
||||
if (const ESM::Script *script = store.scripts.find (iter->base->script))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user