From ef983c3d47b2795671e0a130b566cc4f1d35e7f5 Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:50:36 -0600 Subject: [PATCH] Move bot_list from std::list to std::unordered_map like other entities --- zone/bot.cpp | 123 +++++++++---------- zone/bot_command.cpp | 2 +- zone/bot_command.h | 89 +++++++------- zone/bot_commands/aggressive.cpp | 4 +- zone/bot_commands/appearance.cpp | 2 +- zone/bot_commands/attack.cpp | 4 +- zone/bot_commands/behind_mob.cpp | 4 +- zone/bot_commands/blocked_buffs.cpp | 8 +- zone/bot_commands/bot.cpp | 26 ++-- zone/bot_commands/cast.cpp | 4 +- zone/bot_commands/click_item.cpp | 4 +- zone/bot_commands/default_settings.cpp | 4 +- zone/bot_commands/defensive.cpp | 4 +- zone/bot_commands/depart.cpp | 4 +- zone/bot_commands/distance_ranged.cpp | 4 +- zone/bot_commands/follow.cpp | 4 +- zone/bot_commands/guard.cpp | 4 +- zone/bot_commands/heal_rotation.cpp | 40 +++--- zone/bot_commands/hold.cpp | 4 +- zone/bot_commands/illusion_block.cpp | 4 +- zone/bot_commands/inventory.cpp | 8 +- zone/bot_commands/item_use.cpp | 4 +- zone/bot_commands/max_melee_range.cpp | 4 +- zone/bot_commands/pet.cpp | 10 +- zone/bot_commands/pick_lock.cpp | 2 +- zone/bot_commands/pickpocket.cpp | 2 +- zone/bot_commands/pull.cpp | 4 +- zone/bot_commands/release.cpp | 4 +- zone/bot_commands/sit_hp_percent.cpp | 4 +- zone/bot_commands/sit_in_combat.cpp | 4 +- zone/bot_commands/sit_mana_percent.cpp | 4 +- zone/bot_commands/spell_aggro_checks.cpp | 4 +- zone/bot_commands/spell_delays.cpp | 4 +- zone/bot_commands/spell_engaged_priority.cpp | 4 +- zone/bot_commands/spell_holds.cpp | 4 +- zone/bot_commands/spell_idle_priority.cpp | 4 +- zone/bot_commands/spell_max_hp_pct.cpp | 4 +- zone/bot_commands/spell_max_mana_pct.cpp | 4 +- zone/bot_commands/spell_max_thresholds.cpp | 4 +- zone/bot_commands/spell_min_hp_pct.cpp | 4 +- zone/bot_commands/spell_min_mana_pct.cpp | 4 +- zone/bot_commands/spell_min_thresholds.cpp | 4 +- zone/bot_commands/spell_pursue_priority.cpp | 4 +- zone/bot_commands/spell_target_count.cpp | 4 +- zone/bot_commands/suspend.cpp | 4 +- zone/bot_commands/taunt.cpp | 4 +- zone/bot_commands/timer.cpp | 4 +- zone/bot_commands/track.cpp | 2 +- zone/entity.cpp | 41 +++---- zone/entity.h | 8 +- zone/gm_commands/list.cpp | 14 ++- zone/lua_entity_list.cpp | 11 +- zone/perl_entity.cpp | 9 +- 53 files changed, 266 insertions(+), 275 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index a891c6367..5d9da0727 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -5529,9 +5529,9 @@ void Bot::BotOrderCampAll(Client* c, uint8 class_id) { void Bot::ProcessBotOwnerRefDelete(Mob* botOwner) { if (botOwner && botOwner->IsClient()) { - std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CastToClient()->CharacterID()); + std::vector BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CastToClient()->CharacterID()); if (!BotList.empty()) { - for (std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { + for (std::vector::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { Bot* tempBot = *botListItr; if (tempBot) { tempBot->SetTarget(nullptr); @@ -6966,7 +6966,7 @@ void Bot::UpdateGroupCastingRoles(const Group* group, bool disband) Bot* Bot::GetBotByBotClientOwnerAndBotName(Client* c, const std::string& botName) { Bot* Result = nullptr; if (c) { - std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); + std::vector BotList = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); if (!BotList.empty()) { for (auto botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { if (std::string((*botListItr)->GetCleanName()) == botName) { @@ -7056,9 +7056,9 @@ void Bot::RemoveBotFromRaid(Bot* bot) { // Handles all client zone change event void Bot::ProcessClientZoneChange(Client* botOwner) { if (botOwner) { - std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CharacterID()); + std::vector BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CharacterID()); - for (std::list::iterator itr = BotList.begin(); itr != BotList.end(); ++itr) { + for (std::vector::iterator itr = BotList.begin(); itr != BotList.end(); ++itr) { Bot* tempBot = *itr; if (tempBot) { @@ -7285,65 +7285,54 @@ Mob* EntityList::GetMobByBotID(uint32 botID) { } Bot* EntityList::GetBotByBotID(uint32 botID) { - Bot* Result = nullptr; - if (botID > 0) { - for (std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) { - Bot* tempBot = *botListItr; - if (tempBot && tempBot->GetBotID() == botID) { - Result = tempBot; - break; - } - } + auto it = bot_list.begin(); + while (it != bot_list.end()) { + if (it->second->GetBotID() == botID) + return it->second; + ++it; } - return Result; + return nullptr; } -Bot* EntityList::GetBotByBotName(std::string_view botName) { - Bot* Result = nullptr; - if (!botName.empty()) { - for (const auto b : bot_list) { - if (b && std::string_view(b->GetName()) == botName) { - Result = b; - break; - } +Bot* EntityList::GetBotByBotName(std::string botName) { + for (const auto& e : bot_list) { + if (e.second && Strings::EqualFold(e.second->GetName(), botName)) { + return e.second; } } - return Result; + + return nullptr; } Client* EntityList::GetBotOwnerByBotEntityID(uint32 entity_id) { - Client* c = nullptr; - if (entity_id) { - for (const auto& b : bot_list) { - if (b && b->GetID() == entity_id) { - c = b->GetBotOwner()->CastToClient(); - break; - } + auto it = bot_list.begin(); + while (it != bot_list.end()) { + if (it->second->GetID() == entity_id) + return it->second->GetBotOwner()->CastToClient(); + ++it; } } - - return c; + return nullptr; } Client* EntityList::GetBotOwnerByBotID(const uint32 bot_id) { - Client* c = nullptr; - if (bot_id) { - const auto owner_id = database.botdb.GetOwnerID(bot_id); - if (owner_id) { - c = GetClientByCharID(owner_id); + auto it = bot_list.begin(); + while (it != bot_list.end()) { + if (it->second->GetBotID() == bot_id) + return it->second->GetBotOwner()->CastToClient(); + ++it; } } - - return c; + return nullptr; } void EntityList::AddBot(Bot *new_bot, bool send_spawn_packet, bool dont_queue) { if (new_bot) { new_bot->SetID(GetFreeID()); - bot_list.push_back(new_bot); - mob_list.insert(std::pair(new_bot->GetID(), new_bot)); + bot_list.emplace(std::pair(new_bot->GetID(), new_bot)); + mob_list.emplace(std::pair(new_bot->GetID(), new_bot)); if (parse->BotHasQuestSub(EVENT_SPAWN)) { parse->EventBot(EVENT_SPAWN, new_bot, nullptr, "", 0); @@ -7372,31 +7361,32 @@ void EntityList::AddBot(Bot *new_bot, bool send_spawn_packet, bool dont_queue) { } } -std::list EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID) { - std::list Result; - if (botOwnerCharacterID > 0) { - for (std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) { - Bot* tempBot = *botListItr; - if (tempBot && tempBot->GetBotOwnerCharacterID() == botOwnerCharacterID) - Result.push_back(tempBot); - } +std::vector EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID) { + std::vector client_bot_list; + + if (botOwnerCharacterID <= 0) { + return client_bot_list; } - return Result; + + auto it = bot_list.begin(); + + while (it != bot_list.end()) { + if (it->second->GetOwner() && it->second->GetBotOwnerCharacterID() == botOwnerCharacterID) { + client_bot_list.push_back(it->second); + } + ++it; + } + + return client_bot_list; } bool EntityList::RemoveBot(uint16 entityID) { - bool Result = false; - if (entityID > 0) { - for (std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) { - Bot* tempBot = *botListItr; - if (tempBot && tempBot->GetID() == entityID) { - bot_list.erase(botListItr); - Result = true; - break; - } - } + auto it = bot_list.find(entityID); + if (it != bot_list.end()) { + bot_list.erase(it); // Already deleted + return true; } - return Result; + return false; } void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) { @@ -11973,14 +11963,11 @@ void Bot::CleanBotBlockedBuffs() } std::vector Bot::BotGetSpellsByType(uint16 spellType) { - if (!AIBot_spells_by_type[spellType].empty()) { - return AIBot_spells_by_type[spellType]; - } - else { + if (AIBot_spells_by_type[spellType].empty()) { spellType = GetParentSpellType(spellType); - - return AIBot_spells_by_type[spellType]; } + + return AIBot_spells_by_type[spellType]; } void Bot::AssignBotSpellsToTypes(std::vector& AIBot_spells, std::unordered_map>& AIBot_spells_by_type) { diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 482cab3e3..4eb252617 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -1814,7 +1814,7 @@ int helper_bot_follow_option_chain(Client* bot_owner) return 0; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_BySpawnedBots(bot_owner, sbl); if (sbl.empty()) { return 0; diff --git a/zone/bot_command.h b/zone/bot_command.h index 875c6f3ac..6f66e8788 100644 --- a/zone/bot_command.h +++ b/zone/bot_command.h @@ -272,13 +272,13 @@ namespace MyBots return (grouped_player->GetGroup() == grouped_bot->GetGroup()); } - static void UniquifySBL(std::list &sbl) { - sbl.remove(nullptr); - sbl.sort(); - sbl.unique(); + static void UniquifySBL(std::vector &sbl) { + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); + std::sort(sbl.begin(), sbl.end()); + sbl.erase(std::unique(sbl.begin(), sbl.end()), sbl.end()); } - static void PopulateSBL_ByTargetedBot(Client *bot_owner, std::list &sbl, bool clear_list = true) { + static void PopulateSBL_ByTargetedBot(Client *bot_owner, std::vector &sbl, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -292,7 +292,7 @@ namespace MyBots } } - static void PopulateSBL_ByNamedBot(Client *bot_owner, std::list &sbl, const char* name, bool clear_list = true) { + static void PopulateSBL_ByNamedBot(Client *bot_owner, std::vector &sbl, const char* name, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -314,7 +314,7 @@ namespace MyBots } } - static void PopulateSBL_ByMyGroupedBots(Client *bot_owner, std::list &sbl, bool clear_list = true) { + static void PopulateSBL_ByMyGroupedBots(Client *bot_owner, std::vector &sbl, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -363,7 +363,7 @@ namespace MyBots } } - static void PopulateSBL_ByMyRaidBots(Client* bot_owner, std::list& sbl, bool clear_list = true) { + static void PopulateSBL_ByMyRaidBots(Client* bot_owner, std::vector& sbl, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -396,7 +396,7 @@ namespace MyBots } } - static void PopulateSBL_ByTargetsGroupedBots(Client *bot_owner, std::list &sbl, bool clear_list = true) { + static void PopulateSBL_ByTargetsGroupedBots(Client *bot_owner, std::vector &sbl, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -448,7 +448,7 @@ namespace MyBots } } - static void PopulateSBL_ByNamesGroupedBots(Client *bot_owner, std::list &sbl, const char* name, bool clear_list = true) { + static void PopulateSBL_ByNamesGroupedBots(Client *bot_owner, std::vector &sbl, const char* name, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -507,7 +507,7 @@ namespace MyBots } } - static void PopulateSBL_ByHealRotation(Client *bot_owner, std::list &sbl, const char* name, bool clear_list = true) { + static void PopulateSBL_ByHealRotation(Client *bot_owner, std::vector &sbl, const char* name, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -516,7 +516,7 @@ namespace MyBots return; } - std::list selectable_bot_list; + std::vector selectable_bot_list; if (name) { PopulateSBL_ByNamedBot(bot_owner, selectable_bot_list, name); } @@ -545,7 +545,7 @@ namespace MyBots UniquifySBL(sbl); } - static void PopulateSBL_ByHealRotationMembers(Client *bot_owner, std::list &sbl, const char* name, bool clear_list = true) { + static void PopulateSBL_ByHealRotationMembers(Client *bot_owner, std::vector &sbl, const char* name, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -554,7 +554,7 @@ namespace MyBots return; } - std::list selectable_bot_list; + std::vector selectable_bot_list; if (name) { PopulateSBL_ByNamedBot(bot_owner, selectable_bot_list, name); } @@ -578,7 +578,7 @@ namespace MyBots } } - static void PopulateSBL_ByHealRotationTargets(Client *bot_owner, std::list &sbl, const char* name, bool clear_list = true) { + static void PopulateSBL_ByHealRotationTargets(Client *bot_owner, std::vector &sbl, const char* name, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -587,7 +587,7 @@ namespace MyBots return; } - std::list selectable_bot_list; + std::vector selectable_bot_list; if (name) { PopulateSBL_ByNamedBot(bot_owner, selectable_bot_list, name); } @@ -611,17 +611,17 @@ namespace MyBots } } - static void PopulateSBL_BySpawnedBots(Client *bot_owner, std::list &sbl) { // should be used for most spell casting commands + static void PopulateSBL_BySpawnedBots(Client *bot_owner, std::vector &sbl) { // should be used for most spell casting commands sbl.clear(); if (!bot_owner) { return; } sbl = entity_list.GetBotsByBotOwnerCharacterID(bot_owner->CharacterID()); - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); } - static void PopulateSBL_BySpawnedBotsClass(Client * bot_owner, std::list &sbl, uint16 cls, bool clear_list = true) { + static void PopulateSBL_BySpawnedBotsClass(Client * bot_owner, std::vector &sbl, uint16 cls, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -644,7 +644,7 @@ namespace MyBots } } - static void PopulateSBL_BySpawnedBotsRace(Client* bot_owner, std::list& sbl, uint16 race, bool clear_list = true) { + static void PopulateSBL_BySpawnedBotsRace(Client* bot_owner, std::vector& sbl, uint16 race, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -667,7 +667,7 @@ namespace MyBots } } - static void PopulateSBL_ByAtMMR(Client* bot_owner, std::list& sbl, bool clear_list = true) { + static void PopulateSBL_ByAtMMR(Client* bot_owner, std::vector& sbl, bool clear_list = true) { if (clear_list) { sbl.clear(); } @@ -927,7 +927,7 @@ namespace ActionableBots }; // Populates 'sbl' - static ABType PopulateSBL(Client* bot_owner, std::string ab_type_arg, std::list &sbl, int ab_mask, const char* name = nullptr, uint16 classrace = 0, bool clear_list = true, bool suppress_message = false) { + static ABType PopulateSBL(Client* bot_owner, std::string ab_type_arg, std::vector &sbl, int ab_mask, const char* name = nullptr, uint16 classrace = 0, bool clear_list = true, bool suppress_message = false) { if (clear_list) { sbl.clear(); } @@ -1164,7 +1164,7 @@ namespace ActionableBots return nullptr; } - static Bot* AsSpawned_ByClass(Client *bot_owner, std::list &sbl, uint8 cls, bool petless = false) { + static Bot* AsSpawned_ByClass(Client *bot_owner, std::vector &sbl, uint8 cls, bool petless = false) { if (!bot_owner) { return nullptr; } @@ -1188,7 +1188,7 @@ namespace ActionableBots return nullptr; } - static Bot* AsSpawned_ByMinLevelAndClass(Client *bot_owner, std::list &sbl, uint8 minlvl, uint8 cls, bool petless = false) { + static Bot* AsSpawned_ByMinLevelAndClass(Client *bot_owner, std::vector &sbl, uint8 minlvl, uint8 cls, bool petless = false) { // This function can be nixed if we can enforce bot level as owner level..and the level check can then be moved to the spell loop in the command function if (!bot_owner) return nullptr; @@ -1218,7 +1218,7 @@ namespace ActionableBots if (!bot_owner || bot_name.empty()) return nullptr; - std::list selectable_bot_list; + std::vector selectable_bot_list; MyBots::PopulateSBL_BySpawnedBots(bot_owner, selectable_bot_list); for (auto bot_iter : selectable_bot_list) { if (!bot_name.compare(bot_iter->GetCleanName())) @@ -1228,7 +1228,7 @@ namespace ActionableBots return nullptr; } - static Bot* Select_ByClass(Client* bot_owner, BCEnum::TType target_type, std::list& sbl, uint8 cls, Mob* target_mob = nullptr, bool petless = false) { + static Bot* Select_ByClass(Client* bot_owner, BCEnum::TType target_type, std::vector& sbl, uint8 cls, Mob* target_mob = nullptr, bool petless = false) { if (!bot_owner || sbl.empty()) return nullptr; @@ -1252,7 +1252,7 @@ namespace ActionableBots return nullptr; } - static Bot* Select_ByMinLevelAndClass(Client* bot_owner, BCEnum::TType target_type, std::list& sbl, uint8 minlvl, uint8 cls, Mob* target_mob = nullptr, bool petless = false) { + static Bot* Select_ByMinLevelAndClass(Client* bot_owner, BCEnum::TType target_type, std::vector& sbl, uint8 minlvl, uint8 cls, Mob* target_mob = nullptr, bool petless = false) { if (!bot_owner || sbl.empty()) return nullptr; @@ -1277,23 +1277,23 @@ namespace ActionableBots } // Filters actual 'sbl' list - static void Filter_ByClasses(Client* bot_owner, std::list& sbl, uint16 class_mask) { - sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); - sbl.remove_if([class_mask](const Bot* l) { return (GetPlayerClassBit(l->GetClass()) & (~class_mask)); }); + static void Filter_ByClasses(Client* bot_owner, std::vector& sbl, uint16 class_mask) { + std::erase_if(sbl, [bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); + std::erase_if(sbl, [class_mask](Bot* l) { return (GetPlayerClassBit(l->GetClass()) & (~class_mask)); }); } - static void Filter_ByMinLevel(Client* bot_owner, std::list& sbl, uint8 min_level) { - sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); - sbl.remove_if([min_level](const Bot* l) { return (l->GetLevel() < min_level); }); + static void Filter_ByMinLevel(Client* bot_owner, std::vector& sbl, uint8 min_level) { + std::erase_if(sbl, [bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); + std::erase_if(sbl, [min_level](Bot* l) { return (l->GetLevel() < min_level); }); } - static void Filter_ByRanged(Client* bot_owner, std::list& sbl) { - sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); - sbl.remove_if([bot_owner](Bot* l) { return (!l->IsBotRanged()); }); + static void Filter_ByRanged(Client* bot_owner, std::vector& sbl) { + std::erase_if(sbl, [bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); + std::erase_if(sbl, [bot_owner](Bot* l) { return (l->IsBotRanged()); }); } - static void Filter_ByHighestSkill(Client* bot_owner, std::list& sbl, EQ::skills::SkillType skill_type, float& skill_value) { - sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); + static void Filter_ByHighestSkill(Client* bot_owner, std::vector& sbl, EQ::skills::SkillType skill_type, float& skill_value) { + std::erase_if(sbl, [bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); skill_value = 0.0f; float mod_skill_value = 0.0f; @@ -1319,15 +1319,14 @@ namespace ActionableBots skilled_bot = bot_iter; } } - - sbl.remove_if([skilled_bot](const Bot* l) { return (l != skilled_bot); }); + std::erase_if(sbl, [skilled_bot](Bot* l) { return (l != skilled_bot); }); } - static void Filter_ByHighestPickLock(Client* bot_owner, std::list& sbl, float& pick_lock_value) { - sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); - sbl.remove_if([bot_owner](const Bot* l) { return (l->GetClass() != Class::Rogue && l->GetClass() != Class::Bard); }); - sbl.remove_if([bot_owner](const Bot* l) { return (l->GetClass() == Class::Rogue && l->GetLevel() < 5); }); - sbl.remove_if([bot_owner](const Bot* l) { return (l->GetClass() == Class::Bard && l->GetLevel() < 40); }); + static void Filter_ByHighestPickLock(Client* bot_owner, std::vector& sbl, float& pick_lock_value) { + std::erase_if(sbl, [bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); + std::erase_if(sbl, [bot_owner](Bot* l) { return (l->GetClass() != Class::Rogue && l->GetClass() != Class::Bard); }); + std::erase_if(sbl, [bot_owner](Bot* l) { return (l->GetClass() == Class::Rogue && l->GetLevel() < 5); }); + std::erase_if(sbl, [bot_owner](Bot* l) { return (l->GetClass() == Class::Bard && l->GetLevel() < 40); }); ActionableBots::Filter_ByHighestSkill(bot_owner, sbl, EQ::skills::SkillPickLock, pick_lock_value); } diff --git a/zone/bot_commands/aggressive.cpp b/zone/bot_commands/aggressive.cpp index b40bf7123..7f26b2a49 100644 --- a/zone/bot_commands/aggressive.cpp +++ b/zone/bot_commands/aggressive.cpp @@ -24,13 +24,13 @@ void bot_command_aggressive(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); int success_count = 0; int candidate_count = sbl.size(); diff --git a/zone/bot_commands/appearance.cpp b/zone/bot_commands/appearance.cpp index c6aed9e08..9ca820e60 100644 --- a/zone/bot_commands/appearance.cpp +++ b/zone/bot_commands/appearance.cpp @@ -214,7 +214,7 @@ void bot_command_dye_armor(Client *c, const Seperator *sep) uint32 rgb_value = ((uint32)red_value << 16) | ((uint32)green_value << 8) | ((uint32)blue_value); - std::list sbl; + std::vector sbl; auto ab_type = ActionableBots::PopulateSBL(c, sep->arg[5], sbl, ab_mask); if (ab_type == ActionableBots::ABT_None) { return; diff --git a/zone/bot_commands/attack.cpp b/zone/bot_commands/attack.cpp index 8cce85db1..6b8a929cb 100644 --- a/zone/bot_commands/attack.cpp +++ b/zone/bot_commands/attack.cpp @@ -34,7 +34,7 @@ void bot_command_attack(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, ab_arg.c_str(), sbl, ab_mask, !class_race_check ? sep->arg[2] : nullptr, class_race_check ? atoi(sep->arg[2]) : 0) == ActionableBots::ABT_None) { return; @@ -47,7 +47,7 @@ void bot_command_attack(Client *c, const Seperator *sep) size_t attacker_count = 0; Bot *first_attacker = nullptr; - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); for (auto bot_iter : sbl) { if (bot_iter->GetAppearance() != eaDead && bot_iter->GetBotStance() != Stance::Passive) { diff --git a/zone/bot_commands/behind_mob.cpp b/zone/bot_commands/behind_mob.cpp index 3abde3c1a..0385ad5b2 100644 --- a/zone/bot_commands/behind_mob.cpp +++ b/zone/bot_commands/behind_mob.cpp @@ -118,12 +118,12 @@ void bot_command_behind_mob(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/blocked_buffs.cpp b/zone/bot_commands/blocked_buffs.cpp index 69a1aa13a..d41dd54bc 100644 --- a/zone/bot_commands/blocked_buffs.cpp +++ b/zone/bot_commands/blocked_buffs.cpp @@ -162,13 +162,13 @@ void bot_command_blocked_buffs(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); bool isSuccess = false; uint16 successCount = 0; @@ -421,13 +421,13 @@ void bot_command_blocked_pet_buffs(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); bool isSuccess = false; uint16 successCount = 0; diff --git a/zone/bot_commands/bot.cpp b/zone/bot_commands/bot.cpp index c836888b2..6678cb521 100644 --- a/zone/bot_commands/bot.cpp +++ b/zone/bot_commands/bot.cpp @@ -51,7 +51,7 @@ void bot_command_camp(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, !class_race_check ? sep->arg[2] : nullptr, class_race_check ? atoi(sep->arg[2]) : 0) == ActionableBots::ABT_None) { return; } @@ -611,13 +611,13 @@ void bot_command_follow_distance(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); int botCount = 0; for (auto bot_iter : sbl) { @@ -704,7 +704,7 @@ void bot_command_inspect_message(Client *c, const Seperator *sep) return; } - std::list sbl; + std::vector sbl; auto ab_type = ActionableBots::PopulateSBL(c, sep->arg[2], sbl, ab_mask, sep->arg[3]); if (ab_type == ActionableBots::ABT_None) return; @@ -947,7 +947,7 @@ void bot_command_report(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } @@ -1377,7 +1377,7 @@ void bot_command_stance(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } @@ -1519,13 +1519,13 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; @@ -1614,12 +1614,12 @@ void bot_command_summon(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); for (auto bot_iter : sbl) { if (!bot_iter) { @@ -1695,7 +1695,7 @@ void bot_command_toggle_ranged(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; @@ -1747,7 +1747,7 @@ void bot_command_toggle_helm(Client *c, const Seperator *sep) ++ab_arg; } - std::list sbl; + std::vector sbl; auto ab_type = ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, sep->arg[(ab_arg + 1)]); if (ab_type == ActionableBots::ABT_None) return; @@ -1844,7 +1844,7 @@ void bot_command_update(Client *c, const Seperator *sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_BySpawnedBots(c, sbl); if (sbl.empty()) { c->Message(Chat::White, "You currently have no spawned bots"); diff --git a/zone/bot_commands/cast.cpp b/zone/bot_commands/cast.cpp index d02c9f2a9..9abd8eb55 100644 --- a/zone/bot_commands/cast.cpp +++ b/zone/bot_commands/cast.cpp @@ -466,13 +466,13 @@ void bot_command_cast(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); BotSpell botSpell; botSpell.SpellId = 0; diff --git a/zone/bot_commands/click_item.cpp b/zone/bot_commands/click_item.cpp index 469750f59..a101dfbd2 100644 --- a/zone/bot_commands/click_item.cpp +++ b/zone/bot_commands/click_item.cpp @@ -39,13 +39,13 @@ void bot_command_click_item(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); for (auto my_bot : sbl) { if (my_bot->BotPassiveCheck()) { diff --git a/zone/bot_commands/default_settings.cpp b/zone/bot_commands/default_settings.cpp index 2e3ecc9c2..0843e9a8f 100644 --- a/zone/bot_commands/default_settings.cpp +++ b/zone/bot_commands/default_settings.cpp @@ -187,12 +187,12 @@ void bot_command_default_settings(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/defensive.cpp b/zone/bot_commands/defensive.cpp index 081e07f34..4fcf0fce2 100644 --- a/zone/bot_commands/defensive.cpp +++ b/zone/bot_commands/defensive.cpp @@ -22,12 +22,12 @@ void bot_command_defensive(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); int success_count = 0; int candidate_count = sbl.size(); diff --git a/zone/bot_commands/depart.cpp b/zone/bot_commands/depart.cpp index 23bb375b1..c82acd1ba 100644 --- a/zone/bot_commands/depart.cpp +++ b/zone/bot_commands/depart.cpp @@ -147,13 +147,13 @@ void bot_command_depart(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); BotSpell botSpell; botSpell.SpellId = 0; diff --git a/zone/bot_commands/distance_ranged.cpp b/zone/bot_commands/distance_ranged.cpp index 7c7dec82a..35db3ac75 100644 --- a/zone/bot_commands/distance_ranged.cpp +++ b/zone/bot_commands/distance_ranged.cpp @@ -46,12 +46,12 @@ void bot_command_distance_ranged(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/follow.cpp b/zone/bot_commands/follow.cpp index f970773d7..34e16b7f3 100644 --- a/zone/bot_commands/follow.cpp +++ b/zone/bot_commands/follow.cpp @@ -117,12 +117,12 @@ void bot_command_follow(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); auto botCount = sbl.size(); Mob* follow_mob = nullptr; diff --git a/zone/bot_commands/guard.cpp b/zone/bot_commands/guard.cpp index 1cacd2742..324bfb03c 100644 --- a/zone/bot_commands/guard.cpp +++ b/zone/bot_commands/guard.cpp @@ -30,12 +30,12 @@ void bot_command_guard(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[name_arg] : nullptr, class_race_check ? atoi(sep->arg[name_arg]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); for (auto bot_iter : sbl) { if (clear) { diff --git a/zone/bot_commands/heal_rotation.cpp b/zone/bot_commands/heal_rotation.cpp index b755016fc..0dd57eb37 100644 --- a/zone/bot_commands/heal_rotation.cpp +++ b/zone/bot_commands/heal_rotation.cpp @@ -63,7 +63,7 @@ void bot_command_heal_rotation_adaptive_targeting(Client* c, const Seperator* se std::string adaptive_targeting_arg; - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (!sbl.empty()) { adaptive_targeting_arg = sep->arg[2]; @@ -123,7 +123,7 @@ void bot_command_heal_rotation_add_member(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (sbl.empty()) { c->Message(Chat::White, "You must [name] a new member as a bot that you own to use this command"); @@ -191,7 +191,7 @@ void bot_command_heal_rotation_add_target(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[2]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -283,7 +283,7 @@ void bot_command_heal_rotation_adjust_critical(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[3]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -383,7 +383,7 @@ void bot_command_heal_rotation_adjust_safe(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[3]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -460,7 +460,7 @@ void bot_command_heal_rotation_casting_override(Client* c, const Seperator* sep) std::string casting_override_arg; - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (!sbl.empty()) { casting_override_arg = sep->arg[2]; @@ -534,7 +534,7 @@ void bot_command_heal_rotation_change_interval(Client* c, const Seperator* sep) std::string change_interval_arg; - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (!sbl.empty()) { change_interval_arg = sep->arg[2]; @@ -603,7 +603,7 @@ void bot_command_heal_rotation_clear_hot(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -649,7 +649,7 @@ void bot_command_heal_rotation_clear_targets(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -703,7 +703,7 @@ void bot_command_heal_rotation_create(Client* c, const Seperator* sep) std::string adaptive_targeting_arg; std::string casting_override_arg; - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (!sbl.empty()) { interval_arg = sep->arg[2]; @@ -858,7 +858,7 @@ void bot_command_heal_rotation_delete(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[name_arg]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -896,7 +896,7 @@ void bot_command_heal_rotation_fast_heals(Client* c, const Seperator* sep) std::string fast_heals_arg; - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (!sbl.empty()) { fast_heals_arg = sep->arg[2]; @@ -956,7 +956,7 @@ void bot_command_heal_rotation_list(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -1076,7 +1076,7 @@ void bot_command_heal_rotation_remove_member(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -1123,7 +1123,7 @@ void bot_command_heal_rotation_remove_target(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[2]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -1181,7 +1181,7 @@ void bot_command_heal_rotation_reset_limits(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -1223,7 +1223,7 @@ void bot_command_heal_rotation_save(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -1272,7 +1272,7 @@ void bot_command_heal_rotation_set_hot(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[2]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -1337,7 +1337,7 @@ void bot_command_heal_rotation_start(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); @@ -1384,7 +1384,7 @@ void bot_command_heal_rotation_stop(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_ByNamedBot(c, sbl, sep->arg[1]); if (sbl.empty()) { MyBots::PopulateSBL_ByTargetedBot(c, sbl); diff --git a/zone/bot_commands/hold.cpp b/zone/bot_commands/hold.cpp index 0fad872dc..e4528a990 100644 --- a/zone/bot_commands/hold.cpp +++ b/zone/bot_commands/hold.cpp @@ -30,12 +30,12 @@ void bot_command_hold(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[name_arg] : nullptr, class_race_check ? atoi(sep->arg[name_arg]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); for (auto bot_iter : sbl) { if (clear) { diff --git a/zone/bot_commands/illusion_block.cpp b/zone/bot_commands/illusion_block.cpp index 47d2d6b26..1ad5e8465 100644 --- a/zone/bot_commands/illusion_block.cpp +++ b/zone/bot_commands/illusion_block.cpp @@ -118,12 +118,12 @@ void bot_command_illusion_block(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/inventory.cpp b/zone/bot_commands/inventory.cpp index 7371475ed..b83ce228c 100644 --- a/zone/bot_commands/inventory.cpp +++ b/zone/bot_commands/inventory.cpp @@ -34,7 +34,7 @@ void bot_command_inventory_give(Client* c, const Seperator* sep) int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName); - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) { return; } @@ -67,7 +67,7 @@ void bot_command_inventory_list(Client* c, const Seperator* sep) int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName); - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) { return; } @@ -168,7 +168,7 @@ void bot_command_inventory_remove(Client* c, const Seperator* sep) return; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[2], sbl, ab_mask, sep->arg[3]) == ActionableBots::ABT_None) { return; } @@ -311,7 +311,7 @@ void bot_command_inventory_window(Client* c, const Seperator* sep) int ab_mask = ActionableBots::ABM_Target; - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) { return; } diff --git a/zone/bot_commands/item_use.cpp b/zone/bot_commands/item_use.cpp index 0db5983dc..f76c5e48b 100644 --- a/zone/bot_commands/item_use.cpp +++ b/zone/bot_commands/item_use.cpp @@ -136,13 +136,13 @@ void bot_command_item_use(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); EQ::SayLinkEngine linker; linker.SetLinkType(EQ::saylink::SayLinkItemData); diff --git a/zone/bot_commands/max_melee_range.cpp b/zone/bot_commands/max_melee_range.cpp index 6c4460ac2..a8df8eecc 100644 --- a/zone/bot_commands/max_melee_range.cpp +++ b/zone/bot_commands/max_melee_range.cpp @@ -117,12 +117,12 @@ void bot_command_max_melee_range(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/pet.cpp b/zone/bot_commands/pet.cpp index d0345ced2..ce01596ad 100644 --- a/zone/bot_commands/pet.cpp +++ b/zone/bot_commands/pet.cpp @@ -25,7 +25,7 @@ void bot_command_pet_get_lost(Client *c, const Seperator *sep) } int ab_mask = ActionableBots::ABM_NoFilter; - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) return; @@ -56,7 +56,7 @@ void bot_command_pet_remove(Client *c, const Seperator *sep) } int ab_mask = (ActionableBots::ABM_Target | ActionableBots::ABM_ByName); - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) return; @@ -66,7 +66,7 @@ void bot_command_pet_remove(Client *c, const Seperator *sep) c->Message(Chat::White, "You have no spawned bots capable of charming"); return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); int charmed_pet = 0; int summoned_pet = 0; @@ -241,13 +241,13 @@ void bot_command_pet_set_type(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); std::string currentType; uint16 reclaim_energy_id = RuleI(Bots, ReclaimEnergySpellID); diff --git a/zone/bot_commands/pick_lock.cpp b/zone/bot_commands/pick_lock.cpp index 7c4379458..d34ab6f98 100644 --- a/zone/bot_commands/pick_lock.cpp +++ b/zone/bot_commands/pick_lock.cpp @@ -11,7 +11,7 @@ void bot_command_pick_lock(Client *c, const Seperator *sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_BySpawnedBots(c, sbl); float pick_lock_value = 0.0f; diff --git a/zone/bot_commands/pickpocket.cpp b/zone/bot_commands/pickpocket.cpp index 5aec32383..8b5339cca 100644 --- a/zone/bot_commands/pickpocket.cpp +++ b/zone/bot_commands/pickpocket.cpp @@ -15,7 +15,7 @@ void bot_command_pickpocket(Client *c, const Seperator *sep) return; } - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_BySpawnedBots(c, sbl); // Check for capable rogue diff --git a/zone/bot_commands/pull.cpp b/zone/bot_commands/pull.cpp index 535743712..9d60408bc 100644 --- a/zone/bot_commands/pull.cpp +++ b/zone/bot_commands/pull.cpp @@ -28,13 +28,13 @@ void bot_command_pull(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, actionableArg, sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); auto target_mob = ActionableTarget::VerifyEnemy(c, BCEnum::TT_Single); if (!target_mob) { diff --git a/zone/bot_commands/release.cpp b/zone/bot_commands/release.cpp index bf8741d33..9bd9d979c 100644 --- a/zone/bot_commands/release.cpp +++ b/zone/bot_commands/release.cpp @@ -10,11 +10,11 @@ void bot_command_release(Client *c, const Seperator *sep) } const int ab_mask = ActionableBots::ABM_NoFilter; - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) return; - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); for (auto bot_iter : sbl) { bot_iter->WipeHateList(); bot_iter->SetPauseAI(false); diff --git a/zone/bot_commands/sit_hp_percent.cpp b/zone/bot_commands/sit_hp_percent.cpp index a8f6d76ff..e374ac5e2 100644 --- a/zone/bot_commands/sit_hp_percent.cpp +++ b/zone/bot_commands/sit_hp_percent.cpp @@ -117,12 +117,12 @@ void bot_command_sit_hp_percent(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/sit_in_combat.cpp b/zone/bot_commands/sit_in_combat.cpp index eaf08e0ae..e40c79dc2 100644 --- a/zone/bot_commands/sit_in_combat.cpp +++ b/zone/bot_commands/sit_in_combat.cpp @@ -117,12 +117,12 @@ void bot_command_sit_in_combat(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/sit_mana_percent.cpp b/zone/bot_commands/sit_mana_percent.cpp index 0c538023c..6c2f2fd43 100644 --- a/zone/bot_commands/sit_mana_percent.cpp +++ b/zone/bot_commands/sit_mana_percent.cpp @@ -117,12 +117,12 @@ void bot_command_sit_mana_percent(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_aggro_checks.cpp b/zone/bot_commands/spell_aggro_checks.cpp index c1b824101..e4c64a24c 100644 --- a/zone/bot_commands/spell_aggro_checks.cpp +++ b/zone/bot_commands/spell_aggro_checks.cpp @@ -177,12 +177,12 @@ void bot_command_spell_aggro_checks(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_delays.cpp b/zone/bot_commands/spell_delays.cpp index 165770cbc..ea7250e8c 100644 --- a/zone/bot_commands/spell_delays.cpp +++ b/zone/bot_commands/spell_delays.cpp @@ -183,12 +183,12 @@ void bot_command_spell_delays(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_engaged_priority.cpp b/zone/bot_commands/spell_engaged_priority.cpp index 2c5208d14..b934d5ccb 100644 --- a/zone/bot_commands/spell_engaged_priority.cpp +++ b/zone/bot_commands/spell_engaged_priority.cpp @@ -181,12 +181,12 @@ void bot_command_spell_engaged_priority(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_holds.cpp b/zone/bot_commands/spell_holds.cpp index d83b5369b..4f14129c4 100644 --- a/zone/bot_commands/spell_holds.cpp +++ b/zone/bot_commands/spell_holds.cpp @@ -167,12 +167,12 @@ void bot_command_spell_holds(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_idle_priority.cpp b/zone/bot_commands/spell_idle_priority.cpp index 9576d4a8f..82676db3c 100644 --- a/zone/bot_commands/spell_idle_priority.cpp +++ b/zone/bot_commands/spell_idle_priority.cpp @@ -181,12 +181,12 @@ void bot_command_spell_idle_priority(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_max_hp_pct.cpp b/zone/bot_commands/spell_max_hp_pct.cpp index 42c552cdb..50c83e6dd 100644 --- a/zone/bot_commands/spell_max_hp_pct.cpp +++ b/zone/bot_commands/spell_max_hp_pct.cpp @@ -177,12 +177,12 @@ void bot_command_spell_max_hp_pct(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_max_mana_pct.cpp b/zone/bot_commands/spell_max_mana_pct.cpp index da8ad9d36..2bd4aa323 100644 --- a/zone/bot_commands/spell_max_mana_pct.cpp +++ b/zone/bot_commands/spell_max_mana_pct.cpp @@ -177,12 +177,12 @@ void bot_command_spell_max_mana_pct(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_max_thresholds.cpp b/zone/bot_commands/spell_max_thresholds.cpp index ed3316c01..432e506fd 100644 --- a/zone/bot_commands/spell_max_thresholds.cpp +++ b/zone/bot_commands/spell_max_thresholds.cpp @@ -183,12 +183,12 @@ void bot_command_spell_max_thresholds(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_min_hp_pct.cpp b/zone/bot_commands/spell_min_hp_pct.cpp index 3c512ab3a..359ca1d4f 100644 --- a/zone/bot_commands/spell_min_hp_pct.cpp +++ b/zone/bot_commands/spell_min_hp_pct.cpp @@ -177,12 +177,12 @@ void bot_command_spell_min_hp_pct(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_min_mana_pct.cpp b/zone/bot_commands/spell_min_mana_pct.cpp index 43c37ed8c..7963f14a1 100644 --- a/zone/bot_commands/spell_min_mana_pct.cpp +++ b/zone/bot_commands/spell_min_mana_pct.cpp @@ -177,12 +177,12 @@ void bot_command_spell_min_mana_pct(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_min_thresholds.cpp b/zone/bot_commands/spell_min_thresholds.cpp index 4c1b11a3a..2c0257ccb 100644 --- a/zone/bot_commands/spell_min_thresholds.cpp +++ b/zone/bot_commands/spell_min_thresholds.cpp @@ -185,12 +185,12 @@ void bot_command_spell_min_thresholds(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_pursue_priority.cpp b/zone/bot_commands/spell_pursue_priority.cpp index 864bc2ba9..fb90ccd1e 100644 --- a/zone/bot_commands/spell_pursue_priority.cpp +++ b/zone/bot_commands/spell_pursue_priority.cpp @@ -181,12 +181,12 @@ void bot_command_spell_pursue_priority(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/spell_target_count.cpp b/zone/bot_commands/spell_target_count.cpp index 066fe95cc..ff9ea7587 100644 --- a/zone/bot_commands/spell_target_count.cpp +++ b/zone/bot_commands/spell_target_count.cpp @@ -177,12 +177,12 @@ void bot_command_spell_target_count(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); Bot* first_found = nullptr; int success_count = 0; diff --git a/zone/bot_commands/suspend.cpp b/zone/bot_commands/suspend.cpp index 287db739c..63c728fd3 100644 --- a/zone/bot_commands/suspend.cpp +++ b/zone/bot_commands/suspend.cpp @@ -11,12 +11,12 @@ void bot_command_suspend(Client *c, const Seperator *sep) } const int ab_mask = ActionableBots::ABM_NoFilter; - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); for (auto bot_iter : sbl) { bot_iter->SetPauseAI(true); } diff --git a/zone/bot_commands/taunt.cpp b/zone/bot_commands/taunt.cpp index 866e9899c..39d1675ff 100644 --- a/zone/bot_commands/taunt.cpp +++ b/zone/bot_commands/taunt.cpp @@ -36,13 +36,13 @@ void bot_command_taunt(Client *c, const Seperator *sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[(ab_arg + 1)] : nullptr, class_race_check ? atoi(sep->arg[(ab_arg + 1)]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); int taunting_count = 0; for (auto bot_iter : sbl) { diff --git a/zone/bot_commands/timer.cpp b/zone/bot_commands/timer.cpp index 30b495d3a..99ad38001 100644 --- a/zone/bot_commands/timer.cpp +++ b/zone/bot_commands/timer.cpp @@ -95,13 +95,13 @@ void bot_command_timer(Client* c, const Seperator* sep) class_race_check = true; } - std::list sbl; + std::vector sbl; if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) { return; } - sbl.remove(nullptr); + sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); for (auto my_bot : sbl) { bool found = false; diff --git a/zone/bot_commands/track.cpp b/zone/bot_commands/track.cpp index 9ac0904a2..f134c4596 100644 --- a/zone/bot_commands/track.cpp +++ b/zone/bot_commands/track.cpp @@ -13,7 +13,7 @@ void bot_command_track(Client *c, const Seperator *sep) std::string tracking_scope = sep->arg[1]; - std::list sbl; + std::vector sbl; MyBots::PopulateSBL_BySpawnedBots(c, sbl); uint16 class_mask = (player_class_bitmasks[Class::Ranger] | player_class_bitmasks[Class::Druid] | player_class_bitmasks[Class::Bard]); diff --git a/zone/entity.cpp b/zone/entity.cpp index 317663927..a756c9fdc 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1900,13 +1900,13 @@ Bot* EntityList::GetRandomBot(const glm::vec3& location, float distance, Bot* ex for (const auto& b : bot_list) { if ( - b != exclude_bot && + b.second != exclude_bot && ( is_whole_zone || - DistanceSquared(static_cast(b->GetPosition()), location) <= distance_squared - ) + DistanceSquared(static_cast(b.second->GetPosition()), location) <= distance_squared + ) ) { - bots_in_range.push_back(b); + bots_in_range.push_back(b.second); } } @@ -5121,9 +5121,10 @@ void EntityList::GetClientList(std::list &c_list) void EntityList::GetBotList(std::list &b_list) { b_list.clear(); - - for (const auto& b : bot_list) { - b_list.push_back(b); + auto it = bot_list.begin(); + while (it != bot_list.end()) { + b_list.push_back(it->second); + ++it; } } @@ -5135,14 +5136,13 @@ std::vector EntityList::GetBotListByCharacterID(uint32 character_id, uint return client_bot_list; } - for (const auto& b : bot_list) { - if ( - b->GetOwner() && - b->GetBotOwnerCharacterID() == character_id && - (!class_id || b->GetClass() == class_id) - ) { - client_bot_list.push_back(b); + auto it = bot_list.begin(); + + while (it != bot_list.end()) { + if (it->second->GetOwner() && it->second->GetBotOwnerCharacterID() == character_id && (!class_id || it->second->GetClass() == class_id)) { + client_bot_list.push_back(it->second); } + ++it; } return client_bot_list; @@ -5156,14 +5156,13 @@ std::vector EntityList::GetBotListByClientName(std::string client_name, u return client_bot_list; } - for (const auto& b : bot_list) { - if ( - b->GetOwner() && - Strings::ToLower(b->GetOwner()->GetCleanName()) == Strings::ToLower(client_name) && - (!class_id || b->GetClass() == class_id) - ) { - client_bot_list.push_back(b); + auto it = bot_list.begin(); + + while (it != bot_list.end()) { + if (it->second->GetOwner() && Strings::ToLower(it->second->GetOwner()->GetCleanName()) == Strings::ToLower(client_name) && (!class_id || it->second->GetClass() == class_id)) { + client_bot_list.push_back(it->second); } + ++it; } return client_bot_list; diff --git a/zone/entity.h b/zone/entity.h index c9d48bc7d..4b5c9b690 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -547,7 +547,7 @@ public: inline const std::unordered_map &GetNPCList() { return npc_list; } inline const std::unordered_map &GetMercList() { return merc_list; } inline const std::unordered_map &GetClientList() { return client_list; } - inline const std::list &GetBotList() { return bot_list; } + inline const std::unordered_map &GetBotList() { return bot_list; } std::vector GetBotListByCharacterID(uint32 character_id, uint8 class_id = Class::None); std::vector GetBotListByClientName(std::string client_name, uint8 class_id = Class::None); void SignalAllBotsByOwnerCharacterID(uint32 character_id, int signal_id); @@ -623,10 +623,10 @@ private: bool RemoveBot(uint16 entityID); Mob* GetMobByBotID(uint32 botID); Bot* GetBotByBotID(uint32 botID); - Bot* GetBotByBotName(std::string_view botName); + Bot* GetBotByBotName(std::string botName); Client* GetBotOwnerByBotEntityID(uint32 entity_id); Client* GetBotOwnerByBotID(const uint32 bot_id); - std::list GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID); + std::vector GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID); void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff @@ -634,7 +634,7 @@ private: void GetBotList(std::list &b_list); private: - std::list bot_list; + std::unordered_map bot_list; }; class BulkZoneSpawnPacket { diff --git a/zone/gm_commands/list.cpp b/zone/gm_commands/list.cpp index 5019c09b8..7e05a1d6a 100755 --- a/zone/gm_commands/list.cpp +++ b/zone/gm_commands/list.cpp @@ -74,20 +74,22 @@ void command_list(Client *c, const Seperator *sep) if (is_bots) { const auto& l = entity_list.GetBotList(); - for (const auto& e: l) { + for (const auto& e : l) { + Bot* entity = e.second; + entity_count++; - const std::string& entity_name = Strings::ToLower(e->GetName()); + const std::string& entity_name = Strings::ToLower(entity->GetName()); if (!search_string.empty() && !Strings::Contains(entity_name, search_string)) { continue; } unique_entities.emplace_back( UniqueEntity{ - .entity_id = e->GetID(), - .entity_name = e->GetName(), - .unique_id = e->GetBotID(), - .position = e->GetPosition() + .entity_id = entity->GetID(), + .entity_name = entity->GetName(), + .unique_id = entity->GetBotID(), + .position = entity->GetPosition() } ); diff --git a/zone/lua_entity_list.cpp b/zone/lua_entity_list.cpp index 45c0e6621..4b99c869e 100644 --- a/zone/lua_entity_list.cpp +++ b/zone/lua_entity_list.cpp @@ -382,12 +382,13 @@ Lua_Bot Lua_EntityList::GetBotByName(std::string bot_name) { Lua_Bot_List Lua_EntityList::GetBotList() { Lua_Safe_Call_Class(Lua_Bot_List); Lua_Bot_List ret; - auto &bot_list = self->GetBotList(); - if (bot_list.size()) { - for (auto bot : bot_list) { - ret.entries.emplace_back(Lua_Bot(bot)); - } + auto ¤t_bot_list = self->GetBotList(); + auto it = current_bot_list.begin(); + + while (it != current_bot_list.end()) { + ret.entries.emplace_back(it->second); + ++it; } return ret; diff --git a/zone/perl_entity.cpp b/zone/perl_entity.cpp index 64860f4a2..eaad24db5 100644 --- a/zone/perl_entity.cpp +++ b/zone/perl_entity.cpp @@ -419,10 +419,13 @@ perl::array Perl_EntityList_GetBotList(EntityList* self) // @categories Script U { perl::array result; auto current_bot_list = self->GetBotList(); - for (Bot* bot_iterator : current_bot_list) - { - result.push_back(bot_iterator); + auto it = current_bot_list.begin(); + + while (it != current_bot_list.end()) { + result.push_back(it->second); + ++it; } + return result; }