diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
index 256ee2ba8..5b553a703 100644
--- a/src/game/Level2.cpp
+++ b/src/game/Level2.cpp
@@ -2579,7 +2579,7 @@ bool ChatHandler::HandlePInfoCommand(char* args)
AccountTypes security = SEC_PLAYER;
std::string last_login = GetMangosString(LANG_ERROR);
- QueryResult* result = LoginDatabase.PQuery("SELECT a.username,aa.gmlevel,a.last_ip,a.last_login FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.id = '%u'", accId);
+ QueryResult* result = LoginDatabase.PQuery("SELECT username,gmlevel,last_ip,last_login FROM account WHERE id = '%u'", accId);
if (result)
{
Field* fields = result->Fetch();
@@ -4442,7 +4442,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(char* args)
HandleLearnSkillRecipesHelper(target, targetSkillInfo->id);
uint16 maxLevel = target->GetPureMaxSkillValue(targetSkillInfo->id);
- target->SetSkill(targetSkillInfo->id, maxLevel, maxLevel, target->GetSkillStep(targetSkillInfo->id));
+ target->SetSkill(targetSkillInfo->id, maxLevel, maxLevel);
PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str());
return true;
}
@@ -4460,7 +4460,7 @@ bool ChatHandler::HandleLookupAccountEmailCommand(char* args)
std::string email = emailStr;
LoginDatabase.escape_string(email);
// 0 1 2 3 4
- QueryResult* result = LoginDatabase.PQuery("SELECT a.id, a.username, a.last_ip, aa.gmlevel, a.expansion FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE email " _LIKE_ " " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), email.c_str());
+ QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE email " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), email.c_str());
return ShowAccountListHelper(result, &limit);
}
@@ -4479,7 +4479,7 @@ bool ChatHandler::HandleLookupAccountIpCommand(char* args)
LoginDatabase.escape_string(ip);
// 0 1 2 3 4
- QueryResult* result = LoginDatabase.PQuery("SELECT a.id, a.username, a.last_ip, aa.gmlevel, a.expansion FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE last_ip " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), ip.c_str());
+ QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE last_ip " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), ip.c_str());
return ShowAccountListHelper(result, &limit);
}
@@ -4500,7 +4500,7 @@ bool ChatHandler::HandleLookupAccountNameCommand(char* args)
LoginDatabase.escape_string(account);
// 0 1 2 3 4
- QueryResult* result = LoginDatabase.PQuery("SELECT a.id, a.username, a.last_ip, aa.gmlevel, a.expansion FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE username " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), account.c_str());
+ QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE username " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), account.c_str());
return ShowAccountListHelper(result, &limit);
}
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index ffad1c373..8a08f287b 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -22613,7 +22613,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset)
if (!found) // something wrong...
{
- sLog.outError("Player %s tried to save equipment set "UI64FMTD" (index %u), but that equipment set not found!", GetName(), eqset.Guid, index);
+ sLog.outError("Player %s tried to save equipment set " UI64FMTD " (index %u), but that equipment set not found!", GetName(), eqset.Guid, index);
return;
}
}
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 953d7cc28..251e811cd 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -2033,7 +2033,7 @@ void World::InitWeeklyQuestResetTime()
m_NextWeeklyQuestReset = m_NextWeeklyQuestReset < curTime ? nextWeekResetTime - WEEK : nextWeekResetTime;
if (!result)
- CharacterDatabase.PExecute("INSERT INTO saved_variables (NextWeeklyQuestResetTime) VALUES ('"UI64FMTD"')", uint64(m_NextWeeklyQuestReset));
+ CharacterDatabase.PExecute("INSERT INTO saved_variables (NextWeeklyQuestResetTime) VALUES ('" UI64FMTD "')", uint64(m_NextWeeklyQuestReset));
else
delete result;
}
@@ -2064,7 +2064,7 @@ void World::InitDailyQuestResetTime()
m_NextDailyQuestReset = m_NextDailyQuestReset < curTime ? nextDayResetTime - DAY : nextDayResetTime;
if (!result)
- CharacterDatabase.PExecute("INSERT INTO saved_variables (NextDailyQuestResetTime) VALUES ('"UI64FMTD"')", uint64(m_NextDailyQuestReset));
+ CharacterDatabase.PExecute("INSERT INTO saved_variables (NextDailyQuestResetTime) VALUES ('" UI64FMTD "')", uint64(m_NextDailyQuestReset));
else
delete result;
}
@@ -2112,7 +2112,7 @@ void World::SetMonthlyQuestResetTime(bool initialize)
m_NextMonthlyQuestReset = (initialize && m_NextMonthlyQuestReset < nextMonthResetTime) ? m_NextMonthlyQuestReset : nextMonthResetTime;
// Row must exist for this to work. Currently row is added by InitDailyQuestResetTime(), called before this function
- CharacterDatabase.PExecute("UPDATE saved_variables SET NextMonthlyQuestResetTime = '"UI64FMTD"'", uint64(m_NextMonthlyQuestReset));
+ CharacterDatabase.PExecute("UPDATE saved_variables SET NextMonthlyQuestResetTime = '" UI64FMTD "'", uint64(m_NextMonthlyQuestReset));
}
void World::ResetDailyQuests()
@@ -2124,7 +2124,7 @@ void World::ResetDailyQuests()
itr->second->GetPlayer()->ResetDailyQuestStatus();
m_NextDailyQuestReset = time_t(m_NextDailyQuestReset + DAY);
- CharacterDatabase.PExecute("UPDATE saved_variables SET NextDailyQuestResetTime = '"UI64FMTD"'", uint64(m_NextDailyQuestReset));
+ CharacterDatabase.PExecute("UPDATE saved_variables SET NextDailyQuestResetTime = '" UI64FMTD "'", uint64(m_NextDailyQuestReset));
}
void World::ResetWeeklyQuests()
@@ -2136,7 +2136,7 @@ void World::ResetWeeklyQuests()
itr->second->GetPlayer()->ResetWeeklyQuestStatus();
m_NextWeeklyQuestReset = time_t(m_NextWeeklyQuestReset + WEEK);
- CharacterDatabase.PExecute("UPDATE saved_variables SET NextWeeklyQuestResetTime = '"UI64FMTD"'", uint64(m_NextWeeklyQuestReset));
+ CharacterDatabase.PExecute("UPDATE saved_variables SET NextWeeklyQuestResetTime = '" UI64FMTD "'", uint64(m_NextWeeklyQuestReset));
}
void World::ResetMonthlyQuests()
diff --git a/src/shared/ByteBuffer.cpp b/src/shared/ByteBuffer.cpp
index 95df50e5b..3254d97c8 100644
--- a/src/shared/ByteBuffer.cpp
+++ b/src/shared/ByteBuffer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2011 MaNGOS
+ * Copyright (C) 2005-2012 MaNGOS
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,68 +17,95 @@
*/
#include "ByteBuffer.h"
+#include "Log.h"
-void BitStream::Clear()
+void ByteBufferException::PrintPosError() const
{
- _data.clear();
- _rpos = _wpos = 0;
+ char const* traceStr;
+
+#ifdef HAVE_ACE_STACK_TRACE_H
+ ACE_Stack_Trace trace;
+ traceStr = trace.c_str();
+#else
+ traceStr = NULL;
+#endif
+
+ sLog.outError(
+ "Attempted to %s in ByteBuffer (pos: " SIZEFMTD " size: " SIZEFMTD ") "
+ "value with size: " SIZEFMTD "%s%s",
+ (add ? "put" : "get"), pos, size, esize,
+ traceStr ? "\n" : "", traceStr ? traceStr : "");
}
-uint8 BitStream::GetBit(uint32 bit)
+void ByteBuffer::print_storage() const
{
- MANGOS_ASSERT(_data.size() > bit);
- return _data[bit];
-}
+ if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
+ return;
-uint8 BitStream::ReadBit()
-{
- MANGOS_ASSERT(_data.size() < _rpos);
- uint8 b = _data[_rpos];
- ++_rpos;
- return b;
-}
+ std::ostringstream ss;
+ ss << "STORAGE_SIZE: " << size() << "\n";
-void BitStream::WriteBit(uint32 bit)
-{
- _data.push_back(bit ? uint8(1) : uint8(0));
- ++_wpos;
-}
+ if (sLog.IsIncludeTime())
+ ss << " ";
-template void BitStream::WriteBits(T value, size_t bits)
-{
- for (int32 i = bits-1; i >= 0; --i)
- WriteBit((value >> i) & 1);
-}
-
-bool BitStream::Empty()
-{
- return _data.empty();
-}
-
-void BitStream::Reverse()
-{
- uint32 len = GetLength();
- std::vector b = _data;
- Clear();
-
- for(uint32 i = len; i > 0; --i)
- WriteBit(b[i-1]);
-}
-
-void BitStream::Print()
-{
- std::stringstream ss;
- ss << "BitStream: ";
- for (uint32 i = 0; i < GetLength(); ++i)
- ss << uint32(GetBit(i)) << " ";
+ for (size_t i = 0; i < size(); ++i)
+ ss << uint32(read(i)) << " - ";
sLog.outDebug(ss.str().c_str());
}
-ByteBuffer::ByteBuffer(size_t res, bool init): _rpos(0), _wpos(0), _bitpos(8), _curbitval(0)
+void ByteBuffer::textlike() const
{
- if (init)
- _storage.resize(res, 0);
- else
- _storage.reserve(res);
+ if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
+ return;
+
+ std::ostringstream ss;
+ ss << "STORAGE_SIZE: " << size() << "\n";
+
+ if (sLog.IsIncludeTime())
+ ss << " ";
+
+ for (size_t i = 0; i < size(); ++i)
+ ss << read(i);
+
+ sLog.outDebug(ss.str().c_str());
+}
+
+void ByteBuffer::hexlike() const
+{
+ if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
+ return;
+
+ std::ostringstream ss;
+ ss << "STORAGE_SIZE: " << size() << "\n";
+
+ if (sLog.IsIncludeTime())
+ ss << " ";
+
+ size_t j = 1, k = 1;
+
+ for (size_t i = 0; i < size(); ++i)
+ {
+ if ((i == (j * 8)) && ((i != (k * 16))))
+ {
+ ss << "| ";
+ ++j;
+ }
+ else if (i == (k * 16))
+ {
+ ss << "\n";
+
+ if (sLog.IsIncludeTime())
+ ss << " ";
+
+ ++k;
+ ++j;
+ }
+
+ char buf[4];
+ snprintf(buf, 4, "%02X", read(i));
+ ss << buf << " ";
+ }
+
+ sLog.outDebug(ss.str().c_str());
}
diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h
index 95dd52884..75149ef12 100644
--- a/src/shared/revision_nr.h
+++ b/src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "12085"
+ #define REVISION_NR "12086"
#endif // __REVISION_NR_H__