diff options
author | megamage <none@none> | 2009-04-27 18:42:35 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-27 18:42:35 -0500 |
commit | 09af28301e646bf75b63113129996724550d7dd6 (patch) | |
tree | a36f7bb0f369c13b71958f40e0247150417ba18e /src | |
parent | 5ac67c27f71a7b53fbce92ffdab3adb62b6baf0c (diff) |
[7716] Fixed some typos and possible crashes. Author: AlexDereka
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/AchievementMgr.cpp | 22 | ||||
-rw-r--r-- | src/game/BattleGroundHandler.cpp | 8 | ||||
-rw-r--r-- | src/game/BattleGroundMgr.cpp | 23 | ||||
-rw-r--r-- | src/game/Channel.cpp | 14 | ||||
-rw-r--r-- | src/game/CreatureEventAI.cpp | 4 | ||||
-rw-r--r-- | src/game/Debugcmds.cpp | 40 | ||||
-rw-r--r-- | src/game/GameEventMgr.cpp | 12 | ||||
-rw-r--r-- | src/game/Group.cpp | 4 | ||||
-rw-r--r-- | src/game/GuildHandler.cpp | 2 | ||||
-rw-r--r-- | src/game/InstanceSaveMgr.cpp | 16 | ||||
-rw-r--r-- | src/game/ItemHandler.cpp | 2 | ||||
-rw-r--r-- | src/game/Level2.cpp | 4 | ||||
-rw-r--r-- | src/game/MapInstanced.cpp | 2 | ||||
-rw-r--r-- | src/game/MiscHandler.cpp | 5 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 26 | ||||
-rw-r--r-- | src/game/Pet.cpp | 18 | ||||
-rw-r--r-- | src/game/PetHandler.cpp | 17 | ||||
-rw-r--r-- | src/game/PetitionsHandler.cpp | 8 | ||||
-rw-r--r-- | src/game/Player.cpp | 229 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 5 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 31 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 12 | ||||
-rw-r--r-- | src/game/Unit.cpp | 12 | ||||
-rw-r--r-- | src/shared/ServiceWin32.cpp | 6 |
24 files changed, 270 insertions, 252 deletions
diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 3eb76d6f45f..35e834242af 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -720,12 +720,12 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; // skip wrong arena achievements, if not achievIdByArenaSlot then normal total death counter bool notfit = false; - for(int i = 0; i < MAX_ARENA_SLOT; ++i) + for(int j = 0; j < MAX_ARENA_SLOT; ++j) { - if(achievIdByArenaSlot[i] == achievement->ID) + if(achievIdByArenaSlot[j] == achievement->ID) { BattleGround* bg = GetPlayer()->GetBattleGround(); - if(!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != i) + if(!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != j) notfit = true; break; @@ -749,26 +749,26 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui // search case bool found = false; - for(int i = 0; achievIdForDangeon[i][0]; ++i) + for(int j = 0; achievIdForDangeon[j][0]; ++j) { - if(achievIdForDangeon[i][0] == achievement->ID) + if(achievIdForDangeon[j][0] == achievement->ID) { if(map->IsRaid()) { // if raid accepted (ignore difficulty) - if(!achievIdForDangeon[i][2]) + if(!achievIdForDangeon[j][2]) break; // for } else if(GetPlayer()->GetDifficulty()==DIFFICULTY_NORMAL) { // dungeon in normal mode accepted - if(!achievIdForDangeon[i][1]) + if(!achievIdForDangeon[j][1]) break; // for } else { // dungeon in heroic mode accepted - if(!achievIdForDangeon[i][3]) + if(!achievIdForDangeon[j][3]) break; // for } @@ -890,9 +890,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui break; bool matchFound = false; - for (int i = 0; i < 3; ++i) + for (int j = 0; j < 3; ++j) { - int32 exploreFlag = GetAreaFlagByAreaID(worldOverlayEntry->areatableID[i]); + int32 exploreFlag = GetAreaFlagByAreaID(worldOverlayEntry->areatableID[j]); if(exploreFlag < 0) break; @@ -1392,7 +1392,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, { progress = &iter->second; - uint32 newValue; + uint32 newValue = 0; switch(ptype) { case PROGRESS_SET: diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index cf062708a80..5540aa025d4 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -112,9 +112,9 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) return; // get bg instance or bg template if instance not found - BattleGround * bg = NULL; + BattleGround *bg = NULL; if (instanceId) - BattleGround *bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId)); + bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId)); if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId))) { @@ -359,7 +359,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) else { // get the bg we're invited to - BattleGround * bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId); + bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId); status = STATUS_WAIT_JOIN; } @@ -573,7 +573,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) } else { - BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); + bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); if (!bg) continue; uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(itrPlayerStatus->second.GroupInfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId)); diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 6b7b3c99fe0..e5e134b6478 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -763,10 +763,10 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve FillPlayersToBG(bg, queue_id); // now everything is set, invite players - for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++itr) - InviteGroupToBG((*itr), bg, (*itr)->Team); - for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++itr) - InviteGroupToBG((*itr), bg, (*itr)->Team); + for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg, (*citr)->Team); + for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg, (*citr)->Team); if (!bg->HasFreeSlots()) { @@ -836,8 +836,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve } //invite those selection pools for(uint32 i = 0; i < BG_TEAMS_COUNT; i++) - for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++itr) - InviteGroupToBG((*itr), bg2, (*itr)->Team); + for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg2, (*citr)->Team); //start bg bg2->StartBattleGround(); //clear structures @@ -863,8 +863,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve // invite those selection pools for(uint32 i = 0; i < BG_TEAMS_COUNT; i++) - for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++itr) - InviteGroupToBG((*itr), bg2, (*itr)->Team); + for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg2, (*citr)->Team); // start bg bg2->StartBattleGround(); } @@ -1826,10 +1826,11 @@ void BattleGroundMgr::DistributeArenaPoints() void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, BattleGroundTypeId bgTypeId) { - uint32 PlayerLevel = 10; + if (!plr) + return; - if (plr) - PlayerLevel = plr->getLevel(); + uint32 PlayerLevel = 10; + PlayerLevel = plr->getLevel(); data->Initialize(SMSG_BATTLEFIELD_LIST); *data << uint64(guid); // battlemaster guid diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index 8d61dd733ea..4799539ac62 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -300,10 +300,11 @@ void Channel::Password(uint64 p, const char *pass) void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) { - uint32 sec = 0; Player *plr = objmgr.GetPlayer(p); - if(plr) - sec = plr->GetSession()->GetSecurity(); + if (!plr) + return; + + uint32 sec = plr->GetSession()->GetSecurity(); if(!IsOn(p)) { @@ -368,10 +369,11 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) void Channel::SetOwner(uint64 p, const char *newname) { - uint32 sec = 0; Player *plr = objmgr.GetPlayer(p); - if(plr) - sec = plr->GetSession()->GetSecurity(); + if (!plr) + return; + + uint32 sec = plr->GetSession()->GetSecurity(); if(!IsOn(p)) { diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 704dad6ad34..a737a7a3205 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -904,8 +904,8 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u //if not available, use pActionInvoker if (Unit* pTarget = GetTargetByType(param2, pActionInvoker)) { - if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself()) - pPlayer->RewardPlayerAndGroupAtEvent(param1, m_creature); + if (Player* pPlayer2 = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself()) + pPlayer2->RewardPlayerAndGroupAtEvent(param1, m_creature); } } } diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp index de72f60acb3..5b0f1cbebe3 100644 --- a/src/game/Debugcmds.cpp +++ b/src/game/Debugcmds.cpp @@ -429,9 +429,9 @@ bool ChatHandler::HandleDebugGetItemState(const char* args) Bag *bag = (Bag*)item; for (uint8 j = 0; j < bag->GetBagSize(); ++j) { - Item* item = bag->GetItemByPos(j); - if (item && item->GetState() == state) - PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID())); + Item* item2 = bag->GetItemByPos(j); + if (item2 && item2->GetState() == state) + PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID())); } } } @@ -525,58 +525,58 @@ bool ChatHandler::HandleDebugGetItemState(const char* args) Bag *bag = (Bag*)item; for (uint8 j = 0; j < bag->GetBagSize(); ++j) { - Item* item = bag->GetItemByPos(j); - if (!item) continue; + Item* item2 = bag->GetItemByPos(j); + if (!item2) continue; - if (item->GetSlot() != j) + if (item2->GetSlot() != j) { - PSendSysMessage("the item in bag %d slot %d, guid %d has an incorrect slot value: %d", bag->GetSlot(), j, item->GetGUIDLow(), item->GetSlot()); + PSendSysMessage("the item in bag %d slot %d, guid %d has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUIDLow(), item2->GetSlot()); error = true; continue; } - if (item->GetOwnerGUID() != player->GetGUID()) + if (item2->GetOwnerGUID() != player->GetGUID()) { - PSendSysMessage("for the item in bag %d at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); + PSendSysMessage("for the item in bag %d at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow()); error = true; continue; } - Bag *container = item->GetContainer(); + Bag *container = item2->GetContainer(); if (!container) { - PSendSysMessage("the item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow()); + PSendSysMessage("the item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow()); error = true; continue; } if (container != bag) { - PSendSysMessage("the item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); + PSendSysMessage("the item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); error = true; continue; } - if (item->IsInUpdateQueue()) + if (item2->IsInUpdateQueue()) { - uint16 qp = item->GetQueuePos(); + uint16 qp = item2->GetQueuePos(); if (qp > updateQueue.size()) { - PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp); + PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp); error = true; continue; } if (updateQueue[qp] == NULL) { - PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp); + PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp); error = true; continue; } - if (updateQueue[qp] != item) + if (updateQueue[qp] != item2) { - PSendSysMessage("item in bag: %d at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow()); + PSendSysMessage("item in bag: %d at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow()); error = true; continue; } } - else if (item->GetState() != ITEM_UNCHANGED) + else if (item2->GetState() != ITEM_UNCHANGED) { - PSendSysMessage("item in bag: %d at slot: %d guid: %d is not in queue but should be (state: %d)!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), item->GetState()); + PSendSysMessage("item in bag: %d at slot: %d guid: %d is not in queue but should be (state: %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetState()); error = true; continue; } } diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 53d01529fb9..5af64d805ed 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -1377,17 +1377,17 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) } else // If not spawned { - CreatureData const* data = objmgr.GetCreatureData(itr->first); - if (data && activate) + CreatureData const* data2 = objmgr.GetCreatureData(itr->first); + if (data2 && activate) { - CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(data->id); - uint32 display_id = objmgr.ChooseDisplayId(0,cinfo,data); + CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(data2->id); + uint32 display_id = objmgr.ChooseDisplayId(0,cinfo,data2); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; - if (data->equipmentId == 0) + if (data2->equipmentId == 0) itr->second.equipement_id_prev = cinfo->equipmentId; - else if (data->equipmentId != -1) + else if (data2->equipmentId != -1) itr->second.equipement_id_prev = data->equipmentId; itr->second.modelid_prev = display_id; } diff --git a/src/game/Group.cpp b/src/game/Group.cpp index f4a977c3d7c..34829b7794c 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -72,8 +72,8 @@ Group::~Group() // will be unloaded first so we must be prepared for both cases // this may unload some instance saves for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++) - for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) - itr->second.save->RemoveGroup(this); + for(BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2) + itr2->second.save->RemoveGroup(this); // Sub group counters clean up if (m_subGroupsCounts) diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index b544db01f66..ef59a67ceae 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -1194,7 +1194,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data ) else // swap { gDest.clear(); - uint8 msg = pGuild->CanStoreItem(BankTabDst,BankTabSlotDst,gDest,pItemSrc->GetCount(),pItemSrc,true); + msg = pGuild->CanStoreItem(BankTabDst,BankTabSlotDst,gDest,pItemSrc->GetCount(),pItemSrc,true); if( msg != EQUIP_ERR_OK ) { pl->SendEquipError( msg, pItemSrc, NULL ); diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index d4232a71838..43205cd1e8c 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -55,16 +55,16 @@ InstanceSaveManager::~InstanceSaveManager() for (InstanceSaveHashMap::iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr) { InstanceSave *save = itr->second; - for(InstanceSave::PlayerListType::iterator itr = save->m_playerList.begin(), next = itr; itr != save->m_playerList.end(); itr = next) + for(InstanceSave::PlayerListType::iterator itr2 = save->m_playerList.begin(), next = itr2; itr2 != save->m_playerList.end(); itr2 = next) { ++next; - (*itr)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true); + (*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true); } save->m_playerList.clear(); - for(InstanceSave::GroupListType::iterator itr = save->m_groupList.begin(), next = itr; itr != save->m_groupList.end(); itr = next) + for(InstanceSave::GroupListType::iterator itr2 = save->m_groupList.begin(), next = itr2; itr2 != save->m_groupList.end(); itr2 = next) { ++next; - (*itr)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true); + (*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true); } save->m_groupList.clear(); delete save; @@ -622,10 +622,10 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe MapInstanced::InstancedMaps::iterator mitr; for(mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr) { - Map *map = mitr->second; - if(!map->IsDungeon()) continue; - if(warn) ((InstanceMap*)map)->SendResetWarnings(timeLeft); - else ((InstanceMap*)map)->Reset(INSTANCE_RESET_GLOBAL); + Map *map2 = mitr->second; + if(!map2->IsDungeon()) continue; + if(warn) ((InstanceMap*)map2)->SendResetWarnings(timeLeft); + else ((InstanceMap*)map2)->Reset(INSTANCE_RESET_GLOBAL); } // TODO: delete creature/gameobject respawn times even if the maps are not loaded diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index c37b7cc4dbe..774a6eb8287 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -201,7 +201,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) // check dest->src move possibility ItemPosCountVec sSrc; - uint16 eSrc; + uint16 eSrc = 0; if( _player->IsInventoryPos( src ) ) { msg = _player->CanStoreItem( srcbag, srcslot, sSrc, pDstItem, true ); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 1d019e3dfbb..e94f752c41f 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -599,7 +599,7 @@ bool ChatHandler::HandleGameObjectDeleteCommand(const char* args) if(owner_guid) { Unit* owner = ObjectAccessor::GetUnit(*m_session->GetPlayer(),owner_guid); - if(!owner && !IS_PLAYER_GUID(owner_guid)) + if(!owner || !IS_PLAYER_GUID(owner_guid)) { PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow()); SetSentErrorMessage(true); @@ -1421,7 +1421,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args) if(!cId) return false; - uint32 lowguid = atoi(cId); + lowguid = atoi(cId); /* FIXME: impossibel without entry if(lowguid) diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index 99d677afffa..2494a07e20c 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -221,7 +221,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, } // some instances only have one difficulty - if(!entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL; + if (entry && !entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL; sLog.outDebug("MapInstanced::CreateInstance: %smap instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal"); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 2fdee922446..aca89640d6d 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1432,7 +1432,10 @@ void WorldSession::HandleReportSpamOpcode( WorldPacket & recv_data ) uint8 spam_type; // 0 - mail, 1 - chat uint64 spammer_guid; - uint32 unk1, unk2, unk3, unk4 = 0; + uint32 unk1 = 0; + uint32 unk2 = 0; + uint32 unk3 = 0; + uint32 unk4 = 0; std::string description = ""; recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat) recv_data >> spammer_guid; // player guid diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index fb351bf91a2..a23b900e239 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -678,12 +678,12 @@ void ObjectMgr::LoadCreatureTemplates() sLog.outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u)", cInfo->Entry, cInfo->PetSpellDataId); } - for(int i = 0; i < CREATURE_MAX_SPELLS; ++i) + for(int j = 0; j < CREATURE_MAX_SPELLS; ++j) { - if(cInfo->spells[i] && !sSpellStore.LookupEntry(cInfo->spells[i])) + if(cInfo->spells[j] && !sSpellStore.LookupEntry(cInfo->spells[j])) { - sLog.outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0", cInfo->Entry, i+1,cInfo->spells[i]); - const_cast<CreatureInfo*>(cInfo)->spells[i] = 0; + sLog.outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0", cInfo->Entry, j+1,cInfo->spells[j]); + const_cast<CreatureInfo*>(cInfo)->spells[j] = 0; } } @@ -2879,15 +2879,15 @@ void ObjectMgr::LoadGroups() result = CharacterDatabase.Query("SELECT memberGuid, assistant, subgroup, leaderGuid FROM group_member ORDER BY leaderGuid"); if(!result) { - barGoLink bar( 1 ); - bar.step(); + barGoLink bar2( 1 ); + bar2.step(); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar2( result->GetRowCount() ); do { - bar.step(); + bar2.step(); Field *fields = result->Fetch(); count++; leaderGuid = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER); @@ -2939,15 +2939,15 @@ void ObjectMgr::LoadGroups() if(!result) { - barGoLink bar( 1 ); - bar.step(); + barGoLink bar2( 1 ); + bar2.step(); } else { - barGoLink bar( result->GetRowCount() ); + barGoLink bar2( result->GetRowCount() ); do { - bar.step(); + bar2.step(); Field *fields = result->Fetch(); count++; leaderGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); @@ -3334,7 +3334,7 @@ void ObjectMgr::LoadQuests() { sLog.outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.", qinfo->GetQuestId(),j+1,id,id); - // no changes, quest can't be done for this requirement + continue; } if(!qinfo->ReqCreatureOrGOId[j]) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 2fb1a710e7a..0c254bc9eb7 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -357,10 +357,10 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool delete m_declinedname; m_declinedname = new DeclinedName; - Field *fields = result->Fetch(); + Field *fields2 = result->Fetch(); for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) { - m_declinedname->name[i] = fields[i].GetCppString(); + m_declinedname->name[i] = fields2[i].GetCppString(); } } } @@ -1275,19 +1275,19 @@ bool Pet::addSpell(uint32 spell_id, uint16 active, PetSpellState state, PetSpell } else if(uint32 chainstart = spellmgr.GetFirstSpellInChain(spell_id)) { - for (PetSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) + for (PetSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { - if(itr->second->state == PETSPELL_REMOVED) continue; + if(itr2->second->state == PETSPELL_REMOVED) continue; - if(spellmgr.GetFirstSpellInChain(itr->first) == chainstart) + if(spellmgr.GetFirstSpellInChain(itr2->first) == chainstart) { - newspell->active = itr->second->active; + newspell->active = itr2->second->active; if(newspell->active == ACT_ENABLED) - ToggleAutocast(itr->first, false); + ToggleAutocast(itr2->first, false); - oldspell_id = itr->first; - unlearnSpell(itr->first); + oldspell_id = itr2->first; + unlearnSpell(itr2->first); break; } } diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 56845eaa656..37f0255f6b3 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -226,10 +226,19 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid //auto turn to target unless possessed if(result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->isPossessed()) { - pet->SetInFront(unit_target); - if( unit_target->GetTypeId() == TYPEID_PLAYER ) - pet->SendUpdateToPlayer( (Player*)unit_target ); - if(Unit* powner = pet->GetCharmerOrOwner()) + if(unit_target) + { + pet->SetInFront(unit_target); + if (unit_target->GetTypeId() == TYPEID_PLAYER) + pet->SendUpdateToPlayer( (Player*)unit_target ); + } + else if(Unit *unit_target2 = spell->m_targets.getUnitTarget()) + { + pet->SetInFront(unit_target2); + if (unit_target2->GetTypeId() == TYPEID_PLAYER) + pet->SendUpdateToPlayer( (Player*)unit_target2 ); + } + if (Unit* powner = pet->GetCharmerOrOwner()) if(powner->GetTypeId() == TYPEID_PLAYER) pet->SendUpdateToPlayer((Player*)powner); result = SPELL_CAST_OK; diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index 7d14e26c7d5..316de998a80 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -281,8 +281,8 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) for(uint8 i = 1; i <= signs; i++) { - Field *fields = result->Fetch(); - uint64 plguid = fields[0].GetUInt64(); + Field *fields2 = result->Fetch(); + uint64 plguid = fields2[0].GetUInt64(); data << plguid; // Player GUID data << (uint32)0; // there 0 ... @@ -692,8 +692,8 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) for(uint8 i = 1; i <= signs; i++) { - Field *fields = result->Fetch(); - uint64 plguid = fields[0].GetUInt64(); + Field *fields2 = result->Fetch(); + plguid = fields2[0].GetUInt64(); data << plguid; // Player GUID data << (uint32)0; // there 0 ... diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d1bbaebd0d6..30c79b11c95 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -812,7 +812,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 } // if this is ammo then use it - uint8 msg = CanUseAmmo( pItem->GetEntry() ); + msg = CanUseAmmo( pItem->GetEntry() ); if( msg == EQUIP_ERR_OK ) SetAmmo( pItem->GetEntry() ); } @@ -916,8 +916,8 @@ void Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) DEBUG_LOG("We are fall to death, loosing 10 percents durability"); DurabilityLossAll(0.10f,false); // durability lost message - WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0); - GetSession()->SendPacket(&data); + WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 0); + GetSession()->SendPacket(&data2); } GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM, 1, type); @@ -2870,22 +2870,22 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen // replace spells in action bars and spellbook to bigger rank if only one spell rank must be accessible if(newspell->active && !newspell->disabled && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0) { - for( PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr ) + for( PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2 ) { - if(itr->second->state == PLAYERSPELL_REMOVED) continue; - SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr->first); + if(itr2->second->state == PLAYERSPELL_REMOVED) continue; + SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr2->first); if(!i_spellInfo) continue; - if( spellmgr.IsRankSpellDueToSpell(spellInfo,itr->first) ) + if( spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first) ) { - if(itr->second->active) + if(itr2->second->active) { - if(spellmgr.IsHighRankOfSpell(spell_id,itr->first)) + if(spellmgr.IsHighRankOfSpell(spell_id,itr2->first)) { if(IsInWorld()) // not send spell (re-/over-)learn packets at loading { WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); - data << uint16(itr->first); + data << uint16(itr2->first); data << uint16(spell_id); GetSession()->SendPacket( &data ); } @@ -2896,13 +2896,13 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen itr->second->state = PLAYERSPELL_CHANGED; superceded_old = true; // new spell replace old in action bars and spell book. } - else if(spellmgr.IsHighRankOfSpell(itr->first,spell_id)) + else if(spellmgr.IsHighRankOfSpell(itr2->first,spell_id)) { if(IsInWorld()) // not send spell (re-/over-)learn packets at loading { WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); data << uint16(spell_id); - data << uint16(itr->first); + data << uint16(itr2->first); GetSession()->SendPacket( &data ); } @@ -3015,14 +3015,14 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen SpellLearnSpellMap::const_iterator spell_begin = spellmgr.GetBeginSpellLearnSpell(spell_id); SpellLearnSpellMap::const_iterator spell_end = spellmgr.GetEndSpellLearnSpell(spell_id); - for(SpellLearnSpellMap::const_iterator itr = spell_begin; itr != spell_end; ++itr) + for(SpellLearnSpellMap::const_iterator itr2 = spell_begin; itr2 != spell_end; ++itr2) { - if(!itr->second.autoLearned) + if(!itr2->second.autoLearned) { - if(!IsInWorld() || !itr->second.active) // at spells loading, no output, but allow save - addSpell(itr->second.spell,itr->second.active,true,true,false); + if(!IsInWorld() || !itr2->second.active) // at spells loading, no output, but allow save + addSpell(itr2->second.spell,itr2->second.active,true,true,false); else // at normal learning - learnSpell(itr->second.spell,true); + learnSpell(itr2->second.spell,true); } } @@ -5304,15 +5304,15 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal) // temporary bonuses AuraEffectList const& mModSkill = GetAurasByType(SPELL_AURA_MOD_SKILL); - for(AuraEffectList::const_iterator i = mModSkill.begin(); i != mModSkill.end(); ++i) - if ((*i)->GetMiscValue() == int32(id)) - (*i)->ApplyModifier(true); + for(AuraEffectList::const_iterator j = mModSkill.begin(); j != mModSkill.end(); ++j) + if ((*j)->GetMiscValue() == int32(id)) + (*j)->ApplyModifier(true); // permanent bonuses AuraEffectList const& mModSkillTalent = GetAurasByType(SPELL_AURA_MOD_SKILL_TALENT); - for(AuraEffectList::const_iterator i = mModSkillTalent.begin(); i != mModSkillTalent.end(); ++i) - if ((*i)->GetMiscValue() == int32(id)) - (*i)->ApplyModifier(true); + for(AuraEffectList::const_iterator j = mModSkillTalent.begin(); j != mModSkillTalent.end(); ++j) + if ((*j)->GetMiscValue() == int32(id)) + (*j)->ApplyModifier(true); // Learn all spells for skill learnSkillRewardedSpells(id, currVal); @@ -5766,11 +5766,11 @@ void Player::RewardReputation(Unit *pVictim, float rate) donerep1 = int32(donerep1*rate); FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(Rep->repfaction1); uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); - if(factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1) + if (factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1) GetReputationMgr().ModifyReputation(factionEntry1, donerep1); // Wiki: Team factions value divided by 2 - if(Rep->is_teamaward1) + if (factionEntry1 && Rep->is_teamaward1) { FactionEntry const *team1_factionEntry = sFactionStore.LookupEntry(factionEntry1->team); if(team1_factionEntry) @@ -5784,11 +5784,11 @@ void Player::RewardReputation(Unit *pVictim, float rate) donerep2 = int32(donerep2*rate); FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(Rep->repfaction2); uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); - if(factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2) + if (factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2) GetReputationMgr().ModifyReputation(factionEntry2, donerep2); // Wiki: Team factions value divided by 2 - if(Rep->is_teamaward2) + if (factionEntry2 && Rep->is_teamaward2) { FactionEntry const *team2_factionEntry = sFactionStore.LookupEntry(factionEntry2->team); if(team2_factionEntry) @@ -9836,8 +9836,8 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo return EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE; // if swap ignore item (equipped also) - if(uint8 res = CanEquipUniqueItem(pItem, swap ? eslot : NULL_SLOT)) - return res; + if(uint8 res2 = CanEquipUniqueItem(pItem, swap ? eslot : NULL_SLOT)) + return res2; // check unique-equipped special item classes if (pProto->Class == ITEM_CLASS_QUIVER) @@ -10428,97 +10428,96 @@ Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update ) Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) { - if( pItem ) - { - AddEnchantmentDurations(pItem); - AddItemDurations(pItem); - uint8 bag = pos >> 8; - uint8 slot = pos & 255; + AddEnchantmentDurations(pItem); + AddItemDurations(pItem); - Item *pItem2 = GetItemByPos( bag, slot ); + uint8 bag = pos >> 8; + uint8 slot = pos & 255; - if( !pItem2 ) + Item *pItem2 = GetItemByPos( bag, slot ); + + if( !pItem2 ) + { + VisualizeItem( slot, pItem); + + if(isAlive()) { - VisualizeItem( slot, pItem); + ItemPrototype const *pProto = pItem->GetProto(); - if(isAlive()) - { - ItemPrototype const *pProto = pItem->GetProto(); + // item set bonuses applied only at equip and removed at unequip, and still active for broken items + if(pProto && pProto->ItemSet) + AddItemsSetItem(this,pItem); - // item set bonuses applied only at equip and removed at unequip, and still active for broken items - if(pProto && pProto->ItemSet) - AddItemsSetItem(this,pItem); + _ApplyItemMods(pItem, slot, true); - _ApplyItemMods(pItem, slot, true); + if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0) + { + uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s; - if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0) - { - uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s; + if (getClass() == CLASS_ROGUE) + cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s; - if (getClass() == CLASS_ROGUE) - cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s; + SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell); - SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell); + if (!spellProto) + sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); + else + { + m_weaponChangeTimer = spellProto->StartRecoveryTime; - if (!spellProto) - sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); - else - { - m_weaponChangeTimer = spellProto->StartRecoveryTime; - - WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4); - data << uint64(GetGUID()); - data << uint8(1); - data << uint32(cooldownSpell); - data << uint32(0); - GetSession()->SendPacket(&data); - } + WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4); + data << uint64(GetGUID()); + data << uint8(1); + data << uint32(cooldownSpell); + data << uint32(0); + GetSession()->SendPacket(&data); } } + } - if( IsInWorld() && update ) - { - pItem->AddToWorld(); - pItem->SendUpdateToPlayer( this ); - } + if( IsInWorld() && update ) + { + pItem->AddToWorld(); + pItem->SendUpdateToPlayer( this ); + } - ApplyEquipCooldown(pItem); + ApplyEquipCooldown(pItem); - if( slot == EQUIPMENT_SLOT_MAINHAND ) - UpdateExpertise(BASE_ATTACK); - else if( slot == EQUIPMENT_SLOT_OFFHAND ) - UpdateExpertise(OFF_ATTACK); - } - else - { - pItem2->SetCount( pItem2->GetCount() + pItem->GetCount() ); - if( IsInWorld() && update ) - pItem2->SendUpdateToPlayer( this ); + if( slot == EQUIPMENT_SLOT_MAINHAND ) + UpdateExpertise(BASE_ATTACK); + else if( slot == EQUIPMENT_SLOT_OFFHAND ) + UpdateExpertise(OFF_ATTACK); + } + else + { + pItem2->SetCount( pItem2->GetCount() + pItem->GetCount() ); + if( IsInWorld() && update ) + pItem2->SendUpdateToPlayer( this ); - // delete item (it not in any slot currently) - //pItem->DeleteFromDB(); - if( IsInWorld() && update ) - { - pItem->RemoveFromWorld(); - pItem->DestroyForPlayer( this ); - } + // delete item (it not in any slot currently) + //pItem->DeleteFromDB(); + if( IsInWorld() && update ) + { + pItem->RemoveFromWorld(); + pItem->DestroyForPlayer( this ); + } - RemoveEnchantmentDurations(pItem); - RemoveItemDurations(pItem); + RemoveEnchantmentDurations(pItem); + RemoveItemDurations(pItem); - pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor - pItem->SetState(ITEM_REMOVED, this); - pItem2->SetState(ITEM_CHANGED, this); + pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor + pItem->SetState(ITEM_REMOVED, this); + pItem2->SetState(ITEM_CHANGED, this); - ApplyEquipCooldown(pItem2); + ApplyEquipCooldown(pItem2); - return pItem2; - } + return pItem2; } // only for full equip instead adding to stack GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry()); + return pItem; } @@ -11286,7 +11285,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) // check src->dest move possibility ItemPosCountVec sDest; - uint16 eDest; + uint16 eDest = 0; if( IsInventoryPos( dst ) ) msg = CanStoreItem( dstbag, dstslot, sDest, pSrcItem, true ); else if( IsBankPos( dst ) ) @@ -11306,7 +11305,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) // check dest->src move possibility ItemPosCountVec sDest2; - uint16 eDest2; + uint16 eDest2 = 0; if( IsInventoryPos( src ) ) msg = CanStoreItem( srcbag, srcslot, sDest2, pDstItem, true ); else if( IsBankPos( src ) ) @@ -12334,14 +12333,14 @@ bool Player::CanAddQuest( Quest const *pQuest, bool msg ) { uint32 count = pQuest->GetSrcItemCount(); ItemPosCountVec dest; - uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count ); + uint8 msg2 = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count ); // player already have max number (in most case 1) source item, no additional item needed and quest can be added. - if( msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS ) + if( msg2 == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS ) return true; - else if( msg != EQUIP_ERR_OK ) + else if( msg2 != EQUIP_ERR_OK ) { - SendEquipError( msg, NULL, NULL ); + SendEquipError( msg2, NULL, NULL ); return false; } } @@ -12942,14 +12941,14 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) // each-from-all exclusive group ( < 0) // can be start if only all quests in prev quest exclusive group completed and rewarded - ObjectMgr::ExclusiveQuestGroups::iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); - assert(iter!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 + assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 - for(; iter != end; ++iter) + for(; iter2 != end; ++iter2) { - uint32 exclude_Id = iter->second; + uint32 exclude_Id = iter2->second; // skip checked quest id, only state of other quests in group is interesting if(exclude_Id == prevId) @@ -12977,14 +12976,14 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) // each-from-all exclusive group ( < 0) // can be start if only all quests in prev quest exclusive group active - ObjectMgr::ExclusiveQuestGroups::iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); - assert(iter!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 + assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 - for(; iter != end; ++iter) + for(; iter2 != end; ++iter2) { - uint32 exclude_Id = iter->second; + uint32 exclude_Id = iter2->second; // skip checked quest id, only state of other quests in group is interesting if(exclude_Id == prevId) @@ -18358,8 +18357,8 @@ void Player::AddComboPoints(Unit* target, int8 count) else { if(m_comboTarget) - if(Unit* target = ObjectAccessor::GetUnit(*this,m_comboTarget)) - target->RemoveComboPointHolder(GetGUIDLow()); + if(Unit* target2 = ObjectAccessor::GetUnit(*this,m_comboTarget)) + target2->RemoveComboPointHolder(GetGUIDLow()); m_comboTarget = target->GetGUID(); m_comboPoints = count; @@ -18483,10 +18482,10 @@ void Player::SendInitialPacketsAfterAddToMap() // manual send package (have code in ApplyModifier(true,true); that don't must be re-applied. if(HasAuraType(SPELL_AURA_MOD_ROOT)) { - WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10); - data.append(GetPackGUID()); - data << (uint32)2; - SendMessageToSet(&data,true); + WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10); + data2.append(GetPackGUID()); + data2 << (uint32)2; + SendMessageToSet(&data2,true); } SendAurasForTarget(this); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index e24f3862c4b..30cbdc13ac8 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2446,11 +2446,12 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real) if( GetId()==24658 ) { uint32 spellId = 24659; - if (apply) + if (apply && caster) { const SpellEntry *spell = sSpellStore.LookupEntry(spellId); if (!spell) return; + for (int i=0; i < spell->StackAmount; ++i) caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID()); return; @@ -2462,7 +2463,7 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real) if( GetId()==24661 ) { uint32 spellId = 24662; - if (apply) + if (apply && caster) { const SpellEntry *spell = sSpellStore.LookupEntry(spellId); if (!spell) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 5de1f63cfff..0532be77b8e 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1003,7 +1003,7 @@ void Spell::EffectDummy(uint32 i) // return; -- implemented at client side case 28006: // Arcane Cloaking { - if( unitTarget->GetTypeId() == TYPEID_PLAYER ) + if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER ) m_caster->CastSpell(unitTarget,29294,true); return; } @@ -1431,7 +1431,7 @@ void Spell::EffectDummy(uint32 i) } // Think its not need (also need remove Life Tap from SpellDamageBonus or add new value) // damage = m_caster->SpellDamageBonus(m_caster, m_spellInfo,uint32(damage > 0 ? damage : 0), SPELL_DIRECT_DAMAGE); - if(int32(unitTarget->GetHealth()) > damage) + if(unitTarget && (int32(unitTarget->GetHealth()) > damage)) { // Shouldn't Appear in Combat Log unitTarget->ModifyHealth(-damage); @@ -1784,9 +1784,9 @@ void Spell::EffectDummy(uint32 i) if(m_caster->GetTypeId() != TYPEID_PLAYER) return; - for(int i = BASE_ATTACK; i <= OFF_ATTACK; ++i) + for(int j = BASE_ATTACK; j <= OFF_ATTACK; ++j) { - if(Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(i))) + if(Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(j))) { if(item->IsFitToSpellRequirements(m_spellInfo)) { @@ -2041,7 +2041,7 @@ void Spell::EffectTriggerSpell(uint32 i) if (!spell) return; - for (int i=0; i < spell->StackAmount; ++i) + for (int j=0; j < spell->StackAmount; ++j) m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); return; } @@ -2052,7 +2052,7 @@ void Spell::EffectTriggerSpell(uint32 i) if (!spell) return; - for (int i=0; i < spell->StackAmount; ++i) + for (int j=0; j < spell->StackAmount; ++j) m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); return; } @@ -3117,10 +3117,10 @@ void Spell::EffectSummonChangeItem(uint32 i) if( !pNewItem ) return; - for(uint8 i= PERM_ENCHANTMENT_SLOT; i<=TEMP_ENCHANTMENT_SLOT; ++i) + for(uint8 j= PERM_ENCHANTMENT_SLOT; j<=TEMP_ENCHANTMENT_SLOT; ++j) { - if(m_CastItem->GetEnchantmentId(EnchantmentSlot(i))) - pNewItem->SetEnchantment(EnchantmentSlot(i), m_CastItem->GetEnchantmentId(EnchantmentSlot(i)), m_CastItem->GetEnchantmentDuration(EnchantmentSlot(i)), m_CastItem->GetEnchantmentCharges(EnchantmentSlot(i))); + if(m_CastItem->GetEnchantmentId(EnchantmentSlot(j))) + pNewItem->SetEnchantment(EnchantmentSlot(j), m_CastItem->GetEnchantmentId(EnchantmentSlot(j)), m_CastItem->GetEnchantmentDuration(EnchantmentSlot(j)), m_CastItem->GetEnchantmentCharges(EnchantmentSlot(j))); } if(m_CastItem->GetUInt32Value(ITEM_FIELD_DURABILITY) < m_CastItem->GetUInt32Value(ITEM_FIELD_MAXDURABILITY)) @@ -4094,6 +4094,9 @@ void Spell::EffectLearnPetSpell(uint32 i) void Spell::EffectTaunt(uint32 /*i*/) { + if (!unitTarget) + return; + // this effect use before aura Taunt apply for prevent taunt already attacking target // for spell as marked "non effective at already attacking target" if(!unitTarget || !unitTarget->CanHaveThreatList() @@ -4274,12 +4277,12 @@ void Spell::SpellDamageWeaponDmg(uint32 i) if(m_spellInfo->SpellFamilyFlags[1] & 0x0010) { Unit::AuraEffectList const& m_OverrideClassScript = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraEffectList::const_iterator i = m_OverrideClassScript.begin(); i != m_OverrideClassScript.end(); ++i) + for(Unit::AuraEffectList::const_iterator citr = m_OverrideClassScript.begin(); citr != m_OverrideClassScript.end(); ++citr) { // Stormstrike AP Buff - if ( (*i)->GetMiscValue() == 5634 ) + if ( (*citr)->GetMiscValue() == 5634 ) { - m_caster->CastSpell(m_caster,38430,true,NULL,*i); + m_caster->CastSpell(m_caster,38430,true,NULL,*citr); break; } } @@ -4801,7 +4804,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) if(!unitTarget) return; - uint32 spellId; + uint32 spellId = 0; switch(rand()%4) { case 0: spellId = 46740; break; @@ -6137,7 +6140,7 @@ void Spell::EffectTransmitted(uint32 effIndex) // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo)) // start time == fish-FISHING_BOBBER_READY_TIME (0..GetDuration(m_spellInfo)-FISHING_BOBBER_READY_TIME) - int32 lastSec; + int32 lastSec = 0; switch(urand(0, 3)) { case 0: lastSec = 3; break; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index e7f9d81d5dd..934326fe6d1 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -532,9 +532,9 @@ class PetAura return itr->second; else { - std::map<uint16, uint16>::const_iterator itr = auras.find(0); - if(itr != auras.end()) - return itr->second; + std::map<uint16, uint16>::const_iterator itr2 = auras.find(0); + if(itr2 != auras.end()) + return itr2->second; else return 0; } @@ -736,9 +736,9 @@ class SpellMgr // Not found, try lookup for 1 spell rank if exist if (uint32 rank_1 = GetFirstSpellInChain(spellId)) { - SpellBonusMap::const_iterator itr = mSpellBonusMap.find(rank_1); - if( itr != mSpellBonusMap.end( ) ) - return &itr->second; + SpellBonusMap::const_iterator itr2 = mSpellBonusMap.find(rank_1); + if( itr2 != mSpellBonusMap.end( ) ) + return &itr2->second; } return NULL; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 90a2a228397..7f197c16ac9 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -2418,12 +2418,12 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack if(pVictim->GetTypeId()==TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY) ) { - int32 tmp = int32(parry_chance); - if ( (tmp > 0) // check if unit _can_ parry - && ((tmp -= skillBonus) > 0) - && (roll < (sum += tmp))) + int32 tmp2 = int32(parry_chance); + if ( (tmp2 > 0) // check if unit _can_ parry + && ((tmp2 -= skillBonus) > 0) + && (roll < (sum += tmp2))) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp, sum); + DEBUG_LOG ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum); return MELEE_HIT_PARRY; } } @@ -3327,7 +3327,7 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell ) { assert(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells - uint32 CSpellType = pSpell->GetCurrentContainer(); + CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer(); if (pSpell == m_currentSpells[CSpellType]) return; // avoid breaking self diff --git a/src/shared/ServiceWin32.cpp b/src/shared/ServiceWin32.cpp index bdc2a371297..5c68ba31954 100644 --- a/src/shared/ServiceWin32.cpp +++ b/src/shared/ServiceWin32.cpp @@ -131,10 +131,10 @@ bool WinServiceUninstall() serviceName, SERVICE_QUERY_STATUS | DELETE); if (service) { - SERVICE_STATUS serviceStatus; - if (QueryServiceStatus(service, &serviceStatus)) + SERVICE_STATUS serviceStatus2; + if (QueryServiceStatus(service, &serviceStatus2)) { - if (serviceStatus.dwCurrentState == SERVICE_STOPPED) + if (serviceStatus2.dwCurrentState == SERVICE_STOPPED) DeleteService(service); } CloseServiceHandle(service); |