I've been writing an engine and ran into a problem, I'm getting a read access violation in my code. I have no idea why, but it happens when I add this->chunks.push_back(chunk); into this block of code,
void c_world::generate_world()
{
this->chunks.resize(MAX_CHUNKS);
for (auto chunk : this->chunks)
{
chunk.setup_landscape();
}
}
so it becomes...
void c_world::generate_world()
{
this->chunks.resize(MAX_CHUNKS);
for (auto chunk : this->chunks)
{
chunk.setup_landscape();
this->chunks.push_back(chunk);
}
}
this->chunks is an std::vector<c_chunk> (c_chunk) being a custom class. Thank you!
All helps appreciated.
Aucun commentaire:
Enregistrer un commentaire