I have a game object that is processed in two completely different places. In the Contact Listener, I check some conditions, and if they happen, I have to save one or more parts of the complex data. So I decided to use struct. For instance:
struct SomeStruct { int value1; int value2; CGPoint value3; b2Vec2 value4; }; typedef SomeStruct SomeStruct;
In the game scene, I look through all the game objects, and if its stack / array is not empty, do something and wipe it.
In Contact Listener, it repeats from the very beginning.
I have to use this architecture because of the strict order of execution (the method must be called after other methods).
I suspect that I need something like a vector or NSMutableArray (I think it will not work with the structure), so vector may be the only way.
But I donโt understand how to achieve this. Can you help me with a code / pseudo-code or a link to a book / article where I can find a solution?
source share