[10658] Add enum as argument for quest special/flags functions

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-10-30 01:46:51 +02:00
parent b6e367bf3c
commit 506e93d15d
5 changed files with 22 additions and 24 deletions

View file

@ -3654,15 +3654,15 @@ void ObjectMgr::LoadQuests()
sLog.outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.",qinfo->GetQuestId(),qinfo->GetQuestMethod()); sLog.outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.",qinfo->GetQuestId(),qinfo->GetQuestMethod());
} }
if (qinfo->SpecialFlags > QUEST_SPECIAL_FLAG_DB_ALLOWED) if (qinfo->m_SpecialFlags > QUEST_SPECIAL_FLAG_DB_ALLOWED)
{ {
sLog.outErrorDb("Quest %u has `SpecialFlags` = %u, above max flags not allowed for database.", qinfo->GetQuestId(), qinfo->SpecialFlags); sLog.outErrorDb("Quest %u has `SpecialFlags` = %u, above max flags not allowed for database.", qinfo->GetQuestId(), qinfo->m_SpecialFlags);
} }
if (qinfo->HasQuestFlag(QUEST_FLAGS_DAILY) && qinfo->HasQuestFlag(QUEST_FLAGS_WEEKLY)) if (qinfo->HasQuestFlag(QUEST_FLAGS_DAILY) && qinfo->HasQuestFlag(QUEST_FLAGS_WEEKLY))
{ {
sLog.outErrorDb("Weekly Quest %u is marked as daily quest in `QuestFlags`, removed daily flag.",qinfo->GetQuestId()); sLog.outErrorDb("Weekly Quest %u is marked as daily quest in `QuestFlags`, removed daily flag.",qinfo->GetQuestId());
qinfo->QuestFlags &= ~QUEST_FLAGS_DAILY; qinfo->m_QuestFlags &= ~QUEST_FLAGS_DAILY;
} }
if (qinfo->HasQuestFlag(QUEST_FLAGS_DAILY)) if (qinfo->HasQuestFlag(QUEST_FLAGS_DAILY))
@ -3999,7 +3999,7 @@ void ObjectMgr::LoadQuests()
{ {
// In fact SpeakTo and Kill are quite same: either you can speak to mob:SpeakTo or you can't:Kill/Cast // In fact SpeakTo and Kill are quite same: either you can speak to mob:SpeakTo or you can't:Kill/Cast
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO); qinfo->SetSpecialFlag(QuestSpecialFlags(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO));
if (!qinfo->ReqCreatureOrGOCount[j]) if (!qinfo->ReqCreatureOrGOCount[j])
{ {

View file

@ -13353,7 +13353,7 @@ bool Player::CanCompleteQuest(uint32 quest_id) const
} }
} }
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO)) if (qInfo->HasSpecialFlag(QuestSpecialFlags(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO)))
{ {
for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{ {
@ -13507,7 +13507,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
questStatusData.m_itemcount[i] = 0; questStatusData.m_itemcount[i] = 0;
} }
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO)) if (pQuest->HasSpecialFlag(QuestSpecialFlags(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO)))
{ {
for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
questStatusData.m_creatureOrGOcount[i] = 0; questStatusData.m_creatureOrGOcount[i] = 0;
@ -14593,7 +14593,7 @@ void Player::TalkedToCreature( uint32 entry, ObjectGuid guid )
if ( q_status.m_status == QUEST_STATUS_INCOMPLETE ) if ( q_status.m_status == QUEST_STATUS_INCOMPLETE )
{ {
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO)) if (qInfo->HasSpecialFlag(QuestSpecialFlags(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO)))
{ {
for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{ {

View file

@ -40,8 +40,8 @@ Quest::Quest(Field * questRecord)
RequiredMaxRepValue = questRecord[15].GetInt32(); RequiredMaxRepValue = questRecord[15].GetInt32();
SuggestedPlayers = questRecord[16].GetUInt32(); SuggestedPlayers = questRecord[16].GetUInt32();
LimitTime = questRecord[17].GetUInt32(); LimitTime = questRecord[17].GetUInt32();
QuestFlags = questRecord[18].GetUInt16(); m_QuestFlags = questRecord[18].GetUInt16();
SpecialFlags = questRecord[19].GetUInt16(); m_SpecialFlags = questRecord[19].GetUInt16();
CharTitleId = questRecord[20].GetUInt32(); CharTitleId = questRecord[20].GetUInt32();
PlayersSlain = questRecord[21].GetUInt32(); PlayersSlain = questRecord[21].GetUInt32();
BonusTalents = questRecord[22].GetUInt32(); BonusTalents = questRecord[22].GetUInt32();
@ -137,8 +137,6 @@ Quest::Quest(Field * questRecord)
QuestStartScript = questRecord[139].GetUInt32(); QuestStartScript = questRecord[139].GetUInt32();
QuestCompleteScript = questRecord[140].GetUInt32(); QuestCompleteScript = questRecord[140].GetUInt32();
QuestFlags |= SpecialFlags << 24;
m_reqitemscount = 0; m_reqitemscount = 0;
m_reqCreatureOrGOcount = 0; m_reqCreatureOrGOcount = 0;
m_rewitemscount = 0; m_rewitemscount = 0;

View file

@ -200,10 +200,10 @@ class Quest
Quest(Field * questRecord); Quest(Field * questRecord);
uint32 XPValue( Player *pPlayer ) const; uint32 XPValue( Player *pPlayer ) const;
uint32 GetQuestFlags() const { return QuestFlags; } uint32 GetQuestFlags() const { return m_QuestFlags; }
bool HasQuestFlag(uint32 flag) const { return (QuestFlags & flag) != 0; } bool HasQuestFlag(QuestFlags flag) const { return (m_QuestFlags & flag) != 0; }
bool HasSpecialFlag(uint32 flag) const { return (SpecialFlags & flag) != 0; } bool HasSpecialFlag(QuestSpecialFlags flag) const { return (m_SpecialFlags & flag) != 0; }
void SetSpecialFlag(uint32 flag) { SpecialFlags |= flag; } void SetSpecialFlag(QuestSpecialFlags flag) { m_SpecialFlags |= flag; }
// table data accessors: // table data accessors:
uint32 GetQuestId() const { return QuestId; } uint32 GetQuestId() const { return QuestId; }
@ -260,13 +260,13 @@ class Quest
uint32 GetQuestStartScript() const { return QuestStartScript; } uint32 GetQuestStartScript() const { return QuestStartScript; }
uint32 GetQuestCompleteScript() const { return QuestCompleteScript; } uint32 GetQuestCompleteScript() const { return QuestCompleteScript; }
bool IsRepeatable() const { return SpecialFlags & QUEST_SPECIAL_FLAG_REPEATABLE; } bool IsRepeatable() const { return m_SpecialFlags & QUEST_SPECIAL_FLAG_REPEATABLE; }
bool IsAutoComplete() const { return QuestMethod ? false : true; } bool IsAutoComplete() const { return QuestMethod ? false : true; }
bool IsDaily() const { return QuestFlags & QUEST_FLAGS_DAILY; } bool IsDaily() const { return m_QuestFlags & QUEST_FLAGS_DAILY; }
bool IsWeekly() const { return QuestFlags & QUEST_FLAGS_WEEKLY; } bool IsWeekly() const { return m_QuestFlags & QUEST_FLAGS_WEEKLY; }
bool IsMonthly() const { return SpecialFlags & QUEST_SPECIAL_FLAG_MONTHLY; } bool IsMonthly() const { return m_SpecialFlags & QUEST_SPECIAL_FLAG_MONTHLY; }
bool IsDailyOrWeekly() const { return QuestFlags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); } bool IsDailyOrWeekly() const { return m_QuestFlags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
bool IsAutoAccept() const { return QuestFlags & QUEST_FLAGS_AUTO_ACCEPT; } bool IsAutoAccept() const { return m_QuestFlags & QUEST_FLAGS_AUTO_ACCEPT; }
bool IsAllowedInRaid() const; bool IsAllowedInRaid() const;
// multiple values // multiple values
@ -327,8 +327,8 @@ class Quest
int32 RequiredMaxRepValue; int32 RequiredMaxRepValue;
uint32 SuggestedPlayers; uint32 SuggestedPlayers;
uint32 LimitTime; uint32 LimitTime;
uint32 QuestFlags; uint32 m_QuestFlags;
uint32 SpecialFlags; uint32 m_SpecialFlags;
uint32 CharTitleId; uint32 CharTitleId;
uint32 PlayersSlain; uint32 PlayersSlain;
uint32 BonusTalents; uint32 BonusTalents;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10657" #define REVISION_NR "10658"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__