mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-05 22:45:32 +00:00
Merge branch 'master' into inventoryGUI
This commit is contained in:
commit
0063387979
8 changed files with 103 additions and 5 deletions
|
@ -179,4 +179,17 @@ namespace MWClass
|
||||||
|
|
||||||
return info;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Container::getEncumbrance (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
return getContainerStore (ptr).getWeight();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,14 @@ namespace MWClass
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return name of the script attached to ptr
|
///< Return name of the script attached to ptr
|
||||||
|
|
||||||
|
virtual float getCapactiy (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Return total weight that fits into the object. Throws an exception, if the object can't
|
||||||
|
/// hold other objects.
|
||||||
|
|
||||||
|
virtual float getEncumbrance (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Returns total weight of objects inside this object (including modifications from magic
|
||||||
|
/// effects). Throws an exception, if the object can't hold other objects.
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||||
|
#include "../mwmechanics/magiceffects.hpp"
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
|
@ -56,8 +57,6 @@ namespace MWClass
|
||||||
|
|
||||||
data->mCreatureStats.mLevel = ref->base->data.level;
|
data->mCreatureStats.mLevel = ref->base->data.level;
|
||||||
|
|
||||||
// \todo add initial container content
|
|
||||||
|
|
||||||
// store
|
// store
|
||||||
ptr.getRefData().setCustomData (data.release());
|
ptr.getRefData().setCustomData (data.release());
|
||||||
}
|
}
|
||||||
|
@ -166,4 +165,26 @@ namespace MWClass
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Creature::getCapactiy (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||||
|
return stats.mAttributes[0].getModified()*5;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Creature::getEncumbrance (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
float weight = getContainerStore (ptr).getWeight();
|
||||||
|
|
||||||
|
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||||
|
|
||||||
|
weight -= stats.mMagicEffects.get (MWMechanics::EffectKey (8)).mMagnitude; // feather
|
||||||
|
|
||||||
|
weight += stats.mMagicEffects.get (MWMechanics::EffectKey (7)).mMagnitude; // burden
|
||||||
|
|
||||||
|
if (weight<0)
|
||||||
|
weight = 0;
|
||||||
|
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,14 @@ namespace MWClass
|
||||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return name of the script attached to ptr
|
///< Return name of the script attached to ptr
|
||||||
|
|
||||||
|
virtual float getCapactiy (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Return total weight that fits into the object. Throws an exception, if the object can't
|
||||||
|
/// hold other objects.
|
||||||
|
|
||||||
|
virtual float getEncumbrance (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Returns total weight of objects inside this object (including modifications from magic
|
||||||
|
/// effects). Throws an exception, if the object can't hold other objects.
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,11 +88,9 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//TODO: do something with npdt12 maybe:p
|
/// \todo do something with npdt12 maybe:p
|
||||||
}
|
}
|
||||||
|
|
||||||
// \todo add initial container content
|
|
||||||
|
|
||||||
// store
|
// store
|
||||||
ptr.getRefData().setCustomData (data.release());
|
ptr.getRefData().setCustomData (data.release());
|
||||||
}
|
}
|
||||||
|
@ -325,4 +323,26 @@ namespace MWClass
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Npc::getCapactiy (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||||
|
return stats.mAttributes[0].getModified()*5;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Npc::getEncumbrance (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
float weight = getContainerStore (ptr).getWeight();
|
||||||
|
|
||||||
|
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||||
|
|
||||||
|
weight -= stats.mMagicEffects.get (MWMechanics::EffectKey (8)).mMagnitude; // feather
|
||||||
|
|
||||||
|
weight += stats.mMagicEffects.get (MWMechanics::EffectKey (7)).mMagnitude; // burden
|
||||||
|
|
||||||
|
if (weight<0)
|
||||||
|
weight = 0;
|
||||||
|
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,14 @@ namespace MWClass
|
||||||
///< Return desired movement vector (determined based on movement settings,
|
///< Return desired movement vector (determined based on movement settings,
|
||||||
/// stance and stats).
|
/// stance and stats).
|
||||||
|
|
||||||
|
virtual float getCapactiy (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Return total weight that fits into the object. Throws an exception, if the object can't
|
||||||
|
/// hold other objects.
|
||||||
|
|
||||||
|
virtual float getEncumbrance (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Returns total weight of objects inside this object (including modifications from magic
|
||||||
|
/// effects). Throws an exception, if the object can't hold other objects.
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,16 @@ namespace MWWorld
|
||||||
throw std::logic_error ("value not supported by this class");
|
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 this class");
|
||||||
|
}
|
||||||
|
|
||||||
|
float Class::getEncumbrance (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
throw std::runtime_error ("encumbrance not supported by class");
|
||||||
|
}
|
||||||
|
|
||||||
const Class& Class::get (const std::string& key)
|
const Class& Class::get (const std::string& key)
|
||||||
{
|
{
|
||||||
std::map<std::string, boost::shared_ptr<Class> >::const_iterator iter = sClasses.find (key);
|
std::map<std::string, boost::shared_ptr<Class> >::const_iterator iter = sClasses.find (key);
|
||||||
|
|
|
@ -164,6 +164,16 @@ namespace MWWorld
|
||||||
///< Return trade value of the object. Throws an exception, if the object can't be traded.
|
///< Return trade value of the object. Throws an exception, if the object can't be traded.
|
||||||
/// (default implementation: throws an exception)
|
/// (default implementation: throws an exception)
|
||||||
|
|
||||||
|
virtual float getCapactiy (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Return total weight that fits into the object. Throws an exception, if the object can't
|
||||||
|
/// hold other objects.
|
||||||
|
/// (default implementation: throws an exception)
|
||||||
|
|
||||||
|
virtual float getEncumbrance (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Returns total weight of objects inside this 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);
|
static const Class& get (const std::string& key);
|
||||||
///< If there is no class for this \a key, an exception is thrown.
|
///< If there is no class for this \a key, an exception is thrown.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue