View Full Version : What file controls units given during event?


wotan321
Aug 14, 2009, 04:56 PM
In the 1936 Europe scenario with accurate events, the Munich event gives Czechoslovakia to Germany, and a bunch of units. What file determines what units Germany gets? I see in the RTWEvents python file the mention of the annexation events for Austria and Czechoslovakia, but nothing about the units or where they go or how many, etc.

Where is that?

TC01
Aug 15, 2009, 12:59 PM
I woulds say CvPlayer.cpp (sorry, it appears to be hardcoded):

void CvPlayer::doAnnexation(int value1)
{
CvUnit* pGiftUnit;
PlayerTypes eNewPlayer = ((PlayerTypes)value1);
if (eNewPlayer == NO_PLAYER)
{
return;
}
int iLoop;
for (CvUnit* pLoopUnit = firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = nextUnit(&iLoop))
{
CvPlot* pPlot = pLoopUnit->plot();
pGiftUnit = GET_PLAYER(eNewPlayer).initUnit(pLoopUnit->getUnitType(), pLoopUnit->getX_INLINE(), pLoopUnit->getY_INLINE(), pLoopUnit->AI_getUnitAIType());
pGiftUnit->convert(pLoopUnit);
}
for (CvCity* pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
{
int iCulture = pLoopCity->getCultureTimes100(getID());
CvPlot* pPlot = pLoopCity->plot();
GET_PLAYER(eNewPlayer).acquireCity(pLoopCity, false, true, false);
if (NULL != pPlot)
{
CvCity* pCity = pPlot->getPlotCity();
if (NULL != pCity)
{
pCity->setCultureTimes100(getID(), 0, false, false);
pCity->setCultureTimes100(eNewPlayer, iCulture, true, false);
}
}
}
return;
}

Not a C++ modder, so I can't tell for sure, but I do know that the event in RTWEventManager triggers this.

wotan321
Aug 15, 2009, 06:41 PM
That bit of code doesn't mean much to me, but I am guessing it takes the city and units from one civ and gives it to another. So whatever units Czechoslovakia has, Germany gets via the annexation.