Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-09 20:06:41 +0000
committerStijn Buys <ingar@osirion.org>2013-11-09 20:06:41 +0000
commit49b8e384b39dbfd25f510c91e610eb7f3bba4199 (patch)
tree32760141e9946c79e8024407cbdf2e9606229339 /src
parent45ea16384fdc077ca07e21e309170894bdf88860 (diff)
Do not run game frames and upkeep on destroyed entities.
Diffstat (limited to 'src')
-rw-r--r--src/core/gameserver.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc
index 003b9c6..9e24c64 100644
--- a/src/core/gameserver.cc
+++ b/src/core/gameserver.cc
@@ -622,6 +622,7 @@ 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) {
@@ -635,9 +636,8 @@ void GameServer::frame(const unsigned long timestamp)
view->zone()->keepalive_box().expand(view->location());
}
} else {
- EntityControlable *controlable = (*it)->control();
+ 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());
@@ -652,8 +652,9 @@ void GameServer::frame(const unsigned long timestamp)
// run entity game frames
for (Entity::Registry::iterator it = Entity::registry().begin(); it != Entity::registry().end(); ++it) {
Entity *entity = (*it).second;
-
- entity->frame(elapsed);
+ if (!entity->destroyed()) {
+ entity->frame(elapsed);
+ }
}
@@ -669,8 +670,7 @@ void GameServer::frame(const unsigned long timestamp)
for (Entity::Registry::iterator it = Entity::registry().begin(); it != Entity::registry().end(); ++it) {
Entity *entity = (*it).second;
Zone *zone = entity->zone();
- if (zone && entity->has_flag(Entity::KeepAlive)) {
-
+ if (zone && entity->has_flag(Entity::KeepAlive) && !entity->destroyed()) {
// reset timeout counter if the zone is active
if (zone->keepalive_run() && zone->keepalive_box().inside(entity->location())) {
entity->set_keepalive(this->timestamp());