@feelotraveler: I tried bulding a plot (the conventional way, using dorfs) and then went into the farm plot building and set the plot to grow 53 (or whatever the number was), and nothing happened, which I think is due to the order bypassing the checks. If I would do this manually, I'd do what Fleeting Frames does, i.e. bring up the farm plot and look at what plants are available, but the data structure contains what's ordered, so it comes after the check (and crops that are inserted that way aren't show in the list and won't be planted since they're not legal). Note that you don't order seeds to be planted: that order is generated internally by DF as a result of the farm plot being ordered to grow a plant and the plot not being fully populated by growing crops yet.
Anyway, I've changed the code to use biomes (and fixed some bugs), and the result is a mess. For the embark I'm currently using, having tropical and temperate grassland only, I get a patchwork of different biome numbers within the same region, and the patchwork is cut off at embark tile boundaries, and those biomes have sets of parameters that are identical within either the temperate or tropical grassland group, so there are no seams visible in the parameter views. However, further examination shows there's actually some kind of method to the madness somewhere, as these subgroups line up with groups with different biome numbers on neighboring tiles. However, the biome numbers do not seem to really match entries in the regions' biome list. They may, however, have some relation to the delta numbers in ragundo's code. I guess that's the next thing to explore.
Edit: OK, it looks like we're at least approaching coming back on track. I've updated to 1.5, but there are oddities left.
I would have gotten nowhere without ragundo's input. Many thanks!
My current understanding, reflected by the code, regarding the biome is:
- The biome info shown by Probe on a tile isn't actually a biome index at all, but a delta as per ragundo's code, that shows which embark tile that has the biome data is its "main" data.
- The embark tile has a delta which shows which world tile its biome info has as its home. This is what ragundo's code handles.
- Thus, there seems to be a two step indirection to get to the world tile where the biome "belongs"
My guess why this is made that way is:
- On world generation, all there is is world tile data. This data then "bleeds" into surrounding tiles, which now is represented by embark tiles, resulting in areas of connected biomes on embark level, centered on world level tiles, so they should never spread beyond their neighbors.
- The process is then repeated where the embark tiles bleed into each other.
- Regions are then created by collecting all world tiles that have a biome type of one of the 10 high level ones. This would also mean the indices in the region structure do not mean anything; it's just an array listing all world map tiles that have been rounded up into that region.
Anyway, one thing I've seen in the latest version is a straight line (actually two, since it's broken) that cuts a biome along an embark tile boundary with different tropicality for the two of them. Somehow being on the wrong upper side has turned the northern parts into temperate, which they probably belong to the southern region tile, and thus their tropicality should be calculated from that.
Edit2: I forgot I've turned the vegetation view back on, but presents the biome delta number there.
Edit3: OK, it looks like ragundo wrote the code out of memory (thanks for the effort), since reversing all the signs (as well as reducing the numbers by one to account for C's starting at 0, not 1) provides a nice output and fits with the logic scheme when looking at the numbers and trying to fit their movement direction matches that.
Edit4: Well, this is weird. Trying another embark cause the script to spew out debug trace about deltas being out of range. Using ragundo's original code on the region level and my "corrected" one at embark level at least caused the errors to go away (using the same code in both places resulted in errors about 9 or 0, depending on which version was used. We'll see if the results make sense, though.