diff --git a/flecs.h b/flecs.h index 34d3d4198..d0cf66d7b 100644 --- a/flecs.h +++ b/flecs.h @@ -20110,9 +20110,9 @@ struct world { /** Create world from C world. */ - explicit world(world_t *w) + explicit world(world_t *w, bool owned = false) : m_world( w ) - , m_owned( false ) { } + , m_owned( owned ) { } /** Not allowed to copy a world. May only take a reference. */ diff --git a/include/flecs/addons/cpp/world.hpp b/include/flecs/addons/cpp/world.hpp index d5e2dd576..b37b9d8ff 100644 --- a/include/flecs/addons/cpp/world.hpp +++ b/include/flecs/addons/cpp/world.hpp @@ -146,9 +146,9 @@ struct world { /** Create world from C world. */ - explicit world(world_t *w) + explicit world(world_t *w, bool owned = false) : m_world( w ) - , m_owned( false ) { } + , m_owned( owned ) { } /** Not allowed to copy a world. May only take a reference. */ diff --git a/test/cpp_api/project.json b/test/cpp_api/project.json index deec7fb97..9bac0713c 100644 --- a/test/cpp_api/project.json +++ b/test/cpp_api/project.json @@ -1241,7 +1241,8 @@ "atfini", "atfini_w_ctx", "get_mut_T", - "get_mut_R_T" + "get_mut_R_T", + "world_mini" ] }, { "id": "Singleton", diff --git a/test/cpp_api/src/World.cpp b/test/cpp_api/src/World.cpp index b76919d46..2765afec8 100644 --- a/test/cpp_api/src/World.cpp +++ b/test/cpp_api/src/World.cpp @@ -1927,3 +1927,11 @@ void World_get_mut_R_T(void) { test_int(p->y, 20); } +void World_world_mini(void) { + flecs::world world(ecs_mini(), true); + + test_assert(world.lookup("flecs.system") == 0); + test_assert(world.lookup("flecs.pipeline") == 0); + test_assert(world.lookup("flecs.timer") == 0); + test_assert(world.lookup("flecs.meta") == 0); +} diff --git a/test/cpp_api/src/main.cpp b/test/cpp_api/src/main.cpp index c69d1400c..2fae2458e 100644 --- a/test/cpp_api/src/main.cpp +++ b/test/cpp_api/src/main.cpp @@ -1191,6 +1191,7 @@ void World_atfini(void); void World_atfini_w_ctx(void); void World_get_mut_T(void); void World_get_mut_R_T(void); +void World_world_mini(void); // Testsuite 'Singleton' void Singleton_set_get_singleton(void); @@ -5984,6 +5985,10 @@ bake_test_case World_testcases[] = { { "get_mut_R_T", World_get_mut_R_T + }, + { + "world_mini", + World_world_mini } }; @@ -6814,7 +6819,7 @@ static bake_test_suite suites[] = { "World", NULL, NULL, - 112, + 113, World_testcases }, {