diff options
| author | expwnent | 2012-09-28 19:07:29 -0400 |
|---|---|---|
| committer | expwnent | 2012-09-28 19:07:29 -0400 |
| commit | 4b99d096da95ebc44d1cd8b8788b4166b45bfeda (patch) | |
| tree | 186a9c777458a46fc1e57a81eca0ad70a2b32052 /plugins | |
| parent | ce7e21f869ca56b22f0aaedc802042f70702c729 (diff) | |
| parent | 1bde32fa5b72a070a81c142b4044f8fd355e2145 (diff) | |
| download | dfhack-4b99d096da95ebc44d1cd8b8788b4166b45bfeda.tar.gz dfhack-4b99d096da95ebc44d1cd8b8788b4166b45bfeda.tar.bz2 dfhack-4b99d096da95ebc44d1cd8b8788b4166b45bfeda.tar.xz | |
Merge branch 'teledwarf' into experimental
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/fastdwarf.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/fastdwarf.cpp b/plugins/fastdwarf.cpp index 400bff23..4c235394 100644 --- a/plugins/fastdwarf.cpp +++ b/plugins/fastdwarf.cpp @@ -2,6 +2,7 @@ #include "Console.h" #include "Export.h" #include "PluginManager.h" +#include "modules/MapCache.h" #include "DataDefs.h" #include "df/ui.h" @@ -48,6 +49,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) } } if ( enable_teledwarf ) { + MapExtras::MapCache *MCache = new MapExtras::MapCache(); for (size_t i = 0; i < world->units.all.size(); i++) { df::unit *unit = world->units.all[i]; @@ -59,11 +61,19 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) if (unit->relations.following != 0) continue; + MapExtras::Block* block = MCache->BlockAtTile(unit->pos); + df::coord2d pos(unit->pos.x % 16, unit->pos.y % 16); + df::tile_occupancy occ = block->OccupancyAt(pos); + occ.bits.unit = 0; + block->setOccupancyAt(pos, occ); + //move immediately to destination unit->pos.x = unit->path.dest.x; unit->pos.y = unit->path.dest.y; unit->pos.z = unit->path.dest.z; } + MCache->WriteAll(); + delete MCache; } return CR_OK; } |
