Skip to main content
GameDev.net gamedev.net
🔒 Locked

Flag Tutorial Modification HELP!

Started by Viri- Jun 28, 2001 at 12:08 AM 0 replies 450+ views
Original Post
Viri-
Viri-
Ok I was working with the NeXe tutorials and was workign with the Flag Tutorial. I changed a thing or two here and there and liked how it works and I''ve really wanted to have this effect saved so I could add it to my project any time I want. I have two files: Flag.h/.cpp And all is good. But then I changed some things around and now I get this error on my setup func: ...\main.cpp(56) : error C2664: ''SetupFlag'' : cannot convert parameter 5 from ''class CFlagVertex (*)[400]'' to ''class CFlagVertex *[]'' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast What I have in my code is this: CFlag Flag; CFlagVertex pVertices[400]; ... // the func in the class (flag.h/.cpp) is: void SetupFlag(CDirect3D *pDirect3D, char *szTextName, CTexture *pCTexture, CVertexBuffer *pCVertBuff, CFlagVertex *pVertices[]); // the func in my main.cpp Flag.SetupFlag(&Direct3D, "nel.bmp", &pCTexture, &CVertBuff, &pVertices); What the problem is is that I have pVertices declared at 400 (ie: pVertices[400] and I want to be able to let the coder decide how big the flag and be able to pass it to the setup func so it will setup the points correctly. But I again get the error: ''class CFlagVertex (*)[400]'' to ''class CFlagVertex *[]'' What am I doing wrong or what do I need to do to fix this? If this just isn''t clear let me know and I''ll post more code and try again explaining it.. basicly I''m just trying to pass pVertices[400] into my function: FlagSetup(...CFlagVertex *pVertices) Thanks for any and all help...
------------thanks,Phoenix
snowmoon
snowmoon
I''m a little rusty, but you have a paramater passing problem because of the **CFlagVertex vs *CFlagVertex[400] you cannot pass an abatrariry sized array as a pointer. You either have to pass the array as a fixed size ( not what you want ), or pass as a simple pointer and also pass the size you are sending. Note the canged both to the function definition and the calling.

Ok... try this...


CFlag Flag;
CFlagVertex pVertices[400];
...
// the func in the class (flag.h/.cpp) is:
void SetupFlag(CDirect3D *pDirect3D, char *szTextName, CTexture *pCTexture, CVertexBuffer *pCVertBuff, CFlagVertex *pVertices, unsigned int iVerticesSize);

// the func in my main.cpp
Flag.SetupFlag(&Direct3D, "nel.bmp", &pCTexture, &CVertBuff, pVertices, sizeof(pVertices));




Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.