diff --git a/test/lib/dispatcher_plugin/plugin.cpp b/test/lib/dispatcher_plugin/plugin.cpp index a473142c7..8a8a60c0d 100644 --- a/test/lib/dispatcher_plugin/plugin.cpp +++ b/test/lib/dispatcher_plugin/plugin.cpp @@ -4,12 +4,14 @@ #include "type_context.h" #include "types.h" -inline static type_context *context; +struct ctx { + inline static type_context *ref; +}; template struct entt::type_seq { [[nodiscard]] static id_type value() ENTT_NOEXCEPT { - static const entt::id_type value = context->value(entt::type_hash::value()); + static const entt::id_type value = ctx::ref->value(entt::type_hash::value()); return value; } }; @@ -17,8 +19,8 @@ struct entt::type_seq { CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) { switch (operation) { case CR_STEP: - if(!context) { - context = static_cast(ctx->userdata); + if(!ctx::ref) { + ctx::ref = static_cast(ctx->userdata); } else { static_cast(ctx->userdata)->trigger(); static_cast(ctx->userdata)->trigger(42); diff --git a/test/lib/emitter_plugin/plugin.cpp b/test/lib/emitter_plugin/plugin.cpp index 669b4bc7c..527c84504 100644 --- a/test/lib/emitter_plugin/plugin.cpp +++ b/test/lib/emitter_plugin/plugin.cpp @@ -4,12 +4,14 @@ #include "type_context.h" #include "types.h" -inline static type_context *context; +struct ctx { + inline static type_context *ref; +}; template struct entt::type_seq { [[nodiscard]] static id_type value() ENTT_NOEXCEPT { - static const entt::id_type value = context->value(entt::type_hash::value()); + static const entt::id_type value = ctx::ref->value(entt::type_hash::value()); return value; } }; @@ -17,8 +19,8 @@ struct entt::type_seq { CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) { switch (operation) { case CR_STEP: - if(!context) { - context = static_cast(ctx->userdata); + if(!ctx::ref) { + ctx::ref = static_cast(ctx->userdata); } else { static_cast(ctx->userdata)->publish(); static_cast(ctx->userdata)->publish(42); diff --git a/test/lib/registry_plugin/plugin.cpp b/test/lib/registry_plugin/plugin.cpp index d98026454..e7321b1c1 100644 --- a/test/lib/registry_plugin/plugin.cpp +++ b/test/lib/registry_plugin/plugin.cpp @@ -4,12 +4,14 @@ #include "type_context.h" #include "types.h" -inline static type_context *context; +struct ctx { + inline static type_context *ref; +}; template struct entt::type_seq { [[nodiscard]] static id_type value() ENTT_NOEXCEPT { - static const entt::id_type value = context->value(entt::type_hash::value()); + static const entt::id_type value = ctx::ref->value(entt::type_hash::value()); return value; } }; @@ -17,14 +19,14 @@ struct entt::type_seq { CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) { switch (operation) { case CR_STEP: - if(!context) { - context = static_cast(ctx->userdata); + if(!ctx::ref) { + ctx::ref = static_cast(ctx->userdata); } else { // forces things to break auto ®istry = *static_cast(ctx->userdata); registry.prepare(); - + const auto view = registry.view(); registry.insert(view.begin(), view.end(), velocity{1., 1.});