CvPlot::SetResourceLinkedCityActive(bool)
- Defined in
- CvPlot.cpp, line 7477
- Class
- CvPlot
- Hook name
CivHooks::CvPlot_SetResourceLinkedCityActive
Hooks
static bool BeforeCvPlot_SetResourceLinkedCityActive(CvPlot* self, bool bValue);static void AfterCvPlot_SetResourceLinkedCityActive(CvPlot* self, bool bValue);static void ReplaceCvPlot_SetResourceLinkedCityActive(void (*original)(CvPlot*, bool), CvPlot* self, bool bValue);CivRegisterBefore<CivHooks::CvPlot_SetResourceLinkedCityActive>(host, &BeforeCvPlot_SetResourceLinkedCityActive);CivRegisterAfter<CivHooks::CvPlot_SetResourceLinkedCityActive>(host, &AfterCvPlot_SetResourceLinkedCityActive);CivRegisterReplace<CivHooks::CvPlot_SetResourceLinkedCityActive>(host, &ReplaceCvPlot_SetResourceLinkedCityActive);
Code
7476/// Is the Resource connection with the linked city active? (e.g. pillaging)7477void CvPlot::SetResourceLinkedCityActive(bool bValue)7478{7479 if(bValue != IsResourceLinkedCityActive())7480 {7481 m_bResourceLinkedCityActive = bValue;74827483 // Now change num resource local to linked city (new or former)74847485 FAssertMsg(GetResourceLinkedCity() != NULL, "Resource linked city is null for some reason. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");7486 FAssertMsg(getOwner() != NO_PLAYER, "Owner of a tile with a resource linkned to a city is not valid. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");74877488 int iResourceChange = bValue ? getNumResource() : -getNumResource();7489 GetResourceLinkedCity()->ChangeNumResourceLocal(getResourceType(), iResourceChange);7490 }7491}