df-structures icon indicating copy to clipboard operation
df-structures copied to clipboard

`hauler_type.Bin` is inaccurate

Open lethosor opened this issue 3 years ago • 4 comments

Originally posted by @ab9rf in https://github.com/DFHack/df-structures/issues/435#issuecomment-903359458

My research suggests that we should rename Bin to something else. Specifically, StoreItemInHospital jobs increment world.stockpile.num_jobs[Bin], even though a "store in hospital" job never result in anything being actually stored in a bin.

        pjVar38 = job::create();
        piVar42 = local_440;
        pjVar38->job_type = StoreItemInHospital;
...
        world.stockpile.num_jobs.Any = world.stockpile.num_jobs.Any + 1;
        world.stockpile.num_jobs.Bin = world.stockpile.num_jobs.Bin + 1;

lethosor avatar Aug 24 '21 16:08 lethosor

To my fairly substantial surprise, I note that MSVC tells me that there are zero live references to df::enums::hauler_type::Bin in dfhack C++ code. I also did a search of the published hack/scripts folder and found no references in published Lua or Ruby scripts.

ab9rf avatar Aug 24 '21 16:08 ab9rf

Isn't labormanager using a hardcoded "4" somewhere in place of it?

lethosor avatar Aug 25 '21 00:08 lethosor

Isn't labormanager using a hardcoded "4" somewhere in place of it?

Yes. And that's the only code in DFHack I'm aware of that uses world.stockpiles.num_haulers or world.stockpiles.num_jobs at all.

ab9rf avatar Aug 25 '21 14:08 ab9rf

Turns out DF doesn't even have a "hauler_type" enum, and the arrays in world.stockpile (bay12 storage_handlerst) are simply two flat sets of variables whose names end with "", "_mining", "_wood", "_burial", "_item", "_body", "_food", "_refuse", "_furniture", and "_animals".

quietust avatar Jun 12 '24 16:06 quietust