Hello all
I’m using a struct to encapsulate a host of variables for a flocking algorithm. I have a class for the flock manager set up in the observer pattern that has all of my public variables that affect how the flock behaves.
Currently, I’m having to compare all of my variables to the stored info in my struct which is tedious to write. I have a huge f(a != struct. || b != struct.b || c != struct.c || d != struct.d) statement comparing 20 variables to each corresponding variable in the struct, and if any of them are different, it updates the struct.
Is there a better way to monitor a list of variables (they must be serialized so that I can adjust them for preview) without a gigantic if(a != struct. || b != struct.b || c != struct.c || d != struct.d) statement?
Or, even if I weren’t using a struct, how could I best monitor a large set of variables for changes?
Thanks in advance