struct TERRAIN
{
BYTE HeightMap[1024*1024];
int MAP_SIZE;
int ID;
};
problem while using vector.push_back [FIXED]
well i have made a class for heightmaps which i will use for terrain. I have all of different heightmap files in a vector. heres my struct
the thing is, when i push a vector with the hieghtmap data, the array is way to big for the vector (i think), so it causes an error. If i reduce the size of the byte array then it will work properly. Is there a way to fix this?
thx jake
[Edited by - jake_Ghost on March 28, 2005 6:36:43 PM]
You could replace the BYTE array itself with a vector<BYTE>. A 1M struct is huge; it won't fit on the stack.
You realize that structure is over 1MB big? Hopefully you don't want to push to many of them.
Anyway, it helps to mention what the error is when you say you get an error.
Anyway, it helps to mention what the error is when you say you get an error.
its one of those window errors that says send error report or dont send. i am using the code from gametutorials.com for raw loading.
I think the problem is probably that, even though vector uses the heap, when you do push_back you pass it a TERRAIN object that was created on the stack. And like Fruny said, that structure won't fit on the stack.
Quote:Original post by jake_Ghost
its one of those window errors that says send error report or dont send. i am using the code from gametutorials.com for raw loading.
It's a stack overflow. The default stack size is generally only 1MB. A single variable of that type is already bigger than that. Use dynamic allocation (e.g. a vector<BYTE>) instead of an array.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement