2010-08-03 09:14:57 +00:00
|
|
|
|
|
|
|
#include "class.hpp"
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
2011-02-03 10:37:17 +00:00
|
|
|
#include <OgreVector3.h>
|
|
|
|
|
2010-08-03 09:49:12 +00:00
|
|
|
#include "ptr.hpp"
|
2010-08-03 16:20:15 +00:00
|
|
|
#include "nullaction.hpp"
|
2010-08-03 09:49:12 +00:00
|
|
|
|
2010-08-03 09:14:57 +00:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
std::map<std::string, boost::shared_ptr<Class> > Class::sClasses;
|
|
|
|
|
|
|
|
Class::Class() {}
|
|
|
|
|
|
|
|
Class::~Class() {}
|
|
|
|
|
2010-08-08 12:28:35 +00:00
|
|
|
std::string Class::getId (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("class does not support ID retrieval");
|
|
|
|
}
|
|
|
|
|
2011-11-09 20:47:06 +00:00
|
|
|
void Class::insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
2010-08-14 07:20:47 +00:00
|
|
|
{
|
|
|
|
|
2011-11-09 23:06:55 +00:00
|
|
|
}
|
2011-11-11 05:20:53 +00:00
|
|
|
void Class::insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const{
|
2011-11-09 23:06:55 +00:00
|
|
|
|
2010-08-14 07:20:47 +00:00
|
|
|
}
|
|
|
|
|
2010-08-14 09:27:13 +00:00
|
|
|
void Class::enable (const Ptr& ptr, MWWorld::Environment& environment) const
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Class::disable (const Ptr& ptr, MWWorld::Environment& environment) const
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-08-03 09:49:12 +00:00
|
|
|
MWMechanics::CreatureStats& Class::getCreatureStats (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("class does not have creature stats");
|
|
|
|
}
|
|
|
|
|
2010-08-19 10:49:13 +00:00
|
|
|
MWMechanics::NpcStats& Class::getNpcStats (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("class does not have NPC stats");
|
|
|
|
}
|
|
|
|
|
2010-08-03 12:14:04 +00:00
|
|
|
bool Class::hasItemHealth (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Class::getItemMaxHealth (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("class does not have item health");
|
|
|
|
}
|
|
|
|
|
2010-08-03 16:44:52 +00:00
|
|
|
boost::shared_ptr<Action> Class::activate (const Ptr& ptr, const Ptr& actor,
|
|
|
|
const Environment& environment) const
|
2010-08-03 16:20:15 +00:00
|
|
|
{
|
|
|
|
return boost::shared_ptr<Action> (new NullAction);
|
|
|
|
}
|
|
|
|
|
2010-08-03 16:44:52 +00:00
|
|
|
boost::shared_ptr<Action> Class::use (const Ptr& ptr,
|
|
|
|
const Environment& environment) const
|
2010-08-03 16:20:15 +00:00
|
|
|
{
|
|
|
|
return boost::shared_ptr<Action> (new NullAction);
|
|
|
|
}
|
|
|
|
|
2010-08-04 12:37:23 +00:00
|
|
|
ContainerStore<RefData>& Class::getContainerStore (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("class does not have a container store");
|
2010-08-06 20:20:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Class::insertIntoContainer (const Ptr& ptr, ContainerStore<RefData>& containerStore) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("class does not support inserting into a container");
|
|
|
|
}
|
2010-08-06 12:37:53 +00:00
|
|
|
|
2010-08-30 09:56:55 +00:00
|
|
|
void Class::lock (const Ptr& ptr, int lockLevel) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("class does not support locking");
|
|
|
|
}
|
|
|
|
|
|
|
|
void Class::unlock (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("class does not support unlocking");
|
|
|
|
}
|
|
|
|
|
2010-08-05 13:40:03 +00:00
|
|
|
std::string Class::getScript (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
return "";
|
2010-08-04 12:37:23 +00:00
|
|
|
}
|
|
|
|
|
2011-01-18 09:45:29 +00:00
|
|
|
void Class::setForceStance (const Ptr& ptr, Stance stance, bool force) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("stance not supported by class");
|
|
|
|
}
|
|
|
|
|
|
|
|
void Class::setStance (const Ptr& ptr, Stance stance, bool set) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("stance not supported by class");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Class::getStance (const Ptr& ptr, Stance stance, bool ignoreForce) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
float Class::getSpeed (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-02-03 10:37:17 +00:00
|
|
|
MWMechanics::Movement& Class::getMovementSettings (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
throw std::runtime_error ("movement settings not supported by class");
|
|
|
|
}
|
|
|
|
|
|
|
|
Ogre::Vector3 Class::getMovementVector (const Ptr& ptr) const
|
|
|
|
{
|
|
|
|
return Ogre::Vector3 (0, 0, 0);
|
|
|
|
}
|
|
|
|
|
2010-08-03 09:14:57 +00:00
|
|
|
const Class& Class::get (const std::string& key)
|
|
|
|
{
|
|
|
|
std::map<std::string, boost::shared_ptr<Class> >::const_iterator iter = sClasses.find (key);
|
|
|
|
|
|
|
|
if (iter==sClasses.end())
|
|
|
|
throw std::logic_error ("unknown class key: " + key);
|
|
|
|
|
|
|
|
return *iter->second;
|
|
|
|
}
|
|
|
|
|
2010-08-03 09:49:12 +00:00
|
|
|
const Class& Class::get (const Ptr& ptr)
|
|
|
|
{
|
|
|
|
return get (ptr.getTypeName());
|
|
|
|
}
|
|
|
|
|
2010-08-03 09:14:57 +00:00
|
|
|
void Class::registerClass (const std::string& key, boost::shared_ptr<Class> instance)
|
|
|
|
{
|
|
|
|
sClasses.insert (std::make_pair (key, instance));
|
|
|
|
}
|
|
|
|
}
|