diff options
| author | Robert Heinrich | 2012-04-11 18:22:39 +0200 |
|---|---|---|
| committer | Robert Heinrich | 2012-04-11 18:22:39 +0200 |
| commit | 2cf078419b22be998c1d06ae0bca94774c04c527 (patch) | |
| tree | afcb71a3fb7f13c4f58aa66b062f9faf6b877d38 /plugins/probe.cpp | |
| parent | e8e8f293289e755fa40f64301f0e747dfaa40c79 (diff) | |
| download | dfhack-2cf078419b22be998c1d06ae0bca94774c04c527.tar.gz dfhack-2cf078419b22be998c1d06ae0bca94774c04c527.tar.bz2 dfhack-2cf078419b22be998c1d06ae0bca94774c04c527.tar.xz | |
cprobe: list items worn by unit and checks if they are owned or not
Diffstat (limited to 'plugins/probe.cpp')
| -rw-r--r-- | plugins/probe.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/plugins/probe.cpp b/plugins/probe.cpp index c2a82840..d5f03b81 100644 --- a/plugins/probe.cpp +++ b/plugins/probe.cpp @@ -15,6 +15,7 @@ using namespace std; #include "Export.h" #include "PluginManager.h" #include "modules/Units.h" +#include "df/unit_inventory_item.h" #include "modules/Maps.h" #include "modules/Gui.h" #include "modules/Materials.h" @@ -75,7 +76,26 @@ command_result df_cprobe (color_ostream &out, vector <string> & parameters) if(unit->pos.x == cursorX && unit->pos.y == cursorY && unit->pos.z == cursorZ) { out.print("Creature %d, race %d (%x), civ %d (%x)\n", unit->id, unit->race, unit->race, unit->civ_id, unit->civ_id); - break; + + for(size_t j=0; j<unit->inventory.size(); j++) + { + df::unit_inventory_item* inv_item = unit->inventory[j]; + df::item* item = inv_item->item; + if(inv_item->mode == df::unit_inventory_item::T_mode::Worn) + { + out << " wears item: #" << item->id; + if(item->flags.bits.owned) + out << " (owned)"; + else + out << " (not owned)"; + if(item->getEffectiveArmorLevel() != 0) + out << ", armor"; + out << endl; + } + } + + // don't leave loop, there may be more than 1 creature at the cursor position + //break; } } } |
