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/cvar.cc | 5 ++--- src/core/entity.cc | 46 +++++++++++++++++++++++----------------------- src/core/func.cc | 7 +++---- src/core/info.cc | 8 ++++---- src/core/zone.cc | 16 ++++++++++++---- 5 files changed, 44 insertions(+), 38 deletions(-) (limited to 'src/core') diff --git a/src/core/cvar.cc b/src/core/cvar.cc index f043028..a47b72e 100644 --- a/src/core/cvar.cc +++ b/src/core/cvar.cc @@ -167,8 +167,6 @@ Cvar *Cvar::find(const char* name) void Cvar::list() { - con_print << "Flags: A=Archive G=Game R=ReadOnly" << std::endl; - Registry::iterator it; for (it = cvar_registry.begin(); it != cvar_registry.end(); it++) { std::string typeindicator; @@ -190,7 +188,8 @@ void Cvar::list() con_print << " " << typeindicator << " " << (*it).first << " " << (*it).second->str() << " ^N" << (*it).second->info() << std::endl; } - con_print << cvar_registry.size() << " registered variables" << std::endl; + con_print << " Flags: A=Archive G=Game R=ReadOnly" << std::endl; + con_print << "^B " << cvar_registry.size() << " registered variables" << std::endl; } } 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() diff --git a/src/core/func.cc b/src/core/func.cc index 4072f39..aa49f17 100644 --- a/src/core/func.cc +++ b/src/core/func.cc @@ -108,8 +108,7 @@ Func *Func::find(const std::string &name) void Func::list() { Registry::iterator it; - con_print << "Flags: G=Game S=Shared" << std::endl; - + for (it = func_registry.begin(); it != func_registry.end(); it++) { std::string typeindicator; if (((*it).second->flags() & Game) == Game) @@ -122,8 +121,8 @@ void Func::list() typeindicator += ' '; con_print << " " << typeindicator << " " << (*it).second->name() << " " << (*it).second->info() << std::endl; } - - con_print << func_registry.size() << " registered functions" << std::endl; + con_print << "Flags: G=Game S=Shared" << std::endl; + con_print << "^B " << func_registry.size() << " registered functions" << std::endl; } /* ---- Func ------------------------------------------------------ */ diff --git a/src/core/info.cc b/src/core/info.cc index 1a4f68f..c331d91 100644 --- a/src/core/info.cc +++ b/src/core/info.cc @@ -365,8 +365,8 @@ void Info::list(const Info *info) { con_print << " " << "^B" << std::setw(4) << info->id() << " " - << "^B" << (info->type() ? aux::pad_right(info->type()->label(), 8) : "NULL ") << " " - << "^B" << aux::pad_right(info->label(), 12) << " " + << "^N" << (info->type() ? aux::pad_right(info->type()->label(), 8) : "NULL ") << " " + << "^N" << aux::pad_right(info->label(), 12) << " " << "^N" << info->name() << std::endl; } @@ -377,7 +377,7 @@ void Info::list() Info *info = (*it); list(info); } - con_print << info_registry.size() << " info " << aux::plural("record", info_registry.size()) << std::endl; + con_print << "^B " << info_registry.size() << " info " << aux::plural("record", info_registry.size()) << std::endl; } void Info::list(const InfoType *type) @@ -391,7 +391,7 @@ void Info::list(const InfoType *type) list(info); } } - con_print << count << " " << type->label() << " info " << aux::plural("record", count) << std::endl; + con_print << "^B " << count << " " << type->label() << " info " << aux::plural("record", count) << std::endl; } } diff --git a/src/core/zone.cc b/src/core/zone.cc index ab38b1b..7fc3f4d 100644 --- a/src/core/zone.cc +++ b/src/core/zone.cc @@ -91,11 +91,19 @@ Zone *Zone::search(std::string const & searchname) void Zone::list() { + con_print << " " + << " id " + << "label " + << "name" << std::endl; + for (Registry::iterator it = zone_registry.begin(); it != zone_registry.end(); it++) { Zone *zone = (*it).second; - con_print << " id " << std::setw(4) << zone->id() << " " << zone->label() << std::endl; + con_print << " " + << "^B" << std::setw(4) << zone->id() << " " + << "^N" << aux::pad_right(zone->label(), 24) << " " + << "^N" << zone->name() << std::endl; } - con_print << zone_registry.size() << " registered zones" << std::endl; + con_print << "^B " << zone_registry.size() << " zones" << std::endl; } void Zone ::clear() @@ -135,13 +143,13 @@ Zone::~Zone() void Zone::print() { - con_print << "id ^B" << id() << " ^Nlabel ^B" << label() << " ^Nname ^B" << name() << std::endl; + con_print << " zone id ^B" << id() << " ^Nlabel ^B" << label() << " ^Nname ^B" << name() << std::endl; Entity::list_header(); for (Content::iterator it = zone_content.begin(); it != zone_content.end(); it++) { Entity *entity = (*it); Entity::list(entity); } - con_print << zone_content.size() << " registered zone entities" << std::endl; + con_print << " ^B" << zone_content.size() << " zone entities" << std::endl; } void Zone::add(Entity *entity) -- cgit v1.2.3