Bazaar developer reference

CvUnit::makeTradeRoute(int, int, TradeConnectionType)

Defined in
CvUnit.cpp, line 6802
Class
CvUnit
Hook name
CivHooks::CvUnit_makeTradeRoute

Hooks

static bool BeforeCvUnit_makeTradeRoute(CvUnit* self, int iX, int iY, TradeConnectionType eConnectionType, bool& result);static void AfterCvUnit_makeTradeRoute(CvUnit* self, int iX, int iY, TradeConnectionType eConnectionType, bool& result);static bool ReplaceCvUnit_makeTradeRoute(bool (*original)(CvUnit*, int, int, TradeConnectionType), CvUnit* self, int iX, int iY, TradeConnectionType eConnectionType);CivRegisterBefore<CivHooks::CvUnit_makeTradeRoute>(host, &BeforeCvUnit_makeTradeRoute);CivRegisterAfter<CivHooks::CvUnit_makeTradeRoute>(host, &AfterCvUnit_makeTradeRoute);CivRegisterReplace<CivHooks::CvUnit_makeTradeRoute>(host, &ReplaceCvUnit_makeTradeRoute);

Code

6802bool CvUnit::makeTradeRoute(int iX, int iY, TradeConnectionType eConnectionType)6803{6804	if (!canMakeTradeRouteAt(plot(), iX, iY, eConnectionType))6805	{6806		return false;6807	}68086809	kill(true);68106811	CvCity* pFromCity = NULL;6812	CvCity* pToCity = NULL;68136814	if (plot())6815	{6816		pFromCity = plot()->getPlotCity();6817	}68186819	CvPlot* pToPlot = GC.getMap().plot(iX, iY);6820	if (pToPlot)6821	{6822		pToCity = pToPlot->getPlotCity();6823	}68246825	bool bResult = GET_PLAYER(getOwner()).GetTrade()->CreateTradeRoute(pFromCity, pToCity, getDomainType(), eConnectionType);6826	return bResult;6827}

Calls

Called by