[0.15.6] Hard crash on iterating through chunks

This subforum contains all the issues which we already resolved.
orzelek
Smart Inserter
Smart Inserter
Posts: 3924
Joined: Fri Apr 03, 2015 10:20 am
Contact:

[0.15.6] Hard crash on iterating through chunks

Post by orzelek »

There seems to be a strange crash when iterating over chunks using for and LuaSurface.get_chunks().
To reproduce it you need mods and save avaialble in this thread:
viewtopic.php?p=266428#p266428

After loading the save try to run following command:

Code: Select all

/c remote.call("RSO", "regenerate")
Function called in RSO uses for loop with chunk iterator twice. First time it clears the chunks and second time it generates ores again.
I used log() statements to check that crash happens after generating a chunk when it should iterate to next one (thats during second iteration).
I'm not sure if it's something I'm doing in lua or the fact that I'm iterating twice over chunks.
Log from crash:
log
Rseding91
Factorio Staff
Factorio Staff
Posts: 14360
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15.6] Hard crash on iterating through chunks

Post by Rseding91 »

The problem is the chunk iterator becomes invalid when chunks are generated because it points at the old data the chunks were stored in.

I'll work on it and get it fixed for the next version of 0.15 so it's capable of handling when chunks are generated while iterating. You just might not get every single chunk in those instances (ones generated after the iterator moves past that chunk position).
If you want to get ahold of me I'm almost always on Discord.
orzelek
Smart Inserter
Smart Inserter
Posts: 3924
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.15.6] Hard crash on iterating through chunks

Post by orzelek »

So one of ore placements causes chunk to be created?

I had an idea to calculate ore patch first, then check for chunks there, trigger their generation and place the patch after all are ready.
I'm not 100% sure how that would work since I would need to store whole ore patch somewhere in global and that would be quite a lot of coordinate pairs with one or two additional values.
Post Reply

Return to “Resolved Problems and Bugs”