cprobe: list items worn by unit and checks if they are owned or not

develop
Robert Heinrich 2012-04-11 18:22:39 +02:00
parent e8e8f29328
commit 2cf078419b
1 changed files with 21 additions and 1 deletions

@ -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;
}
}
}