From fc4809e41bc5694231046eb2fd4c324c4daba13f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 18 Sep 2010 13:25:37 +0000 Subject: cosmetic updates in engine list functions, trade menu updates --- src/core/entity.cc | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/core/entity.cc') diff --git a/src/core/entity.cc b/src/core/entity.cc index 538aecb..0b3a402 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -81,6 +81,26 @@ void Entity::clear() entity_nextid = 0; } +void Entity::list_inventory() const +{ + con_print << " entity id ^B" << id() << " ^Nlabel ^B" << label() << " ^Nname ^B" << name() << std::endl; + if (!entity_inventory) { + con_print << "no inventory availble" << std::endl; + return; + } + + con_print << " ^Nid type label amount" << std::endl; + for (Inventory::Items::const_iterator it = entity_inventory->items().begin(); it != entity_inventory->items().end(); it++) { + Item *item = (*it); + con_print << " " + << " ^B" << std::setw(4) << item->info()->id() + << " ^N" << aux::pad_right((item->info()->type() ? item->info()->type()->label() : "NULL"), 8) + << " ^N" << aux::pad_right(item->info()->label(), 24) + << std::setw(5) << item->amount() << std::endl; + } + con_print << "^B " << entity_inventory->items().size() << " inventory items" << std::endl; +} + void Entity::list_header() { con_print << " " @@ -94,8 +114,8 @@ void Entity::list(const Entity *entity) { con_print << " " << "^B" << std::setw(4) << entity->id() << " " - << "^B" << std::setfill('0') << std::setw(4) << entity->type() << ":" << std::setw(4) << entity->moduletype() << std::setfill(' ') << " " - << "^B" << aux::pad_right(entity->label(), 24) << " " + << "^N" << std::setfill('0') << std::setw(4) << entity->type() << ":" << std::setw(4) << entity->moduletype() << std::setfill(' ') << " " + << "^N" << aux::pad_right(entity->label(), 24) << " " << "^N" << entity->name() << std::endl; } @@ -107,7 +127,7 @@ void Entity::list() Entity *entity = (*it).second; list(entity); } - con_print << entity_registry.size() << " entities" << std::endl; + con_print << "^B " << entity_registry.size() << " entities" << std::endl; } /* ---- class Entity ----------------------------------------------- */ @@ -401,26 +421,6 @@ void Entity::remove_menu(std::string const &label) } } -void Entity::list_inventory() const -{ - con_print << " ^B" << name() << "^N "; - if (!entity_inventory) { - con_print << "no inventory availble" << std::endl; - return; - } - con_print << "inventory" << std::endl; - - for (Inventory::Items::const_iterator it = entity_inventory->items().begin(); it != entity_inventory->items().end(); it++) { - Item *item = (*it); - con_print << " " - << " ^B" << std::setw(4) << item->info()->id() - << " ^N" << (item->info()->type() ? item->info()->type()->label() : "NULL") - << " ^N" << item->info()->label() - << " amount " << item->amount() << std::endl; - } - -} - /* ---- class EntityDynamic ---------------------------------------- */ EntityDynamic::EntityDynamic() : Entity() -- cgit v1.2.3