Minor changes

This commit is contained in:
otfallen 2012-09-19 07:13:45 +00:00
parent 4d0725e876
commit baceba74b9
2 changed files with 4 additions and 6 deletions

View File

@ -144,7 +144,6 @@ CreaturePtr CreatureType::cast()
CreatureManager::CreatureManager()
{
m_nullCreature = CreatureTypePtr(new CreatureType);
m_nullSpawn = SpawnPtr(new Spawn);
}
void CreatureManager::clearSpawns()
@ -203,7 +202,7 @@ void CreatureManager::loadNpcs(const std::string& folder)
void CreatureManager::loadSpawns(const std::string& fileName)
{
if(!isLoaded()) {
g_logger.fatal("creatures aren't loaded yet to load spawns.");
g_logger.warning("creatures aren't loaded yet to load spawns.");
return;
}
@ -336,7 +335,7 @@ const CreatureTypePtr& CreatureManager::getCreatureByLook(int look)
return m_nullCreature;
}
const SpawnPtr& CreatureManager::getSpawn(const Position& centerPos)
SpawnPtr CreatureManager::getSpawn(const Position& centerPos)
{
// TODO instead of a list, a map could do better...
auto findFun = [=] (const SpawnPtr& sp) -> bool
@ -349,6 +348,6 @@ const SpawnPtr& CreatureManager::getSpawn(const Position& centerPos)
return *it;
// Let it be debug so in release versions it shouldn't annoy the user
g_logger.debug(stdext::format("failed to find spawn at center %s",stdext::to_string(centerPos)));
return m_nullSpawn;
return nullptr;
}

View File

@ -111,7 +111,7 @@ public:
const CreatureTypePtr& getCreatureByName(std::string name);
const CreatureTypePtr& getCreatureByLook(int look);
const SpawnPtr& getSpawn(const Position& centerPos);
SpawnPtr getSpawn(const Position& centerPos);
bool isLoaded() { return m_loaded; }
bool isSpawnLoaded() { return m_spawnLoaded; }
@ -127,7 +127,6 @@ private:
std::vector<SpawnPtr> m_spawns;
stdext::boolean<false> m_loaded, m_spawnLoaded;
CreatureTypePtr m_nullCreature;
SpawnPtr m_nullSpawn;
};
extern CreatureManager g_creatures;