Jump to content
  • Advertisement
Sign in to follow this  
raptorstrike

incompatible types in assignment of Tile** to Tile*[0]

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

Advertisement
ok how bout this as an example
BTW: (i dont want any crap about how i need to do this this and this to the game engine because im doing a MAJOR over haul right now wich is why i 'ave this question k)

map.cpp

//stuff before
Map::Map(int width, int height, Tile *tile[],int tileheight, int tilewidth,const char* szFiles[],int c)
{
m_Width = width;
m_Height = height;
m_tilelist = tile;//HERES THE PROBLEM <------------------------------------
m_tileHeight = tileheight;
m_tileWidth = tilewidth;
if(tileheight > 60 || tilewidth > 60)
{
printf("invalid tile size");
};
if(width > 200 || height > 200)
{
printf("map too large please break it up");
};
if(tile+ height == NULL || tile+ width == NULL)
{
printf("do you really intend to have a diffrent tile for every square");
};
int count;
SetFiles(szFiles);
InitImages(szFiles, m_tilelist, count);
};
//stuff after




a public decleration in map.h

//stuff before

Tile *m_tilelist[];//stuff after




btw way i get the above error on my problem zone
i dont know bout you but those types look exactly the same to me

Share this post


Link to post
Share on other sites
Not to be a spoil sport, but in personal experience, using my own container class instead of pointer magic makes things a hell of alot easier. You'd [and everyone really] would be better off using the STL's container classes rather than your own.

But in reference to this question, using [] lowers the dereference of the variable by 1.

Share this post


Link to post
Share on other sites
A pointer is a variable by itself, which contains the address of another variable. You can take the address of that pointer and store it in a pointer to a pointer.

An array is not a variable; its elements are. The compiler knows where the array is, its location is part of the structure of the program, a constant. Therefore, you can't assign to an array, only to its elements.

Referring to an array name gives you access to that constant, which can be converted to a pointer if necessary, but if you try to take its address, the compiler will stop you - it is not a variable.

This is, as best as I can explain it, the difference between an array and a pointer.

Share this post


Link to post
Share on other sites
ok so ill just make a for loop and asign them indivudaly right?

screw it im using vectors

[Edited by - raptorstrike on October 6, 2004 4:01:52 PM]

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!