diff --git a/docs/changelog.txt b/docs/changelog.txt index 7f15d5279..793e91858 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -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 diff --git a/library/modules/EventManager.cpp b/library/modules/EventManager.cpp index d8f8543a0..eb41bbeaf 100644 --- a/library/modules/EventManager.cpp +++ b/library/modules/EventManager.cpp @@ -444,12 +444,14 @@ static void manageJobStartedEvent(color_ostream& out) { // iterate event handler callbacks multimap 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; + for (df::job_list_link* link = df::global::world->jobs.list.next; link != nullptr; link = link->next) { + df::job* job = link->item; + bool send = false; + for (auto &key_value : copy) { + auto &handler = key_value.second; // the jobs must have a worker to start - if (job && Job::getWorker(job) && !startedJobs.count(job->id)) { + if (send || (job && Job::getWorker(job) && !startedJobs.count(job->id))) { + send = true; startedJobs.emplace(job->id); handler.eventHandler(out, job); }