Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-11-18 16:34:29 +0000
committerStijn Buys <ingar@osirion.org>2012-11-18 16:34:29 +0000
commit4c45315c9f76bc32e1015a2a2bd9b3ae635023a7 (patch)
tree3fbfe947a46aabea04d724e29307d40f9292f7f1 /src/core/entity.cc
parentab61530779c73e7e145193efcb1e23a47c16e7f3 (diff)
ADded support for enitty information printing, print current armor values for ships, print death messages
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r--src/core/entity.cc70
1 files changed, 50 insertions, 20 deletions
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;