diff options
| author | Petr Mrázek | 2011-11-02 00:26:45 +0100 |
|---|---|---|
| committer | Petr Mrázek | 2011-11-02 00:26:45 +0100 |
| commit | dcce48c243d43df26a42ee45a83fbdecc2795727 (patch) | |
| tree | 43a975d29a54a9a30000e40810513890253d78cd /plugins/probe.cpp | |
| parent | 6bbc27dbce08383a3450f5a5e85f446afa1eb3fe (diff) | |
| download | dfhack-dcce48c243d43df26a42ee45a83fbdecc2795727.tar.gz dfhack-dcce48c243d43df26a42ee45a83fbdecc2795727.tar.bz2 dfhack-dcce48c243d43df26a42ee45a83fbdecc2795727.tar.xz | |
Add simple creature probe, fix current civ address on windows, update df2mc.
Diffstat (limited to 'plugins/probe.cpp')
| -rw-r--r-- | plugins/probe.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/plugins/probe.cpp b/plugins/probe.cpp index 2e1997ca..6006e77e 100644 --- a/plugins/probe.cpp +++ b/plugins/probe.cpp @@ -15,6 +15,7 @@ using namespace std; #include <dfhack/PluginManager.h> #include <vector> #include <string> +#include <dfhack/modules/Creatures.h> #include <dfhack/modules/Maps.h> #include <dfhack/modules/Gui.h> #include <dfhack/modules/Materials.h> @@ -27,6 +28,7 @@ using std::string; using namespace DFHack; DFhackCExport command_result df_probe (Core * c, vector <string> & parameters); +DFhackCExport command_result df_cprobe (Core * c, vector <string> & parameters); DFhackCExport const char * plugin_name ( void ) { @@ -39,6 +41,9 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> commands.push_back(PluginCommand("probe", "A tile probe", df_probe)); + commands.push_back(PluginCommand("cprobe", + "A creature probe", + df_cprobe)); return CR_OK; } @@ -47,6 +52,37 @@ DFhackCExport command_result plugin_shutdown ( Core * c ) return CR_OK; } +DFhackCExport command_result df_cprobe (Core * c, vector <string> & parameters) +{ + Console & con = c->con; + BEGIN_PROBE: + c->Suspend(); + DFHack::Gui *Gui = c->getGui(); + DFHack::Creatures * cr = c->getCreatures(); + int32_t cursorX, cursorY, cursorZ; + Gui->getCursorCoords(cursorX,cursorY,cursorZ); + if(cursorX == -30000) + { + con.printerr("No cursor; place cursor over creature to probe.\n"); + } + else + { + uint32_t ncr; + cr->Start(ncr); + for(auto i = 0; i < ncr; i++) + { + df_creature * unit = cr->GetCreature( i ); + if(unit->x == cursorX && unit->y == cursorY && unit->z == cursorZ) + { + con.print("Creature %d, race %d (%x), civ %d (%x)\n", unit->id, unit->race, unit->race, unit->civ, unit->civ); + break; + } + } + } + c->Resume(); + return CR_OK; +} + DFhackCExport command_result df_probe (Core * c, vector <string> & parameters) { //bool showBlock, showDesig, showOccup, showTile, showMisc; |
