diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/entity.cc | 18 | ||||
-rw-r--r-- | src/core/entity.h | 8 | ||||
-rw-r--r-- | src/core/gameserver.cc | 28 |
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(); |