Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Server/Handlers: Reduce the scope of variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
AriDEV3 committed Feb 18, 2024
1 parent d5167c6 commit 28e4e9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/server/game/Handlers/LFGHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,12 @@ void WorldSession::SendLfgPlayerLockInfo()
{
lfg::LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level);
Quest const* quest = NULL;
bool done = false;
if (reward)
{
quest = sObjectMgr->GetQuestTemplate(reward->firstQuest);
if (quest)
{
done = !GetPlayer()->CanRewardQuest(quest, false);
bool done = !GetPlayer()->CanRewardQuest(quest, false);
if (done)
quest = sObjectMgr->GetQuestTemplate(reward->otherQuest);
}
Expand Down
5 changes: 2 additions & 3 deletions src/server/game/Handlers/TradeHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)

Item* myItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL };
Item* hisItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL };
bool myCanCompleteTrade = true, hisCanCompleteTrade = true;

// set before checks for propertly undo at problems (it already set in to client)
my_trade->SetAccepted(true);
Expand Down Expand Up @@ -474,8 +473,8 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
trader->GetSession()->SendTradeStatus(TRADE_STATUS_ACCEPTED);

// test if item will fit in each inventory
hisCanCompleteTrade = (trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
myCanCompleteTrade = (_player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
bool hisCanCompleteTrade = (trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
bool myCanCompleteTrade = (_player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);

clearAcceptTradeMode(myItems, hisItems);

Expand Down

0 comments on commit 28e4e9b

Please sign in to comment.