refactor(src/common): remove unused imports (#19506)

* refactor(src/common): remove unused imports

* fix: build

* chore: fix build

* chore: size_t -> std::size_t

* chore: fix fuckup from previous commit

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build with std::size_t

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build
This commit is contained in:
Francesco Borzì
2024-07-31 01:06:46 +02:00
committed by GitHub
parent 06a608d244
commit 02a05fbd4c
200 changed files with 522 additions and 581 deletions
@@ -480,9 +480,9 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e)
{
size_t paramsStructSize = [&]() -> size_t
std::size_t paramsStructSize = [&]() -> std::size_t
{
constexpr size_t NO_PARAMS = size_t(0);
constexpr std::size_t NO_PARAMS = std::size_t(0);
switch (e.event.type)
{
case SMART_EVENT_UPDATE_IC: return sizeof(SmartEvent::minMaxRepeat);
@@ -584,11 +584,11 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e)
}
}();
static size_t rawCount = sizeof(SmartEvent::raw) / sizeof(uint32);
size_t paramsCount = paramsStructSize / sizeof(uint32);
static std::size_t rawCount = sizeof(SmartEvent::raw) / sizeof(uint32);
std::size_t paramsCount = paramsStructSize / sizeof(uint32);
bool valid = true;
for (size_t index = paramsCount; index < rawCount; index++)
for (std::size_t index = paramsCount; index < rawCount; index++)
{
uint32 value = ((uint32*)&e.event.raw)[index];
if (value != 0)
@@ -604,9 +604,9 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e)
bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
{
size_t paramsStructSize = [&]() -> size_t
std::size_t paramsStructSize = [&]() -> std::size_t
{
constexpr size_t NO_PARAMS = size_t(0);
constexpr std::size_t NO_PARAMS = std::size_t(0);
switch (e.action.type)
{
case SMART_ACTION_NONE: return NO_PARAMS;
@@ -784,11 +784,11 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
}
}();
static size_t rawCount = sizeof(SmartAction::raw) / sizeof(uint32);
size_t paramsCount = paramsStructSize / sizeof(uint32);
static std::size_t rawCount = sizeof(SmartAction::raw) / sizeof(uint32);
std::size_t paramsCount = paramsStructSize / sizeof(uint32);
bool valid = true;
for (size_t index = paramsCount; index < rawCount; index++)
for (std::size_t index = paramsCount; index < rawCount; index++)
{
uint32 value = ((uint32*)&e.action.raw)[index];
if (value != 0)
@@ -804,9 +804,9 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
bool SmartAIMgr::CheckUnusedTargetParams(SmartScriptHolder const& e)
{
size_t paramsStructSize = [&]() -> size_t
std::size_t paramsStructSize = [&]() -> std::size_t
{
constexpr size_t NO_PARAMS = size_t(0);
constexpr std::size_t NO_PARAMS = std::size_t(0);
switch (e.target.type)
{
case SMART_TARGET_NONE: return NO_PARAMS;
@@ -848,11 +848,11 @@ bool SmartAIMgr::CheckUnusedTargetParams(SmartScriptHolder const& e)
}
}();
static size_t rawCount = sizeof(SmartTarget::raw) / sizeof(uint32);
size_t paramsCount = paramsStructSize / sizeof(uint32);
static std::size_t rawCount = sizeof(SmartTarget::raw) / sizeof(uint32);
std::size_t paramsCount = paramsStructSize / sizeof(uint32);
bool valid = true;
for (size_t index = paramsCount; index < rawCount; index++)
for (std::size_t index = paramsCount; index < rawCount; index++)
{
uint32 value = ((uint32*)&e.target.raw)[index];
if (value != 0)
+3 -3
View File
@@ -40,10 +40,10 @@ AC_API_EXPORT EnumText EnumUtils<CreatureAI::EvadeReason>::ToString(CreatureAI::
}
template <>
AC_API_EXPORT size_t EnumUtils<CreatureAI::EvadeReason>::Count() { return 4; }
AC_API_EXPORT std::size_t EnumUtils<CreatureAI::EvadeReason>::Count() { return 4; }
template <>
AC_API_EXPORT CreatureAI::EvadeReason EnumUtils<CreatureAI::EvadeReason>::FromIndex(size_t index)
AC_API_EXPORT CreatureAI::EvadeReason EnumUtils<CreatureAI::EvadeReason>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -56,7 +56,7 @@ AC_API_EXPORT CreatureAI::EvadeReason EnumUtils<CreatureAI::EvadeReason>::FromIn
}
template <>
AC_API_EXPORT size_t EnumUtils<CreatureAI::EvadeReason>::ToIndex(CreatureAI::EvadeReason value)
AC_API_EXPORT std::size_t EnumUtils<CreatureAI::EvadeReason>::ToIndex(CreatureAI::EvadeReason value)
{
switch (value)
{
@@ -212,7 +212,7 @@ bool ArenaSpectator::HandleSpectatorWatchCommand(ChatHandler* handler, std::stri
void ArenaSpectator::CreatePacket(WorldPacket& data, std::string const& message)
{
size_t len = message.length();
std::size_t len = message.length();
data.Initialize(SMSG_MESSAGECHAT, 1 + 4 + 8 + 4 + 8 + 4 + 1 + len + 1);
data << uint8(CHAT_MSG_WHISPER);
data << uint32(LANG_ADDON);
+1 -1
View File
@@ -167,7 +167,7 @@ public:
// and this method removes given record from list. So invalid reference can happen.
void DelMember(ObjectGuid guid, bool cleanDb);
[[nodiscard]] size_t GetMembersSize() const { return Members.size(); }
[[nodiscard]] std::size_t GetMembersSize() const { return Members.size(); }
[[nodiscard]] bool Empty() const { return Members.empty(); }
MemberList::iterator m_membersBegin() { return Members.begin(); }
MemberList::iterator m_membersEnd() { return Members.end(); }
@@ -608,7 +608,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid
*data << uint32(0); // unk (count?)
else // battleground
{
size_t count_pos = data->wpos();
std::size_t count_pos = data->wpos();
*data << uint32(0); // number of bg instances
auto const& it = bgDataStore.find(bgTypeId);
@@ -39,10 +39,10 @@ AC_API_EXPORT EnumText EnumUtils<ArenaTeamTypes>::ToString(ArenaTeamTypes value)
}
template <>
AC_API_EXPORT size_t EnumUtils<ArenaTeamTypes>::Count() { return 3; }
AC_API_EXPORT std::size_t EnumUtils<ArenaTeamTypes>::Count() { return 3; }
template <>
AC_API_EXPORT ArenaTeamTypes EnumUtils<ArenaTeamTypes>::FromIndex(size_t index)
AC_API_EXPORT ArenaTeamTypes EnumUtils<ArenaTeamTypes>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -54,7 +54,7 @@ AC_API_EXPORT ArenaTeamTypes EnumUtils<ArenaTeamTypes>::FromIndex(size_t index)
}
template <>
AC_API_EXPORT size_t EnumUtils<ArenaTeamTypes>::ToIndex(ArenaTeamTypes value)
AC_API_EXPORT std::size_t EnumUtils<ArenaTeamTypes>::ToIndex(ArenaTeamTypes value)
{
switch (value)
{
+1 -1
View File
@@ -182,7 +182,7 @@ void CalendarMgr::RemoveEvent(CalendarEvent* calendarEvent, ObjectGuid remover)
MailDraft mail(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody());
CalendarInviteStore& eventInvites = _invites[calendarEvent->GetEventId()];
for (size_t i = 0; i < eventInvites.size(); ++i)
for (std::size_t i = 0; i < eventInvites.size(); ++i)
{
CalendarInvite* invite = eventInvites[i];
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_INVITE);
+1 -1
View File
@@ -706,7 +706,7 @@ void Channel::List(Player const* player)
data << GetName(); // channel name
data << uint8(GetFlags()); // channel flags?
size_t pos = data.wpos();
std::size_t pos = data.wpos();
data << uint32(0); // size of list, placeholder
uint32 count = 0;
@@ -72,10 +72,10 @@ AC_API_EXPORT EnumText EnumUtils<ChatNotify>::ToString(ChatNotify value)
}
template <>
AC_API_EXPORT size_t EnumUtils<ChatNotify>::Count() { return 36; }
AC_API_EXPORT std::size_t EnumUtils<ChatNotify>::Count() { return 36; }
template <>
AC_API_EXPORT ChatNotify EnumUtils<ChatNotify>::FromIndex(size_t index)
AC_API_EXPORT ChatNotify EnumUtils<ChatNotify>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -120,7 +120,7 @@ AC_API_EXPORT ChatNotify EnumUtils<ChatNotify>::FromIndex(size_t index)
}
template <>
AC_API_EXPORT size_t EnumUtils<ChatNotify>::ToIndex(ChatNotify value)
AC_API_EXPORT std::size_t EnumUtils<ChatNotify>::ToIndex(ChatNotify value)
{
switch (value)
{
+5 -5
View File
@@ -145,7 +145,7 @@ void ChatHandler::SendSysMessage(std::string_view str, bool escapeCharacters)
std::vector<std::string_view> tokens = Acore::Tokenize(msg, '|', true);
std::ostringstream stream;
for (size_t i = 0; i < tokens.size() - 1; ++i)
for (std::size_t i = 0; i < tokens.size() - 1; ++i)
stream << tokens[i] << "||";
stream << tokens[tokens.size() - 1];
@@ -240,11 +240,11 @@ bool ChatHandler::ParseCommands(std::string_view text)
return _ParseCommands(text.substr(1));
}
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag,
std::size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag,
std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/,
uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/)
{
size_t receiverGUIDPos = 0;
std::size_t receiverGUIDPos = 0;
data.Initialize(!gmMessage ? SMSG_MESSAGECHAT : SMSG_GM_MESSAGECHAT);
data << uint8(chatType);
data << int32(language);
@@ -320,7 +320,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
return receiverGUIDPos;
}
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message,
std::size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message,
uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/)
{
ObjectGuid senderGUID;
@@ -1022,7 +1022,7 @@ void AddonChannelCommandHandler::SendSysMessage(std::string_view str, bool escap
std::string body(str);
if (escapeCharacters)
boost::replace_all(body, "|", "||");
size_t pos, lastpos;
std::size_t pos, lastpos;
for (lastpos = 0, pos = body.find('\n', lastpos); pos != std::string::npos; lastpos = pos + 1, pos = body.find('\n', lastpos))
{
std::string line(msg);
+2 -2
View File
@@ -42,12 +42,12 @@ public:
virtual ~ChatHandler() { }
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag,
static std::size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag,
std::string const& senderName = "", std::string const& receiverName = "",
uint32 achievementId = 0, bool gmMessage = false, std::string const& channelName = "");
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message, uint32 achievementId = 0, std::string const& channelName = "", LocaleConstant locale = DEFAULT_LOCALE);
static std::size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message, uint32 achievementId = 0, std::string const& channelName = "", LocaleConstant locale = DEFAULT_LOCALE);
static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; }
@@ -58,7 +58,7 @@ void Acore::Impl::ChatCommands::ChatCommandNode::LoadFromBuilder(ChatCommandBuil
std::vector<std::string_view> const tokens = Acore::Tokenize(builder._name, COMMAND_DELIMITER, false);
ASSERT(!tokens.empty(), "Invalid command name '{}'.", builder._name);
ChatSubCommandMap* subMap = &map;
for (size_t i = 0, n = (tokens.size() - 1); i < n; ++i)
for (std::size_t i = 0, n = (tokens.size() - 1); i < n; ++i)
subMap = &((*subMap)[tokens[i]]._subCommands);
((*subMap)[tokens.back()]).LoadFromBuilder(builder);
}
@@ -55,10 +55,10 @@ namespace Acore::Impl::ChatCommands
// ConsumeFromOffset contains the bounds check for offset, then hands off to MultiConsumer
// the call stack is MultiConsumer -> ConsumeFromOffset -> MultiConsumer -> ConsumeFromOffset etc
// MultiConsumer goes into ArgInfo for parsing on each iteration
template <typename Tuple, size_t offset>
template <typename Tuple, std::size_t offset>
ChatCommandResult ConsumeFromOffset(Tuple&, ChatHandler const* handler, std::string_view args);
template <typename Tuple, typename NextType, size_t offset>
template <typename Tuple, typename NextType, std::size_t offset>
struct MultiConsumer
{
static ChatCommandResult TryConsumeTo(Tuple& tuple, ChatHandler const* handler, std::string_view args)
@@ -71,7 +71,7 @@ namespace Acore::Impl::ChatCommands
}
};
template <typename Tuple, typename NestedNextType, size_t offset>
template <typename Tuple, typename NestedNextType, std::size_t offset>
struct MultiConsumer<Tuple, Optional<NestedNextType>, offset>
{
static ChatCommandResult TryConsumeTo(Tuple& tuple, ChatHandler const* handler, std::string_view args)
@@ -102,7 +102,7 @@ namespace Acore::Impl::ChatCommands
}
};
template <typename Tuple, size_t offset>
template <typename Tuple, std::size_t offset>
ChatCommandResult ConsumeFromOffset([[maybe_unused]] Tuple& tuple, [[maybe_unused]] ChatHandler const* handler, std::string_view args)
{
if constexpr (offset < std::tuple_size_v<Tuple>)
@@ -237,7 +237,7 @@ namespace Acore::Impl::ChatCommands
};
// fixed-size array
template <typename T, size_t N>
template <typename T, std::size_t N>
struct ArgInfo<std::array<T, N>, void>
{
static ChatCommandResult TryConsume(std::array<T, N>& val, ChatHandler const* handler, std::string_view args)
@@ -255,9 +255,9 @@ namespace Acore::Impl::ChatCommands
struct ArgInfo<Acore::ChatCommands::Variant<Ts...>>
{
using V = std::variant<Ts...>;
static constexpr size_t N = std::variant_size_v<V>;
static constexpr std::size_t N = std::variant_size_v<V>;
template <size_t I>
template <std::size_t I>
static ChatCommandResult TryAtIndex([[maybe_unused]] Acore::ChatCommands::Variant<Ts...>& val, [[maybe_unused]] ChatHandler const* handler, [[maybe_unused]] std::string_view args)
{
if constexpr (I < N)
@@ -55,10 +55,10 @@ namespace Acore::Impl::ChatCommands
inline TokenizeResult tokenize(std::string_view args)
{
TokenizeResult result;
if (size_t delimPos = args.find(COMMAND_DELIMITER); delimPos != std::string_view::npos)
if (std::size_t delimPos = args.find(COMMAND_DELIMITER); delimPos != std::string_view::npos)
{
result.token = args.substr(0, delimPos);
if (size_t tailPos = args.find_first_not_of(COMMAND_DELIMITER, delimPos); tailPos != std::string_view::npos)
if (std::size_t tailPos = args.find_first_not_of(COMMAND_DELIMITER, delimPos); tailPos != std::string_view::npos)
result.tail = args.substr(tailPos);
}
else
@@ -34,7 +34,7 @@ ChatCommandResult Acore::ChatCommands::QuotedString::TryConsume(ChatHandler cons
return ArgInfo<std::string>::TryConsume(*this, handler, args);
char const QUOTE = args[0];
for (size_t i = 1; i < args.length(); ++i)
for (std::size_t i = 1; i < args.length(); ++i)
{
if (args[i] == QUOTE)
{
@@ -51,8 +51,8 @@ namespace Acore::Impl::ChatCommands
using type = typename T::value_type;
};
template <size_t N>
inline constexpr char GetChar(char const (&s)[N], size_t i)
template <std::size_t N>
inline constexpr char GetChar(char const (&s)[N], std::size_t i)
{
static_assert(N <= 25, "The EXACT_SEQUENCE macro can only be used with up to 25 character long literals. Specify them char-by-char (null terminated) as parameters to ExactSequence<> instead.");
return i >= N ? '\0' : s[i];
@@ -273,7 +273,7 @@ namespace Acore::ChatCommands
}
template<bool C = have_operators>
operator std::enable_if_t<C && !std::is_same_v<first_type, size_t> && std::is_convertible_v<first_type, size_t>, size_t>() const
operator std::enable_if_t<C && !std::is_same_v<first_type, std::size_t> && std::is_convertible_v<first_type, std::size_t>, std::size_t>() const
{
return operator*();
}
@@ -284,9 +284,9 @@ namespace Acore::ChatCommands
template <typename T>
Variant& operator=(T&& arg) { base::operator=(std::forward<T>(arg)); return *this; }
template <size_t index>
template <std::size_t index>
constexpr decltype(auto) get() { return std::get<index>(static_cast<base&>(*this)); }
template <size_t index>
template <std::size_t index>
constexpr decltype(auto) get() const { return std::get<index>(static_cast<base const&>(*this)); }
template <typename type>
constexpr decltype(auto) get() { return std::get<type>(static_cast<base&>(*this)); }
+1 -1
View File
@@ -35,7 +35,7 @@ class HyperlinkDataTokenizer
if (IsEmpty())
return false;
if (size_t off = _str.find(HYPERLINK_DATA_DELIMITER); off != std::string_view::npos)
if (std::size_t off = _str.find(HYPERLINK_DATA_DELIMITER); off != std::string_view::npos)
{
if (!Acore::Hyperlinks::LinkTags::base_tag::StoreTo(val, _str.substr(0, off)))
return false;
+3 -3
View File
@@ -61,7 +61,7 @@ HyperlinkInfo Acore::Hyperlinks::ParseSingleHyperlink(std::string_view str)
str.remove_prefix(2);
// tag+data part follows
if (size_t delimPos = str.find('|'); delimPos != std::string_view::npos)
if (std::size_t delimPos = str.find('|'); delimPos != std::string_view::npos)
{
tag = str.substr(0, delimPos);
str.remove_prefix(delimPos+1);
@@ -70,7 +70,7 @@ HyperlinkInfo Acore::Hyperlinks::ParseSingleHyperlink(std::string_view str)
return {};
// split tag if : is present (data separator)
if (size_t dataStart = tag.find(':'); dataStart != std::string_view::npos)
if (std::size_t dataStart = tag.find(':'); dataStart != std::string_view::npos)
{
data = tag.substr(dataStart+1);
tag = tag.substr(0, dataStart);
@@ -81,7 +81,7 @@ HyperlinkInfo Acore::Hyperlinks::ParseSingleHyperlink(std::string_view str)
return {};
str.remove_prefix(1);
// skip to final |
if (size_t end = str.find('|'); end != std::string_view::npos)
if (std::size_t end = str.find('|'); end != std::string_view::npos)
{
// check end tag
if (str.substr(end, 4) != "|h|r")
@@ -337,7 +337,7 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, std::string const
data << uint32(eEmote._Emote); // NPC emote
}
size_t count_pos = data.wpos();
std::size_t count_pos = data.wpos();
data << uint8(0);
uint32 count = 0;
@@ -68,10 +68,10 @@ AC_API_EXPORT EnumText EnumUtils<CreatureFlagsExtra>::ToString(CreatureFlagsExtr
}
template <>
AC_API_EXPORT size_t EnumUtils<CreatureFlagsExtra>::Count() { return 32; }
AC_API_EXPORT std::size_t EnumUtils<CreatureFlagsExtra>::Count() { return 32; }
template <>
AC_API_EXPORT CreatureFlagsExtra EnumUtils<CreatureFlagsExtra>::FromIndex(size_t index)
AC_API_EXPORT CreatureFlagsExtra EnumUtils<CreatureFlagsExtra>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -112,7 +112,7 @@ AC_API_EXPORT CreatureFlagsExtra EnumUtils<CreatureFlagsExtra>::FromIndex(size_t
}
template <>
AC_API_EXPORT size_t EnumUtils<CreatureFlagsExtra>::ToIndex(CreatureFlagsExtra value)
AC_API_EXPORT std::size_t EnumUtils<CreatureFlagsExtra>::ToIndex(CreatureFlagsExtra value)
{
switch (value)
{
+3 -3
View File
@@ -48,7 +48,7 @@ void AddItemsSetItem(Player* player, Item* item)
ItemSetEffect* eff = nullptr;
for (size_t x = 0; x < player->ItemSetEff.size(); ++x)
for (std::size_t x = 0; x < player->ItemSetEff.size(); ++x)
{
if (player->ItemSetEff[x] && player->ItemSetEff[x]->setid == setid)
{
@@ -62,7 +62,7 @@ void AddItemsSetItem(Player* player, Item* item)
eff = new ItemSetEffect();
eff->setid = setid;
size_t x = 0;
std::size_t x = 0;
for (; x < player->ItemSetEff.size(); ++x)
if (!player->ItemSetEff[x])
break;
@@ -129,7 +129,7 @@ void RemoveItemsSetItem(Player* player, ItemTemplate const* proto)
}
ItemSetEffect* eff = nullptr;
size_t setindex = 0;
std::size_t setindex = 0;
for (; setindex < player->ItemSetEff.size(); setindex++)
{
if (player->ItemSetEff[setindex] && player->ItemSetEff[setindex]->setid == setid)
@@ -124,10 +124,10 @@ AC_API_EXPORT EnumText EnumUtils<InventoryResult>::ToString(InventoryResult valu
}
template <>
AC_API_EXPORT size_t EnumUtils<InventoryResult>::Count() { return 88; }
AC_API_EXPORT std::size_t EnumUtils<InventoryResult>::Count() { return 88; }
template <>
AC_API_EXPORT InventoryResult EnumUtils<InventoryResult>::FromIndex(size_t index)
AC_API_EXPORT InventoryResult EnumUtils<InventoryResult>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -224,7 +224,7 @@ AC_API_EXPORT InventoryResult EnumUtils<InventoryResult>::FromIndex(size_t index
}
template <>
AC_API_EXPORT size_t EnumUtils<InventoryResult>::ToIndex(InventoryResult value)
AC_API_EXPORT std::size_t EnumUtils<InventoryResult>::ToIndex(InventoryResult value)
{
switch (value)
{
@@ -342,10 +342,10 @@ AC_API_EXPORT EnumText EnumUtils<BuyResult>::ToString(BuyResult value)
}
template <>
AC_API_EXPORT size_t EnumUtils<BuyResult>::Count() { return 9; }
AC_API_EXPORT std::size_t EnumUtils<BuyResult>::Count() { return 9; }
template <>
AC_API_EXPORT BuyResult EnumUtils<BuyResult>::FromIndex(size_t index)
AC_API_EXPORT BuyResult EnumUtils<BuyResult>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -363,7 +363,7 @@ AC_API_EXPORT BuyResult EnumUtils<BuyResult>::FromIndex(size_t index)
}
template <>
AC_API_EXPORT size_t EnumUtils<BuyResult>::ToIndex(BuyResult value)
AC_API_EXPORT std::size_t EnumUtils<BuyResult>::ToIndex(BuyResult value)
{
switch (value)
{
@@ -402,10 +402,10 @@ AC_API_EXPORT EnumText EnumUtils<SellResult>::ToString(SellResult value)
}
template <>
AC_API_EXPORT size_t EnumUtils<SellResult>::Count() { return 9; }
AC_API_EXPORT std::size_t EnumUtils<SellResult>::Count() { return 9; }
template <>
AC_API_EXPORT SellResult EnumUtils<SellResult>::FromIndex(size_t index)
AC_API_EXPORT SellResult EnumUtils<SellResult>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -423,7 +423,7 @@ AC_API_EXPORT SellResult EnumUtils<SellResult>::FromIndex(size_t index)
}
template <>
AC_API_EXPORT size_t EnumUtils<SellResult>::ToIndex(SellResult value)
AC_API_EXPORT std::size_t EnumUtils<SellResult>::ToIndex(SellResult value)
{
switch (value)
{
+1
View File
@@ -31,6 +31,7 @@
#include "Position.h"
#include "UpdateData.h"
#include "UpdateMask.h"
#include <memory>
#include <set>
#include <sstream>
#include <string>
+1 -1
View File
@@ -321,7 +321,7 @@ namespace std
struct hash<ObjectGuid>
{
public:
size_t operator()(ObjectGuid const& key) const
std::size_t operator()(ObjectGuid const& key) const
{
return std::hash<uint64>()(key.GetRawValue());
}
+10 -10
View File
@@ -434,7 +434,7 @@ Player::~Player()
delete PlayerTalkClass;
for (size_t x = 0; x < ItemSetEff.size(); x++)
for (std::size_t x = 0; x < ItemSetEff.size(); x++)
delete ItemSetEff[x];
delete m_declinedname;
@@ -2749,7 +2749,7 @@ void Player::SendInitialSpells()
WorldPacket data(SMSG_INITIAL_SPELLS, (1 + 2 + 4 * m_spells.size() + 2 + m_spellCooldowns.size() * (4 + 2 + 2 + 4 + 4)));
data << uint8(0);
size_t countPos = data.wpos();
std::size_t countPos = data.wpos();
data << uint16(spellCount); // spell count placeholder
for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
@@ -8153,7 +8153,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(mapid); // mapid
data << uint32(zoneid); // zone id
data << uint32(areaid); // area id, new 2.1.0
size_t countPos = data.wpos();
std::size_t countPos = data.wpos();
data << uint16(0); // count of uint64 blocks
data << uint32(0x8d8) << uint32(0x0); // 1
data << uint32(0x8d7) << uint32(0x0); // 2
@@ -9442,7 +9442,7 @@ void Player::PetSpellInitialize()
// action bar loop
charmInfo->BuildActionBar(&data);
size_t spellsCountPos = data.wpos();
std::size_t spellsCountPos = data.wpos();
// spells count
uint8 addlist = 0;
@@ -14270,7 +14270,7 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket* data)
for (uint32 specIdx = 0; specIdx < m_specsCount; ++specIdx)
{
uint8 talentIdCount = 0;
size_t pos = data->wpos();
std::size_t pos = data->wpos();
*data << uint8(talentIdCount); // [PH], talentIdCount
const PlayerTalentMap& talentMap = GetTalentMap();
@@ -14295,11 +14295,11 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket* data)
void Player::BuildPetTalentsInfoData(WorldPacket* data)
{
uint32 unspentTalentPoints = 0;
size_t pointsPos = data->wpos();
std::size_t pointsPos = data->wpos();
*data << uint32(unspentTalentPoints); // [PH], unspentTalentPoints
uint8 talentIdCount = 0;
size_t countPos = data->wpos();
std::size_t countPos = data->wpos();
*data << uint8(talentIdCount); // [PH], talentIdCount
Pet* pet = GetPet();
@@ -14378,7 +14378,7 @@ void Player::SendTalentsInfoData(bool pet)
void Player::BuildEnchantmentsInfoData(WorldPacket* data)
{
uint32 slotUsedMask = 0;
size_t slotUsedMaskPos = data->wpos();
std::size_t slotUsedMaskPos = data->wpos();
*data << uint32(slotUsedMask); // slotUsedMask < 0x80000
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
@@ -14393,7 +14393,7 @@ void Player::BuildEnchantmentsInfoData(WorldPacket* data)
*data << uint32(item->GetEntry()); // item entry
uint16 enchantmentMask = 0;
size_t enchantmentMaskPos = data->wpos();
std::size_t enchantmentMaskPos = data->wpos();
*data << uint16(enchantmentMask); // enchantmentMask < 0x1000
for (uint32 j = 0; j < MAX_ENCHANTMENT_SLOT; ++j)
@@ -14422,7 +14422,7 @@ void Player::SendEquipmentSetList()
{
uint32 count = 0;
WorldPacket data(SMSG_EQUIPMENT_SET_LIST, 4);
size_t count_pos = data.wpos();
std::size_t count_pos = data.wpos();
data << uint32(count); // count placeholder
for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
{
+1 -1
View File
@@ -1609,7 +1609,7 @@ public:
QuestStatusMap& getQuestStatusMap() { return m_QuestStatus; }
QuestStatusSaveMap& GetQuestStatusSaveMap() { return m_QuestStatusSave; }
[[nodiscard]] size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); }
[[nodiscard]] std::size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); }
[[nodiscard]] bool IsQuestRewarded(uint32 quest_id) const
{
return m_RewardedQuests.find(quest_id) != m_RewardedQuests.end();
@@ -6537,7 +6537,7 @@ void Player::SendRaidInfo()
WorldPacket data(SMSG_RAID_INSTANCE_INFO, 4);
size_t p_counter = data.wpos();
std::size_t p_counter = data.wpos();
data << uint32(counter); // placeholder
time_t now = GameTime::GetGameTime().count();
@@ -7318,7 +7318,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans)
return;
ObjectGuid::LowType lowGuid = GetGUID().GetCounter();
for (size_t i = 0; i < m_itemUpdateQueue.size(); ++i)
for (std::size_t i = 0; i < m_itemUpdateQueue.size(); ++i)
{
Item* item = m_itemUpdateQueue[i];
if (!item)
@@ -170,7 +170,7 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, TeamI
return false;
}
for (size_t i = 1; i < m_TaxiDestinations.size(); ++i)
for (std::size_t i = 1; i < m_TaxiDestinations.size(); ++i)
{
uint32 cost;
uint32 path;
@@ -202,7 +202,7 @@ std::string PlayerTaxi::SaveTaxiDestinationsToString()
std::ostringstream ss;
ss << m_flightMasterFactionId << ' ';
for (size_t i = 0; i < m_TaxiDestinations.size(); ++i)
for (std::size_t i = 0; i < m_TaxiDestinations.size(); ++i)
{
ss << m_TaxiDestinations[i] << ' ';
}
@@ -864,7 +864,7 @@ bool Player::UpdateFishingSkill()
// bonus abilities in sSkillLineAbilityStore
// Used only to avoid scan DBC at each skill grow
static uint32 bonusSkillLevels[] = {75, 150, 225, 300, 375, 450};
static const size_t bonusSkillLevelsSize =
static const std::size_t bonusSkillLevelsSize =
sizeof(bonusSkillLevels) / sizeof(uint32);
bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
@@ -908,7 +908,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
for (size_t i = 0; i < bonusSkillLevelsSize; ++i)
for (std::size_t i = 0; i < bonusSkillLevelsSize; ++i)
{
uint32 bsl = bonusSkillLevels[i];
if (SkillValue < bsl && new_value >= bsl)
@@ -1322,7 +1322,7 @@ void Player::UpdateEquipSpellsAtFormChange()
}
// item set bonuses not dependent from item broken state
for (size_t setindex = 0; setindex < ItemSetEff.size(); ++setindex)
for (std::size_t setindex = 0; setindex < ItemSetEff.size(); ++setindex)
{
ItemSetEffect* eff = ItemSetEff[setindex];
if (!eff)
@@ -132,7 +132,7 @@ void PlayerSocial::SendSocialList(Player* player, uint32 flags)
WorldPacket data(SMSG_CONTACT_LIST, (4 + 4 + m_playerSocialMap.size() * 25)); // just can guess size
data << uint32(flags); // 0x1 = Friendlist update. 0x2 = Ignorelist update. 0x4 = Mutelist update.
size_t countPos = data.wpos();
std::size_t countPos = data.wpos();
data << uint32(0); // contacts count placeholder
for (auto& itr : m_playerSocialMap)
+1 -1
View File
@@ -6467,7 +6467,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo)
++count;
}
size_t const maxsize = 4 + 5 + 5 + 4 + 4 + 1 + count * (4 + 4 + 4 + 4 + 4) + 1 + 4 + 4 + 4 + 4 + 4 * 12;
std::size_t const maxsize = 4 + 5 + 5 + 4 + 4 + 1 + count * (4 + 4 + 4 + 4 + 4) + 1 + 4 + 4 + 4 + 4 + 4 * 12;
WorldPacket data(SMSG_ATTACKERSTATEUPDATE, maxsize); // we guess size
data << uint32(damageInfo->HitInfo);
data << damageInfo->attacker->GetPackGUID();
@@ -69,10 +69,10 @@ AC_API_EXPORT EnumText EnumUtils<UnitFlags>::ToString(UnitFlags value)
}
template <>
AC_API_EXPORT size_t EnumUtils<UnitFlags>::Count() { return 33; }
AC_API_EXPORT std::size_t EnumUtils<UnitFlags>::Count() { return 33; }
template <>
AC_API_EXPORT UnitFlags EnumUtils<UnitFlags>::FromIndex(size_t index)
AC_API_EXPORT UnitFlags EnumUtils<UnitFlags>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -114,7 +114,7 @@ AC_API_EXPORT UnitFlags EnumUtils<UnitFlags>::FromIndex(size_t index)
}
template <>
AC_API_EXPORT size_t EnumUtils<UnitFlags>::ToIndex(UnitFlags value)
AC_API_EXPORT std::size_t EnumUtils<UnitFlags>::ToIndex(UnitFlags value)
{
switch (value)
{
@@ -196,10 +196,10 @@ AC_API_EXPORT EnumText EnumUtils<NPCFlags>::ToString(NPCFlags value)
}
template <>
AC_API_EXPORT size_t EnumUtils<NPCFlags>::Count() { return 28; }
AC_API_EXPORT std::size_t EnumUtils<NPCFlags>::Count() { return 28; }
template <>
AC_API_EXPORT NPCFlags EnumUtils<NPCFlags>::FromIndex(size_t index)
AC_API_EXPORT NPCFlags EnumUtils<NPCFlags>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -236,7 +236,7 @@ AC_API_EXPORT NPCFlags EnumUtils<NPCFlags>::FromIndex(size_t index)
}
template <>
AC_API_EXPORT size_t EnumUtils<NPCFlags>::ToIndex(NPCFlags value)
AC_API_EXPORT std::size_t EnumUtils<NPCFlags>::ToIndex(NPCFlags value)
{
switch (value)
{
+5 -5
View File
@@ -381,7 +381,7 @@ void ObjectMgr::AddLocaleString(std::string&& s, LocaleConstant locale, std::vec
{
if (!s.empty())
{
if (data.size() <= size_t(locale))
if (data.size() <= std::size_t(locale))
data.resize(locale + 1);
data[locale] = std::move(s);
@@ -5514,9 +5514,9 @@ void ObjectMgr::LoadEventScripts()
if (spell->Effects[j].MiscValue)
evt_scripts.insert(spell->Effects[j].MiscValue);
for (size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx)
for (std::size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx)
{
for (size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx)
for (std::size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx)
{
TaxiPathNodeEntry const* node = sTaxiPathNodesByPath[path_idx][node_idx];
@@ -8388,7 +8388,7 @@ uint8 ObjectMgr::CheckPlayerName(std::string_view name, bool create)
// Check for three consecutive letters
wstrToLower(wname);
for (size_t i = 2; i < wname.size(); ++i)
for (std::size_t i = 2; i < wname.size(); ++i)
if (wname[i] == wname[i - 1] && wname[i] == wname[i - 2])
return CHAR_NAME_THREE_CONSECUTIVE;
@@ -8581,7 +8581,7 @@ char const* ObjectMgr::GetAcoreString(uint32 entry, LocaleConstant locale) const
{
if (AcoreString const* ts = GetAcoreString(entry))
{
if (ts->Content.size() > size_t(locale) && !ts->Content[locale].empty())
if (ts->Content.size() > std::size_t(locale) && !ts->Content[locale].empty())
return ts->Content[locale].c_str();
return ts->Content[DEFAULT_LOCALE].c_str();
+4 -4
View File
@@ -458,13 +458,13 @@ struct BroadcastText
{
if (gender == GENDER_FEMALE && (forceGender || !FemaleText[DEFAULT_LOCALE].empty()))
{
if (FemaleText.size() > size_t(locale) && !FemaleText[locale].empty())
if (FemaleText.size() > std::size_t(locale) && !FemaleText[locale].empty())
return FemaleText[locale];
return FemaleText[DEFAULT_LOCALE];
}
// else if (gender == GENDER_MALE)
{
if (MaleText.size() > size_t(locale) && !MaleText[locale].empty())
if (MaleText.size() > std::size_t(locale) && !MaleText[locale].empty())
return MaleText[locale];
return MaleText[DEFAULT_LOCALE];
}
@@ -1414,7 +1414,7 @@ public:
}
static void AddLocaleString(std::string&& s, LocaleConstant locale, std::vector<std::string>& data);
static std::string_view GetLocaleString(std::vector<std::string> const& data, size_t locale)
static std::string_view GetLocaleString(std::vector<std::string> const& data, std::size_t locale)
{
if (locale < data.size())
return data[locale];
@@ -1423,7 +1423,7 @@ public:
}
static inline void GetLocaleString(const std::vector<std::string>& data, int loc_idx, std::string& value)
{
if (data.size() > size_t(loc_idx) && !data[loc_idx].empty())
if (data.size() > std::size_t(loc_idx) && !data[loc_idx].empty())
value = data[loc_idx];
}
@@ -1709,7 +1709,7 @@ namespace Acore
~LocalizedPacketDo()
{
for (size_t i = 0; i < i_data_cache.size(); ++i)
for (std::size_t i = 0; i < i_data_cache.size(); ++i)
delete i_data_cache[i];
}
void operator()(Player* p);
@@ -1729,8 +1729,8 @@ namespace Acore
~LocalizedPacketListDo()
{
for (size_t i = 0; i < i_data_cache.size(); ++i)
for (size_t j = 0; j < i_data_cache[i].size(); ++j)
for (std::size_t i = 0; i < i_data_cache.size(); ++i)
for (std::size_t j = 0; j < i_data_cache[i].size(); ++j)
delete i_data_cache[i][j];
}
void operator()(Player* p);
@@ -580,7 +580,7 @@ void Acore::LocalizedPacketListDo<Builder>::operator()(Player* p)
else
data_list = &i_data_cache[cache_idx];
for (size_t i = 0; i < data_list->size(); ++i)
for (std::size_t i = 0; i < data_list->size(); ++i)
p->SendDirectMessage((*data_list)[i]);
}
+1 -1
View File
@@ -1024,7 +1024,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
data << uint16(player->GetPositionY()); // GROUP_UPDATE_FLAG_POSITION
uint64 auraMask = 0;
size_t maskPos = data.wpos();
std::size_t maskPos = data.wpos();
data << uint64(auraMask); // placeholder
for (uint8 i = 0; i < MAX_AURAS_GROUP_UPDATE; ++i)
{
+1 -1
View File
@@ -1074,7 +1074,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid, uint32 vendorEntry)
WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + itemCount * 8 * 4);
data << vendorGuid;
size_t countPos = data.wpos();
std::size_t countPos = data.wpos();
data << uint8(count);
float discountMod = _player->GetReputationPriceDiscount(vendor);
+1 -1
View File
@@ -660,7 +660,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
uint8 item_count = uint8(mail->items.size()); // max count is MAX_MAIL_ITEMS (12)
size_t next_mail_size = 2 + 4 + 1 + (mail->messageType == MAIL_NORMAL ? 8 : 4) + 4 * 8 + (mail->subject.size() + 1) + (mail->body.size() + 1) + 1 + item_count * (1 + 4 + 4 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3 * 4 + 4 + 4 + 4 + 4 + 4 + 4 + 1);
std::size_t next_mail_size = 2 + 4 + 1 + (mail->messageType == MAIL_NORMAL ? 8 : 4) + 4 * 8 + (mail->subject.size() + 1) + (mail->body.size() + 1) + 1 + item_count * (1 + 4 + 4 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3 * 4 + 4 + 4 + 4 + 4 + 4 + 4 + 1);
if (data.wpos() + next_mail_size > MAX_NETCLIENT_PACKET_SIZE)
{
+2 -2
View File
@@ -124,7 +124,7 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
data << guid;
data << uint32(trainer_spells->trainerType);
size_t count_pos = data.wpos();
std::size_t count_pos = data.wpos();
data << uint32(trainer_spells->spellList.size());
// reputation discount
@@ -483,7 +483,7 @@ void WorldSession::SendStablePet(ObjectGuid guid)
WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
data << guid;
size_t wpos = data.wpos();
std::size_t wpos = data.wpos();
data << uint8(0); // place holder for slot show number
PetStable* petStable = GetPlayer()->GetPetStable();
+4 -4
View File
@@ -149,10 +149,10 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
CreatureQuestItemList const* items = sObjectMgr->GetCreatureQuestItemList(entry);
if (items)
for (size_t i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
for (std::size_t i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
data << (i < items->size() ? uint32((*items)[i]) : uint32(0));
else
for (size_t i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
for (std::size_t i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
data << uint32(0);
data << uint32(ci->movementId); // CreatureMovementInfo.dbc
@@ -210,10 +210,10 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
GameObjectQuestItemList const* items = sObjectMgr->GetGameObjectQuestItemList(entry);
if (items)
for (size_t i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
for (std::size_t i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
data << (i < items->size() ? uint32((*items)[i]) : uint32(0));
else
for (size_t i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
for (std::size_t i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
data << uint32(0);
SendPacket(&data);
+1 -1
View File
@@ -641,7 +641,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
void WorldSession::HandleQueryQuestsCompleted(WorldPacket& /*recvData*/)
{
size_t rew_count = _player->GetRewardedQuestCount();
std::size_t rew_count = _player->GetRewardedQuestCount();
WorldPacket data(SMSG_QUERY_QUESTS_COMPLETED_RESPONSE, 4 + 4 * rew_count);
data << uint32(rew_count);
+2 -2
View File
@@ -1007,7 +1007,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
b << uint32(l.gold); //gold
size_t count_pos = b.wpos(); // pos of item count byte
std::size_t count_pos = b.wpos(); // pos of item count byte
b << uint8(0); // item count placeholder
switch (lv.permission)
@@ -1546,7 +1546,7 @@ LootTemplate::~LootTemplate()
Entries.pop_back();
}
for (size_t i = 0; i < Groups.size(); ++i)
for (std::size_t i = 0; i < Groups.size(); ++i)
delete Groups[i];
Groups.clear();
}
+1 -1
View File
@@ -651,7 +651,7 @@ public:
_updateObjects.erase(obj);
}
size_t GetActiveNonPlayersCount() const
std::size_t GetActiveNonPlayersCount() const
{
return m_activeNonPlayers.size();
}
+2 -2
View File
@@ -71,10 +71,10 @@ MapUpdater::MapUpdater(): pending_requests(0)
{
}
void MapUpdater::activate(size_t num_threads)
void MapUpdater::activate(std::size_t num_threads)
{
_workerThreads.reserve(num_threads);
for (size_t i = 0; i < num_threads; ++i)
for (std::size_t i = 0; i < num_threads; ++i)
{
_workerThreads.push_back(std::thread(&MapUpdater::WorkerThread, this));
}
+2 -2
View File
@@ -36,7 +36,7 @@ public:
void schedule_update(Map& map, uint32 diff, uint32 s_diff);
void schedule_lfg_update(uint32 diff);
void wait();
void activate(size_t num_threads);
void activate(std::size_t num_threads);
void deactivate();
bool activated();
void update_finished();
@@ -51,7 +51,7 @@ private:
std::mutex _lock;
std::condition_variable _condition;
size_t pending_requests;
std::size_t pending_requests;
};
#endif //_MAP_UPDATER_H_INCLUDED
+11 -11
View File
@@ -25,7 +25,7 @@ TransportTemplate::~TransportTemplate()
{
// Collect shared pointers into a set to avoid deleting the same memory more than once
std::set<TransportSpline*> splines;
for (size_t i = 0; i < keyFrames.size(); ++i)
for (std::size_t i = 0; i < keyFrames.size(); ++i)
splines.insert(keyFrames[i].Spline);
for (std::set<TransportSpline*>::iterator itr = splines.begin(); itr != splines.end(); ++itr)
@@ -118,7 +118,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
std::vector<KeyFrame>& keyFrames = transport->keyFrames;
Movement::PointsArray splinePath, allPoints;
bool mapChange = false;
for (size_t i = 0; i < path.size(); ++i)
for (std::size_t i = 0; i < path.size(); ++i)
allPoints.push_back(G3D::Vector3(path[i]->x, path[i]->y, path[i]->z));
// Add extra points to allow derivative calculations for all path nodes
@@ -131,7 +131,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
orientationSpline.init_spline_custom(initer);
orientationSpline.initLengths();
for (size_t i = 0; i < path.size(); ++i)
for (std::size_t i = 0; i < path.size(); ++i)
{
if (!mapChange)
{
@@ -208,16 +208,16 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
// find the rest of the distances between key points
// Every path segment has its own spline
size_t start = 0;
for (size_t i = 1; i < keyFrames.size(); ++i)
std::size_t start = 0;
for (std::size_t i = 1; i < keyFrames.size(); ++i)
{
if (keyFrames[i - 1].Teleport || i + 1 == keyFrames.size())
{
size_t extra = !keyFrames[i - 1].Teleport ? 1 : 0;
std::size_t extra = !keyFrames[i - 1].Teleport ? 1 : 0;
TransportSpline* spline = new TransportSpline();
spline->init_spline(&splinePath[start], i - start + extra, Movement::SplineBase::ModeCatmullrom);
spline->initLengths();
for (size_t j = start; j < i + extra; ++j)
for (std::size_t j = start; j < i + extra; ++j)
{
keyFrames[j].Index = j - start + 1;
keyFrames[j].DistFromPrev = spline->length(j - start, j + 1 - start);
@@ -255,7 +255,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
// and distUntilStop is to the next stopping keyframe.
// this is required to properly handle cases of two stopping frames in a row (yes they do exist)
float tmpDist = 0.0f;
for (size_t i = 0; i < keyFrames.size(); ++i)
for (std::size_t i = 0; i < keyFrames.size(); ++i)
{
int32 j = (i + lastStop) % keyFrames.size();
if (keyFrames[j].IsStopFrame() || j == lastStop)
@@ -275,7 +275,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
tmpDist = 0.0f;
}
for (size_t i = 0; i < keyFrames.size(); ++i)
for (std::size_t i = 0; i < keyFrames.size(); ++i)
{
float total_dist = keyFrames[i].DistSinceStop + keyFrames[i].DistUntilStop;
if (total_dist < 2 * accel_dist) // won't reach full speed
@@ -305,7 +305,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
// calculate tFrom times from tTo times
float segmentTime = 0.0f;
for (size_t i = 0; i < keyFrames.size(); ++i)
for (std::size_t i = 0; i < keyFrames.size(); ++i)
{
int32 j = (i + lastStop) % keyFrames.size();
if (keyFrames[j].IsStopFrame() || j == lastStop)
@@ -322,7 +322,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
keyFrames[0].DepartureTime = uint32(curPathTime * IN_MILLISECONDS);
}
for (size_t i = 1; i < keyFrames.size(); ++i)
for (std::size_t i = 1; i < keyFrames.size(); ++i)
{
curPathTime += keyFrames[i - 1].TimeTo;
if (keyFrames[i].IsStopFrame())
+1 -1
View File
@@ -121,7 +121,7 @@ void MotionMaster::UpdateMotion(uint32 diff)
if (_expList)
{
for (size_t i = 0; i < _expList->size(); ++i)
for (std::size_t i = 0; i < _expList->size(); ++i)
{
MovementGenerator* mg = (*_expList)[i];
DirectDelete(mg);
@@ -1038,7 +1038,7 @@ void PathGenerator::ShortenPathUntilDist(G3D::Vector3 const& target, float dist)
if ((*_pathPoints.rbegin() - target).squaredLength() >= distSq)
return;
size_t i = _pathPoints.size() - 1;
std::size_t i = _pathPoints.size() - 1;
float x, y, z, collisionHeight = _source->GetCollisionHeight();
// find the first i s.t.:
// - _pathPoints[i] is still too close
@@ -500,7 +500,7 @@ void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
}
uint32 map0 = i_path[i_currentNode]->mapid;
for (size_t i = i_currentNode + 1; i < i_path.size(); ++i)
for (std::size_t i = i_currentNode + 1; i < i_path.size(); ++i)
{
if (i_path[i]->mapid != map0)
{
@@ -43,7 +43,7 @@ namespace Movement
struct MoveSplineInitArgs
{
MoveSplineInitArgs(size_t path_capacity = 16)
MoveSplineInitArgs(std::size_t path_capacity = 16)
{
path.reserve(path_capacity);
}
+2 -2
View File
@@ -158,7 +158,7 @@ bool PoolGroup<T>::CheckPool() const
template<class T>
void PoolGroup<T>::DespawnObject(ActivePoolData& spawns, ObjectGuid::LowType guid)
{
for (size_t i = 0; i < EqualChanced.size(); ++i)
for (std::size_t i = 0; i < EqualChanced.size(); ++i)
{
// if spawned
if (spawns.IsActiveObject<T>(EqualChanced[i].guid))
@@ -171,7 +171,7 @@ void PoolGroup<T>::DespawnObject(ActivePoolData& spawns, ObjectGuid::LowType gui
}
}
for (size_t i = 0; i < ExplicitlyChanced.size(); ++i)
for (std::size_t i = 0; i < ExplicitlyChanced.size(); ++i)
{
// spawned
if (spawns.IsActiveObject<T>(ExplicitlyChanced[i].guid))
+6 -6
View File
@@ -49,10 +49,10 @@ AC_API_EXPORT EnumText EnumUtils<QuestFailedReason>::ToString(QuestFailedReason
}
template <>
AC_API_EXPORT size_t EnumUtils<QuestFailedReason>::Count() { return 13; }
AC_API_EXPORT std::size_t EnumUtils<QuestFailedReason>::Count() { return 13; }
template <>
AC_API_EXPORT QuestFailedReason EnumUtils<QuestFailedReason>::FromIndex(size_t index)
AC_API_EXPORT QuestFailedReason EnumUtils<QuestFailedReason>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -74,7 +74,7 @@ AC_API_EXPORT QuestFailedReason EnumUtils<QuestFailedReason>::FromIndex(size_t i
}
template <>
AC_API_EXPORT size_t EnumUtils<QuestFailedReason>::ToIndex(QuestFailedReason value)
AC_API_EXPORT std::size_t EnumUtils<QuestFailedReason>::ToIndex(QuestFailedReason value)
{
switch (value)
{
@@ -119,10 +119,10 @@ AC_API_EXPORT EnumText EnumUtils<QuestShareMessages>::ToString(QuestShareMessage
}
template <>
AC_API_EXPORT size_t EnumUtils<QuestShareMessages>::Count() { return 11; }
AC_API_EXPORT std::size_t EnumUtils<QuestShareMessages>::Count() { return 11; }
template <>
AC_API_EXPORT QuestShareMessages EnumUtils<QuestShareMessages>::FromIndex(size_t index)
AC_API_EXPORT QuestShareMessages EnumUtils<QuestShareMessages>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -142,7 +142,7 @@ AC_API_EXPORT QuestShareMessages EnumUtils<QuestShareMessages>::FromIndex(size_t
}
template <>
AC_API_EXPORT size_t EnumUtils<QuestShareMessages>::ToIndex(QuestShareMessages value)
AC_API_EXPORT std::size_t EnumUtils<QuestShareMessages>::ToIndex(QuestShareMessages value)
{
switch (value)
{
+1 -1
View File
@@ -184,7 +184,7 @@ void ReputationMgr::SendState(FactionState const* faction)
data << uint8(_sendFactionIncreased);
_sendFactionIncreased = false; // Reset
size_t p_count = data.wpos();
std::size_t p_count = data.wpos();
data << uint32(count);
data << uint32(faction->ReputationListID);
+2 -2
View File
@@ -530,7 +530,7 @@ public: /* GlobalScript */
public: /* Scheduled scripts */
uint32 IncreaseScheduledScriptsCount() { return ++_scheduledScripts; }
uint32 DecreaseScheduledScriptCount() { return --_scheduledScripts; }
uint32 DecreaseScheduledScriptCount(size_t count) { return _scheduledScripts -= count; }
uint32 DecreaseScheduledScriptCount(std::size_t count) { return _scheduledScripts -= count; }
bool IsScriptScheduled() const { return _scheduledScripts > 0; }
public: /* UnitScript */
@@ -796,7 +796,7 @@ public:
if (oldScript)
{
for (auto& vIt : EnabledHooks)
for (size_t i = 0; i < vIt.size(); ++i)
for (std::size_t i = 0; i < vIt.size(); ++i)
if (vIt[i] == oldScript)
{
vIt.erase(vIt.begin() + i);
+1 -1
View File
@@ -22,7 +22,7 @@ WorldPackets::Packet::Packet(WorldPacket&& worldPacket) : _worldPacket(std::move
{
}
WorldPackets::ServerPacket::ServerPacket(OpcodeServer opcode, size_t initialSize /*= 200*/) : Packet(WorldPacket(opcode, initialSize))
WorldPackets::ServerPacket::ServerPacket(OpcodeServer opcode, std::size_t initialSize /*= 200*/) : Packet(WorldPacket(opcode, initialSize))
{
}
+2 -2
View File
@@ -36,7 +36,7 @@ namespace WorldPackets
virtual void Read() = 0;
[[nodiscard]] WorldPacket const* GetRawPacket() const { return &_worldPacket; }
[[nodiscard]] size_t GetSize() const { return _worldPacket.size(); }
[[nodiscard]] std::size_t GetSize() const { return _worldPacket.size(); }
protected:
WorldPacket _worldPacket;
@@ -45,7 +45,7 @@ namespace WorldPackets
class AC_GAME_API ServerPacket : public Packet
{
public:
ServerPacket(OpcodeServer opcode, size_t initialSize = 200);
ServerPacket(OpcodeServer opcode, std::size_t initialSize = 200);
void Read() final;
+2 -2
View File
@@ -29,7 +29,7 @@ public:
// just container for later use
WorldPacket() : ByteBuffer(0) { }
explicit WorldPacket(uint16 opcode, size_t res = 200) :
explicit WorldPacket(uint16 opcode, std::size_t res = 200) :
ByteBuffer(res), m_opcode(opcode) { }
WorldPacket(WorldPacket&& packet) noexcept :
@@ -66,7 +66,7 @@ public:
WorldPacket(uint16 opcode, MessageBuffer&& buffer) :
ByteBuffer(std::move(buffer)), m_opcode(opcode) { }
void Initialize(uint16 opcode, size_t newres = 200)
void Initialize(uint16 opcode, std::size_t newres = 200)
{
clear();
_storage.reserve(newres);
+2 -1
View File
@@ -46,13 +46,14 @@
#include "Tokenize.h"
#include "Transport.h"
#include "Vehicle.h"
#include "WardenMac.h"
#include "WardenWin.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSocket.h"
#include <zlib.h>
#include "BanMgr.h"
namespace
{
std::string const DefaultPlayerName = "<none>";
+1 -1
View File
@@ -25,7 +25,6 @@
#include "AccountMgr.h"
#include "AddonMgr.h"
#include "AuthDefines.h"
#include "BanMgr.h"
#include "CircularBuffer.h"
#include "Common.h"
#include "DatabaseEnv.h"
@@ -34,6 +33,7 @@
#include "SharedDefines.h"
#include "World.h"
#include <map>
#include <memory>
#include <utility>
class Creature;
+2 -2
View File
@@ -5002,7 +5002,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data)
// correct count for both hit and miss).
uint32 hit = 0;
size_t hitPos = data->wpos();
std::size_t hitPos = data->wpos();
*data << (uint8)0; // placeholder
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && hit < 255; ++ihit)
{
@@ -5022,7 +5022,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data)
}
uint32 miss = 0;
size_t missPos = data->wpos();
std::size_t missPos = data->wpos();
*data << (uint8)0; // placeholder
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && miss < 255; ++ihit)
{
+2 -2
View File
@@ -26,7 +26,7 @@ void Acore::BroadcastTextBuilder::operator()(WorldPacket& data, LocaleConstant l
ChatHandler::BuildChatPacket(data, _msgType, bct ? Language(bct->LanguageID) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", _achievementId, "", locale);
}
size_t Acore::BroadcastTextBuilder::operator()(WorldPacket* data, LocaleConstant locale) const
std::size_t Acore::BroadcastTextBuilder::operator()(WorldPacket* data, LocaleConstant locale) const
{
BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId);
return ChatHandler::BuildChatPacket(*data, _msgType, bct ? Language(bct->LanguageID) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", _achievementId, "", locale);
@@ -47,7 +47,7 @@ void Acore::AcoreStringChatBuilder::operator()(WorldPacket& data, LocaleConstant
va_list ap;
va_copy(ap, *_args);
static size_t const BufferSize = 2048;
static std::size_t const BufferSize = 2048;
char strBuffer[BufferSize];
vsnprintf(strBuffer, BufferSize, text, ap);
va_end(ap);
+1 -1
View File
@@ -34,7 +34,7 @@ namespace Acore
: _source(obj), _msgType(msgType), _textId(textId), _gender(gender), _target(target), _achievementId(achievementId) { }
void operator()(WorldPacket& data, LocaleConstant locale) const;
size_t operator()(WorldPacket* data, LocaleConstant locale) const;
std::size_t operator()(WorldPacket* data, LocaleConstant locale) const;
private:
WorldObject const* _source;
+2 -2
View File
@@ -31,7 +31,7 @@ public:
CreatureTextBuilder(WorldObject* obj, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
: _source(obj), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target) { }
size_t operator()(WorldPacket* data, LocaleConstant locale) const
std::size_t operator()(WorldPacket* data, LocaleConstant locale) const
{
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale);
@@ -54,7 +54,7 @@ public:
PlayerTextBuilder(WorldObject* obj, WorldObject* speaker, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
: _source(obj), _talker(speaker), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target) { }
size_t operator()(WorldPacket* data, LocaleConstant locale) const
std::size_t operator()(WorldPacket* data, LocaleConstant locale) const
{
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale);
+4 -4
View File
@@ -129,7 +129,7 @@ public:
~CreatureTextLocalizer()
{
for (size_t i = 0; i < _packetCache.size(); ++i)
for (std::size_t i = 0; i < _packetCache.size(); ++i)
{
if (_packetCache[i])
delete _packetCache[i]->first;
@@ -141,14 +141,14 @@ public:
{
LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
WorldPacket* messageTemplate;
size_t whisperGUIDpos;
std::size_t whisperGUIDpos;
// create if not cached yet
if (!_packetCache[loc_idx])
{
messageTemplate = new WorldPacket();
whisperGUIDpos = _builder(messageTemplate, loc_idx);
_packetCache[loc_idx] = new std::pair<WorldPacket*, size_t>(messageTemplate, whisperGUIDpos);
_packetCache[loc_idx] = new std::pair<WorldPacket*, std::size_t>(messageTemplate, whisperGUIDpos);
}
else
{
@@ -171,7 +171,7 @@ public:
}
private:
std::vector<std::pair<WorldPacket*, size_t>* > _packetCache;
std::vector<std::pair<WorldPacket*, std::size_t>* > _packetCache;
Builder const& _builder;
ChatMsg _msgType;
};
+2 -2
View File
@@ -138,14 +138,14 @@ void GmTicket::SendResponse(WorldSession* session) const
data << uint32(_id); // ticketID
data << _message.c_str();
size_t len = _response.size();
std::size_t len = _response.size();
char const* s = _response.c_str();
for (int i = 0; i < 4; i++)
{
if (len)
{
size_t writeLen = std::min<size_t>(len, 3999);
std::size_t writeLen = std::min<size_t>(len, 3999);
data.append(s, writeLen);
len -= writeLen;
+4 -4
View File
@@ -426,7 +426,7 @@ inline std::string GetTableName(std::string const& str)
return str.substr(s, e - s);
}
inline bool ValidateFields(TableStruct const& ts, std::string const& str, size_t lineNumber)
inline bool ValidateFields(TableStruct const& ts, std::string const& str, std::size_t lineNumber)
{
std::string::size_type s = str.find("` VALUES (");
if (s != std::string::npos) // old dump format (no column names)
@@ -753,7 +753,7 @@ DumpReturn PlayerDumpWriter::WriteDumpToString(std::string& dump, ObjectGuid::Lo
inline void FixNULLfields(std::string& line)
{
static std::string const NullString("'NULL'");
size_t pos = line.find(NullString);
std::size_t pos = line.find(NullString);
while (pos != std::string::npos)
{
line.replace(pos, NullString.length(), "NULL");
@@ -823,7 +823,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::istream& input, uint32 account, std::
uint8 level = 1;
// for logs
size_t lineNumber = 0;
std::size_t lineNumber = 0;
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
while (std::getline(input, line))
@@ -831,7 +831,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::istream& input, uint32 account, std::
++lineNumber;
// skip empty strings
size_t nw_pos = line.find_first_not_of(" \t\n\r\7");
std::size_t nw_pos = line.find_first_not_of(" \t\n\r\7");
if (nw_pos == std::string::npos)
continue;
+1 -1
View File
@@ -168,7 +168,7 @@ union keyData
uint32 Warden::BuildChecksum(const uint8* data, uint32 length)
{
keyData hash{};
hash.bytes = Acore::Crypto::SHA1::GetDigestOf(data, size_t(length));
hash.bytes = Acore::Crypto::SHA1::GetDigestOf(data, std::size_t(length));
uint32 checkSum = 0;
for (uint8 i = 0; i < 5; ++i)
+1
View File
@@ -17,6 +17,7 @@
#include "WardenMac.h"
#include "ByteBuffer.h"
#include "CryptoHash.h"
#include "Log.h"
#include "Opcodes.h"
#include "Player.h"
+1 -1
View File
@@ -128,7 +128,7 @@ void WardenPayloadMgr::QueuePayload(uint16 payloadId, bool pushToFront)
bool WardenPayloadMgr::DequeuePayload(uint16 payloadId)
{
size_t const queueSize = QueuedPayloads.size();
std::size_t const queueSize = QueuedPayloads.size();
QueuedPayloads.remove(payloadId);
return queueSize != QueuedPayloads.size();
@@ -39,10 +39,10 @@ AC_API_EXPORT EnumText EnumUtils<WardenActions>::ToString(WardenActions value)
}
template <>
AC_API_EXPORT size_t EnumUtils<WardenActions>::Count() { return 3; }
AC_API_EXPORT std::size_t EnumUtils<WardenActions>::Count() { return 3; }
template <>
AC_API_EXPORT WardenActions EnumUtils<WardenActions>::FromIndex(size_t index)
AC_API_EXPORT WardenActions EnumUtils<WardenActions>::FromIndex(std::size_t index)
{
switch (index)
{
@@ -54,7 +54,7 @@ AC_API_EXPORT WardenActions EnumUtils<WardenActions>::FromIndex(size_t index)
}
template <>
AC_API_EXPORT size_t EnumUtils<WardenActions>::ToIndex(WardenActions value)
AC_API_EXPORT std::size_t EnumUtils<WardenActions>::ToIndex(WardenActions value)
{
switch (value)
{