🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
I keep staring, but it doesn't fix itself
Ok.. this may sound really easy, but I''ve stared at this for a long time (and you know what that does - nothing)
So tell me what I''m doing wrong.
I declare a ptr as
TileClass * Map;
in the include file. Later, I want to create a multi-dem. array out of it, so I do this
Map = new TileClass[30][30];
for( i=0; i<=29; i++)
{
for( j=0; j<=29; j++ )
{
TileClass * tempTile = new TileClass;
tempTile->Init(1,0);
Map[j] = tempTile;
delete tempTile;
}
}
And I get the error
cannot convert from ''class TileClass (*)[30]'' to ''class TileClass *
I know it something simple, yet staring doesn''t help...
You are declaring Map a a 1D array and then trying to assign a 2D array to it. Changing your declaration to TileClass** Map; should fix your problem.
On the other hand, if you want to have a 1D array in the first place, you should declare it as such when you call new... just change it to new TileClass[30*30] and that should work as well.
Check out the GPI project today!
Edited by - chippydip on 4/6/00 4:09:48 AM
On the other hand, if you want to have a 1D array in the first place, you should declare it as such when you call new... just change it to new TileClass[30*30] and that should work as well.
Check out the GPI project today!
Edited by - chippydip on 4/6/00 4:09:48 AM
You don''t need tempTile. You should write Map[i*j].Init(1,0);
Visit our homepage: www.rarebyte.de.st
GA
Visit our homepage: www.rarebyte.de.st
GA
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement