Now, given modern coding practices, it could be made better. That's what we're trying to do here, but remaking something just because it's old is stupid when you do not know exactly why you're doing it, which in this case means knowing what the subtle issues are that cause problems.
The maximum number of bitmaps and repetitive items are the problems we're running into.
No, it's not. That's the surface level issue, and if it was the actual issue, we could just increase the number of bitmap slots and be done with it. Just like your attempts at raising the number of asteroids or changing path lengths, if it was just an issue of adjusting the value of one constant, we'd have done it long ago.
The actual problem goes deeper. And you, quite frankly, do NOT have the experience with the engine or C/C++ required to fix it. [/quote]
I get it, as I intend to do some code refactoring on it. As for my attempts at raising the number of asteroids (to my intended 1024, though it's raised from 256 to 512, short of that) or changing path lengths, I will re-visit these at some point in the future.
Two tasks.
One. Explain what the keyword "static" in C/C++ does, and what behaviour your specific usage here will result in.
Two. Explain what a "Template" in C++ is, and what it does in this code snippet of yours.
The static keyword is used to declare variables and functions at global scope, namespace scope, class scope and local scope. Static objects or variables are allocated when the program starts and is deallocated when the program ends. In this case here, an ID is initialized upon starting FSO, and it deallocated when FSO closes.
Templates are the foundation of generic programming, which involves writing code in a way that is independent of any particular type. Here in my code snippet, type is a placeholder name for a data type used by the function. This name can be used within the function definition - in this case, get an ID for a bitmap entry.
I know C/C++ a decade ago, bolstered thanks to my college studies, which is starting to pay off.