From 8f393ff70e60172c632efc81694433568df2862b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 25 Dec 2014 15:58:24 +0000 Subject: Added a core::Level type, added a level attribute to core::Entity and core::Info, updated core::Player to use the new type. --- src/core/entity.cc | 78 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 20 deletions(-) (limited to 'src/core/entity.cc') diff --git a/src/core/entity.cc b/src/core/entity.cc index f4a29dd..41ead7e 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -155,6 +155,8 @@ Entity::Entity() : entity_died = false; entity_dirty = false; entity_keepalive = 0; + + entity_level = 1; entity_zone = 0; entity_oldzone = 0; @@ -181,6 +183,8 @@ Entity::Entity(std::istream & is) entity_oldzone = 0; entity_visible = true; entity_keepalive = 0; + + entity_level = 1; entity_model = 0; @@ -265,11 +269,6 @@ void Entity::print() const // print header print_header(); - // faction - if (faction()) { - con_print << " ^Nfaction ^B" << faction()->label() << std::endl; - } - // entity type id con_print << " ^Ntype ^B"; switch (type()) { @@ -299,27 +298,66 @@ void Entity::print() const // print entity flags con_print << " ^Nflags ^B"; - if (has_flag(NonSolid)) { - con_print << " ^Bnonsolid"; - } - if (has_flag(Bright)) { - con_print << " ^Bbright"; - } - if (has_flag(Dockable)) { - con_print << " ^Bdockable"; - } - if (has_flag(ShowOnMap)) { - con_print << " ^Bshownmap"; - } - if (has_flag(KeepAlive)) { - con_print << " ^Bkeepalive"; + if (flags() == 0) + { + if (has_flag(NonSolid)) { + con_print << " ^Bnonsolid"; + } + if (has_flag(Bright)) { + con_print << " ^Bbright"; + } + if (has_flag(Dockable)) { + con_print << " ^Bdockable"; + } + if (has_flag(ShowOnMap)) { + con_print << " ^Bshownmap"; + } + if (has_flag(KeepAlive)) { + con_print << " ^Bkeepalive"; + } + } else + { + con_print << " ^Bnone"; } con_print << std::endl; + + // level + con_print << " ^Nlevel ^B" << level() << std::endl; + + // faction + if (faction()) { + con_print << " ^Nfaction ^Nid ^B" << faction()->id() << " ^Nlabel ^B" << faction()->label() << std::endl; + } // info record if (info()) { - con_print << " ^Ninfo id ^B" << info()->id() << std::endl; + con_print << " ^Ninfo ^Nid ^B" << info()->id() << " ^Nlabel ^B" << info()->label() << std::endl; + } + + // model or shape + if (model()) + { + con_print << " ^Nmodel ^B" << model()->name() << std::endl; + } else + { + con_print << " ^Nshape ^B"; + switch (shape()) + { + case Diamond: + con_print << "diamond"; + break; + case Sphere: + con_print << "sphere"; + break; + case Cube: + con_print << "cube"; + break; + case Axis: + con_print << "axis"; + break; + } } + // slots if (slots() && slots()->size()) { -- cgit v1.2.3