CvPlot::setLandmass(int)
- Defined in
- CvPlot.cpp, line 4701
- Class
- CvPlot
- Hook name
CivHooks::CvPlot_setLandmass- Lua events
GameEvents.TerraformingPlot
Hooks
static bool BeforeCvPlot_setLandmass(CvPlot* self, int iNewValue);static void AfterCvPlot_setLandmass(CvPlot* self, int iNewValue);static void ReplaceCvPlot_setLandmass(void (*original)(CvPlot*, int), CvPlot* self, int iNewValue);CivRegisterBefore<CivHooks::CvPlot_setLandmass>(host, &BeforeCvPlot_setLandmass);CivRegisterAfter<CivHooks::CvPlot_setLandmass>(host, &AfterCvPlot_setLandmass);CivRegisterReplace<CivHooks::CvPlot_setLandmass>(host, &ReplaceCvPlot_setLandmass);
Code
4701void CvPlot::setLandmass(int iNewValue)4702{4703 if(m_iLandmass != iNewValue)4704 {4705 // cleanup old one4706 CvLandmass* pLandmass = GC.getMap().getLandmass(m_iLandmass);4707 if(pLandmass != NULL)4708 {4709 pLandmass->changeNumTiles(-1);4710 pLandmass->ChangeCentroidX(-m_iX);4711 pLandmass->ChangeCentroidY(-m_iY);4712 }47134714#if defined(MOD_EVENTS_TERRAFORMING)4715 if (MOD_EVENTS_TERRAFORMING) {4716 GAMEEVENTINVOKE_HOOK(GAMEEVENT_TerraformingPlot, TERRAFORMINGEVENT_LANDMASS, m_iX, m_iY, 0, iNewValue, m_iLandmass, -1, -1);4717 }4718#endif47194720 m_iLandmass = iNewValue;47214722 pLandmass = GC.getMap().getLandmass(m_iLandmass);4723 if(pLandmass != NULL)4724 {4725 pLandmass->changeNumTiles(1);4726 pLandmass->ChangeCentroidX(m_iX);4727 pLandmass->ChangeCentroidY(m_iY);4728 }4729 }4730}