Skip to content

Commit

Permalink
Player: Make GetReqKillOrCastCurrentCount const
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Sep 24, 2023
1 parent cb94498 commit aedf677
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/game/Entities/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13204,15 +13204,21 @@ void Player::SetQuestStatus(uint32 quest_id, QuestStatus status)
}

// not used in MaNGOS, but used in scripting code
uint32 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry)
uint32 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) const
{
Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id);
if (!qInfo)
return 0;

for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{
if (qInfo->ReqCreatureOrGOId[j] == entry)
return mQuestStatus[quest_id].m_creatureOrGOcount[j];
{
auto itr = mQuestStatus.find(quest_id);
if (itr != mQuestStatus.end())
return itr->second.m_creatureOrGOcount[j];
}
}

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/Entities/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ class Player : public Unit
SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET * slot2 + i, temp1);
}
}
uint32 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry);
uint32 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) const;
void AreaExploredOrEventHappens(uint32 questId);
void ItemAddedQuestCheck(uint32 entry, uint32 count);
void ItemRemovedQuestCheck(uint32 entry, uint32 count);
Expand Down

0 comments on commit aedf677

Please sign in to comment.