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