diff --git a/plugins/channel-safely/channel-safely-plugin.cpp b/plugins/channel-safely/channel-safely-plugin.cpp index bfb99b463..1224413f1 100644 --- a/plugins/channel-safely/channel-safely-plugin.cpp +++ b/plugins/channel-safely/channel-safely-plugin.cpp @@ -199,13 +199,15 @@ namespace CSP { INFO(jobs).print("JobStartedEvent()\n"); auto job = (df::job*) j; // validate job type - if (is_channel_job(job)) { - DEBUG(jobs).print(" valid channel job:\n"); + if (ChannelManager::Get().exists(job->pos)) { + WARN(jobs).print(" valid channel job:\n"); df::unit* worker = Job::getWorker(job); // there is a valid worker (living citizen) on the job? right.. if (worker && Units::isAlive(worker) && Units::isCitizen(worker)) { DEBUG(jobs).print(" valid worker:\n"); // track workers on jobs + df::coord &pos = job->pos; + WARN(jobs).print(" -> Starting job at (" COORD ")\n", COORDARGS(pos)); if (config.monitor_active || config.resurrect) { job_ids.emplace(job, job->id); active_jobs.emplace(job->id, job); @@ -225,7 +227,7 @@ namespace CSP { INFO(jobs).print("JobCompletedEvent()\n"); auto job = (df::job*) j; // we only care if the job is a channeling one - if (ChannelManager::Get().groups.count(job->pos)) { + if (ChannelManager::Get().exists(job->pos)) { // check job outcome auto block = Maps::getTileBlock(job->pos); df::coord local(job->pos); @@ -246,7 +248,7 @@ namespace CSP { // the tile is unchanged df::unit* worker = active_workers[job->id]; endangered_workers.emplace(active_workers[job->id]); - ERR(jobs).print(" -> (" COORD ") stopped working but (" COORD ") doesn't appear done.\n",COORDARGS(worker->pos), COORDARGS(job->pos)); + ERR(jobs).print("() -> job at (" COORD ") is done, but (" COORD ") doesn't appear done.\n",COORDARGS(worker->pos), COORDARGS(job->pos)); if (config.insta_dig) { dignow_queue.emplace(job->pos); } diff --git a/plugins/channel-safely/include/channel-manager.h b/plugins/channel-safely/include/channel-manager.h index 79c1e3770..d36e98ca3 100644 --- a/plugins/channel-safely/include/channel-manager.h +++ b/plugins/channel-safely/include/channel-manager.h @@ -30,6 +30,7 @@ public: void manage_group(const Group &group, bool set_marker_mode = false, bool marker_mode = false); bool manage_one(const Group &group, const df::coord &map_pos, bool set_marker_mode = false, bool marker_mode = false); void mark_done(const df::coord &map_pos); + bool exists(const df::coord &map_pos) const { return groups.count(map_pos); } void debug() { DEBUG(groups).print(" DEBUGGING GROUPS:\n"); if (config.debug) {