Jump to content
  • Advertisement
Sign in to follow this  
justin12343

Help!! [void** and vectors]

This topic is 3033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to make a function thats casts a array into void** returns it, but I don't know if I'm doing this correctly.



class mapData
{
public:
mapData( vector<LPDIRECT3DTEXTURE9> tl): texture_list(tl)
{
mNumTiles=0;
}
~mapData(){};

int tw, th;
int mNumTiles;
vector<tile> tile_list;
vector<LPDIRECT3DTEXTURE9> texture_list;
};

LPVOID &getMapData()
{
static void *data;
data =(LPVOID)&md; //md is the array
return data;
}





When I cast it back to mapData ( (mapData**)&GetMapData()), the debuggers shows that it doesn't have the original values.

[Edited by - ApochPiQ on August 25, 2010 5:10:22 AM]

Share this post


Link to post
Share on other sites
Advertisement
Well I can only guess since there is no declaration of md but I think,
that you already return a void** so why are you applying the &-operator?
It should work when you do the cast like this: ( (mapData**)GetMapData())

Share this post


Link to post
Share on other sites
Hold up... what are you using a void** for? Chances are something is amiss...


Also, please choose more appropriate thread titles in the future. "Help!!" is kind of annoying [wink]

Share this post


Link to post
Share on other sites
I do not see any variable or value anywhere in your posted code that is of type void**.

And why don't you show us the definition of 'md' instead of just commenting on it?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!