View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005739 | Dwarf Fortress | Dwarf Mode -- Stockpiles | public | 2012-03-31 18:39 | 2014-07-23 10:40 |
Reporter | Andrakon | Assigned To | Toady One | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Windows | OS | Vista | OS Version | Windows Vista |
Product Version | 0.34.07 | ||||
Fixed in Version | 0.40.01 | ||||
Summary | 0005739: Stockpile settings for cloth are broken if adamantine cloth is permitted | ||||
Description | If a stockpile only has adamantine thread allowed, nothing will be stored there. If a stockpile only has adamantine cloth allowed, all types of cloth will be stored there. All of my cloth and thread is in bins. I have two stockpiles set up, one for adamntine strands and cloth, and the other for all other cloth plus leather. In the stockpile settings on the adamntine stockpile I have everything except adamantine thread and cloth forbidden and everything except adamntine thread and cloth allowed in the other stockpile. My dwarves were storing the adamntine thread in the regular thread and cloth stockpile, so I had the adamntine thread stockpile take from the regular thread and cloth stockpile, then my dwarves start moving bins of regular thread and cloth to the adamntine only stockpile and did not take out the regular thread or cloth. Most bins did not even have adamntine stuff in them. Strangely they would not take all of the bins either. And if I set number of bins to 0 then nothing would be stored in the stockpile. I double checked the stockpile settings on both and confirmed that they are correct. | ||||
Steps To Reproduce | Have two stockpiles, a lot of cloth and thread in bins, and some adamantine strands. Set one stockpile to forbid adamantine strands and cloth but allow the rest of the cloth category. Do the opposite for the other stockpile. Dwarves will store adamantine strands in the wrong stockpile. Have the adamantine strand stockpile take from the regular stockpile. Dwarves will start moving bins of regular cloth to the adamantine stockpile. | ||||
Additional Information | Phoebus graphics pack | ||||
Tags | binary patch | ||||
has duplicate | 0004790 | resolved | Cloth stockpiles ignoring preferences | |
has duplicate | 0004788 | resolved | Dwarves ignore thread type when storing thread in a thread stockpile. (Thread (Metal) option not working) | |
has duplicate | 0004913 | resolved | metal cloth stockpiles accept non-metal cloth | |
has duplicate | 0004473 | resolved | Stockpiles ignore settings for adamantine/metal cloth/thread | |
has duplicate | 0005492 | resolved | Dwarves putting Pig tails on prohibited stock pile | |
has duplicate | 0006290 | resolved | Metal thread stockpiles accept any thread | |
related to | 0004380 | new | Stockpile options don't work for cloth | |
related to | 0005569 | resolved | Toady One | Stone globs (generated by magma crabs) get stored in food stockpiles |
|
yep, still the case for 34.11 |
|
Possible workaround (not mine): http://www.bay12forums.com/smf/index.php?topic=122782.0 |
|
I got curious about that workaround and looked at the code. It turns out this bug is most likely caused by the same uninitalized reference array in the material structure that crashes the economy if it is enabled via memory hacking (as found by Quietust). Basically, for use in stockpiling and economy, the game pre-sorts the materials into a certain set of groups; here is the list of them: https://github.com/angavrilov/df-structures/blob/master/df.materials.xml#L448 This sorting process fills an array of vectors with material ids, and also sets things up for reverse lookup by storing the index of each material id within the material id vector inside the matching material structure itself. Unfortunately, while the array inside the material structure that is used to store the reverse lookup references is supposed to be preinitialized with -1, it isn't filled at all, and ends up containing whatever there was in memory before. As a result, since the most likely value for newly allocated memory contents when DF is just being loaded is 0, thread&cloth end up being matched against index 0 within all categories they don't really belong to (and should thus be referencing -1). |
|
Specifically, the material descriptor structure contains a 37-element array near the end (between the PREFIX string and the POWDER_DYE/STATE_COLOR temp-strings) which refers to a set of vectors in the raws sub-structure (immediately after the custom building raws and the interactions list), and the values in this array are assumed to be initialized to -1 - the code for stockpiling cloth/thread and for nobles adjusting economy prices both rely on this, the latter actually crashing if this assumption is violated. Similar references appear to be present inside the creature caste raw structure, between the TRADE_CAPACITY and ATTACK_TRIGGER fields. |
|
This bug may also be the root cause of 0005569. |
|
It looks like I had the values initialized for 0.40.01, changed at some point I don't remember. |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-03-31 18:39 | Andrakon | New Issue | |
2012-04-01 09:17 |
|
Relationship added | child of 0004380 |
2012-04-01 09:17 |
|
Relationship added | has duplicate 0004790 |
2012-04-01 09:17 |
|
Relationship added | has duplicate 0004788 |
2012-04-01 09:18 |
|
Relationship added | has duplicate 0004913 |
2012-04-01 09:21 |
|
Relationship added | has duplicate 0004473 |
2012-04-01 09:21 |
|
Relationship added | has duplicate 0005492 |
2012-04-01 09:22 |
|
Relationship replaced | related to 0004380 |
2012-11-03 03:50 | Alumine | Note Added: 0023704 | |
2013-02-04 08:15 |
|
Relationship added | has duplicate 0006290 |
2013-02-11 12:10 | lethosor | Note Added: 0023848 | |
2013-02-12 09:43 | ag | Note Added: 0023849 | |
2013-02-12 09:50 | Quietust | Note Added: 0023850 | |
2013-02-12 09:53 | Quietust | Note Edited: 0023850 | |
2013-02-14 13:45 | Quietust | Note Edited: 0023850 | |
2013-03-21 19:32 | Quietust | Note Added: 0023908 | |
2013-03-21 19:33 | Quietust | Note Edited: 0023908 | |
2014-02-19 17:58 |
|
Relationship added | related to 0005569 |
2014-02-19 17:59 |
|
Tag Attached: binary patch | |
2014-03-25 13:18 |
|
Assigned To | => user11 |
2014-03-25 13:18 |
|
Status | new => acknowledged |
2014-07-23 10:40 | Toady One | Note Added: 0027328 | |
2014-07-23 10:40 | Toady One | Status | acknowledged => resolved |
2014-07-23 10:40 | Toady One | Fixed in Version | => 0.40.01 |
2014-07-23 10:40 | Toady One | Resolution | open => fixed |
2014-07-23 10:40 | Toady One | Assigned To | user11 => Toady One |