CvPlayerCulture::GetNextDigCompleteArchaeologist(CvPlot **) const
- Defined in
- CvCultureClasses.cpp, line 2072
- Class
- CvPlayerCulture
- Hook name
CivHooks::CvPlayerCulture_GetNextDigCompleteArchaeologist
Hooks
static bool BeforeCvPlayerCulture_GetNextDigCompleteArchaeologist(const CvPlayerCulture* self, CvPlot ** ppPlot, CvUnit *& result);static void AfterCvPlayerCulture_GetNextDigCompleteArchaeologist(const CvPlayerCulture* self, CvPlot ** ppPlot, CvUnit *& result);static CvUnit * ReplaceCvPlayerCulture_GetNextDigCompleteArchaeologist(CvUnit * (*original)(const CvPlayerCulture*, CvPlot **), const CvPlayerCulture* self, CvPlot ** ppPlot);CivRegisterBefore<CivHooks::CvPlayerCulture_GetNextDigCompleteArchaeologist>(host, &BeforeCvPlayerCulture_GetNextDigCompleteArchaeologist);CivRegisterAfter<CivHooks::CvPlayerCulture_GetNextDigCompleteArchaeologist>(host, &AfterCvPlayerCulture_GetNextDigCompleteArchaeologist);CivRegisterReplace<CivHooks::CvPlayerCulture_GetNextDigCompleteArchaeologist>(host, &ReplaceCvPlayerCulture_GetNextDigCompleteArchaeologist);
Code
2071/// Find the next archaeologist waiting for orders2072CvUnit *CvPlayerCulture::GetNextDigCompleteArchaeologist(CvPlot **ppPlot) const2073{2074 CvUnit *pRtnValue = NULL;2075 CvPlot *pPlot = GetNextDigCompletePlot();2076 *ppPlot = pPlot;2077 int iClosestDistance = MAX_INT;20782079 if (pPlot)2080 {2081 int iLoop;2082 CvUnit *pLoopUnit;2083 for (pLoopUnit = m_pPlayer->firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = m_pPlayer->nextUnit(&iLoop))2084 {2085 if (pLoopUnit->AI_getUnitAIType() == UNITAI_ARCHAEOLOGIST)2086 {2087 int iDistance = plotDistance(pLoopUnit->getX(), pLoopUnit->getY(), pPlot->getX(), pPlot->getY());2088 if (iDistance < iClosestDistance)2089 {2090 pRtnValue = pLoopUnit;2091 iClosestDistance = iDistance;2092 }2093 if (iDistance == 0) break;2094 }2095 }2096 }20972098 return pRtnValue;2099}