mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
added getCapacity function
This commit is contained in:
parent
2bf12a4839
commit
c6493fb133
@ -176,4 +176,12 @@ namespace MWClass
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
float Container::getCapactiy (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return ref->base->weight;
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,10 @@ namespace MWClass
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of the script attached to ptr
|
||||
|
||||
virtual float getCapactiy (const MWWorld::Ptr& ptr) const;
|
||||
///< Return total weight that fits into the object (including modifications from magic
|
||||
/// effects). Throws an exception, if the object can't hold other objects.
|
||||
|
||||
static void registerSelf();
|
||||
};
|
||||
}
|
||||
|
@ -166,4 +166,10 @@ namespace MWClass
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
float Creature::getCapactiy (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||
return stats.mAttributes[0].getModified()*5;
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,10 @@ namespace MWClass
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of the script attached to ptr
|
||||
|
||||
virtual float getCapactiy (const MWWorld::Ptr& ptr) const;
|
||||
///< Return total weight that fits into the object (including modifications from magic
|
||||
/// effects). Throws an exception, if the object can't hold other objects.
|
||||
|
||||
static void registerSelf();
|
||||
};
|
||||
}
|
||||
|
@ -325,4 +325,10 @@ namespace MWClass
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
float Npc::getCapactiy (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||
return stats.mAttributes[0].getModified()*5;
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +74,10 @@ namespace MWClass
|
||||
///< Return desired movement vector (determined based on movement settings,
|
||||
/// stance and stats).
|
||||
|
||||
virtual float getCapactiy (const MWWorld::Ptr& ptr) const;
|
||||
///< Return total weight that fits into the object (including modifications from magic
|
||||
/// effects). Throws an exception, if the object can't hold other objects.
|
||||
|
||||
static void registerSelf();
|
||||
};
|
||||
}
|
||||
|
@ -142,6 +142,11 @@ namespace MWWorld
|
||||
throw std::logic_error ("value not supported by this class");
|
||||
}
|
||||
|
||||
float Class::getCapactiy (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
throw std::runtime_error ("capacity not supported by class");
|
||||
}
|
||||
|
||||
const Class& Class::get (const std::string& key)
|
||||
{
|
||||
std::map<std::string, boost::shared_ptr<Class> >::const_iterator iter = sClasses.find (key);
|
||||
|
@ -164,6 +164,11 @@ namespace MWWorld
|
||||
///< Return trade value of the object. Throws an exception, if the object can't be traded.
|
||||
/// (default implementation: throws an exception)
|
||||
|
||||
virtual float getCapactiy (const MWWorld::Ptr& ptr) const;
|
||||
///< Return total weight that fits into the object (including modifications from magic
|
||||
/// effects). Throws an exception, if the object can't hold other objects.
|
||||
/// (default implementation: throws an exception)
|
||||
|
||||
static const Class& get (const std::string& key);
|
||||
///< If there is no class for this \a key, an exception is thrown.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user