From 81787e9004377016236865e95b95707ed6cf1d0b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 2 Mar 2008 12:23:48 +0000 Subject: initial (buggy) support for .map models --- src/core/entity.cc | 13 +++++++++---- src/core/entity.h | 4 ++++ src/core/gameinterface.cc | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/core') diff --git a/src/core/entity.cc b/src/core/entity.cc index a0da4ea..2fe381b 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -113,15 +113,19 @@ Entity::Entity(std::istream & is) is >> s; // shape is >> entity_radius; is >> entity_direction; + entity_shape = (Shape) s ; char c; while ( (is.get(c)) && (c != '"')); while ( (is.get(c)) && (c != '"')) - n += c; - - entity_shape = (Shape) s ; + n += c; entity_name = n; + while ( (is.get(c)) && (c != '"')); + while ( (is.get(c)) && (c != '"')) + n += c; + entity_modelname = n; + entity_created = true; entity_destroyed = false; entity_dirty = false; @@ -144,7 +148,8 @@ void Entity::serialize(std::ostream & os) const << entity_shape << " " << entity_radius << " " << entity_direction << " " - << "\"" << entity_name << "\""; + << "\"" << entity_name << "\" " + << "\"" << entity_modelname << "\""; } void Entity::serialize_client_update(std::ostream & os) const diff --git a/src/core/entity.h b/src/core/entity.h index 9c90ef9..d887bc1 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -61,6 +61,9 @@ public: /// entity name (can not contain double qoutes ") inline std::string const & name() { return entity_name; } + /// entity model name + inline std::string const & modelname() { return entity_modelname; } + /// dirty flag inline bool dirty() const { return entity_dirty; } @@ -123,6 +126,7 @@ public: /* entity_ variables can be set by the module */ float entity_radius; std::string entity_name; + std::string entity_modelname; Shape entity_shape; math::Vector3f entity_location; math::Color entity_color; diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc index 6f6a4ac..9aa50fc 100644 --- a/src/core/gameinterface.cc +++ b/src/core/gameinterface.cc @@ -64,7 +64,7 @@ GameInterface::~GameInterface() // clear all game related objects void GameInterface::clear() { - con_debug << "Clearing game data\n"; + //con_debug << "Clearing game data\n"; // remove all entities for (std::map::iterator it = Entity::registry.begin(); it != Entity::registry.end(); it++) { -- cgit v1.2.3