Bazaar developer reference

CvGame::updateSelectionList()

Defined in
CvGame.cpp, line 1839
Class
CvGame
Hook name
CivHooks::CvGame_updateSelectionList

Hooks

static bool BeforeCvGame_updateSelectionList(CvGame* self);static void AfterCvGame_updateSelectionList(CvGame* self);static void ReplaceCvGame_updateSelectionList(void (*original)(CvGame*), CvGame* self);CivRegisterBefore<CivHooks::CvGame_updateSelectionList>(host, &BeforeCvGame_updateSelectionList);CivRegisterAfter<CivHooks::CvGame_updateSelectionList>(host, &AfterCvGame_updateSelectionList);CivRegisterReplace<CivHooks::CvGame_updateSelectionList>(host, &ReplaceCvGame_updateSelectionList);

Code

1839void CvGame::updateSelectionList()1840{1841	if(!GC.GetEngineUserInterface()->DoAutoUnitCycle())1842	{1843		return;1844	}18451846	auto_ptr<ICvUnit1> pDllHeadSelectedUnit(GC.GetEngineUserInterface()->GetHeadSelectedUnit());1847	CvUnit* pkHeadSelectedUnit = GC.UnwrapUnitPointer(pDllHeadSelectedUnit.get());18481849	if((pkHeadSelectedUnit == NULL) || !(pkHeadSelectedUnit->ReadyToSelect()))1850	{1851		if(getGameTurn() == 0)1852		{1853			SelectSettler();	// Auto select the settler on turn 0, helps with multiple humans in the same game (Hot Seat)1854		}1855	}18561857	pDllHeadSelectedUnit.reset(GC.GetEngineUserInterface()->GetHeadSelectedUnit());1858	pkHeadSelectedUnit = GC.UnwrapUnitPointer(pDllHeadSelectedUnit.get());18591860	if((pkHeadSelectedUnit == NULL) || !(pkHeadSelectedUnit->ReadyToSelect()))1861	{1862		int iOriginalPlotIndex = GC.GetEngineUserInterface()->getOriginalPlotIndex();1863		CvPlot* pkOriginalPlot = (iOriginalPlotIndex != -1)? GC.getMap().plotByIndex(iOriginalPlotIndex) : NULL;18641865		if((pkOriginalPlot == NULL) || !(cyclePlotUnits(pkOriginalPlot, true, true, GC.GetEngineUserInterface()->getOriginalPlotCount())))1866		{1867			auto_ptr<ICvPlot1> pSelectionPlot(GC.GetEngineUserInterface()->getSelectionPlot());1868			CvPlot* pkSelectionPlot = GC.UnwrapPlotPointer(pSelectionPlot.get());1869			if((pkSelectionPlot == NULL) || !(cyclePlotUnits(pkSelectionPlot, true, true)))1870			{1871				cycleUnits(true);1872			}1873		}18741875		pDllHeadSelectedUnit.reset(GC.GetEngineUserInterface()->GetHeadSelectedUnit());1876		pkHeadSelectedUnit = GC.UnwrapUnitPointer(pDllHeadSelectedUnit.get());18771878		if(pkHeadSelectedUnit != NULL)1879		{1880			if(!(pkHeadSelectedUnit->ReadyToSelect()))1881			{1882				GC.GetEngineUserInterface()->ClearSelectionList();1883			}1884		}1885	}1886}

Calls

Called by