From d8be908233fd7b85492d7a9e87f07bb207173990 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 25 Nov 2012 12:06:13 +0000 Subject: Moved core::EntityGlobe into a separate file, added various methods to core::Item and core::Slot, added r_slots cvar to draw entity slots and docks, added game methods for mounting and umounting of weapons, added playerlist to chat window. --- src/core/entity.cc | 72 ++++++++++++------------------------------------------ 1 file changed, 16 insertions(+), 56 deletions(-) (limited to 'src/core/entity.cc') diff --git a/src/core/entity.cc b/src/core/entity.cc index 462a46d..64546a7 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -278,7 +278,7 @@ void Entity::print_inventory() const return; } - con_print << " ^Nitem info infotype amount" << std::endl; + con_print << " ^Nitem infotype info amount 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 @@ -286,7 +286,20 @@ 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::endl; + << std::setw(5) << item->amount(); + if (item->has_flag(core::Item::Tradeable)) { + con_print << " tradeable"; + } + if (item->has_flag(core::Item::Unique)) { + con_print << " unique"; + } + if (item->has_flag(core::Item::Unrestricted)) { + con_print << " unrestricted"; + } + if (item->has_flag(core::Item::Mounted)) { + con_print << " mounted"; + } + con_print<< std::endl; } con_print << "^B " << entity_inventory->items().size() << " inventory items" << std::endl; } @@ -1460,58 +1473,5 @@ void EntityControlable::frame(const unsigned long elapsed) } } - -/*----- EntityGlobe ------------------------------------------------ */ - -EntityGlobe::EntityGlobe() : Entity() -{ - entity_texture_id = 0; - entity_corona_id = 0; - entity_rotationspeed = 0; - set_shape(Sphere); -} - -EntityGlobe::EntityGlobe(std::istream & is) : Entity(is) -{ - entity_texture_id = 0; - entity_corona_id = 0; - entity_rotationspeed = 0; - set_shape(Sphere); -} - -EntityGlobe::~EntityGlobe() -{ -} - -void EntityGlobe::serialize_server_create(std::ostream & os) const -{ - Entity::serialize_server_create(os); - os << entity_rotationspeed << " \"" << texturename() << "\" \"" << coronaname() << "\" "; -} - -void EntityGlobe::receive_server_create(std::istream &is) -{ - Entity::receive_server_create(is); - - is >> entity_rotationspeed; - - std::string n; - char c; - - // read texture name - while ((is.get(c)) && (c != '"')); - while ((is.get(c)) && (c != '"')) - n += c; - - entity_texturename.assign(n); - - // read corona name - n.clear(); - while ((is.get(c)) && (c != '"')); - while ((is.get(c)) && (c != '"')) - n += c; - entity_coronaname.assign(n); -} - -} +} //namespace core -- cgit v1.2.3