mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 00:23:48 +00:00
fix(Core/Misc): Memleaks fixes. Part I. (#5546)
This commit is contained in:
@@ -787,7 +787,14 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
||||
if (!map)
|
||||
{
|
||||
LOG_ERROR("server", "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
|
||||
if (!cinfo)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Battlefield::SpawnCreature: entry %u does not exist.", entry);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Creature* creature = new Creature(true);
|
||||
@@ -801,12 +808,6 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
||||
creature->setFaction(BattlefieldFactions[teamId]);
|
||||
creature->SetHomePosition(x, y, z, o);
|
||||
|
||||
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
|
||||
if (!cinfo)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Battlefield::SpawnCreature: entry %u does not exist.", entry);
|
||||
return nullptr;
|
||||
}
|
||||
// force using DB speeds -- do we really need this?
|
||||
creature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
|
||||
creature->SetSpeed(MOVE_RUN, cinfo->speed_run);
|
||||
|
||||
Reference in New Issue
Block a user