mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 03:31:08 +00:00
[Cleanup] Cleanup uses of insert/push_back when a temp object is used. (#3170)
This commit is contained in:
+13
-13
@@ -329,8 +329,8 @@ bool EntityList::CanAddHateForMob(Mob *p)
|
||||
void EntityList::AddClient(Client *client)
|
||||
{
|
||||
client->SetID(GetFreeID());
|
||||
client_list.insert(std::pair<uint16, Client *>(client->GetID(), client));
|
||||
mob_list.insert(std::pair<uint16, Mob *>(client->GetID(), client));
|
||||
client_list.emplace(std::pair<uint16, Client *>(client->GetID(), client));
|
||||
mob_list.emplace(std::pair<uint16, Mob *>(client->GetID(), client));
|
||||
}
|
||||
|
||||
|
||||
@@ -652,7 +652,7 @@ void EntityList::AddCorpse(Corpse *corpse, uint32 in_id)
|
||||
corpse->SetID(in_id);
|
||||
|
||||
corpse->CalcCorpseName();
|
||||
corpse_list.insert(std::pair<uint16, Corpse *>(corpse->GetID(), corpse));
|
||||
corpse_list.emplace(std::pair<uint16, Corpse *>(corpse->GetID(), corpse));
|
||||
|
||||
if (!corpse_timer.Enabled())
|
||||
corpse_timer.Start();
|
||||
@@ -671,8 +671,8 @@ void EntityList::AddNPC(NPC *npc, bool send_spawn_packet, bool dont_queue)
|
||||
}
|
||||
}
|
||||
|
||||
npc_list.insert(std::pair<uint16, NPC *>(npc->GetID(), npc));
|
||||
mob_list.insert(std::pair<uint16, Mob *>(npc->GetID(), npc));
|
||||
npc_list.emplace(std::pair<uint16, NPC *>(npc->GetID(), npc));
|
||||
mob_list.emplace(std::pair<uint16, Mob *>(npc->GetID(), npc));
|
||||
|
||||
if (parse->HasQuestSub(npc->GetNPCTypeID(), EVENT_SPAWN)) {
|
||||
parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0);
|
||||
@@ -752,8 +752,8 @@ void EntityList::AddMerc(Merc *merc, bool SendSpawnPacket, bool dontqueue)
|
||||
}
|
||||
}
|
||||
|
||||
merc_list.insert(std::pair<uint16, Merc *>(merc->GetID(), merc));
|
||||
mob_list.insert(std::pair<uint16, Mob *>(merc->GetID(), merc));
|
||||
merc_list.emplace(std::pair<uint16, Merc *>(merc->GetID(), merc));
|
||||
mob_list.emplace(std::pair<uint16, Mob *>(merc->GetID(), merc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,7 +770,7 @@ void EntityList::AddObject(Object *obj, bool SendSpawnPacket)
|
||||
QueueClients(0, &app,false);
|
||||
}
|
||||
|
||||
object_list.insert(std::pair<uint16, Object *>(obj->GetID(), obj));
|
||||
object_list.emplace(std::pair<uint16, Object *>(obj->GetID(), obj));
|
||||
|
||||
if (!object_timer.Enabled())
|
||||
object_timer.Start();
|
||||
@@ -779,7 +779,7 @@ void EntityList::AddObject(Object *obj, bool SendSpawnPacket)
|
||||
void EntityList::AddDoor(Doors *door)
|
||||
{
|
||||
door->SetEntityID(GetFreeID());
|
||||
door_list.insert(std::pair<uint16, Doors *>(door->GetEntityID(), door));
|
||||
door_list.emplace(std::pair<uint16, Doors *>(door->GetEntityID(), door));
|
||||
|
||||
if (!door_timer.Enabled())
|
||||
door_timer.Start();
|
||||
@@ -788,7 +788,7 @@ void EntityList::AddDoor(Doors *door)
|
||||
void EntityList::AddTrap(Trap *trap)
|
||||
{
|
||||
trap->SetID(GetFreeID());
|
||||
trap_list.insert(std::pair<uint16, Trap *>(trap->GetID(), trap));
|
||||
trap_list.emplace(std::pair<uint16, Trap *>(trap->GetID(), trap));
|
||||
if (!trap_timer.Enabled())
|
||||
trap_timer.Start();
|
||||
}
|
||||
@@ -796,13 +796,13 @@ void EntityList::AddTrap(Trap *trap)
|
||||
void EntityList::AddBeacon(Beacon *beacon)
|
||||
{
|
||||
beacon->SetID(GetFreeID());
|
||||
beacon_list.insert(std::pair<uint16, Beacon *>(beacon->GetID(), beacon));
|
||||
beacon_list.emplace(std::pair<uint16, Beacon *>(beacon->GetID(), beacon));
|
||||
}
|
||||
|
||||
void EntityList::AddEncounter(Encounter *encounter)
|
||||
{
|
||||
encounter->SetID(GetFreeID());
|
||||
encounter_list.insert(std::pair<uint16, Encounter *>(encounter->GetID(), encounter));
|
||||
encounter_list.emplace(std::pair<uint16, Encounter *>(encounter->GetID(), encounter));
|
||||
}
|
||||
|
||||
void EntityList::AddToSpawnQueue(uint16 entityid, NewSpawn_Struct **ns)
|
||||
@@ -2984,7 +2984,7 @@ void EntityList::ScanCloseMobs(
|
||||
|
||||
float distance = DistanceSquared(scanning_mob->GetPosition(), mob->GetPosition());
|
||||
if (distance <= scan_range || mob->GetAggroRange() >= scan_range) {
|
||||
close_mobs.insert(std::pair<uint16, Mob *>(mob->GetID(), mob));
|
||||
close_mobs.emplace(std::pair<uint16, Mob *>(mob->GetID(), mob));
|
||||
|
||||
if (add_self_to_other_lists && scanning_mob->GetID() > 0) {
|
||||
bool has_mob = false;
|
||||
|
||||
Reference in New Issue
Block a user