From e0c185864c09cebd3a7a0118d20ca3a368cbdb6e Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sat, 31 Mar 2007 12:15:39 +0000 Subject: Added a DeathListener interface, which the SpawnArea now uses to get notified about dying beings, so that it knows when to spawn more. --- src/game-server/spawnarea.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/game-server/spawnarea.cpp') diff --git a/src/game-server/spawnarea.cpp b/src/game-server/spawnarea.cpp index 5643047..9d7a4eb 100644 --- a/src/game-server/spawnarea.cpp +++ b/src/game-server/spawnarea.cpp @@ -30,7 +30,6 @@ /* * TODO: Take into account spawn rate. - * TODO: Be a death listener to spawned monsters, to adjust mNumBeings. * TODO: Allow specifying being type and use it. */ @@ -51,6 +50,7 @@ SpawnArea::update() while (mNumBeings < mMaxBeings) { Being *being = new Monster(); + being->addDeathListener(this); // some bogus stats for testing being->setSpeed(150); @@ -66,3 +66,9 @@ SpawnArea::update() mNumBeings++; } } + +void +SpawnArea::died(Being *being) +{ + mNumBeings--; +} -- cgit