I'm working on a game that pre-generates a large map in order for the player to navigate it. It only happens once, and then will be (*not implemented) stored locally such that it doesn't happen again.
I attempted recently to put all of the generation steps into its own function to isolate it, and then call it using a separate thread to run through generation and still allow for player input. The plan is to eventually use it to display generation progress, but I digress.
I've attached pictures of the code in question, one sequential, and the other threaded. Both really do the same thing, but one lets the player move around and see it happen in real time. The thing is, generating the world this way causes extremely weird issues to occur, spamming the console with hundreds of errors (mainly remove: Condition "p_elem->_root != this" is true.), and then causing extremely weird artifacts to occur in generation, which I've also attached. Has anyone run into something similar? This isn't my first run at multithreaded applications, I'm just confused on why things that shouldn't be causing issues are in fact causing catastrophic issues.
Thank you.