mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-26 02:38:04 +00:00
Added a constructor to Light CustomData
This commit is contained in:
parent
2643214ca6
commit
e11da5c0a3
@ -30,6 +30,13 @@ namespace
|
|||||||
float mTime;
|
float mTime;
|
||||||
///< Time remaining
|
///< Time remaining
|
||||||
|
|
||||||
|
CustomData(MWWorld::Ptr ptr)
|
||||||
|
{
|
||||||
|
MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
|
||||||
|
mTime = ref->mBase->mData.mTime;
|
||||||
|
}
|
||||||
|
///< Constructs this CustomData from the base values for Ptr.
|
||||||
|
|
||||||
virtual MWWorld::CustomData *clone() const
|
virtual MWWorld::CustomData *clone() const
|
||||||
{
|
{
|
||||||
return new CustomData (*this);
|
return new CustomData (*this);
|
||||||
@ -225,15 +232,7 @@ namespace MWClass
|
|||||||
void Light::ensureCustomData (const MWWorld::Ptr& ptr) const
|
void Light::ensureCustomData (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
if (!ptr.getRefData().getCustomData())
|
if (!ptr.getRefData().getCustomData())
|
||||||
{
|
ptr.getRefData().setCustomData(new CustomData(ptr));
|
||||||
MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
|
|
||||||
|
|
||||||
CustomData *data = new CustomData;
|
|
||||||
|
|
||||||
data->mTime = ref->mBase->mData.mTime;
|
|
||||||
|
|
||||||
ptr.getRefData().setCustomData(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Light::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Light::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user