Merge pull request #2980 from cppcooper/dig-now

dig-now bug fixing revisited
develop
Myk 2023-03-06 13:45:44 -08:00 committed by GitHub
commit ee7692af77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

@ -38,8 +38,10 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes
-@ ``widgets.HotkeyLabel``: don't trigger on click if the widget is disabled
- ``dfhack.job.isSuitableMaterial``: now properly detects lack of fire and magma safety for vulnerable materials with high melting points
- `dig-now`: fixed multi-layer channel designations only channeling every second layer
## Misc Improvements
- `dig-now`: added handling of dig designations that have been converted into active jobs
## Documentation
@ -66,7 +68,6 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `autodump`: changed behaviour to only change ``dump`` and ``forbid`` flags if an item is successfully dumped.
-@ `autochop`: generate default names for burrows with no assigned names
- ``Buildings::StockpileIterator``: fix check for stockpile items on block boundary.
- `dig-now`: fixed multi-layer channel designations only channeling every second layer
- `tailor`: block making clothing sized for toads; make replacement clothing orders use the size of the wearer, not the size of the garment
-@ `confirm`: fix fps drop when enabled
- `channel-safely`: fix an out of bounds error regarding the REPORT event listener receiving (presumably) stale id's
@ -77,7 +78,6 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `showmood`: now shows the number of items needed for cloth and bars in addition to the technically correct but always confusing "total dimension" (150 per bar or 10,000 per cloth)
-@ Stopped mouse clicks from affecting the map when a click on a DFHack screen dismisses the window
- `confirm`: configuration data is now persisted globally.
- `dig-now`: added handling of dig designations that have been converted into active jobs
- `tailor`: add support for adamantine cloth (off by default); improve logging
## API

@ -81,13 +81,15 @@ private:
public:
void load(MapExtras::MapCache &map) {
designations.clear();
DEBUG(general).print("DesignationJobs: reading jobs list\n");
df::job_list_link* node = df::global::world->jobs.list.next;
while (node) {
df::job* job = node->item;
node = node->next;
if(!job || !Maps::isValidTilePos(job->pos))
continue;
node = node->next;
df::tile_designation td = map.designationAt(job->pos);
df::tile_occupancy to = map.occupancyAt(job->pos);
const auto ctd = td.whole;
@ -134,6 +136,7 @@ public:
jobs.emplace(job->pos, job);
}
}
DEBUG(general).print("DesignationJobs: DONE reading jobs list\n");
}
void remove(const df::coord &pos) {
if(jobs.count(pos)) {
@ -731,9 +734,11 @@ static void do_dig(color_ostream &out, std::vector<DFCoord> &dug_coords,
Random::MersenneRNG rng;
DesignationJobs jobs;
DEBUG(general).print("do_dig(): starting..\n");
jobs.load(map);
rng.init();
DEBUG(general).print("do_dig(): reading map..\n");
std::unordered_set<designation> buffer;
// go down levels instead of up so stacked ramps behave as expected
for (int16_t z = options.end.z; z >= options.start.z; --z) {
@ -765,6 +770,7 @@ static void do_dig(color_ostream &out, std::vector<DFCoord> &dug_coords,
}
}
DEBUG(general).print("do_dig(): processing designations..\n");
// process designations
for(auto &d : buffer) {
auto pos = d.pos;
@ -812,6 +818,7 @@ static void do_dig(color_ostream &out, std::vector<DFCoord> &dug_coords,
}
}
DEBUG(general).print("do_dig(): write changes to map..\n");
map.WriteAll();
}