mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
Hackish fix for inheritance.
Character should inherit from Entity/Thing, but doesn't really in the Python class hierarchy. We'll fudge it anyways.
This commit is contained in:
parent
d1ebd44e01
commit
a4e29323a4
4 changed files with 36 additions and 10 deletions
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "CyPy_Entity.h"
|
||||
#include "CyPy_Operation.h"
|
||||
#include "CyPy_Character.h"
|
||||
|
||||
CyPy_Entity::CyPy_Entity(Py::PythonClassInstance* self, Py::Tuple& args, Py::Dict& kwds)
|
||||
: CyPy_LocatedEntityBase(self, args, kwds)
|
||||
|
|
@ -74,3 +75,25 @@ Py::Object CyPy_Entity::send_world(const Py::Tuple& args)
|
|||
m_value->sendWorld(verifyObject<CyPy_Operation>(args.front()));
|
||||
return Py::None();
|
||||
}
|
||||
|
||||
bool CyPy_Entity::check(const Py::Object& object)
|
||||
{
|
||||
return check(object.ptr());
|
||||
}
|
||||
|
||||
bool CyPy_Entity::check(PyObject* object)
|
||||
{
|
||||
//FIXME: Hack to fake inheritance
|
||||
return WrapperBase::check(object)
|
||||
|| CyPy_Character::check(object);
|
||||
}
|
||||
|
||||
Ref<Entity> CyPy_Entity::value(const Py::Object& object)
|
||||
{
|
||||
//FIXME: Hack to fake inheritance
|
||||
if (CyPy_Character::check(object)) {
|
||||
return Py::PythonClassObject<CyPy_Character>(object).getCxxObject()->m_value;
|
||||
}
|
||||
return Py::PythonClassObject<CyPy_Entity>(object).getCxxObject()->m_value;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue