From 2cf078419b22be998c1d06ae0bca94774c04c527 Mon Sep 17 00:00:00 2001 From: Robert Heinrich Date: Wed, 11 Apr 2012 18:22:39 +0200 Subject: [PATCH] cprobe: list items worn by unit and checks if they are owned or not --- plugins/probe.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/plugins/probe.cpp b/plugins/probe.cpp index c2a82840f..d5f03b81f 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 & 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; jinventory.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; } } }