diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/entity.cc | 13 | ||||
-rw-r--r-- | src/core/entity.h | 4 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc index 46231d8..e9985c3 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -71,7 +71,7 @@ void Entity::list() con_print << " id " << std::setw(4) << entity->id() << " type " << std::setw(4) << entity->type() << ":" << std::setw(4) << entity->moduletype() - << " " << entity->name() << std::endl; + << " " << entity->label() << std::endl; } con_print << registry.size() << " registered entities" << std::endl; } @@ -95,6 +95,7 @@ Entity::Entity(unsigned int flags) : entity_model = 0; entity_modelname.clear(); + entity_label.clear(); entity_name.clear(); entity_clientstate = 0; @@ -123,12 +124,21 @@ Entity::Entity(std::istream & is) entity_shape = (Shape) s ; char c; + // read label + while ( (is.get(c)) && (c != '"')); + while ( (is.get(c)) && (c != '"')) + n += c; + entity_label = n; + n.clear(); + + // read name while ( (is.get(c)) && (c != '"')); while ( (is.get(c)) && (c != '"')) n += c; entity_name = n; n.clear(); + // read model name while ( (is.get(c)) && (c != '"')); while ( (is.get(c)) && (c != '"')) n += c; @@ -164,6 +174,7 @@ void Entity::serialize(std::ostream & os) const << entity_radius << " " << entity_axis.forward() << " " << entity_axis.left() << " " + << "\"" << entity_label << "\" " << "\"" << entity_name << "\" " << "\"" << entity_modelname << "\""; } diff --git a/src/core/entity.h b/src/core/entity.h index c93d059..bf35bfe 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -68,6 +68,9 @@ public: /// entity flags inline unsigned int flags() const { return entity_flags; } + /// entity label (can not contain double quotes ") + inline std::string const & label() { return entity_label; } + /// entity name (can not contain double qoutes ") inline std::string const & name() { return entity_name; } @@ -145,6 +148,7 @@ public: float entity_radius; std::string entity_name; + std::string entity_label; std::string entity_modelname; model::Model *entity_model; Shape entity_shape; |