As I was writing this program I suddenly felt unsure about pointers. I'm not yet in a position to test-build so I'm asking here if this is correct before I write a bunch of code which uses these. These structures will hold animation data. Each animation can move an arbitrary number of objects, and each object can have an arbitrary number of key frames.
struct ANIMDATA
{
CString AnimName;
int ObjectCount;
OBJECTDATA* pObjects;
};
struct OBJECTDATA
{
CString ObjectName;
int FrameCount;
bool bRoot;
FRAMEDATA* pFrames;
};
struct FRAMEDATA
{
D3DXQUATERNION Rotation;
D3DXVECTOR3 Translation;
float fTimeIndex;
};
Then after I have a ANIMDATA* pAnims assigned, I figured I'd do this within a loop as it reads from a file...
(pAnims+i)->pObjects = new OBJECTDATA[(pAnims+i)->ObjectCount];
...and likewise for pFrames. Yes, ObjectCount will have been assigned before this part. Is this the right way to use the -> operator and the right way to create an array of arbitrary size?
[edited by - Hollower on November 20, 2002 12:36:28 AM]