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>2010-11-12 16:24:17 +0000
committerStijn Buys <ingar@osirion.org>2010-11-12 16:24:17 +0000
commitb460b3193e54b7364bb75ff26ce6f999887e454b (patch)
treed35e4972fd3ee54b9922908e3791a53bae96af14 /src/core
parentc0c2a0ccc335b00983bf69b99b7a44505ed24b47 (diff)
moved global entity info type to core::Entity::infotype(),
automatic generation of jumppoint and jumpgate names and descriptions, prepared game code for the seperation of Entity::radius() and Model::radius()
Diffstat (limited to 'src/core')
-rw-r--r--src/core/entity.cc12
-rw-r--r--src/core/entity.h13
-rw-r--r--src/core/gameserver.cc5
-rw-r--r--src/core/parser.cc14
-rw-r--r--src/core/parser.h11
5 files changed, 27 insertions, 28 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 7f48c08..9e467fe 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -29,6 +29,8 @@ using math::Vector3f;
/* ---- Static functions for the Entity registry ------------------- */
+const InfoType *Entity::entity_infotype = 0;
+
Entity::Registry Entity::entity_registry;
size_t Entity::entity_nextid = 0;
@@ -314,7 +316,9 @@ void Entity::set_model(model::Model *model)
// server-side property should not clear modelname
entity_model = model;
if (entity_model) {
- entity_radius = entity_model->radius();
+
+ //entity_radius = entity_model->radius();
+
entity_modelname.assign(entity_model->name());
}
@@ -502,6 +506,10 @@ void Entity::remove_menu(std::string const &label)
void Entity::reset()
{
+ if (!radius()) {
+ return;
+ }
+
// location and orientation
btTransform t;
t.setIdentity();
@@ -918,7 +926,7 @@ void EntityControlable::set_zone(Zone *zone)
if (entity_zone) {
entity_zone->add(this);
- if (body() && entity_zone->physics()) {
+ if (body() && entity_zone->physics()) {
entity_zone->physics()->addRigidBody(body());
entity_zone->physics()->addAction(entity_actioninterface);
reset();
diff --git a/src/core/entity.h b/src/core/entity.h
index 48dd949..1996e10 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -402,6 +402,16 @@ public:
virtual void serialize_server_update(std::ostream & os) const;
/* ---- static --------------------------------------------- */
+
+ /// default infotype for entities
+ static inline const InfoType *infotype() {
+ return entity_infotype;
+ }
+
+ /// set the default infotype for entities
+ static inline void set_infotype(const InfoType *infotype) {
+ entity_infotype = infotype;
+ }
/// type definition for the entity registry
typedef std::map<unsigned int, Entity*> Registry;
@@ -492,6 +502,9 @@ private:
static size_t entity_nextid;
static void add(Entity *ent);
+
+ static const InfoType *entity_infotype;
+
};
diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc
index 5ea6206..7d6fc96 100644
--- a/src/core/gameserver.cc
+++ b/src/core/gameserver.cc
@@ -130,7 +130,8 @@ GameServer::GameServer() : GameInterface()
server_maxplayerid = 1;
server_startup = application()->timestamp();
- Parser::init();
+ // create the default infotype for entities
+ Entity::set_infotype(new InfoType("entity"));
Physics::init();
@@ -237,7 +238,7 @@ GameServer::~GameServer()
Physics::done();
- Parser::done();
+ Entity::set_infotype(0);
server_instance = 0;
}
diff --git a/src/core/parser.cc b/src/core/parser.cc
index 3806b99..953cd50 100644
--- a/src/core/parser.cc
+++ b/src/core/parser.cc
@@ -11,18 +11,6 @@
namespace core
{
-InfoType *Parser::entity_infotype = 0;
-
-void Parser::init()
-{
- entity_infotype = new InfoType("entity");
-}
-
-void Parser::done()
-{
- entity_infotype = 0;
-}
-
bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity)
{
math::Vector3f v;
@@ -60,7 +48,7 @@ bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity)
} else if (inifile.got_key_string("info", strval)) {
if (!entity->info()) {
- entity->set_info(new Info(entity_infotype, entity->label().c_str()));
+ entity->set_info(new Info(Entity::infotype(), entity->label().c_str()));
}
entity->info()->add_text(strval);
return true;
diff --git a/src/core/parser.h b/src/core/parser.h
index 993c307..06ddc27 100644
--- a/src/core/parser.h
+++ b/src/core/parser.h
@@ -18,19 +18,8 @@ namespace core
class Parser
{
public:
- /// initialize parser infotypes
- static void init();
-
- /// clean up parser internals
- static void done();
-
/// read default entity keys from an ini file
static bool got_entity_key(filesystem::IniFile &inifile, core::Entity *entity);
-
-private:
- /// default infotype for entities
- static InfoType *entity_infotype;
-
};
}