Merge pull request #2383 from cppcooper/em-fixes

Fixes JOB_STARTED event
develop
Myk 2022-11-11 19:58:46 -08:00 committed by GitHub
commit 5136bbbc03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

@ -42,6 +42,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `tiletypes`: no longer resets dig priority to the default when updating other properties of a tile
- `automaterial`: fix rendering errors with box boundary markers
- Core: fix the segmentation fault with the REPORT event in EventManager
- Core: fix the new JOB_STARTED event only sending each event once, to the first handler listed
## Misc Improvements
- `blueprint`: new ``--smooth`` option for recording all smoothed floors and walls instead of just the ones that require smoothing for later carving

@ -444,13 +444,13 @@ static void manageJobStartedEvent(color_ostream& out) {
// iterate event handler callbacks
multimap<Plugin*, EventHandler> copy(handlers[EventType::JOB_STARTED].begin(), handlers[EventType::JOB_STARTED].end());
for (auto &key_value : copy) {
auto &handler = key_value.second;
for (df::job_list_link* link = df::global::world->jobs.list.next; link != nullptr; link = link->next) {
df::job* job = link->item;
// the jobs must have a worker to start
if (job && Job::getWorker(job) && !startedJobs.count(job->id)) {
startedJobs.emplace(job->id);
for (df::job_list_link* link = df::global::world->jobs.list.next; link != nullptr; link = link->next) {
df::job* job = link->item;
if (job && Job::getWorker(job) && !startedJobs.count(job->id)) {
startedJobs.emplace(job->id);
for (auto &key_value : copy) {
auto &handler = key_value.second;
// the jobs must have a worker to start
handler.eventHandler(out, job);
}
}