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>2013-11-04 21:40:20 +0000
committerStijn Buys <ingar@osirion.org>2013-11-04 21:40:20 +0000
commita045ea4846861404ee26c0d077ea639c1987a8cb (patch)
tree3338eced9df04ca0c6645f9bd7fcb827c67e3437 /src/core
parent5f74a6b0f3e84ec00e68cda63da6e66df33a8149 (diff)
Improved zone keepalive updates.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/entity.cc18
-rw-r--r--src/core/entity.h8
-rw-r--r--src/core/gameserver.cc28
3 files changed, 27 insertions, 27 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index e76f254..89c78d8 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -1505,23 +1505,5 @@ void EntityControlable::action(btScalar seconds)
{
}
-// osirion game frame (runs at osirion server framerate)
-void EntityControlable::frame(const unsigned long elapsed)
-{
- EntityDynamic::frame(elapsed);
-
- // update zone keepalive bounding box
- if (owner() && (owner()->control() == this) && zone()) {
-
- // add player controlable to keepalive bounding box
- if (!zone()->keepalive_run()) {
- zone()->keepalive_box().assign(location());
- zone()->set_keepalive_run(true);
- } else {
- zone()->keepalive_box().expand(location());
- }
- }
-}
-
} //namespace core
diff --git a/src/core/entity.h b/src/core/entity.h
index 721c329..e1a952d 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -827,14 +827,6 @@ public:
/// set thrust
void set_thrust(float thrust);
- /**
- * @brief runs one game frame for the entity
- * The default implementation will set direction() and thrust() to the desired targets
- * and calls its parent frame() funcion.
- * @param elapsed elepased time since previous frame, in milliseconds
- */
- virtual void frame(const unsigned long elapsed);
-
protected:
/// physics action interface callback
diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc
index c27f5d4..003b9c6 100644
--- a/src/core/gameserver.cc
+++ b/src/core/gameserver.cc
@@ -622,6 +622,32 @@ void GameServer::frame(const unsigned long timestamp)
// Note: zone->keepalive_run() is set to true by EntityControlable::frame()
zone->set_keepalive_run(false);
}
+ // update zone keepalive state
+ for (Players::iterator it = game_players.begin(); it != game_players.end(); ++it) {
+
+ Entity *view = (*it)->view();
+ if (view && view->zone()) {
+ // add player view to keepalive bounding box
+ if (!view->zone()->keepalive_run()) {
+ view->zone()->keepalive_box().assign(view->location());
+ view->zone()->set_keepalive_run(true);
+ } else {
+ view->zone()->keepalive_box().expand(view->location());
+ }
+ } else {
+ EntityControlable *controlable = (*it)->control();
+ if (controlable && controlable->zone()) {
+
+ // add player controlable to keepalive bounding box
+ if (!controlable->zone()->keepalive_run()) {
+ controlable->zone()->keepalive_box().assign(controlable->location());
+ controlable->zone()->set_keepalive_run(true);
+ } else {
+ controlable->zone()->keepalive_box().expand(controlable->location());
+ }
+ }
+ }
+ }
// run entity game frames
for (Entity::Registry::iterator it = Entity::registry().begin(); it != Entity::registry().end(); ++it) {
@@ -669,7 +695,7 @@ void GameServer::frame(const unsigned long timestamp)
}
// engine state updates for each player
- for (std::list<Player *>::iterator it = game_players.begin(); it != game_players.end(); ++it) {
+ for (Players::iterator it = game_players.begin(); it != game_players.end(); ++it) {
Player *player = (*it);
Entity *view = player->view();
EntityControlable *control = player->control();