Jump to content
  • Advertisement
Sign in to follow this  
lodoss118

2d tile maps

This topic is 3825 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

Hi i am trying to dynamically size my map i have a map class that has a pointer to my multidimensioanl array i.e. char **m_Level; this gets initialized in the constructor i.e CMap(TCHAR *name, int width, int height); but what i want to do is assign **m_Level to manual 2d dimensional variable i.e int *map1[] = {0, 0, 0, 0 0, 0, 0, 0}; to this method AssignMap(map1); i have a method called AssignMap(int *map[]) { for(int x=0; x<m_Width; x++) { for(int y=0; y<m_Height; y++) { m_Level[x][y]=map[x][y]; } } } but i am not sure this is correct?

Share this post


Link to post
Share on other sites
Advertisement
You have to clarify your question. Your post goes all over the place and is somewhat incoherent.

Why don't you post some of your actual code.

Also if you want to pass a 2D array to a function the signature should be (Assuming C, or C++):

void AssignMap(int (*map) []); // note the brackets

2D arrays decay to "pointers to arrays". 1D arrays decay to plain ol' pointers.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!