mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 15:41:13 -04:00
implemented item count
This commit is contained in:
parent
7ba6bdb56c
commit
e0a3b1b1db
@ -48,24 +48,25 @@ void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRef<ESM::NPC, MWWorld::R
|
|||||||
//get the part of the bodypart id which describes the race and the gender
|
//get the part of the bodypart id which describes the race and the gender
|
||||||
std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
|
std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
|
||||||
std::string headModel = "meshes\\" + store.bodyParts.find(headID)->model;
|
std::string headModel = "meshes\\" + store.bodyParts.find(headID)->model;
|
||||||
|
|
||||||
cellRender.insertBegin(liveRef.ref);
|
cellRender.insertBegin(liveRef.ref);
|
||||||
cellRender.insertMesh(headModel);
|
cellRender.insertMesh(headModel);
|
||||||
|
|
||||||
//TODO: define consts for each bodypart e.g. chest, foot, wrist... and put the parts in the right place
|
//TODO: define consts for each bodypart e.g. chest, foot, wrist... and put the parts in the right place
|
||||||
cellRender.insertMesh("meshes\\" + store.bodyParts.find(bodyRaceID + "chest")->model);
|
cellRender.insertMesh("meshes\\" + store.bodyParts.find(bodyRaceID + "chest")->model);
|
||||||
|
|
||||||
liveRef.mData.setHandle (cellRender.insertEnd (liveRef.mData.isEnabled()));
|
liveRef.mData.setHandle (cellRender.insertEnd (liveRef.mData.isEnabled()));
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,28 +22,34 @@ namespace MWWorld
|
|||||||
class RefData
|
class RefData
|
||||||
{
|
{
|
||||||
std::string mHandle;
|
std::string mHandle;
|
||||||
|
|
||||||
MWScript::Locals mLocals; // if we find the overhead of heaving a locals
|
MWScript::Locals mLocals; // if we find the overhead of heaving a locals
|
||||||
// object in the refdata of refs without a script,
|
// object in the refdata of refs without a script,
|
||||||
// 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
|
||||||
// manually will probably give unexcepted results. This is not a problem since RefData
|
// manually will probably give unexcepted results. This is not a problem since RefData
|
||||||
// are never copied outside of container operations.
|
// are never copied outside of container operations.
|
||||||
boost::shared_ptr<MWMechanics::CreatureStats> mCreatureStats;
|
boost::shared_ptr<MWMechanics::CreatureStats> mCreatureStats;
|
||||||
|
|
||||||
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)
|
||||||
@ -52,37 +58,42 @@ namespace MWWorld
|
|||||||
mHasLocals = true;
|
mHasLocals = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setHandle (const std::string& handle)
|
void setHandle (const std::string& handle)
|
||||||
{
|
{
|
||||||
mHandle = handle;
|
mHandle = handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setCount (int count)
|
||||||
|
{
|
||||||
|
mCount = count;
|
||||||
|
}
|
||||||
|
|
||||||
MWScript::Locals& getLocals()
|
MWScript::Locals& getLocals()
|
||||||
{
|
{
|
||||||
return mLocals;
|
return mLocals;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isEnabled() const
|
bool isEnabled() const
|
||||||
{
|
{
|
||||||
return mEnabled;
|
return mEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void enable()
|
void enable()
|
||||||
{
|
{
|
||||||
mEnabled = true;
|
mEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void disable()
|
void disable()
|
||||||
{
|
{
|
||||||
mEnabled = true;
|
mEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWMechanics::CreatureStats>& getCreatureStats()
|
boost::shared_ptr<MWMechanics::CreatureStats>& getCreatureStats()
|
||||||
{
|
{
|
||||||
return mCreatureStats;
|
return mCreatureStats;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -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