[12086] Fix some unintended custom literals.

This commit is contained in:
LordJZ 2012-08-04 15:59:33 +04:00 committed by Antz
parent f2578c0e74
commit a2f442fc73
5 changed files with 91 additions and 64 deletions

View file

@ -2579,7 +2579,7 @@ bool ChatHandler::HandlePInfoCommand(char* args)
AccountTypes security = SEC_PLAYER; AccountTypes security = SEC_PLAYER;
std::string last_login = GetMangosString(LANG_ERROR); 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) if (result)
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
@ -4442,7 +4442,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(char* args)
HandleLearnSkillRecipesHelper(target, targetSkillInfo->id); HandleLearnSkillRecipesHelper(target, targetSkillInfo->id);
uint16 maxLevel = target->GetPureMaxSkillValue(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()); PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str());
return true; return true;
} }
@ -4460,7 +4460,7 @@ bool ChatHandler::HandleLookupAccountEmailCommand(char* args)
std::string email = emailStr; std::string email = emailStr;
LoginDatabase.escape_string(email); LoginDatabase.escape_string(email);
// 0 1 2 3 4 // 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); return ShowAccountListHelper(result, &limit);
} }
@ -4479,7 +4479,7 @@ bool ChatHandler::HandleLookupAccountIpCommand(char* args)
LoginDatabase.escape_string(ip); LoginDatabase.escape_string(ip);
// 0 1 2 3 4 // 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); return ShowAccountListHelper(result, &limit);
} }
@ -4500,7 +4500,7 @@ bool ChatHandler::HandleLookupAccountNameCommand(char* args)
LoginDatabase.escape_string(account); LoginDatabase.escape_string(account);
// 0 1 2 3 4 // 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); return ShowAccountListHelper(result, &limit);
} }

View file

@ -22613,7 +22613,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset)
if (!found) // something wrong... 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; return;
} }
} }

View file

@ -2033,7 +2033,7 @@ void World::InitWeeklyQuestResetTime()
m_NextWeeklyQuestReset = m_NextWeeklyQuestReset < curTime ? nextWeekResetTime - WEEK : nextWeekResetTime; m_NextWeeklyQuestReset = m_NextWeeklyQuestReset < curTime ? nextWeekResetTime - WEEK : nextWeekResetTime;
if (!result) 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 else
delete result; delete result;
} }
@ -2064,7 +2064,7 @@ void World::InitDailyQuestResetTime()
m_NextDailyQuestReset = m_NextDailyQuestReset < curTime ? nextDayResetTime - DAY : nextDayResetTime; m_NextDailyQuestReset = m_NextDailyQuestReset < curTime ? nextDayResetTime - DAY : nextDayResetTime;
if (!result) 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 else
delete result; delete result;
} }
@ -2112,7 +2112,7 @@ void World::SetMonthlyQuestResetTime(bool initialize)
m_NextMonthlyQuestReset = (initialize && m_NextMonthlyQuestReset < nextMonthResetTime) ? m_NextMonthlyQuestReset : nextMonthResetTime; 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 // 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() void World::ResetDailyQuests()
@ -2124,7 +2124,7 @@ void World::ResetDailyQuests()
itr->second->GetPlayer()->ResetDailyQuestStatus(); itr->second->GetPlayer()->ResetDailyQuestStatus();
m_NextDailyQuestReset = time_t(m_NextDailyQuestReset + DAY); 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() void World::ResetWeeklyQuests()
@ -2136,7 +2136,7 @@ void World::ResetWeeklyQuests()
itr->second->GetPlayer()->ResetWeeklyQuestStatus(); itr->second->GetPlayer()->ResetWeeklyQuestStatus();
m_NextWeeklyQuestReset = time_t(m_NextWeeklyQuestReset + WEEK); 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() void World::ResetMonthlyQuests()

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,68 +17,95 @@
*/ */
#include "ByteBuffer.h" #include "ByteBuffer.h"
#include "Log.h"
void BitStream::Clear() void ByteBufferException::PrintPosError() const
{ {
_data.clear(); char const* traceStr;
_rpos = _wpos = 0;
#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); if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
return _data[bit]; return;
}
uint8 BitStream::ReadBit() std::ostringstream ss;
{ ss << "STORAGE_SIZE: " << size() << "\n";
MANGOS_ASSERT(_data.size() < _rpos);
uint8 b = _data[_rpos];
++_rpos;
return b;
}
void BitStream::WriteBit(uint32 bit) if (sLog.IsIncludeTime())
{ ss << " ";
_data.push_back(bit ? uint8(1) : uint8(0));
++_wpos;
}
template <typename T> void BitStream::WriteBits(T value, size_t bits) for (size_t i = 0; i < size(); ++i)
{ ss << uint32(read<uint8>(i)) << " - ";
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<uint8> 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)) << " ";
sLog.outDebug(ss.str().c_str()); 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) if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
_storage.resize(res, 0); return;
else
_storage.reserve(res); std::ostringstream ss;
ss << "STORAGE_SIZE: " << size() << "\n";
if (sLog.IsIncludeTime())
ss << " ";
for (size_t i = 0; i < size(); ++i)
ss << read<uint8>(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<uint8>(i));
ss << buf << " ";
}
sLog.outDebug(ss.str().c_str());
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12085" #define REVISION_NR "12086"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__