diff --git a/CMakeLists.txt b/CMakeLists.txt index 59031b6..cb5514b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ target_include_directories( $ ) -option(BUILD_TESTING "Enable testing with ctest." ON) +option(BUILD_TESTING "Enable testing with ctest." OFF) if(BUILD_TESTING) @@ -34,7 +34,7 @@ if(BUILD_TESTING) FetchContent_Declare(googletest #ExternalProject_Add(googletest GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG master + GIT_TAG main SOURCE_DIR "${GOOGLETEST_DEPS_DIR}/src" BINARY_DIR "${GOOGLETEST_DEPS_DIR}/build" CONFIGURE_COMMAND "" diff --git a/src/decs.h b/src/decs.h index b91f32b..825cbeb 100644 --- a/src/decs.h +++ b/src/decs.h @@ -253,7 +253,12 @@ namespace decs { data = (T*)pointer; chunkOwner = owner; index = cindex; - bitf = reinterpret_cast(data + chunkOwner->chunk_headers->componentList->chunkCapacity); + if constexpr (std::is_same_v) { + bitf = reinterpret_cast(data + chunkOwner->chunk_headers->componentList->chunkCapacity); + } + else { + bitf = nullptr; + } } const T& operator[](size_t index) const { @@ -1314,7 +1319,7 @@ namespace decs { uint64_t separator = get_entity_separator(world,id); Archetype* oldarch = get_entity_archetype(world, id); - Archetype* newarch = make_archetype_by_adding_component(oldarch, type); + Archetype* newarch = make_archetype_by_removing_component(oldarch, type); set_entity_archetype(newarch, id,separator); } diff --git a/test/base_tests.cpp b/test/base_tests.cpp index 9b73b8f..57009dd 100644 --- a/test/base_tests.cpp +++ b/test/base_tests.cpp @@ -70,7 +70,7 @@ TEST(Basic, NullEntities) int count = 0; for (auto chnk : world.archetypes[0]->chunks) { - count += chnk->header.last; + count += chnk.chunk->header()->alive; } EXPECT_EQ(count, 1000); }