From 4c45315c9f76bc32e1015a2a2bd9b3ae635023a7 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 18 Nov 2012 16:34:29 +0000 Subject: ADded support for enitty information printing, print current armor values for ships, print death messages --- src/core/entity.cc | 70 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 20 deletions(-) (limited to 'src/core/entity.cc') diff --git a/src/core/entity.cc b/src/core/entity.cc index 7ed1328..70d3a4f 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -86,26 +86,6 @@ 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 << " ^Nitem info infotype 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->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 << " " @@ -261,6 +241,56 @@ Entity::~Entity() } } +void Entity::print() const +{ + // print header + print_header(); + + // print entity flags + con_print << " flags ^B"; + + if (has_flag(NonSolid)) { + con_print << " nonsolid"; + } + if (has_flag(Bright)) { + con_print << " bright"; + } + if (has_flag(Dockable)) { + con_print << " dockable"; + } + if (has_flag(ShowOnMap)) { + con_print << " shwonmap"; + } + if (has_flag(KeepAlive)) { + con_print << " keepalive"; + } +} + +void Entity::print_header() const +{ + con_print << " entity id ^B" << id() << " ^Nlabel ^B" << label() << " ^Nname ^B" << name() << std::endl; +} + +void Entity::print_inventory() const +{ + if (!entity_inventory) { + con_print << "no inventory availble" << std::endl; + return; + } + + con_print << " ^Nitem info infotype amount" << std::endl; + for (Inventory::Items::const_iterator it = entity_inventory->items().begin(); it != entity_inventory->items().end(); it++) { + Item *item = (*it); + // TODO item flags + con_print << " " + << " ^B" << std::setw(4) << item->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::die() { entity_destroyed = true; -- cgit v1.2.3