diff --git a/src/EC/Bitset.hpp b/src/EC/Bitset.hpp index b814e07..4317313 100644 --- a/src/EC/Bitset.hpp +++ b/src/EC/Bitset.hpp @@ -19,7 +19,8 @@ namespace EC // Note bitset size is sizes of components and tags + 1 // This is to use the last extra bit as the result of a query // with a Component or Tag not known to the Bitset. - // Those queries will return a false bit every time. + // Those queries should return a false bit every time as long as EC::Manager + // does not change that last bit. template struct Bitset : public std::bitset @@ -31,7 +32,6 @@ namespace EC (*this)[Combined::size] = false; } - // TODO find a better way to handle non-member type in const template constexpr auto getComponentBit() const { @@ -43,7 +43,6 @@ namespace EC constexpr auto getComponentBit() { auto index = EC::Meta::IndexOf::value; - (*this)[Combined::size] = false; return (*this)[index]; } @@ -58,7 +57,6 @@ namespace EC constexpr auto getTagBit() { auto index = EC::Meta::IndexOf::value; - (*this)[Combined::size] = false; return (*this)[index]; } diff --git a/src/EC/Manager.hpp b/src/EC/Manager.hpp index 5a5c0b8..bd15b08 100644 --- a/src/EC/Manager.hpp +++ b/src/EC/Manager.hpp @@ -389,8 +389,8 @@ namespace EC template void addComponent(const std::size_t& entityID, Args&&... args) { - if(!isAlive(entityID) - || !EC::Meta::Contains::value) + if(!EC::Meta::Contains::value + || !isAlive(entityID)) { return; } @@ -426,7 +426,8 @@ namespace EC template void removeComponent(const std::size_t& entityID) { - if(!isAlive(entityID)) + if(!EC::Meta::Contains::value + || !isAlive(entityID)) { return; } @@ -447,8 +448,8 @@ namespace EC template void addTag(const std::size_t& entityID) { - if(!isAlive(entityID) - || !EC::Meta::Contains::value) + if(!EC::Meta::Contains::value + || !isAlive(entityID)) { return; } @@ -471,7 +472,8 @@ namespace EC template void removeTag(const std::size_t& entityID) { - if(!isAlive(entityID)) + if(!EC::Meta::Contains::value + || !isAlive(entityID)) { return; } @@ -1215,7 +1217,7 @@ namespace EC // generate bitsets for each signature EC::Meta::forEachWithIndex( - [this, &signatureBitsets] (auto signature, const auto index) { + [&signatureBitsets] (auto signature, const auto index) { signatureBitsets[index] = BitsetType::template generateBitset ();