Add zoom to kittens, fix tilesieve.

develop
Petr Mrázek 2012-02-17 05:30:34 +01:00
parent 28059a7f35
commit fa6ec63535
3 changed files with 29 additions and 6 deletions

@ -1 +1 @@
Subproject commit ce65a57dc89a9d6f422cfa92d774e5d84f3df884
Subproject commit a43213729651f05fb1dab3474947c0a5e62379b7

@ -32,6 +32,7 @@ command_result ktimer (Core * c, vector <string> & parameters);
command_result trackmenu (Core * c, vector <string> & parameters);
command_result trackpos (Core * c, vector <string> & parameters);
command_result colormods (Core * c, vector <string> & parameters);
command_result zoom (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -46,6 +47,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
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 <string> & parameters)
return CR_OK;
}
command_result zoom (Core * c, vector <string> & 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 <string> & parameters)
{
if(timering)

@ -8,10 +8,14 @@
#include <set>
// 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<std::string> & 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;