Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa6ec63

Browse files
committed
Add zoom to kittens, fix tilesieve.
1 parent 28059a7 commit fa6ec63

3 files changed

Lines changed: 29 additions & 6 deletions

File tree

library/xml

Submodule xml updated from ce65a57 to a432137

plugins/devel/kittens.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ command_result ktimer (Core * c, vector <string> & parameters);
3232
command_result trackmenu (Core * c, vector <string> & parameters);
3333
command_result trackpos (Core * c, vector <string> & parameters);
3434
command_result colormods (Core * c, vector <string> & parameters);
35+
command_result zoom (Core * c, vector <string> & parameters);
3536

3637
DFhackCExport const char * plugin_name ( void )
3738
{
@@ -46,6 +47,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
4647
commands.push_back(PluginCommand("trackmenu","Track menu ID changes (toggle).",trackmenu));
4748
commands.push_back(PluginCommand("trackpos","Track mouse and designation coords (toggle).",trackpos));
4849
commands.push_back(PluginCommand("colormods","Dump colormod vectors.",colormods));
50+
commands.push_back(PluginCommand("zoom","Zoom to x y z.",zoom));
4951
return CR_OK;
5052
}
5153

@@ -152,6 +154,23 @@ command_result colormods (Core * c, vector <string> & parameters)
152154
return CR_OK;
153155
}
154156

157+
command_result zoom (Core * c, vector <string> & parameters)
158+
{
159+
if(parameters.size() < 3)
160+
return CR_FAILURE;
161+
int x = atoi( parameters[0].c_str());
162+
int y = atoi( parameters[1].c_str());
163+
int z = atoi( parameters[2].c_str());
164+
int xi, yi, zi;
165+
CoreSuspender cs (c);
166+
Gui * g = c->getGui();
167+
if(g->getCursorCoords(xi, yi, zi))
168+
{
169+
g->setCursorCoords(x,y,z);
170+
}
171+
g->setViewCoords(x,y,z);
172+
}
173+
155174
command_result ktimer (Core * c, vector <string> & parameters)
156175
{
157176
if(timering)

plugins/devel/tilesieve.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
#include <set>
99
// DF data structure definition headers
1010
#include "DataDefs.h"
11-
//#include "df/world.h"
11+
#include "modules/Maps.h"
12+
#include "df/world.h"
13+
#include "TileTypes.h"
1214

1315
using namespace DFHack;
16+
using namespace DFHack::Simple;
1417
using namespace df::enums;
18+
using df::global::world;
1519

1620
// Here go all the command declarations...
1721
// 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)
6468
{
6569
df::map_block *block = *iter;
6670
df::tiletype tt;
67-
const char * name = tileName(tt);
6871
// for each tile in block
6972
for (uint32_t x = 0; x < 16; x++) for (uint32_t y = 0; y < 16; y++)
7073
{
71-
tt = block.tiletypes[x][y];
72-
if(tileShape(tt) != df::tiletype_shape::None )
74+
tt = block->tiletype[x][y];
75+
const char * name = tileName(tt);
76+
if(tileShape(tt) != tiletype_shape::NONE )
7377
continue;
7478
if(name && strlen(name) != 0)
7579
continue;
7680
if(seen.count(tt))
7781
continue;
7882
seen.insert(tt);
79-
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);
83+
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);
8084
}
8185
}
8286
return CR_OK;

0 commit comments

Comments
 (0)