Skip to content

Commit

Permalink
Fix hierarchy of lua-exported classes.
Browse files Browse the repository at this point in the history
New luabind performs automatic cast to most derived class, which causes crash
when trying to call parent class function from lua.
  • Loading branch information
nitrocaster committed Nov 27, 2015
1 parent 4f6622b commit b4ea6da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/xrGame/PhysicObject_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ SCRIPT_EXPORT(CPhysicObject, (CGameObject),
{
module(luaState)
[
class_<CDestroyablePhysicsObject,CGameObject>("CDestroyablePhysicsObject")
.def(constructor<>()),
class_<CPhysicObject,CGameObject>("CPhysicObject")
.def(constructor<>())
.def("run_anim_forward", &CPhysicObject::run_anim_forward)
Expand All @@ -25,6 +23,8 @@ SCRIPT_EXPORT(CPhysicObject, (CGameObject),
.def("play_bones_sound", &CPhysicObject::play_bones_sound)
.def("stop_bones_sound", &CPhysicObject::stop_bones_sound)
.def("set_door_ignore_dynamics", &CPhysicObject::set_door_ignore_dynamics)
.def("unset_door_ignore_dynamics", &CPhysicObject::unset_door_ignore_dynamics)
.def("unset_door_ignore_dynamics", &CPhysicObject::unset_door_ignore_dynamics),
class_<CDestroyablePhysicsObject, CPhysicObject>("CDestroyablePhysicsObject")
.def(constructor<>())
];
});
4 changes: 2 additions & 2 deletions src/xrGame/ai/stalker/ai_stalker_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

using namespace luabind;

SCRIPT_EXPORT(CStalkerPlanner, (),
SCRIPT_EXPORT(CStalkerPlanner, (CScriptActionPlanner),
{
module(luaState)
[
class_<CStalkerPlanner>("stalker_ids")
class_<CStalkerPlanner, CScriptActionPlanner>("stalker_ids") // CScriptActionPlanner
.enum_("properties")
[
luabind::value("property_alive", StalkerDecisionSpace::eWorldPropertyAlive),
Expand Down

0 comments on commit b4ea6da

Please sign in to comment.