Bazaar developer reference

CvPlot::SetRoutePillaged(bool, bool)

Defined in
CvPlot.cpp, line 7312
Class
CvPlot
Hook name
CivHooks::CvPlot_SetRoutePillaged
Lua events
GameEvents.TileRouteChanged

Hooks

static bool BeforeCvPlot_SetRoutePillaged(CvPlot* self, bool bPillaged, bool bEvents);static void AfterCvPlot_SetRoutePillaged(CvPlot* self, bool bPillaged, bool bEvents);static void ReplaceCvPlot_SetRoutePillaged(void (*original)(CvPlot*, bool, bool), CvPlot* self, bool bPillaged, bool bEvents);CivRegisterBefore<CivHooks::CvPlot_SetRoutePillaged>(host, &BeforeCvPlot_SetRoutePillaged);CivRegisterAfter<CivHooks::CvPlot_SetRoutePillaged>(host, &AfterCvPlot_SetRoutePillaged);CivRegisterReplace<CivHooks::CvPlot_SetRoutePillaged>(host, &ReplaceCvPlot_SetRoutePillaged);

Code

7311#if defined(MOD_EVENTS_TILE_IMPROVEMENTS)7312void CvPlot::SetRoutePillaged(bool bPillaged, bool bEvents)7313#else7314void CvPlot::SetRoutePillaged(bool bPillaged)7315#endif7316{7317	if(m_bRoutePillaged != bPillaged)7318	{7319		for(int iI = 0; iI < MAX_TEAMS; ++iI)7320		{7321			if(GET_TEAM((TeamTypes)iI).isAlive() && GC.getGame().getActiveTeam() == (TeamTypes)iI)7322			{7323				if(isVisible((TeamTypes)iI))7324				{7325					setLayoutDirty(true);7326				}7327			}7328		}7329	}7330#if defined(MOD_EVENTS_TILE_IMPROVEMENTS)7331	else7332	{7333		bEvents = false;7334	}7335#endif73367337	m_bRoutePillaged = bPillaged;73387339	if(bPillaged && IsTradeRoute(NO_PLAYER))7340	{7341		for(int i = 0; i < MAX_CIV_PLAYERS; i++)7342		{7343			PlayerTypes ePlayer = (PlayerTypes)i;7344			if(GET_PLAYER(ePlayer).isAlive())7345			{7346				if(IsTradeRoute(ePlayer))7347				{7348					GET_PLAYER(ePlayer).GetCityConnections()->Update();7349				}7350			}7351		}7352	}73537354#if defined(MOD_EVENTS_TILE_IMPROVEMENTS)7355	if (bEvents && MOD_EVENTS_TILE_IMPROVEMENTS) {7356		GAMEEVENTINVOKE_HOOK(GAMEEVENT_TileRouteChanged, getX(), getY(), getOwner(), getRouteType(), getRouteType(), IsRoutePillaged());7357	}7358#endif7359}

Calls

Called by