implemented item count

This commit is contained in:
Marc Zinnschlag 2010-08-04 14:04:22 +02:00
parent 7ba6bdb56c
commit e0a3b1b1db
3 changed files with 36 additions and 26 deletions

View File

@ -64,6 +64,7 @@ void insertCellRefList (CellRenderImp& cellRender, const ESMS::ESMStore& store,
for(typename T::List::iterator it = cellRefList.list.begin();
it != cellRefList.list.end(); it++)
{
if (it->mData.getCount())
insertObj (cellRender, *it, 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);
}

View File

@ -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;

View File

@ -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))
{