Few small optimizations here and there
This commit is contained in:
1 parent
0f9c7106ce
commit
8bb777ef5c
35 files changed
+366
-373
No files matched your search
@@ -123,7 +123,7 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun
|
||||
m_sessionDbLocaleIndex(locale),
|
||||
m_latency(0),
|
||||
m_clientTimeDelay(0),
|
||||
m_TutorialsChanged(false),
|
||||
m_TutorialsChanged(TUTORIALS_FLAG_NONE),
|
||||
_filterAddonMessages(false),
|
||||
recruiterId(recruiter),
|
||||
isRecruiter(isARecruiter),
|
||||
@@ -795,10 +795,13 @@ void WorldSession::LoadTutorialsData(PreparedQueryResult result)
|
||||
memset(m_Tutorials, 0, sizeof(uint32) * MAX_ACCOUNT_TUTORIAL_VALUES);
|
||||
|
||||
if (result)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
|
||||
m_Tutorials[i] = (*result)[i].GetUInt32();
|
||||
m_TutorialsChanged |= TUTORIALS_FLAG_LOADED_FROM_DB;
|
||||
}
|
||||
|
||||
m_TutorialsChanged = false;
|
||||
m_TutorialsChanged &= ~TUTORIALS_FLAG_CHANGED;
|
||||
}
|
||||
|
||||
void WorldSession::SendTutorialsData()
|
||||
@@ -811,20 +814,17 @@ void WorldSession::SendTutorialsData()
|
||||
|
||||
void WorldSession::SaveTutorialsData(SQLTransaction &trans)
|
||||
{
|
||||
if (!m_TutorialsChanged)
|
||||
if (!(m_TutorialsChanged & TUTORIALS_FLAG_CHANGED))
|
||||
return;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_HAS_TUTORIALS);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
bool hasTutorials = bool(CharacterDatabase.Query(stmt));
|
||||
// Modify data in DB
|
||||
stmt = CharacterDatabase.GetPreparedStatement(hasTutorials ? CHAR_UPD_TUTORIALS : CHAR_INS_TUTORIALS);
|
||||
bool const hasTutorialsInDB = (m_TutorialsChanged & TUTORIALS_FLAG_LOADED_FROM_DB) != 0;
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(hasTutorialsInDB ? CHAR_UPD_TUTORIALS : CHAR_INS_TUTORIALS);
|
||||
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
|
||||
stmt->setUInt32(i, m_Tutorials[i]);
|
||||
stmt->setUInt32(MAX_ACCOUNT_TUTORIAL_VALUES, GetAccountId());
|
||||
trans->Append(stmt);
|
||||
|
||||
m_TutorialsChanged = false;
|
||||
m_TutorialsChanged &= ~TUTORIALS_FLAG_CHANGED;
|
||||
}
|
||||
|
||||
void WorldSession::ReadAddonsInfo(ByteBuffer &data)
|
||||
|
||||
Reference in new issue
Block a user