From 6b3d85eb0feb556a3dd73144d1e61009e2753e56 Mon Sep 17 00:00:00 2001 From: Quietust Date: Thu, 4 Oct 2012 20:17:33 -0500 Subject: [PATCH] Don't make teledwarf skip everything after it if there's a problem --- plugins/fastdwarf.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/fastdwarf.cpp b/plugins/fastdwarf.cpp index f1ecb0baa..4964b542a 100644 --- a/plugins/fastdwarf.cpp +++ b/plugins/fastdwarf.cpp @@ -52,12 +52,12 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) if (enable_fastdwarf) { - if (unit->counters.job_counter > 0) unit->counters.job_counter = 0; // could also patch the unit->job.current_job->completion_timer } - if (enable_teledwarf) + + if (enable_teledwarf) do { // don't do anything if the dwarf isn't going anywhere if (unit->path.dest.x == -30000) @@ -73,7 +73,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) old_block = Maps::getTileBlock(unit->pos.x, unit->pos.y, unit->pos.z); new_block = Maps::getTileBlock(unit->path.dest.x, unit->path.dest.y, unit->path.dest.z); - // just to be safe, prevent the dwarf from being moved to an unallocated map block! + // make sure source and dest map blocks are valid if (!old_block || !new_block) continue; @@ -98,7 +98,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) unit->pos.x = unit->path.dest.x; unit->pos.y = unit->path.dest.y; unit->pos.z = unit->path.dest.z; - } + } while (0); } return CR_OK; }