|
|
@ -209,33 +209,30 @@ namespace CSP {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void JobCompletedEvent(color_ostream &out, void* job_ptr) {
|
|
|
|
void JobCompletedEvent(color_ostream &out, void* job_ptr) {
|
|
|
|
if (config.monitor_active) {
|
|
|
|
if (enabled && World::isFortressMode() && Maps::IsValid()) {
|
|
|
|
INFO(monitor).print("JobCompletedEvent()\n");
|
|
|
|
INFO(monitor).print("JobCompletedEvent()\n");
|
|
|
|
if (enabled && World::isFortressMode() && Maps::IsValid()) {
|
|
|
|
auto job = (df::job*) job_ptr;
|
|
|
|
auto job = (df::job*) job_ptr;
|
|
|
|
// we only care if the job is a channeling one
|
|
|
|
// we only care if the job is a channeling one
|
|
|
|
if (is_dig_job(job)) {
|
|
|
|
if (is_dig_job(job)) {
|
|
|
|
// untrack job/worker
|
|
|
|
// untrack job/worker
|
|
|
|
active_workers.erase(job->id);
|
|
|
|
active_workers.erase(job->id);
|
|
|
|
// check job outcome
|
|
|
|
// check job outcome
|
|
|
|
df::coord local(job->pos);
|
|
|
|
df::coord local(job->pos);
|
|
|
|
auto block = Maps::getTileBlock(local);
|
|
|
|
auto block = Maps::getTileBlock(local);
|
|
|
|
local.x = local.x % 16;
|
|
|
|
local.x = local.x % 16;
|
|
|
|
local.y = local.y % 16;
|
|
|
|
local.y = local.y % 16;
|
|
|
|
// verify completion
|
|
|
|
// verify completion
|
|
|
|
if (isOpenTerrain(block->tiletype[local.x][local.y])
|
|
|
|
if (isOpenTerrain(block->tiletype[local.x][local.y])
|
|
|
|
|| block->designation[local.x][local.y].bits.dig != df::enums::tile_dig_designation::Channel) {
|
|
|
|
|| block->designation[local.x][local.y].bits.dig != df::enums::tile_dig_designation::Channel) {
|
|
|
|
// the job can be considered done
|
|
|
|
// the job can be considered done
|
|
|
|
df::coord below(job->pos);
|
|
|
|
df::coord below(job->pos);
|
|
|
|
below.z--;
|
|
|
|
below.z--;
|
|
|
|
WARN(monitor).print(" -> Marking tile done and managing the group below.\n");
|
|
|
|
WARN(monitor).print(" -> Marking tile done and managing the group below.\n");
|
|
|
|
// mark done and manage below
|
|
|
|
// mark done and manage below
|
|
|
|
Maps::getTileDesignation(job->pos)->bits.traffic = df::tile_traffic::Normal;
|
|
|
|
Maps::getTileDesignation(job->pos)->bits.traffic = df::tile_traffic::Normal;
|
|
|
|
ChannelManager::Get().mark_done(job->pos);
|
|
|
|
ChannelManager::Get().mark_done(job->pos);
|
|
|
|
ChannelManager::Get().manage_group(below);
|
|
|
|
ChannelManager::Get().manage_group(below);
|
|
|
|
ChannelManager::Get().debug();
|
|
|
|
ChannelManager::Get().debug();
|
|
|
|
|
|
|
|
Job::removeJob(job);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
INFO(monitor).print("JobCompletedEvent() exits\n");
|
|
|
|
INFO(monitor).print("JobCompletedEvent() exits\n");
|
|
|
|