From cb29fa74d8c003bce14c1f1004459d0cf907dea9 Mon Sep 17 00:00:00 2001 From: ShinDarth Date: Mon, 7 Dec 2015 14:09:40 +0100 Subject: Core/Quest: code style: - Removed 11 useless for iterations (for each quest loaded) (cherry picked from commit 4a532a71b655945f394fecfe4a2177b2618a6d59) # Conflicts: # src/server/game/Quests/QuestDef.cpp --- src/server/game/Quests/QuestDef.cpp | 39 ++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index ef00c7c092b..91a928b7a98 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -23,6 +23,12 @@ Quest::Quest(Field* questRecord) { + EmoteOnIncomplete = 0; + EmoteOnComplete = 0; + _rewItemsCount = 0; + _rewChoiceItemsCount = 0; + _rewCurrencyCount = 0; + ID = questRecord[0].GetUInt32(); Type = questRecord[1].GetUInt8(); Level = questRecord[2].GetInt32(); @@ -52,6 +58,9 @@ Quest::Quest(Field* questRecord) RewardItemCount[i] = questRecord[23+i*4].GetUInt32(); ItemDrop[i] = questRecord[24+i*4].GetUInt32(); ItemDropQuantity[i] = questRecord[25+i*4].GetUInt32(); + + if (RewardItemId[i]) + ++_rewItemsCount; } for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) @@ -59,6 +68,9 @@ Quest::Quest(Field* questRecord) RewardChoiceItemId[i] = questRecord[38+i*3].GetUInt32(); RewardChoiceItemCount[i] = questRecord[39+i*3].GetUInt32(); RewardChoiceItemDisplayId[i] = questRecord[40+i*3].GetUInt32(); + + if (RewardChoiceItemId[i]) + ++_rewChoiceItemsCount; } POIContinent = questRecord[56].GetUInt32(); @@ -88,6 +100,9 @@ Quest::Quest(Field* questRecord) { RewardCurrencyId[i] = questRecord[83+i*2].GetUInt32(); RewardCurrencyCount[i] = questRecord[84+i*2].GetUInt32(); + + if (RewardCurrencyId[i]) + ++_rewCurrencyCount; } SoundAccept = questRecord[91].GetUInt32(); @@ -106,33 +121,13 @@ Quest::Quest(Field* questRecord) PortraitTurnInName = questRecord[103].GetString(); QuestCompletionLog = questRecord[104].GetString(); - _rewItemsCount = 0; - _rewChoiceItemsCount = 0; - _rewCurrencyCount = 0; - - for (int i = 0; i < QUEST_REWARD_ITEM_COUNT; ++i) - if (RewardItemId[i]) - ++_rewItemsCount; - - for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - if (RewardChoiceItemId[i]) - ++_rewChoiceItemsCount; - - for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) - if (RewardCurrencyId[i]) - ++_rewCurrencyCount; - for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) + { DetailsEmote[i] = 0; - - for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) DetailsEmoteDelay[i] = 0; - - for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) OfferRewardEmote[i] = 0; - - for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) OfferRewardEmoteDelay[i] = 0; + } } void Quest::LoadQuestDetails(Field* fields) -- cgit v1.2.3