summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-09-09 17:23:20 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-09-09 17:23:20 +0200
commitfa79fe2a419ac53b87d06b8231b04ee4776c3bfd (patch)
tree72eb8571f0b39204d8d0a10b19bc23bb752e3924
parent9c780f3d547e11bc6585033b2bf8c1a233aaf9d9 (diff)
downloadmanaserv-fa79fe2a419ac53b87d06b8231b04ee4776c3bfd.tar.gz
manaserv-fa79fe2a419ac53b87d06b8231b04ee4776c3bfd.tar.bz2
manaserv-fa79fe2a419ac53b87d06b8231b04ee4776c3bfd.tar.xz
manaserv-fa79fe2a419ac53b87d06b8231b04ee4776c3bfd.zip
Fixed Entity leak with effects
-rw-r--r--src/game-server/effect.cpp2
-rw-r--r--src/game-server/effect.h11
-rw-r--r--src/game-server/state.cpp1
3 files changed, 4 insertions, 10 deletions
diff --git a/src/game-server/effect.cpp b/src/game-server/effect.cpp
index 42142c5e..89a6b657 100644
--- a/src/game-server/effect.cpp
+++ b/src/game-server/effect.cpp
@@ -27,7 +27,7 @@
void EffectComponent::update(Entity &entity)
{
- if (mHasBeenShown)
+ if (mCreationTick != GameState::getCurrentTick())
GameState::enqueueRemove(&entity);
}
diff --git a/src/game-server/effect.h b/src/game-server/effect.h
index 556d6acb..d4821e66 100644
--- a/src/game-server/effect.h
+++ b/src/game-server/effect.h
@@ -23,6 +23,7 @@
#define EFFECT_H
#include "game-server/component.h"
+#include "game-server/state.h"
class Entity;
class MapComposite;
@@ -35,7 +36,7 @@ class EffectComponent : public Component
EffectComponent(int id)
: mEffectId(id)
- , mHasBeenShown(false)
+ , mCreationTick(GameState::getCurrentTick())
, mBeing(0)
{}
@@ -50,18 +51,12 @@ class EffectComponent : public Component
*/
void update(Entity &entity);
- /**
- * Called when the object has been shown to a player in the state loop.
- */
- void setShown()
- { mHasBeenShown = true; }
-
void setBeing(Entity *b)
{ mBeing = b; }
private:
int mEffectId;
- bool mHasBeenShown;
+ int mCreationTick;
Entity *mBeing;
};
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index 4db5caab..8055c27d 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -435,7 +435,6 @@ static void informPlayer(MapComposite *map, Entity *p)
case OBJECT_EFFECT:
{
EffectComponent *e = o->getComponent<EffectComponent>();
- e->setShown();
// Don't show old effects
if (!(oflags & UPDATEFLAG_NEW_ON_MAP))
break;