Bazaar developer reference

CvPlot::SetResourceLinkedCity(const CvCity *)

Defined in
CvPlot.cpp, line 7449
Class
CvPlot
Hook name
CivHooks::CvPlot_SetResourceLinkedCity

Hooks

static bool BeforeCvPlot_SetResourceLinkedCity(CvPlot* self, const CvCity* pCity);static void AfterCvPlot_SetResourceLinkedCity(CvPlot* self, const CvCity* pCity);static void ReplaceCvPlot_SetResourceLinkedCity(void (*original)(CvPlot*, const CvCity*), CvPlot* self, const CvCity* pCity);CivRegisterBefore<CivHooks::CvPlot_SetResourceLinkedCity>(host, &BeforeCvPlot_SetResourceLinkedCity);CivRegisterAfter<CivHooks::CvPlot_SetResourceLinkedCity>(host, &AfterCvPlot_SetResourceLinkedCity);CivRegisterReplace<CivHooks::CvPlot_SetResourceLinkedCity>(host, &ReplaceCvPlot_SetResourceLinkedCity);

Code

7448/// Link the resource on this plot to pCity. Note that this does NOT set the link to be active - this must be done manually7449void CvPlot::SetResourceLinkedCity(const CvCity* pCity)7450{7451	if(GetResourceLinkedCity() != pCity)7452	{7453		if(pCity != NULL)7454		{7455			CvAssertMsg(pCity->getOwner() == getOwner(), "Argument city pNewValue's owner is expected to be the same as the current instance");7456			m_ResourceLinkedCity = pCity->GetIDInfo();7457		}7458		else7459		{7460			// Set to inactive BEFORE unassigning linked City7461			SetResourceLinkedCityActive(false);74627463			m_ResourceLinkedCity.reset();7464		}7465	}7466}

Calls

Called by