Core: Fix many "errors"/warnings and coding style (3)
Game Errors were found using Cppcheck, open-source static analysis tool
This commit is contained in:
1 parent
abbb896cfb
commit
e3d9768a50
28 files changed
+72
-105
No files matched your search
@@ -7262,8 +7262,6 @@ void Player::SetArenaPoints(uint32 value)
|
||||
|
||||
void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
|
||||
{
|
||||
PreparedStatement* stmt = NULL;
|
||||
|
||||
int32 newValue = int32(GetHonorPoints()) + value;
|
||||
if (newValue < 0)
|
||||
newValue = 0;
|
||||
@@ -7271,7 +7269,7 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
|
||||
|
||||
if (trans && !trans->null())
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
|
||||
stmt->setUInt32(0, newValue);
|
||||
stmt->setUInt32(1, GetGUIDLow());
|
||||
(*trans)->Append(stmt);
|
||||
@@ -7280,8 +7278,6 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
|
||||
|
||||
void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
|
||||
{
|
||||
PreparedStatement* stmt = NULL;
|
||||
|
||||
int32 newValue = int32(GetArenaPoints()) + value;
|
||||
if (newValue < 0)
|
||||
newValue = 0;
|
||||
@@ -7289,7 +7285,7 @@ void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
|
||||
|
||||
if (trans && !trans->null())
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
|
||||
stmt->setUInt32(0, newValue);
|
||||
stmt->setUInt32(1, GetGUIDLow());
|
||||
(*trans)->Append(stmt);
|
||||
@@ -15681,7 +15677,6 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
|
||||
{
|
||||
uint32 srcItemId = quest->GetSrcItemId();
|
||||
ItemTemplate const* item = sObjectMgr->GetItemTemplate(srcItemId);
|
||||
bool destroyItem = true;
|
||||
|
||||
if (srcItemId > 0)
|
||||
{
|
||||
@@ -15701,6 +15696,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool destroyItem = true;
|
||||
for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n)
|
||||
if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n])
|
||||
destroyItem = false;
|
||||
@@ -17637,7 +17633,6 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
|
||||
|
||||
Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields)
|
||||
{
|
||||
PreparedStatement* stmt = NULL;
|
||||
Item* item = NULL;
|
||||
uint32 itemGuid = fields[13].GetUInt32();
|
||||
uint32 itemEntry = fields[14].GetUInt32();
|
||||
@@ -17647,6 +17642,8 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
||||
item = NewItemOrBag(proto);
|
||||
if (item->LoadFromDB(itemGuid, GetGUID(), fields, itemEntry))
|
||||
{
|
||||
PreparedStatement* stmt = NULL;
|
||||
|
||||
// Do not allow to have item limited to another map/zone in alive state
|
||||
if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user