diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-29 14:17:22 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-29 14:17:22 +0000 |
commit | 26b3e1094d85ef89c90376688000836c8ee43979 (patch) | |
tree | f934d936d7c8319e742e946a6bb5f37ab7289b30 /src/game-server/spawnarea.hpp | |
parent | b82bf7df7053a78d51706a5a017d61f564e4677e (diff) | |
download | manaserv-26b3e1094d85ef89c90376688000836c8ee43979.tar.gz manaserv-26b3e1094d85ef89c90376688000836c8ee43979.tar.bz2 manaserv-26b3e1094d85ef89c90376688000836c8ee43979.tar.xz manaserv-26b3e1094d85ef89c90376688000836c8ee43979.zip |
Replaced event system. Fixed race condition between quest variable recovery and character removal.
Diffstat (limited to 'src/game-server/spawnarea.hpp')
-rw-r--r-- | src/game-server/spawnarea.hpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/game-server/spawnarea.hpp b/src/game-server/spawnarea.hpp index cd682647..a565890d 100644 --- a/src/game-server/spawnarea.hpp +++ b/src/game-server/spawnarea.hpp @@ -25,7 +25,7 @@ #define _TMWSERV_SPAWNAREA #include "point.h" -#include "game-server/deathlistener.hpp" +#include "game-server/eventlistener.hpp" #include "game-server/thing.hpp" class Being; @@ -35,22 +35,28 @@ class MonsterClass; * A spawn area, where monsters spawn. The area is a rectangular field and will * spawn a certain number of a given monster type. */ -class SpawnArea : public Thing, public DeathListener +class SpawnArea : public Thing { public: SpawnArea(MapComposite *, MonsterClass *, Rectangle const &zone); - virtual void update(); + void update(); - virtual void died(Being *being); + /** + * Keeps track of the number of spawned being. + */ + void decrease(Thing *); - protected: + private: MonsterClass *mSpecy; /**< Specy of monster that spawns in this area. */ + EventListener mSpawnedListener; /**< Tracking of spawned monsters. */ Rectangle mZone; int mMaxBeings; /**< Maximum population of this area. */ int mSpawnRate; /**< Number of beings spawning per minute. */ int mNumBeings; /**< Current population of this area. */ int mNextSpawn; /**< The time until next being spawn. */ + + friend struct SpawnAreaEventDispatch; }; #endif |