Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-06-01 13:03:45 +0000
committerStijn Buys <ingar@osirion.org>2008-06-01 13:03:45 +0000
commit190cede795ac4c7fcd6865a6c2083b5ce53a154a (patch)
treef1d05ebec665b0fb66ef2448a81ab2ed718ee279 /src/core
parent2a41efa0d43b573e1c8851086268b8a64d51c511 (diff)
entity and shipmodel labels, fixes sort order of shipmodels
Diffstat (limited to 'src/core')
-rw-r--r--src/core/entity.cc13
-rw-r--r--src/core/entity.h4
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;