Bindings: Viewport: Don't dispose children in RGSS2/3
This commit is contained in:
parent
1a489aafaf
commit
5549ff78f0
|
@ -27,8 +27,7 @@
|
||||||
|
|
||||||
/* 'Children' are disposables that are disposed together
|
/* 'Children' are disposables that are disposed together
|
||||||
* with their parent. Currently this is only used by Viewport
|
* with their parent. Currently this is only used by Viewport
|
||||||
* in RGSS1.
|
* in RGSS1. */
|
||||||
* FIXME: Disable this behavior when RGSS2 or 3 */
|
|
||||||
inline void
|
inline void
|
||||||
disposableAddChild(VALUE disp, VALUE child)
|
disposableAddChild(VALUE disp, VALUE child)
|
||||||
{
|
{
|
||||||
|
@ -72,7 +71,8 @@ RB_METHOD(disposableDispose)
|
||||||
if (d->isDisposed())
|
if (d->isDisposed())
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
|
||||||
disposableDisposeChildren(self);
|
if (rgssVer == 1)
|
||||||
|
disposableDisposeChildren(self);
|
||||||
|
|
||||||
d->dispose();
|
d->dispose();
|
||||||
|
|
||||||
|
@ -100,7 +100,8 @@ static void disposableBindingInit(VALUE klass)
|
||||||
|
|
||||||
/* Make sure we always have access to the original method, even
|
/* Make sure we always have access to the original method, even
|
||||||
* if it is overridden by user scripts */
|
* if it is overridden by user scripts */
|
||||||
rb_define_alias(klass, "_mkxp_dispose_alias", "dispose");
|
if (rgssVer == 1)
|
||||||
|
rb_define_alias(klass, "_mkxp_dispose_alias", "dispose");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
|
|
|
@ -75,7 +75,9 @@ viewportElementInitialize(int argc, VALUE *argv, VALUE self)
|
||||||
if (!NIL_P(viewportObj))
|
if (!NIL_P(viewportObj))
|
||||||
{
|
{
|
||||||
viewport = getPrivateDataCheck<Viewport>(viewportObj, ViewportType);
|
viewport = getPrivateDataCheck<Viewport>(viewportObj, ViewportType);
|
||||||
disposableAddChild(viewportObj, self);
|
|
||||||
|
if (rgssVer == 1)
|
||||||
|
disposableAddChild(viewportObj, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Construct object */
|
/* Construct object */
|
||||||
|
|
|
@ -74,7 +74,8 @@ MRB_METHOD(disposableDispose)
|
||||||
if (d->isDisposed())
|
if (d->isDisposed())
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
|
|
||||||
disposableDisposeChildren(mrb, self);
|
if (rgssVer == 1)
|
||||||
|
disposableDisposeChildren(mrb, self);
|
||||||
|
|
||||||
d->dispose();
|
d->dispose();
|
||||||
|
|
||||||
|
@ -100,8 +101,9 @@ static void disposableBindingInit(mrb_state *mrb, RClass *klass)
|
||||||
mrb_define_method(mrb, klass, "dispose", disposableDispose<C>, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "dispose", disposableDispose<C>, MRB_ARGS_NONE());
|
||||||
mrb_define_method(mrb, klass, "disposed?", disposableIsDisposed<C>, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "disposed?", disposableIsDisposed<C>, MRB_ARGS_NONE());
|
||||||
|
|
||||||
mrb_alias_method(mrb, klass, getMrbData(mrb)->symbols[CS_mkxp_dispose_alias],
|
if (rgssVer == 1)
|
||||||
mrb_intern_lit(mrb, "dispose"));
|
mrb_alias_method(mrb, klass, getMrbData(mrb)->symbols[CS_mkxp_dispose_alias],
|
||||||
|
mrb_intern_lit(mrb, "dispose"));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
|
|
|
@ -50,7 +50,9 @@ viewportElementInitialize(mrb_state *mrb, mrb_value self)
|
||||||
if (!mrb_nil_p(viewportObj))
|
if (!mrb_nil_p(viewportObj))
|
||||||
{
|
{
|
||||||
viewport = getPrivateDataCheck<Viewport>(mrb, viewportObj, ViewportType);
|
viewport = getPrivateDataCheck<Viewport>(mrb, viewportObj, ViewportType);
|
||||||
disposableAddChild(mrb, viewportObj, self);
|
|
||||||
|
if (rgssVer == 1)
|
||||||
|
disposableAddChild(mrb, viewportObj, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Construct object */
|
/* Construct object */
|
||||||
|
|
Loading…
Reference in New Issue