Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2014-12-16 23:13:17 +0000
committerStijn Buys <ingar@osirion.org>2014-12-16 23:13:17 +0000
commita5aef07b4a2b85933f3a2f358a4d1b6fe27948b7 (patch)
tree812d8c075d652d3a1e807f8b4051912acee9d7ec /src/core
parentab1f3d1fe9f376c1e6dac83e02e9b63211d1499b (diff)
Improved list_entity engine function.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/entity.cc41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 610db6b..f4a29dd 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -265,7 +265,12 @@ void Entity::print() const
// print header
print_header();
- // type
+ // faction
+ if (faction()) {
+ con_print << " ^Nfaction ^B" << faction()->label() << std::endl;
+ }
+
+ // entity type id
con_print << " ^Ntype ^B";
switch (type()) {
case Default:
@@ -288,6 +293,8 @@ void Entity::print() const
con_print << "^Bprojectile";
}
con_print << std::endl;
+
+ // game module type id
con_print << " ^Nmodule type ^B" << moduletype() << std::endl;
// print entity flags
@@ -308,9 +315,13 @@ void Entity::print() const
con_print << " ^Bkeepalive";
}
con_print << std::endl;
- if (inventory()) {
- con_print << " ^Ninventory capacity ^B" << inventory()->capacity_used() << "/" << inventory()->capacity() << " ^Nitems^B " << inventory()->items().size() << std::endl;
- }
+
+ // info record
+ if (info()) {
+ con_print << " ^Ninfo id ^B" << info()->id() << std::endl;
+ }
+
+ // slots
if (slots() && slots()->size()) {
int nbcannons = 0;
int nbturrets = 0;
@@ -334,18 +345,20 @@ void Entity::print() const
con_print << " ^Nslots ";
if (nbcannons > 0) {
- con_print << " ^Ncannons^B " << nbcannons;
+ con_print << " ^B" << nbcannons << " ^Ncannons";
}
if (nbturrets > 0) {
- con_print << " ^Nturrets^B " << nbturrets;
+ con_print << " ^B" << nbturrets << " ^Nturrets";
}
if (nbdocks > 0) {
- con_print << " ^Ndocks^B " << nbdocks;
+ con_print << " ^B" << nbdocks << " ^Ndocks";
}
con_print << std::endl;
- }
- if (faction()) {
- con_print << " ^Nfaction ^B" << faction()->label() << std::endl;
+ }
+
+ // invenotry
+ if (inventory()) {
+ print_inventory();
}
}
@@ -364,8 +377,8 @@ void Entity::print_inventory() const
con_print << "no inventory availble" << std::endl;
return;
}
-
- con_print << " ^Nitem infotype info amount flags" << std::endl;
+ con_print << " ^Ninventory capacity ^B" << inventory()->capacity_used() << "/" << inventory()->capacity() << " ^Nused by^B " << inventory()->items().size() << " ^Nitems" << std::endl;
+ con_print << " ^Nitem infotype info amount price flags" << std::endl;
for (Inventory::Items::const_iterator it = entity_inventory->items().begin(); it != entity_inventory->items().end(); it++) {
Item *item = (*it);
// TODO item flags
@@ -373,7 +386,8 @@ void Entity::print_inventory() const
<< " ^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::setw(5) << item->amount() << " "
+ << std::setw(9) << item->price();
if (item->has_flag(core::Item::Tradeable)) {
con_print << " tradeable";
}
@@ -388,7 +402,6 @@ void Entity::print_inventory() const
}
con_print<< std::endl;
}
- con_print << "^B " << entity_inventory->items().size() << " inventory items" << std::endl;
}
void Entity::die()