On Friday, 13 August 2021 at 21:10:38 UTC, Steven Schveighoffer wrote:
On 8/13/21 3:59 PM, Mike Parker wrote:
On Friday, 13 August 2021 at 16:18:06 UTC, Ruby The Roobster wrote:
...
...
...

Well, subtracting the length doesn't do much, you aren't actually accessing the array block, you are just changing the reference (which lives in thread-local storage). I kind of feel like the whole entity table thing is not correct anyway. Did you (Mike) also comment out the `did` call? Because that looks more suspicious to me. What it is doing is going through all the entities from the removed one on and setting their id to 1 less. HOWEVER, it's not actually *moving* the entities down in the array.

However, you will NEVER have an entity be destroyed, because there is always a reference to it in the table! They will only get destroyed at the end, via `terminate` where things are destroyed deterministically.

-Steve


Okay. I removed the destructors and the 'did' function. Instead of those, I created a destruct(Entity op) function that works without causing an error. The entitytable array is for the purpose of it being easier to search by id, because the index used to access the array is the same as the id. It's also(IMO) easier on my end to have every Entity object in a single array.


Reply via email to