diff --git a/Engine.cc b/Engine.cc index 59f7482..066d902 100644 --- a/Engine.cc +++ b/Engine.cc @@ -665,12 +665,15 @@ Engine::Object::Object(const Engine::Object & orig) Engine::Object::~Object() { delete m_ode_object; - (*m_display_list_refcnt)--; - if (*m_display_list_refcnt < 1) + if (m_display_list_refcnt != NULL) { - /* we hold the last reference to the OpenGL display list */ - delete m_display_list_refcnt; - glDeleteLists(m_display_list, 1); + (*m_display_list_refcnt)--; + if (*m_display_list_refcnt < 1) + { + /* we hold the last reference to the OpenGL display list */ + delete m_display_list_refcnt; + glDeleteLists(m_display_list, 1); + } } } diff --git a/ag.cc b/ag.cc index faa1184..6356267 100644 --- a/ag.cc +++ b/ag.cc @@ -40,6 +40,18 @@ namespace ag { "isKeyDown", isKeyDown }, { "registerEventHandler", registerEventHandler }, { "clearEventHandler", clearEventHandler }, + + { "createBox", createBox}, + { "createStaticBox", createStaticBox}, + { "createSphere", createSphere}, + { "createStaticSphere", createStaticSphere}, + { "createPlane", createPlane}, + { "createStaticPlane", createStaticPlane}, + { "createCylinder", createCylinder}, + { "createStaticCylinder", createStaticCylinder}, + { "createCCylinder", createCCylinder}, + { "createStaticCCylinder", createStaticCCylinder}, + { NULL, NULL } }; luaL_register(L, "ag", functions);