CvCityConnections::BroadcastPlotRouteStateChanges()
- Defined in
- CvCityConnections.cpp, line 666
- Class
- CvCityConnections
- Hook name
CivHooks::CvCityConnections_BroadcastPlotRouteStateChanges
Hooks
static bool BeforeCvCityConnections_BroadcastPlotRouteStateChanges(CvCityConnections* self);static void AfterCvCityConnections_BroadcastPlotRouteStateChanges(CvCityConnections* self);static void ReplaceCvCityConnections_BroadcastPlotRouteStateChanges(void (*original)(CvCityConnections*), CvCityConnections* self);CivRegisterBefore<CivHooks::CvCityConnections_BroadcastPlotRouteStateChanges>(host, &BeforeCvCityConnections_BroadcastPlotRouteStateChanges);CivRegisterAfter<CivHooks::CvCityConnections_BroadcastPlotRouteStateChanges>(host, &AfterCvCityConnections_BroadcastPlotRouteStateChanges);CivRegisterReplace<CivHooks::CvCityConnections_BroadcastPlotRouteStateChanges>(host, &ReplaceCvCityConnections_BroadcastPlotRouteStateChanges);
Code
666void CvCityConnections::BroadcastPlotRouteStateChanges(void)667{668 for(uint ui = 0; ui < m_aPlotRouteInfos.size(); ui++)669 {670 if(m_aPlotRouteInfos[ui].m_bPlotRouteState & CONNECTION_LAST_TURN)671 {672 if(!(m_aPlotRouteInfos[ui].m_bPlotRouteState & CONNECTION))673 {674 // indicate removed route675 CvPlot* pPlot = GC.getMap().plotByIndex(m_aPlotRouteInfos[ui].m_iPlotIndex);676 pPlot->SetTradeRoute(m_pPlayer->GetID(), false);677 }678 }679 else680 {681 if(m_aPlotRouteInfos[ui].m_bPlotRouteState & CONNECTION)682 {683 // broadcast new connected trade route684 CvPlot* pPlot = GC.getMap().plotByIndex(m_aPlotRouteInfos[ui].m_iPlotIndex);685 pPlot->SetTradeRoute(m_pPlayer->GetID(), true);686 }687 }688 }689}
Calls
BaseVector::operator[]BaseVector::size- CvGlobals::getMap()
- CvMap::plotByIndex(int) const
- CvPlayer::GetID() const
- CvPlot::SetTradeRoute(PlayerTypes, bool)