CvMinorCivQuest::GetEndTurn() const
- Defined in
- CvMinorCivAI.cpp, line 101
- Class
- CvMinorCivQuest
- Hook name
CivHooks::CvMinorCivQuest_GetEndTurn
Hooks
static bool BeforeCvMinorCivQuest_GetEndTurn(const CvMinorCivQuest* self, int& result);static void AfterCvMinorCivQuest_GetEndTurn(const CvMinorCivQuest* self, int& result);static int ReplaceCvMinorCivQuest_GetEndTurn(int (*original)(const CvMinorCivQuest*), const CvMinorCivQuest* self);CivRegisterBefore<CivHooks::CvMinorCivQuest_GetEndTurn>(host, &BeforeCvMinorCivQuest_GetEndTurn);CivRegisterAfter<CivHooks::CvMinorCivQuest_GetEndTurn>(host, &AfterCvMinorCivQuest_GetEndTurn);CivRegisterReplace<CivHooks::CvMinorCivQuest_GetEndTurn>(host, &ReplaceCvMinorCivQuest_GetEndTurn);
Code
100// Turn that quest ends, based on start turn. Some quests have no specified end turn.101int CvMinorCivQuest::GetEndTurn() const102{103 CvAssertMsg(m_iStartTurn != NO_TURN, "GetEndTurn called for a quest, but the start turn was not initialized!");104105 int iLength = 0;106107#if defined(MOD_EVENTS_QUESTS)108 if (UseEvents()) {109 iLength = m_pQuestInfo->getDuration();110111 // If open ended, exit here, otherwise drop down to where game speed modifiers are applied112 if (iLength == NO_TURN) return iLength;113 } else {114 115 // Did it never dawn on the pillocks at Firaxis that there's comes a time when116 // copy/paste is shouting "PUT ME IN A (DATABASE) TABLE YOU FUCKWITS!!!"117#endif118 if(m_eType == MINOR_CIV_QUEST_CONTEST_CULTURE)119 {120 iLength = GC.getMINOR_QUEST_STANDARD_CONTEST_LENGTH();121 }122123 else if(m_eType == MINOR_CIV_QUEST_CONTEST_FAITH)124 {125 iLength = GC.getMINOR_QUEST_STANDARD_CONTEST_LENGTH();126 }127128 else if(m_eType == MINOR_CIV_QUEST_CONTEST_TECHS)129 {130 iLength = GC.getMINOR_QUEST_STANDARD_CONTEST_LENGTH();131 }132133 else if(m_eType == MINOR_CIV_QUEST_INVEST)134 {135 iLength = GC.getMINOR_QUEST_STANDARD_CONTEST_LENGTH();136 }137138 else if(m_eType == MINOR_CIV_QUEST_GIVE_GOLD)139 {140 iLength = GC.getMINOR_QUEST_STANDARD_CONTEST_LENGTH();141 }142143 else if(m_eType == MINOR_CIV_QUEST_PLEDGE_TO_PROTECT)144 {145 iLength = GC.getMINOR_QUEST_STANDARD_CONTEST_LENGTH();146 }147148 else if(m_eType == MINOR_CIV_QUEST_BULLY_CITY_STATE)149 {150 iLength = GC.getMINOR_QUEST_STANDARD_CONTEST_LENGTH();151 }152153 else if(m_eType == MINOR_CIV_QUEST_DENOUNCE_MAJOR)154 {155 iLength = GC.getMINOR_QUEST_STANDARD_CONTEST_LENGTH();156 }157158 // Other quests are not time-sensitive159 else160 {161 return NO_TURN;162 }163#if defined(MOD_EVENTS_QUESTS)164 }165#endif166167 // Modify for Game Speed168 iLength *= GC.getGame().getGameSpeedInfo().getGreatPeoplePercent();169 iLength /= 100;170171 return m_iStartTurn + iLength;172}
Calls
Called by
- CvMinorCivQuest::DoCancelQuest()
- CvMinorCivQuest::DoFinishQuest()
- CvMinorCivQuest::DoStartQuest(int)
- CvMinorCivQuest::DoStartQuestUsingExistingData(CvMinorCivQuest *)
- CvMinorCivQuest::GetTurnsDuration() const
- CvMinorCivQuest::GetTurnsRemaining(int) const
- CvMinorCivQuest::IsComplete()
- CvMinorCivQuest::IsExpired()