Skip to content

Commit b4ea6da

Browse files
author
nitrocaster
committed
Fix hierarchy of lua-exported classes.
New luabind performs automatic cast to most derived class, which causes crash when trying to call parent class function from lua.
1 parent 4f6622b commit b4ea6da

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/xrGame/PhysicObject_script.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ SCRIPT_EXPORT(CPhysicObject, (CGameObject),
1313
{
1414
module(luaState)
1515
[
16-
class_<CDestroyablePhysicsObject,CGameObject>("CDestroyablePhysicsObject")
17-
.def(constructor<>()),
1816
class_<CPhysicObject,CGameObject>("CPhysicObject")
1917
.def(constructor<>())
2018
.def("run_anim_forward", &CPhysicObject::run_anim_forward)
@@ -25,6 +23,8 @@ SCRIPT_EXPORT(CPhysicObject, (CGameObject),
2523
.def("play_bones_sound", &CPhysicObject::play_bones_sound)
2624
.def("stop_bones_sound", &CPhysicObject::stop_bones_sound)
2725
.def("set_door_ignore_dynamics", &CPhysicObject::set_door_ignore_dynamics)
28-
.def("unset_door_ignore_dynamics", &CPhysicObject::unset_door_ignore_dynamics)
26+
.def("unset_door_ignore_dynamics", &CPhysicObject::unset_door_ignore_dynamics),
27+
class_<CDestroyablePhysicsObject, CPhysicObject>("CDestroyablePhysicsObject")
28+
.def(constructor<>())
2929
];
3030
});

src/xrGame/ai/stalker/ai_stalker_script.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
using namespace luabind;
1818

19-
SCRIPT_EXPORT(CStalkerPlanner, (),
19+
SCRIPT_EXPORT(CStalkerPlanner, (CScriptActionPlanner),
2020
{
2121
module(luaState)
2222
[
23-
class_<CStalkerPlanner>("stalker_ids")
23+
class_<CStalkerPlanner, CScriptActionPlanner>("stalker_ids") // CScriptActionPlanner
2424
.enum_("properties")
2525
[
2626
luabind::value("property_alive", StalkerDecisionSpace::eWorldPropertyAlive),

0 commit comments

Comments
 (0)