Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2014-12-07 18:40:54 +0000
committerStijn Buys <ingar@osirion.org>2014-12-07 18:40:54 +0000
commit941c64546ca22b87a9153d36e9e3fe59c18abafe (patch)
treedda251cffa98ba69d7feb4387a221e698b02f6d7 /src
parent2c98d3eef488233b99a76ca44d69c1c9d53404af (diff)
Improved Entity::print().
Diffstat (limited to 'src')
-rw-r--r--src/core/entity.cc56
1 files changed, 43 insertions, 13 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 0c49a3e..610db6b 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -269,23 +269,23 @@ void Entity::print() const
con_print << " ^Ntype ^B";
switch (type()) {
case Default:
- con_print << "entity";
+ con_print << "^Bentity";
break;
case Dynamic:
- con_print << "dynamic";
+ con_print << "^Bdynamic";
break;
case Controlable:
- con_print << "controlable";
+ con_print << "^Bcontrolable";
break;
case Globe:
- con_print << "globe";
+ con_print << "^Bglobe";
break;
case Projectile:
- con_print << "projectile";
+ con_print << "^Bprojectile";
}
con_print << std::endl;
con_print << " ^Nmodule type ^B" << moduletype() << std::endl;
@@ -293,26 +293,56 @@ void Entity::print() const
// print entity flags
con_print << " ^Nflags ^B";
if (has_flag(NonSolid)) {
- con_print << " nonsolid";
+ con_print << " ^Bnonsolid";
}
if (has_flag(Bright)) {
- con_print << " bright";
+ con_print << " ^Bbright";
}
if (has_flag(Dockable)) {
- con_print << " dockable";
+ con_print << " ^Bdockable";
}
if (has_flag(ShowOnMap)) {
- con_print << " shownmap";
+ con_print << " ^Bshownmap";
}
if (has_flag(KeepAlive)) {
- con_print << " keepalive";
+ con_print << " ^Bkeepalive";
}
con_print << std::endl;
if (inventory()) {
- con_print << " ^Ninventory ^Byes" << std::endl;
+ con_print << " ^Ninventory capacity ^B" << inventory()->capacity_used() << "/" << inventory()->capacity() << " ^Nitems^B " << inventory()->items().size() << std::endl;
}
- if (slots()) {
- con_print << " ^Nslots ^Byes" << std::endl;
+ if (slots() && slots()->size()) {
+ int nbcannons = 0;
+ int nbturrets = 0;
+ int nbdocks = 0;
+
+ for (Slots::iterator slit = slots()->begin(); slit != slots()->end(); ++slit) {
+ switch ((*slit)->type()) {
+ case model::Slot::Cannon:
+ ++nbcannons;
+ break;
+ case model::Slot::Turret:
+ ++nbturrets;
+ break;
+ case model::Slot::Dock:
+ ++nbdocks;
+ break;
+ case model::Slot::None:
+ break;
+ }
+ }
+
+ con_print << " ^Nslots ";
+ if (nbcannons > 0) {
+ con_print << " ^Ncannons^B " << nbcannons;
+ }
+ if (nbturrets > 0) {
+ con_print << " ^Nturrets^B " << nbturrets;
+ }
+ if (nbdocks > 0) {
+ con_print << " ^Ndocks^B " << nbdocks;
+ }
+ con_print << std::endl;
}
if (faction()) {
con_print << " ^Nfaction ^B" << faction()->label() << std::endl;