This is a question to the coders out there: I've been trying to add new ruleset options for improving the interception window/minigame for OXCE+, and have run into a number of different memory allocation errors, most of which I narrowed down to how class variables are declared in the header files. Is there a proper method for adding new variables to the header?
For example, in RuleUfo.cpp, I wanted to implement a method for getting an integer from the ufos: ruleset to point to a resource for the UFO's firing sound, copied somewhat from the methods in RuleCraftWeapon.cpp and .h. I declared int fireSound in RuleUfo.h, and had it initialize to fireSound(-1) in the class constructor. Compiled smoothly, but CTD at runtime. I eventually got it to work by moving the declaration of fireSound a few lines down in RuleUfo.h, but still with all the other variable declarations. I've done some similar additions (I can provide more specific examples when I'm not on my phone), and it has been the same story of re-ordering the declarations in the header. It seems like black magic to me, so can anyone provide an explanation why a certain order works, and how to properly code that order without guess and check?
Edit: Thinking about it, could the memory allocation errors come from not recompiling the other .cpp files that include the header before repackaging the executable? I typically only replace the object file for the .cpp file whose header I'm editing, so in the RuleUfo example, only RuleUfo.cpp recompiles into RuleUfo.o when I edit RuleUfo.h. Should I have found all .cpp files that include RuleUfo.h, removed their associated .o files, and then recompiled?