Closed davidyu closed 10 years ago
This happens 100%. It goes away if I add ContainableCmp to the sonar beam, but this doesn't make any sense. BounceCmp has a bitset ID of 16 and ContainableCmp has a bitset ID of 17, so they're not colliding, but the fact that they're close probably isn't a coincidence...
EDIT 1
Something is wrong with Bitset.nextSetBit()
We have an entity with PosCmp (5), PosTrackerCmp (6), RenderCmp (11), TrailCmp (13), TimedEffectCmp (15), and BounceCmp (16). This is the corresponding word:
0b11010100001100000
Which is correct. However, for whatever reason, we're getting 17 instead of 16 when we call componentBits.nextSetBit(16).
Also, isn't the syntax a bit confusing? Why should the search space of nextSetBit include the fromIndex parameter?
EDIT 2
numberOfTrailingZeros is the culprit here.
numberOfTrailingZeroes(65536) returns 17 instead of the expected 16. In fact, for all numbers with >= 16 trailing zeroes, numberOfTrailingZeros returns 17.
Fixed in artemis: 5be287f
I've been getting the following errors in debug-local builds:
There is no entity in existence with a TrailCmp that does not also have a BounceCmp. Also, going through the list of e.dumpComponents(), the ContainableCmp at index 5 is null.
Either addComponent fails from time to time, or something is scribbling on entities. In either case, this is very bad.