-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix comment for job->item_subtype #435
Conversation
while implementing the --hauler-type param for the prioritize script, I noticed that the job->item_subtype field, which is tagged as being a hauler_type enum, did not match up with the type of item being hauled. I fixed this enum based on observation of which enum values resulted in which types of items were hauled. I was unabled to verify the "Bin" enum. I could not get any hauling jobs of this type to be generated in my fort, even when explicitly building bins and enabling bins for stockpiles.
This is an interesting one.
My guess is that Toady might have changed hauler_type at some point to be consistent with unit_labor, but I don't know for sure, or when. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would break the indexing of world.stockpiles.num_jobs
and world.stockpiles.num_haulers
. The current enum is correct; I tested this extensively over the course of years developing labormanager, and just spot-checked it in a mature fort.
hauler_type is also used as an index-enum in stockpile, but @ab9rf reports that this enum was inaccurate at the time labormanager was written, so indices were hardcoded here. Note that "bin" corresponded to 4 at the time.
No, the existing enum is correct. I originally thought it was wrong, but it was more because I didn't understand how it was being used when I initially wrote that, and haven't gone back to update the code to reflect lessons learned since.
There is no direct correspondence between hauling type and labors. The labor for a hauling job is determined in a fairly complicated way: see labormanager job mapping source for more info.
df.stockpile.xml
Outdated
@@ -3,13 +3,13 @@ | |||
<enum-item name='Any'/> | |||
<enum-item name='Stone'/> | |||
<enum-item name='Wood'/> | |||
<enum-item name='Item'/> | |||
<enum-item name='Bin'/> | |||
<enum-item name='Body'/> | |||
<enum-item name='Food'/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, at least with respect to world.stockpiles.num_haulers
, and I must recommend against this PR without more evidence.
I just tested on a mature fort by clearing all hauling labors on everyone. This resulted in world.stockpiles.num_haulers
going to all zero. Then, reenabling food hauling on everyone resulted in world.stockpiles.num_haulers[Food]
going to 194 while the others remained zero.
If the enum were wrong, some other field would have gone up. Therefore, the existing enum is correct, at least for food, but this change would change the value of the Food
enum.
I must therefore object.
Thinking over it a bit, I suspect the comment for |
ack. I'll fix the comment and update DFHack/scripts#327 to interpret the field as a |
changes reverted; misleading comment made less misleading |
My research suggests that we should rename
|
While implementing the --hauler-type param for the prioritize script, I noticed that the
job->item_subtype
field, which is tagged as being ahauler_type
enum, did not match up with the type of item being hauled. I fixed this enum based on observation of which enum values resulted in which types of items were hauled.I was unabled to verify the "Bin" enum. I could not get any hauling jobs of this type to be generated in my fort, even when explicitly building bins and enabling bins for stockpiles.