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,6 +71,7 @@ RB_METHOD(disposableDispose)
|
||||||
if (d->isDisposed())
|
if (d->isDisposed())
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
disposableDisposeChildren(self);
|
disposableDisposeChildren(self);
|
||||||
|
|
||||||
d->dispose();
|
d->dispose();
|
||||||
|
@ -100,6 +100,7 @@ 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 */
|
||||||
|
if (rgssVer == 1)
|
||||||
rb_define_alias(klass, "_mkxp_dispose_alias", "dispose");
|
rb_define_alias(klass, "_mkxp_dispose_alias", "dispose");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,8 @@ 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);
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
disposableAddChild(viewportObj, self);
|
disposableAddChild(viewportObj, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ MRB_METHOD(disposableDispose)
|
||||||
if (d->isDisposed())
|
if (d->isDisposed())
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
disposableDisposeChildren(mrb, self);
|
disposableDisposeChildren(mrb, self);
|
||||||
|
|
||||||
d->dispose();
|
d->dispose();
|
||||||
|
@ -100,6 +101,7 @@ 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());
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
mrb_alias_method(mrb, klass, getMrbData(mrb)->symbols[CS_mkxp_dispose_alias],
|
mrb_alias_method(mrb, klass, getMrbData(mrb)->symbols[CS_mkxp_dispose_alias],
|
||||||
mrb_intern_lit(mrb, "dispose"));
|
mrb_intern_lit(mrb, "dispose"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ 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);
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
disposableAddChild(mrb, viewportObj, self);
|
disposableAddChild(mrb, viewportObj, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue