From: Javier Sancho Date: Fri, 17 Apr 2020 17:14:42 +0000 (+0200) Subject: Revert "reference counted refactor" X-Git-Url: https://git.jsancho.org/?p=guile-irrlicht.git;a=commitdiff_plain;h=480766c8e4e7272c21f69adf24b706aee20a5dba Revert "reference counted refactor" This reverts commit bc651faafe0ae75fd7f09c5318cf21bc0bc3b5a5. --- diff --git a/src/reference-counted.cpp b/src/reference-counted.cpp index b13cbb0..1060df4 100644 --- a/src/reference-counted.cpp +++ b/src/reference-counted.cpp @@ -29,39 +29,30 @@ extern "C" { - DEFINE_WRAPPED_TYPE (irr::IReferenceCounted*, "reference-counted", - init_reference_counted_type, reference_counted_p, - wrap_reference_counted, unwrap_reference_counted); - void init_reference_counted (void) { - init_reference_counted_type (); DEFINE_GSUBR ("drop!", 1, 0, 0, irr_drop); } - bool - is_reference_counted_object (SCM wrapped_obj) - { - return - device_p (wrapped_obj) || - reference_counted_p (wrapped_obj) || - scene_node_animator_p (wrapped_obj); - } - SCM irr_drop (SCM wrapped_obj) { - if (is_reference_counted_object (wrapped_obj)) + bool result = 0; + if (device_p (wrapped_obj)) + { + result = unwrap_device (wrapped_obj)->drop (); + } + else if (scene_node_animator_p (wrapped_obj)) { - irr::IReferenceCounted* obj = unwrap_reference_counted (wrapped_obj, false); - return scm_from_bool (obj->drop ()); + result = unwrap_scene_node_animator (wrapped_obj)->drop (); } else { scm_error (scm_arg_type_key, NULL, "Object cannot be dropped: ~S", scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj)); } + return scm_from_bool (result); } } diff --git a/src/reference-counted.h b/src/reference-counted.h index a4ccfa7..f2a2613 100644 --- a/src/reference-counted.h +++ b/src/reference-counted.h @@ -27,15 +27,9 @@ extern "C" { - DECLARE_WRAPPED_TYPE (irr::IReferenceCounted*, init_reference_counted_type, - reference_counted_p, wrap_reference_counted, unwrap_reference_counted); - void init_reference_counted (void); - bool - is_reference_counted_object (SCM wrapped_obj); - SCM irr_drop (SCM wrapped_obj);