yesterday I wrote this code to make trees spawn randomly anywere in the map:
for (int i = 0; i < 1000; i++)
{
tree[i].setTexture(tr);
tree[i].setPosition(rand() % 10560 + 0, rand() % 10560 + 0);
tree[i].setScale(1, 2);
}
and then
for (int i = 0; i < 1000; i++)
{
app.draw(tree[i]);
}
-------------------------------------
But today i wrote that again for yellow flowers:
for (int i = 0; i < 1000; i++)
{
yellow_flower[i].setTexture(y_f);
yellow_flower[i].setPosition(rand() % 10560 + 0, rand() % 10560 + 0);
}
and then
for (int i = 0; i < 1000; i++)
{
app.draw(yellow_flower[i]);
}
but when I added these new loops, this error occurs to me:
Unhandled exception at 0x01017D59 in MyGame.exe: 0xC00000FD: Stack overflow (parameters: 0x00000000, 0x00402000).