From 921d0ca1730dcc1805b5239f0b081624a0f71b02 Mon Sep 17 00:00:00 2001 From: codinablack Date: Sat, 7 Dec 2024 23:00:35 -0600 Subject: [PATCH] Fix issue #20 - resolves problem of monsters' ownership transferring to a non existent spawn point --- src/spawn.cpp | 9 --------- src/spawn.h | 4 +--- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/spawn.cpp b/src/spawn.cpp index 3c153b38..6b8eb699 100644 --- a/src/spawn.cpp +++ b/src/spawn.cpp @@ -267,11 +267,6 @@ bool Spawn::findPlayer(const Position& pos) return false; } -bool Spawn::isInSpawnZone(const Position& pos) -{ - return Spawns::isInZone(centerPos, radius, pos); -} - bool Spawn::spawnMonster(uint32_t spawnId, spawnBlock_t sb, bool startup/* = false*/) { bool isBlocked = !startup && findPlayer(sb.pos); @@ -388,14 +383,10 @@ void Spawn::cleanup() { auto it = spawnedMap.begin(); while (it != spawnedMap.end()) { - uint32_t spawnId = it->first; Monster* monster = it->second; if (monster->isRemoved()) { monster->decrementReferenceCounter(); it = spawnedMap.erase(it); - } else if (!isInSpawnZone(monster->getPosition()) && spawnId != 0) { - spawnedMap.insert({0, monster}); - it = spawnedMap.erase(it); } else { ++it; } diff --git a/src/spawn.h b/src/spawn.h index ee7c2e26..d3eab8b9 100644 --- a/src/spawn.h +++ b/src/spawn.h @@ -39,12 +39,10 @@ class Spawn uint32_t getInterval() const { return interval; } + void startup(); - void startSpawnCheck(); void stopEvent(); - - bool isInSpawnZone(const Position& pos); void cleanup(); private: