Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-08-01 15:41:23 +08:00
251 changed files with 4841 additions and 6135 deletions
@@ -751,7 +751,7 @@ void AuthSession::RealmListCallback(PreparedQueryResult result)
// Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm)
ByteBuffer pkt;
size_t RealmListSize = 0;
std::size_t RealmListSize = 0;
for (auto const& [realmHandle, realm] : sRealmList->GetRealms())
{
// don't work with realms which not compatible with the client
@@ -113,7 +113,7 @@ private:
struct AuthHandler
{
AuthStatus status;
size_t packetSize;
std::size_t packetSize;
bool (AuthSession::* handler)();
};
@@ -46,7 +46,7 @@ namespace Acore::Impl::Readline
static std::vector<std::string> vec;
char* cli_unpack_vector(char const*, int state)
{
static size_t i=0;
static std::size_t i=0;
if (!state)
i = 0;
if (i < vec.size())
@@ -94,7 +94,7 @@ int RASession::Send(std::string_view data)
{
std::ostream os(&_writeBuffer);
os << data;
size_t written = _socket.send(_writeBuffer.data());
std::size_t written = _socket.send(_writeBuffer.data());
_writeBuffer.consume(written);
return written;
}
@@ -102,7 +102,7 @@ int RASession::Send(std::string_view data)
std::string RASession::ReadString()
{
boost::system::error_code error;
size_t read = boost::asio::read_until(_socket, _readBuffer, "\r\n", error);
std::size_t read = boost::asio::read_until(_socket, _readBuffer, "\r\n", error);
if (!read)
{
_socket.close();
@@ -26,7 +26,7 @@
using boost::asio::ip::tcp;
const size_t bufferSize = 4096;
const std::size_t bufferSize = 4096;
class RASession : public std::enable_shared_from_this<RASession>
{
@@ -155,11 +155,11 @@ bool DatabaseWorkerPool<T>::PrepareStatements()
else
connection->Unlock();
size_t const preparedSize = connection->m_stmts.size();
std::size_t const preparedSize = connection->m_stmts.size();
if (_preparedStatementSize.size() < preparedSize)
_preparedStatementSize.resize(preparedSize);
for (size_t i = 0; i < preparedSize; ++i)
for (std::size_t i = 0; i < preparedSize; ++i)
{
// already set by another connection
// (each connection only has prepared statements of it's own type sync/async)
@@ -489,7 +489,7 @@ void DatabaseWorkerPool<T>::Enqueue(SQLOperation* op)
}
template <class T>
size_t DatabaseWorkerPool<T>::QueueSize() const
std::size_t DatabaseWorkerPool<T>::QueueSize() const
{
return _queue->Size();
}
@@ -227,7 +227,7 @@ public:
#endif
}
[[nodiscard]] size_t QueueSize() const;
[[nodiscard]] std::size_t QueueSize() const;
private:
uint32 OpenConnections(InternalIndex type, uint8 numConnections);
+1 -1
View File
@@ -144,7 +144,7 @@ namespace
}
}
void Field::GetBinarySizeChecked(uint8* buf, size_t length) const
void Field::GetBinarySizeChecked(uint8* buf, std::size_t length) const
{
ASSERT(data.value && (data.length == length), "Expected {}-byte binary blob, got {}data ({} bytes) instead", length, data.value ? "" : "no ", data.length);
memcpy(buf, data.value, length);
+2 -2
View File
@@ -133,7 +133,7 @@ public:
return GetDataBinary();
}
template <typename T, size_t S>
template <typename T, std::size_t S>
inline std::enable_if_t<std::is_same_v<Binary, T>, std::array<uint8, S>> Get() const
{
std::array<uint8, S> buf = {};
@@ -173,7 +173,7 @@ private:
QueryResultFieldMetadata const* meta;
void LogWrongType(std::string_view getter, std::string_view typeName) const;
void SetMetadata(QueryResultFieldMetadata const* fieldMeta);
void GetBinarySizeChecked(uint8* buf, size_t size) const;
void GetBinarySizeChecked(uint8* buf, std::size_t size) const;
};
#endif
@@ -84,6 +84,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK_COUNTRY, "UPDATE account SET lock_country = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_EMAIL, "UPDATE account SET email = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET username = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? , mutereason = ? , muteby = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_MUTE_TIME_LOGIN, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
@@ -68,6 +68,7 @@ enum LoginDatabaseStatements : uint32
LOGIN_UPD_EXPANSION,
LOGIN_UPD_ACCOUNT_LOCK,
LOGIN_UPD_ACCOUNT_LOCK_COUNTRY,
LOGIN_UPD_EMAIL,
LOGIN_UPD_USERNAME,
LOGIN_UPD_MUTE_TIME,
LOGIN_UPD_MUTE_TIME_LOGIN,
@@ -464,7 +464,7 @@ int MySQLConnection::ExecuteTransaction(std::shared_ptr<TransactionBase> transac
return 0;
}
size_t MySQLConnection::EscapeString(char* to, const char* from, size_t length)
std::size_t MySQLConnection::EscapeString(char* to, const char* from, std::size_t length)
{
return mysql_real_escape_string(m_Mysql, to, from, length);
}
@@ -80,7 +80,7 @@ public:
void RollbackTransaction();
void CommitTransaction();
int ExecuteTransaction(std::shared_ptr<TransactionBase> transaction);
size_t EscapeString(char* to, const char* from, size_t length);
std::size_t EscapeString(char* to, const char* from, std::size_t length);
void Ping();
uint32 GetLastError();
@@ -190,7 +190,7 @@ std::string MySQLPreparedStatement::getQueryString() const
{
std::string queryString(m_queryString);
size_t pos = 0;
std::size_t pos = 0;
for (PreparedStatementData const& data : m_stmt->GetParameters())
{
+5 -5
View File
@@ -22,7 +22,7 @@
#include "PreparedStatement.h"
#include "QueryResult.h"
bool SQLQueryHolderBase::SetPreparedQueryImpl(size_t index, PreparedStatementBase* stmt)
bool SQLQueryHolderBase::SetPreparedQueryImpl(std::size_t index, PreparedStatementBase* stmt)
{
if (m_queries.size() <= index)
{
@@ -34,7 +34,7 @@ bool SQLQueryHolderBase::SetPreparedQueryImpl(size_t index, PreparedStatementBas
return true;
}
PreparedQueryResult SQLQueryHolderBase::GetPreparedResult(size_t index) const
PreparedQueryResult SQLQueryHolderBase::GetPreparedResult(std::size_t index) const
{
// Don't call to this function if the index is of a prepared statement
ASSERT(index < m_queries.size(), "Query holder result index out of range, tried to access index {} but there are only {} results",
@@ -43,7 +43,7 @@ PreparedQueryResult SQLQueryHolderBase::GetPreparedResult(size_t index) const
return m_queries[index].second;
}
void SQLQueryHolderBase::SetPreparedResult(size_t index, PreparedResultSet* result)
void SQLQueryHolderBase::SetPreparedResult(std::size_t index, PreparedResultSet* result)
{
if (result && !result->GetRowCount())
{
@@ -66,7 +66,7 @@ SQLQueryHolderBase::~SQLQueryHolderBase()
}
}
void SQLQueryHolderBase::SetSize(size_t size)
void SQLQueryHolderBase::SetSize(std::size_t size)
{
/// to optimize push_back, reserve the number of queries about to be executed
m_queries.resize(size);
@@ -77,7 +77,7 @@ SQLQueryHolderTask::~SQLQueryHolderTask() = default;
bool SQLQueryHolderTask::Execute()
{
/// execute all queries in the holder and pass the results
for (size_t i = 0; i < m_holder->m_queries.size(); ++i)
for (std::size_t i = 0; i < m_holder->m_queries.size(); ++i)
if (PreparedStatementBase* stmt = m_holder->m_queries[i].first)
m_holder->SetPreparedResult(i, m_conn->Query(stmt));
+5 -5
View File
@@ -28,12 +28,12 @@ friend class SQLQueryHolderTask;
public:
SQLQueryHolderBase() = default;
virtual ~SQLQueryHolderBase();
void SetSize(size_t size);
PreparedQueryResult GetPreparedResult(size_t index) const;
void SetPreparedResult(size_t index, PreparedResultSet* result);
void SetSize(std::size_t size);
PreparedQueryResult GetPreparedResult(std::size_t index) const;
void SetPreparedResult(std::size_t index, PreparedResultSet* result);
protected:
bool SetPreparedQueryImpl(size_t index, PreparedStatementBase* stmt);
bool SetPreparedQueryImpl(std::size_t index, PreparedStatementBase* stmt);
private:
std::vector<std::pair<PreparedStatementBase*, PreparedQueryResult>> m_queries;
@@ -43,7 +43,7 @@ template<typename T>
class SQLQueryHolder : public SQLQueryHolderBase
{
public:
bool SetPreparedQuery(size_t index, PreparedStatement<T>* stmt)
bool SetPreparedQuery(std::size_t index, PreparedStatement<T>* stmt)
{
return SetPreparedQueryImpl(index, stmt);
}
@@ -19,6 +19,7 @@
#include "DatabaseEnv.h"
#include "LogMessage.h"
#include "PreparedStatement.h"
#include <vector>
AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, AppenderFlags /*flags*/, std::vector<std::string_view> const& /*args*/)
: Appender(id, name, level), realmId(0), enabled(false) { }
+1
View File
@@ -19,6 +19,7 @@
#define APPENDERDB_H
#include "Appender.h"
#include <vector>
class AppenderDB : public Appender
{
@@ -240,8 +240,8 @@ UpdateResult UpdateFetcher::Update(bool const redundancyChecks,
AppliedFileStorage applied = ReceiveAppliedFiles();
size_t countRecentUpdates = 0;
size_t countArchivedUpdates = 0;
std::size_t countRecentUpdates = 0;
std::size_t countArchivedUpdates = 0;
// Count updates
for (auto const& entry : applied)
@@ -255,7 +255,7 @@ UpdateResult UpdateFetcher::Update(bool const redundancyChecks,
for (auto& entry : applied)
hashToName.insert(std::make_pair(entry.second.hash, entry.first));
size_t importedUpdates = 0;
std::size_t importedUpdates = 0;
auto ApplyUpdateFile = [&](LocaleFileEntry const& sqlFile)
{
@@ -483,7 +483,7 @@ void UpdateFetcher::CleanUp(AppliedFileStorage const& storage) const
return;
std::stringstream update;
size_t remaining = storage.size();
std::size_t remaining = storage.size();
update << "DELETE FROM `updates` WHERE `name` IN(";
+4 -4
View File
@@ -31,12 +31,12 @@ struct AC_DATABASE_API UpdateResult
UpdateResult()
: updated(0), recent(0), archived(0) { }
UpdateResult(size_t const updated_, size_t const recent_, size_t const archived_)
UpdateResult(std::size_t const updated_, std::size_t const recent_, std::size_t const archived_)
: updated(updated_), recent(recent_), archived(archived_) { }
size_t updated;
size_t recent;
size_t archived;
std::size_t updated;
std::size_t recent;
std::size_t archived;
};
class AC_DATABASE_API UpdateFetcher
@@ -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)
{
+27
View File
@@ -58,6 +58,33 @@ namespace AccountMgr
return AOR_OK; // everything's fine
}
AccountOpResult ChangeEmail(uint32 accountId, std::string newEmail)
{
std::string username;
if (!GetName(accountId, username))
{
sScriptMgr->OnFailedEmailChange(accountId);
return AOR_NAME_NOT_EXIST; // account doesn't exist
}
if (utf8length(newEmail) > MAX_EMAIL_STR)
{
sScriptMgr->OnFailedEmailChange(accountId);
return AOR_EMAIL_TOO_LONG; // email's too long
}
Utf8ToUpperOnlyLatin(newEmail);
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EMAIL);
stmt->SetData(0, newEmail);
stmt->SetData(1, accountId);
LoginDatabase.Execute(stmt);
sScriptMgr->OnEmailChange(accountId);
return AOR_OK;
}
AccountOpResult DeleteAccount(uint32 accountId)
{
// Check if accounts exists
+3
View File
@@ -26,6 +26,7 @@ enum AccountOpResult
AOR_OK,
AOR_NAME_TOO_LONG,
AOR_PASS_TOO_LONG,
AOR_EMAIL_TOO_LONG,
AOR_NAME_ALREADY_EXIST,
AOR_NAME_NOT_EXIST,
AOR_DB_INTERNAL_ERROR
@@ -33,6 +34,7 @@ enum AccountOpResult
#define MAX_ACCOUNT_STR 20
#define MAX_PASS_STR 16
#define MAX_EMAIL_STR 255
namespace AccountMgr
{
@@ -40,6 +42,7 @@ namespace AccountMgr
AccountOpResult DeleteAccount(uint32 accountId);
AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword);
AccountOpResult ChangePassword(uint32 accountId, std::string newPassword);
AccountOpResult ChangeEmail(uint32 accountId, std::string email);
bool CheckPassword(uint32 accountId, std::string password);
uint32 GetId(std::string const& username);
@@ -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);
@@ -131,7 +131,7 @@ void AutobroadcastMgr::SendAutobroadcasts()
void AutobroadcastMgr::SendWorldAnnouncement(std::string msg)
{
sWorld->SendWorldTextOptional(LANG_AUTO_BROADCAST, ANNOUNCER_FLAG_DISABLE_AUTOBROADCAST, msg.data());
ChatHandler(nullptr).SendWorldTextOptional(LANG_AUTO_BROADCAST, ANNOUNCER_FLAG_DISABLE_AUTOBROADCAST, msg.data());
}
void AutobroadcastMgr::SendNotificationAnnouncement(std::string msg)
@@ -20,6 +20,7 @@
/// @todo: Add proper implement of achievement
#include "BattlefieldWG.h"
#include "Chat.h"
#include "GameTime.h"
#include "MapMgr.h"
#include "Opcodes.h"
@@ -290,7 +291,7 @@ void BattlefieldWG::OnBattleStart()
m_tenacityUpdateTimer = 20000;
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
sWorld->SendWorldText(BATTLEFIELD_WG_WORLD_START_MESSAGE);
ChatHandler(nullptr).SendWorldText(BATTLEFIELD_WG_WORLD_START_MESSAGE);
}
void BattlefieldWG::UpdateCounterVehicle(bool init)
+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(); }
@@ -16,6 +16,7 @@
*/
#include "ArenaTeamMgr.h"
#include "Chat.h"
#include "DatabaseEnv.h"
#include "Define.h"
#include "Language.h"
@@ -194,9 +195,9 @@ void ArenaTeamMgr::LoadArenaTeams()
void ArenaTeamMgr::DistributeArenaPoints()
{
// Used to distribute arena points based on last week's stats
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_START);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_START);
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START);
// Temporary structure for storing maximum points to add values for all players
std::map<ObjectGuid, uint32> PlayerPoints;
@@ -232,9 +233,9 @@ void ArenaTeamMgr::DistributeArenaPoints()
PlayerPoints.clear();
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END);
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START);
for (ArenaTeamContainer::iterator titr = GetArenaTeamMapBegin(); titr != GetArenaTeamMapEnd(); ++titr)
{
if (ArenaTeam* at = titr->second)
@@ -246,7 +247,7 @@ void ArenaTeamMgr::DistributeArenaPoints()
}
}
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_END);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_END);
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_END);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_END);
}
@@ -618,7 +618,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
// Announce BG starting
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
sWorld->SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName().c_str(), std::min(GetMinLevel(), (uint32)80), std::min(GetMaxLevel(), (uint32)80));
ChatHandler(nullptr).SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), std::min(GetMinLevel(), (uint32)80), std::min(GetMaxLevel(), (uint32)80));
sScriptMgr->OnBattlegroundStart(this);
}
@@ -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);
@@ -722,12 +722,12 @@ void BattlegroundMgr::ToggleTesting()
if (sWorld->getBoolConfig(CONFIG_DEBUG_BATTLEGROUND))
{
m_Testing = true;
sWorld->SendWorldText(LANG_DEBUG_BG_CONF);
ChatHandler(nullptr).SendWorldText(LANG_DEBUG_BG_CONF);
}
else
{
m_Testing = !m_Testing;
sWorld->SendWorldText(m_Testing ? LANG_DEBUG_BG_ON : LANG_DEBUG_BG_OFF);
ChatHandler(nullptr).SendWorldText(m_Testing ? LANG_DEBUG_BG_ON : LANG_DEBUG_BG_OFF);
}
}
@@ -736,12 +736,12 @@ void BattlegroundMgr::ToggleArenaTesting()
if (sWorld->getBoolConfig(CONFIG_DEBUG_ARENA))
{
m_ArenaTesting = true;
sWorld->SendWorldText(LANG_DEBUG_ARENA_CONF);
ChatHandler(nullptr).SendWorldText(LANG_DEBUG_ARENA_CONF);
}
else
{
m_ArenaTesting = !m_ArenaTesting;
sWorld->SendWorldText(m_ArenaTesting ? LANG_DEBUG_ARENA_ON : LANG_DEBUG_ARENA_OFF);
ChatHandler(nullptr).SendWorldText(m_ArenaTesting ? LANG_DEBUG_ARENA_ON : LANG_DEBUG_ARENA_OFF);
}
}
@@ -996,7 +996,7 @@ void BattlegroundQueue::BattlegroundQueueAnnouncerUpdate(uint32 diff, Battlegrou
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32) 80);
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32) 80);
sWorld->SendWorldTextOptional(LANG_BG_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, bgName.c_str(), q_min_level, q_max_level, qPlayers, MaxPlayers);
ChatHandler(nullptr).SendWorldTextOptional(LANG_BG_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, bgName.c_str(), q_min_level, q_max_level, qPlayers, MaxPlayers);
}
else
{
@@ -1077,7 +1077,7 @@ void BattlegroundQueue::SendMessageBGQueue(Player* leader, Battleground* bg, PvP
return;
}
sWorld->SendWorldTextOptional(LANG_BG_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, bgName.c_str(), q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers);
ChatHandler(nullptr).SendWorldTextOptional(LANG_BG_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, bgName.c_str(), q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers);
}
}
}
@@ -1128,7 +1128,7 @@ void BattlegroundQueue::SendJoinMessageArenaQueue(Player* leader, GroupQueueInfo
return;
}
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, bgName.c_str(), arenatype.c_str(), q_min_level, q_max_level, qPlayers, playersNeed);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, bgName.c_str(), arenatype.c_str(), q_min_level, q_max_level, qPlayers, playersNeed);
}
}
else
@@ -1147,16 +1147,16 @@ void BattlegroundQueue::SendJoinMessageArenaQueue(Player* leader, GroupQueueInfo
switch (announcementDetail)
{
case 3:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_NAME_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_NAME_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
break;
case 2:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_NAME, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_NAME, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName, ArenaType, ArenaType);
break;
case 1:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType, ArenaTeamRating);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType, ArenaTeamRating);
break;
default:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType);
break;
}
}
@@ -1187,16 +1187,16 @@ void BattlegroundQueue::SendExitMessageArenaQueue(GroupQueueInfo* ginfo)
switch (announcementDetail)
{
case 3:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_NAME_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_NAME_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
break;
case 2:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_NAME, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_NAME, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName, ArenaType, ArenaType);
break;
case 1:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType, ArenaTeamRating);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType, ArenaTeamRating);
break;
default:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType);
break;
}
}
@@ -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)
{
+41 -5
View File
@@ -99,6 +99,42 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
return false;
}
void ChatHandler::SendWorldText(std::string_view str)
{
std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
Player* player = m_session->GetPlayer();
if (!player || !player->IsInWorld())
return;
for (std::string_view line : lines)
{
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
player->SendDirectMessage(&data);
}
}
void ChatHandler::SendWorldTextOptional(std::string_view str, uint32 flag)
{
std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
Player* player = m_session->GetPlayer();
if (!player || !player->IsInWorld())
return;
if (sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
if (player->GetPlayerSetting(AzerothcorePSSource, SETTING_ANNOUNCER_FLAGS).HasFlag(flag))
return;
for (std::string_view line : lines)
{
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
player->SendDirectMessage(&data);
}
}
void ChatHandler::SendSysMessage(std::string_view str, bool escapeCharacters)
{
std::string msg{ str };
@@ -109,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];
@@ -204,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);
@@ -284,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;
@@ -1058,7 +1094,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);
+67 -2
View File
@@ -20,6 +20,7 @@
#include "ChatCommand.h"
#include "Errors.h"
#include "Player.h"
#include "SharedDefines.h"
#include "WorldSession.h"
#include <vector>
@@ -52,12 +53,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);
// All in one chat message builder
static void BuildChatPacket(
@@ -68,6 +69,70 @@ public:
static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; }
void SendWorldText(std::string_view str);
template<typename... Args>
void SendWorldText(uint32 strId, Args&&... args)
{
// WorldText should be sent to all sessions
SessionMap::const_iterator itr;
for (itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
{
Player* player = itr->second->GetPlayer();
if (player && player->IsInWorld())
{
m_session = player->GetSession();
SendWorldText(Acore::StringFormatFmt(GetAcoreString(strId), std::forward<Args>(args)...));
}
}
}
template<typename... Args>
void SendWorldText(char const* fmt, Args&&... args)
{
// WorldTextOptional should be sent to all sessions
SessionMap::const_iterator itr;
for (itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
{
Player* player = itr->second->GetPlayer();
if (player && player->IsInWorld())
{
m_session = player->GetSession();
SendWorldText(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
}
}
}
void SendWorldTextOptional(std::string_view str, uint32 flag);
template<typename... Args>
void SendWorldTextOptional(uint32 strId, uint32 flag, Args&&... args)
{
// WorldTextOptional should be sent to all sessions
SessionMap::const_iterator itr;
for (itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
{
Player* player = itr->second->GetPlayer();
if (player && player->IsInWorld())
{
m_session = player->GetSession();
SendWorldTextOptional(Acore::StringFormatFmt(GetAcoreString(strId), std::forward<Args>(args)...), flag);
}
}
}
template<typename... Args>
void SendWorldTextOptional(char const* fmt, uint32 flag, Args&&... args)
{
// WorldTextOptional should be sent to all sessions
SessionMap::const_iterator itr;
for (itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
{
Player* player = itr->second->GetPlayer();
if (player && player->IsInWorld())
{
m_session = player->GetSession();
SendWorldTextOptional(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...), flag);
}
}
}
// function with different implementation for chat/console
virtual char const* GetAcoreString(uint32 entry) const;
virtual void SendSysMessage(std::string_view str, bool escapeCharacters = false);
@@ -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")
+2 -1
View File
@@ -17,6 +17,7 @@
#include "LFGMgr.h"
#include "BattlegroundMgr.h"
#include "Chat.h"
#include "CharacterCache.h"
#include "Common.h"
#include "DBCStores.h"
@@ -805,7 +806,7 @@ namespace lfg
void LFGMgr::ToggleTesting()
{
m_Testing = !m_Testing;
sWorld->SendWorldText(m_Testing ? LANG_DEBUG_LFG_ON : LANG_DEBUG_LFG_OFF);
ChatHandler(nullptr).SendWorldText(m_Testing ? LANG_DEBUG_LFG_ON : LANG_DEBUG_LFG_OFF);
}
/**
@@ -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)
@@ -8164,7 +8164,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
@@ -9453,7 +9453,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;
@@ -14281,7 +14281,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();
@@ -14306,11 +14306,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();
@@ -14389,7 +14389,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)
@@ -14404,7 +14404,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)
@@ -14433,7 +14433,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
@@ -1599,7 +1599,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] << ' ';
}
@@ -865,7 +865,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)
@@ -909,7 +909,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)
@@ -1323,7 +1323,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)
{
+2 -1
View File
@@ -17,6 +17,7 @@
#include "GameEventMgr.h"
#include "BattlegroundMgr.h"
#include "Chat.h"
#include "DisableMgr.h"
#include "GameObjectAI.h"
#include "GameTime.h"
@@ -1230,7 +1231,7 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id)
{
uint8 announce = mGameEvent[event_id].announce;
if (announce == 1 || (announce == 2 && sWorld->getIntConfig(CONFIG_EVENT_ANNOUNCE)))
sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
ChatHandler(nullptr).SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description);
LOG_DEBUG("gameevent", "GameEvent {} \"{}\" started.", event_id, mGameEvent[event_id].description);
+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];
}
@@ -1415,7 +1415,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];
@@ -1424,7 +1424,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 -7
View File
@@ -111,12 +111,6 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
SendPartyResult(PARTY_OP_INVITE, membername, ERR_TARGET_NOT_IN_INSTANCE_S);
return;
}
// just ignore us
if (invitedPlayer->GetInstanceId() != 0 && invitedPlayer->GetDungeonDifficulty() != invitingPlayer->GetDungeonDifficulty())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_IGNORING_YOU_S);
return;
}
if (invitedPlayer->GetSocial()->HasIgnore(invitingPlayer->GetGUID()))
{
@@ -1030,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())
+9 -8
View File
@@ -17,6 +17,7 @@
#include "BanMgr.h"
#include "AccountMgr.h"
#include "Chat.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Language.h"
@@ -86,9 +87,9 @@ BanReturn BanMgr::BanAccount(std::string const& AccountName, std::string const&
IsPermanetly = false;
if (!IsPermanetly)
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, Author.c_str(), AccountName.c_str(), secsToTimeString(TimeStringToSecs(Duration), true).c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, Author, AccountName, secsToTimeString(TimeStringToSecs(Duration), true), Reason);
else
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, Author.c_str(), AccountName.c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, Author, AccountName, Reason);
}
return BAN_SUCCESS;
@@ -152,9 +153,9 @@ BanReturn BanMgr::BanAccountByPlayerName(std::string const& CharacterName, std::
AccountMgr::GetName(AccountID, AccountName);
if (!IsPermanetly)
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, Author.c_str(), AccountName.c_str(), secsToTimeString(TimeStringToSecs(Duration), true).c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, Author, AccountName, secsToTimeString(TimeStringToSecs(Duration), true), Reason);
else
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, Author.c_str(), AccountName.c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, Author, AccountName, Reason);
}
return BAN_SUCCESS;
@@ -188,9 +189,9 @@ BanReturn BanMgr::BanIP(std::string const& IP, std::string const& Duration, std:
IsPermanetly = false;
if (IsPermanetly)
sWorld->SendWorldText(LANG_BAN_IP_YOUPERMBANNEDMESSAGE_WORLD, Author.c_str(), IP.c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_IP_YOUPERMBANNEDMESSAGE_WORLD, Author, IP, Reason);
else
sWorld->SendWorldText(LANG_BAN_IP_YOUBANNEDMESSAGE_WORLD, Author.c_str(), IP.c_str(), secsToTimeString(TimeStringToSecs(Duration), true).c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_IP_YOUBANNEDMESSAGE_WORLD, Author, IP, secsToTimeString(TimeStringToSecs(Duration), true), Reason);
}
if (!resultAccounts)
@@ -258,9 +259,9 @@ BanReturn BanMgr::BanCharacter(std::string const& CharacterName, std::string con
IsPermanetly = false;
if (!IsPermanetly)
sWorld->SendWorldText(LANG_BAN_CHARACTER_YOUBANNEDMESSAGE_WORLD, Author.c_str(), CharacterName.c_str(), secsToTimeString(TimeStringToSecs(Duration), true).c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_CHARACTER_YOUBANNEDMESSAGE_WORLD, Author, CharacterName, secsToTimeString(TimeStringToSecs(Duration), true), Reason);
else
sWorld->SendWorldText(LANG_BAN_CHARACTER_YOUPERMBANNEDMESSAGE_WORLD, Author.c_str(), CharacterName.c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_CHARACTER_YOUPERMBANNEDMESSAGE_WORLD, Author, CharacterName, Reason);
}
return BAN_SUCCESS;
+5 -5
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);
@@ -270,7 +270,7 @@ void MotionMaster::MoveTargetedHome(bool walk /*= false*/)
if (target)
{
LOG_DEBUG("movement.motionmaster", "Following {} ({})", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString());
Mutate(new FollowMovementGenerator<Creature>(target, PET_FOLLOW_DIST, _owner->GetFollowAngle()), MOTION_SLOT_ACTIVE);
Mutate(new FollowMovementGenerator<Creature>(target, PET_FOLLOW_DIST, _owner->GetFollowAngle(),true), MOTION_SLOT_ACTIVE);
}
}
else
@@ -391,7 +391,7 @@ void MotionMaster::MoveCircleTarget(Unit* target)
init.Launch();
}
void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slot)
void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slot, bool inheritWalkState)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
// ignore movement request if target not exist
@@ -405,13 +405,13 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
{
LOG_DEBUG("movement.motionmaster", "Player ({}) follow to {} ({})",
_owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString());
Mutate(new FollowMovementGenerator<Player>(target, dist, angle), slot);
Mutate(new FollowMovementGenerator<Player>(target, dist, angle, inheritWalkState), slot);
}
else
{
LOG_DEBUG("movement.motionmaster", "Creature ({}) follow to {} ({})",
_owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString());
Mutate(new FollowMovementGenerator<Creature>(target, dist, angle), slot);
Mutate(new FollowMovementGenerator<Creature>(target, dist, angle, inheritWalkState), slot);
}
}
+1 -1
View File
@@ -199,7 +199,7 @@ public:
void MoveIdle();
void MoveTargetedHome(bool walk = false);
void MoveRandom(float wanderDistance = 0.0f);
void MoveFollow(Unit* target, float dist, float angle, MovementSlot slot = MOTION_SLOT_ACTIVE);
void MoveFollow(Unit* target, float dist, float angle, MovementSlot slot = MOTION_SLOT_ACTIVE, bool inheritWalkState = true);
void MoveChase(Unit* target, std::optional<ChaseRange> dist = {}, std::optional<ChaseAngle> angle = {});
void MoveChase(Unit* target, float dist, float angle) { MoveChase(target, ChaseRange(dist), ChaseAngle(angle)); }
void MoveChase(Unit* target, float dist) { MoveChase(target, ChaseRange(dist)); }
@@ -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
@@ -520,7 +520,9 @@ bool FollowMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
Movement::MoveSplineInit init(owner);
init.MovebyPath(i_path->GetPath());
init.SetWalk(target->IsWalking() || target->movespline->isWalking());
if (_inheritWalkState)
init.SetWalk(target->IsWalking() || target->movespline->isWalking());
if (Optional<float> velocity = GetVelocity(owner, target, i_path->GetActualEndPosition(), owner->IsGuardian()))
init.SetVelocity(*velocity);
init.Launch();
@@ -74,8 +74,8 @@ template<class T>
class FollowMovementGenerator : public MovementGeneratorMedium<T, FollowMovementGenerator<T>>, public TargetedMovementGeneratorBase
{
public:
FollowMovementGenerator(Unit* target, float range, ChaseAngle angle)
: TargetedMovementGeneratorBase(target), i_path(nullptr), i_recheckPredictedDistanceTimer(0), i_recheckPredictedDistance(false), _range(range), _angle(angle) {}
FollowMovementGenerator(Unit* target, float range, ChaseAngle angle, bool inheritWalkState)
: TargetedMovementGeneratorBase(target), i_path(nullptr), i_recheckPredictedDistanceTimer(0), i_recheckPredictedDistance(false), _range(range), _angle(angle),_inheritWalkState(inheritWalkState) {}
~FollowMovementGenerator() { }
MovementGeneratorType GetMovementGeneratorType() { return FOLLOW_MOTION_TYPE; }
@@ -106,6 +106,7 @@ private:
Optional<Position> _lastPredictedPosition;
float _range;
ChaseAngle _angle;
bool _inheritWalkState;
};
#endif
@@ -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
@@ -563,7 +563,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 */
@@ -850,7 +850,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"
@@ -35,6 +34,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)
{
@@ -4784,6 +4784,20 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo(TARGET_DEST_CASTER);
});
// Wing Buffet
ApplySpellFix({ 37319 }, [](SpellInfo* spellInfo)
{
spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CONE_ENEMY_24);
spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo(0);
spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_20_YARDS);
});
// Random Periodic
ApplySpellFix({ 40867 }, [](SpellInfo* spellInfo)
{
spellInfo->Effects[EFFECT_0].Amplitude = 9000;
});
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo* spellInfo = mSpellInfoMap[i];
+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;
};

Some files were not shown because too many files have changed in this diff Show More