From efbd9ab69391e51b8fa6933f69fab5f52390ebc3 Mon Sep 17 00:00:00 2001 From: Allan Ference Date: Mon, 19 Aug 2013 18:57:25 +0200 Subject: [PATCH] Attempt to fix spawn loader --- src/client/creatures.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/client/creatures.cpp b/src/client/creatures.cpp index 5f8e9037..24beafc4 100644 --- a/src/client/creatures.cpp +++ b/src/client/creatures.cpp @@ -76,10 +76,12 @@ void Spawn::load(TiXmlElement* node) dir = (Otc::Direction)dir_; cType->setDirection(dir); - centerPos.x += cNode->readType("x"); - centerPos.y += cNode->readType("y"); - centerPos.z = cNode->readType("z"); - addCreature(centerPos, cType); + Position placePos; + placePos.x = centerPos.x + cNode->readType("x"); + placePos.y = centerPos.y + cNode->readType("y"); + placePos.z = cNode->readType("z"); + + addCreature(placePos, cType); } } @@ -357,8 +359,11 @@ SpawnPtr CreatureManager::getSpawn(const Position& centerPos) SpawnPtr CreatureManager::addSpawn(const Position& centerPos, int radius) { auto iter = m_spawns.find(centerPos); - if(iter != m_spawns.end()) + if(iter != m_spawns.end()) { + if(iter->second->getRadius() != radius) + iter->second->setRadius(radius); return iter->second; + } SpawnPtr ret(new Spawn); @@ -369,3 +374,5 @@ SpawnPtr CreatureManager::addSpawn(const Position& centerPos, int radius) return ret; } +/* vim: set ts=4 sw=4 et: */ +