Bazaar developer reference

CvPlayer::IsPlotTargetedForCity(CvPlot *) const

Defined in
CvPlayer.cpp, line 22114
Class
CvPlayer
Hook name
CivHooks::CvPlayer_IsPlotTargetedForCity

Hooks

static bool BeforeCvPlayer_IsPlotTargetedForCity(const CvPlayer* self, CvPlot * pPlot, bool& result);static void AfterCvPlayer_IsPlotTargetedForCity(const CvPlayer* self, CvPlot * pPlot, bool& result);static bool ReplaceCvPlayer_IsPlotTargetedForCity(bool (*original)(const CvPlayer*, CvPlot *), const CvPlayer* self, CvPlot * pPlot);CivRegisterBefore<CivHooks::CvPlayer_IsPlotTargetedForCity>(host, &BeforeCvPlayer_IsPlotTargetedForCity);CivRegisterAfter<CivHooks::CvPlayer_IsPlotTargetedForCity>(host, &AfterCvPlayer_IsPlotTargetedForCity);CivRegisterReplace<CivHooks::CvPlayer_IsPlotTargetedForCity>(host, &ReplaceCvPlayer_IsPlotTargetedForCity);

Code

22113/// Are we already sending a settler to this plot (or any plot within 2)22114bool CvPlayer::IsPlotTargetedForCity(CvPlot *pPlot) const22115{22116	CvAIOperation* pOperation;22117	std::map<int , CvAIOperation*>::const_iterator iter;2211822119	for(iter = m_AIOperations.begin(); iter != m_AIOperations.end(); ++iter)22120	{22121		pOperation = iter->second;22122		if(pOperation)22123		{22124			switch (pOperation->GetOperationType())22125			{22126			case AI_OPERATION_FOUND_CITY:22127			case AI_OPERATION_COLONIZE:22128			case AI_OPERATION_QUICK_COLONIZE:22129				{22130					if (plotDistance(pPlot->getX(), pPlot->getY(), pOperation->GetTargetPlot()->getX(), pOperation->GetTargetPlot()->getY()) <= 2)22131					{22132						return true;22133					}22134				}22135			}22136		}22137	}22138	return false;22139}

Calls

Called by