CvCity::kill(bool)
- Defined in
- CvCity.cpp, line 1629
- Class
- CvCity
- Hook name
CivHooks::CvCity_kill
Hooks
static bool BeforeCvCity_kill(CvCity* self, bool bKeepResources);static void AfterCvCity_kill(CvCity* self, bool bKeepResources);static void ReplaceCvCity_kill(void (*original)(CvCity*, bool), CvCity* self, bool bKeepResources);CivRegisterBefore<CivHooks::CvCity_kill>(host, &BeforeCvCity_kill);CivRegisterAfter<CivHooks::CvCity_kill>(host, &AfterCvCity_kill);CivRegisterReplace<CivHooks::CvCity_kill>(host, &ReplaceCvCity_kill);
Code
1628#if defined(MOD_GLOBAL_VENICE_KEEPS_RESOURCES) || defined(MOD_GLOBAL_CS_MARRIAGE_KEEPS_RESOURCES)1629void CvCity::kill(bool bKeepResources)1630#else1631void CvCity::kill()1632#endif1633{1634 VALIDATE_OBJECT1635 CvPlot* pPlot = plot();1636 PlayerTypes eOwner = getOwner();1637 bool bCapital = isCapital();16381639 IDInfo* pUnitNode;1640 CvUnit* pLoopUnit;1641 pUnitNode = pPlot->headUnitNode();16421643 FFastSmallFixedList<IDInfo, 25, true, c_eCiv5GameplayDLL > oldUnits;16441645 while(pUnitNode != NULL)1646 {1647 oldUnits.insertAtEnd(pUnitNode);1648 pUnitNode = pPlot->nextUnitNode((IDInfo*)pUnitNode);1649 }16501651 pUnitNode = oldUnits.head();16521653 while(pUnitNode != NULL)1654 {1655 pLoopUnit = ::getUnit(*pUnitNode);1656 pUnitNode = oldUnits.next(pUnitNode);16571658 if(pLoopUnit)1659 {1660 if(pLoopUnit->IsImmobile())1661 {1662 pLoopUnit->kill(false, eOwner);1663 }1664 }1665 }16661667#if defined(MOD_GLOBAL_VENICE_KEEPS_RESOURCES) || defined(MOD_GLOBAL_CS_MARRIAGE_KEEPS_RESOURCES)1668 PreKill(bKeepResources);1669#else1670 PreKill();1671#endif16721673 // get spies out of city1674 CvCityEspionage* pCityEspionage = GetCityEspionage();1675 if(pCityEspionage)1676 {1677 for(int i = 0; i < MAX_MAJOR_CIVS; i++)1678 {1679 int iAssignedSpy = pCityEspionage->m_aiSpyAssignment[i];1680 // if there is a spy in the city1681 if(iAssignedSpy != -1)1682 {1683 GET_PLAYER((PlayerTypes)i).GetEspionage()->ExtractSpyFromCity(iAssignedSpy);1684 }1685 }1686 }16871688 // Delete the city's information here!!!1689 CvGameTrade* pkGameTrade = GC.getGame().GetGameTrade();1690 if(pkGameTrade)1691 {1692#if defined(MOD_BUGFIX_MINOR)1693 pkGameTrade->ClearAllCityTradeRoutes(plot(), true);1694#else1695 pkGameTrade->ClearAllCityTradeRoutes(plot());1696#endif1697 }1698 GET_PLAYER(getOwner()).deleteCity(m_iID);1699 GET_PLAYER(eOwner).GetCityConnections()->Update();17001701 // clean up1702 PostKill(bCapital, pPlot, eOwner);1703}
Calls
- CvCity::GetCityEspionage() const
- CvCity::getOwner() const
- CvCity::isCapital() const
- CvCity::plot() const
- CvCity::PostKill(bool, CvPlot *, PlayerTypes)
- CvCity::PreKill(bool)
- CvCityConnections::Update()
- CvGame::GetGameTrade()
- CvGameTrade::ClearAllCityTradeRoutes(CvPlot *, bool)
- CvGlobals::getGame()
- CvPlayer::deleteCity(int)
- CvPlayer::GetCityConnections() const
- CvPlayer::GetEspionage() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvPlayerEspionage::ExtractSpyFromCity(uint)
- CvPlot::headUnitNode()
- CvPlot::nextUnitNode(IDInfo *)
- CvUnit::IsImmobile() const
- CvUnit::kill(bool, PlayerTypes)
FAutoVariable::operator const int &FFastSmallFixedList::FFastSmallFixedListFFastSmallFixedList::headFFastSmallFixedList::insertAtEndFFastSmallFixedList::nextFiraxis::Array::operator[]- getUnit(const IDInfo &)