diff --git a/apps/openmw/mwlua/types/container.cpp b/apps/openmw/mwlua/types/container.cpp index ccbbc74625..5dc7e70e6c 100644 --- a/apps/openmw/mwlua/types/container.cpp +++ b/apps/openmw/mwlua/types/container.cpp @@ -4,6 +4,9 @@ #include +//#include "../mwworld/class.hpp" +#include "apps/openmw/mwworld/class.hpp" + #include "../luabindings.hpp" namespace MWLua @@ -17,10 +20,14 @@ namespace MWLua [](const LObject& o) { containerPtr(o); return Inventory{o}; }, [](const GObject& o) { containerPtr(o); return Inventory{o}; } ); - //container["capacity"] = [](const Object& o) { - //const MWWorld::Class& cls = o.ptr().getClass(); - //return cls.getCapacity(o); - //}; + container["encumbrance"] = [](const Object& obj) -> float { + const MWWorld::Ptr& ptr = containerPtr(obj); + return ptr.getClass().getEncumbrance(ptr); + }; + container["capacity"] = [](const Object& obj) -> float { + const MWWorld::Ptr& ptr = containerPtr(obj); + return ptr.getClass().getCapacity(ptr); + }; const MWWorld::Store* store = &MWBase::Environment::get().getWorld()->getStore().get(); container["record"] = sol::overload(