From fa6ec63535aa6f2b8ba6863b8a048282bcc6db37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 17 Feb 2012 05:30:34 +0100 Subject: [PATCH] Add zoom to kittens, fix tilesieve. --- library/xml | 2 +- plugins/devel/kittens.cpp | 19 +++++++++++++++++++ plugins/devel/tilesieve.cpp | 14 +++++++++----- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/library/xml b/library/xml index ce65a57dc..a43213729 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit ce65a57dc89a9d6f422cfa92d774e5d84f3df884 +Subproject commit a43213729651f05fb1dab3474947c0a5e62379b7 diff --git a/plugins/devel/kittens.cpp b/plugins/devel/kittens.cpp index ae19c9fee..19b392136 100644 --- a/plugins/devel/kittens.cpp +++ b/plugins/devel/kittens.cpp @@ -32,6 +32,7 @@ command_result ktimer (Core * c, vector & parameters); command_result trackmenu (Core * c, vector & parameters); command_result trackpos (Core * c, vector & parameters); command_result colormods (Core * c, vector & parameters); +command_result zoom (Core * c, vector & parameters); DFhackCExport const char * plugin_name ( void ) { @@ -46,6 +47,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector commands.push_back(PluginCommand("trackmenu","Track menu ID changes (toggle).",trackmenu)); commands.push_back(PluginCommand("trackpos","Track mouse and designation coords (toggle).",trackpos)); commands.push_back(PluginCommand("colormods","Dump colormod vectors.",colormods)); + commands.push_back(PluginCommand("zoom","Zoom to x y z.",zoom)); return CR_OK; } @@ -152,6 +154,23 @@ command_result colormods (Core * c, vector & parameters) return CR_OK; } +command_result zoom (Core * c, vector & parameters) +{ + if(parameters.size() < 3) + return CR_FAILURE; + int x = atoi( parameters[0].c_str()); + int y = atoi( parameters[1].c_str()); + int z = atoi( parameters[2].c_str()); + int xi, yi, zi; + CoreSuspender cs (c); + Gui * g = c->getGui(); + if(g->getCursorCoords(xi, yi, zi)) + { + g->setCursorCoords(x,y,z); + } + g->setViewCoords(x,y,z); +} + command_result ktimer (Core * c, vector & parameters) { if(timering) diff --git a/plugins/devel/tilesieve.cpp b/plugins/devel/tilesieve.cpp index 7f29c9619..a7ad4168a 100644 --- a/plugins/devel/tilesieve.cpp +++ b/plugins/devel/tilesieve.cpp @@ -8,10 +8,14 @@ #include // DF data structure definition headers #include "DataDefs.h" -//#include "df/world.h" +#include "modules/Maps.h" +#include "df/world.h" +#include "TileTypes.h" using namespace DFHack; +using namespace DFHack::Simple; using namespace df::enums; +using df::global::world; // Here go all the command declarations... // mostly to allow having the mandatory stuff on top of the file and commands on the bottom @@ -64,19 +68,19 @@ command_result tilesieve(DFHack::Core * c, std::vector & params) { df::map_block *block = *iter; df::tiletype tt; - const char * name = tileName(tt); // for each tile in block for (uint32_t x = 0; x < 16; x++) for (uint32_t y = 0; y < 16; y++) { - tt = block.tiletypes[x][y]; - if(tileShape(tt) != df::tiletype_shape::None ) + tt = block->tiletype[x][y]; + const char * name = tileName(tt); + if(tileShape(tt) != tiletype_shape::NONE ) continue; if(name && strlen(name) != 0) continue; if(seen.count(tt)) continue; seen.insert(tt); - c->con.print("Found tile %d @ %d %d %d\n", tt, seen.map_pos.x + x, seen.map_pos.y + y, seen.map_pos.z); + c->con.print("Found tile %d @ %d %d %d\n", tt, block->map_pos.x + x, block->map_pos.y + y, block->map_pos.z); } } return CR_OK;