Bazaar developer reference

CvGame::getPlotUnits(CvPlot *, std::vector<CvUnit *> &)

Defined in
CvGame.cpp, line 2248
Class
CvGame
Hook name
CivHooks::CvGame_getPlotUnits

Hooks

static bool BeforeCvGame_getPlotUnits(CvGame* self, CvPlot* pPlot, std::vector<CvUnit*>& plotUnits);static void AfterCvGame_getPlotUnits(CvGame* self, CvPlot* pPlot, std::vector<CvUnit*>& plotUnits);static void ReplaceCvGame_getPlotUnits(void (*original)(CvGame*, CvPlot*, std::vector<CvUnit*>&), CvGame* self, CvPlot* pPlot, std::vector<CvUnit*>& plotUnits);CivRegisterBefore<CivHooks::CvGame_getPlotUnits>(host, &BeforeCvGame_getPlotUnits);CivRegisterAfter<CivHooks::CvGame_getPlotUnits>(host, &AfterCvGame_getPlotUnits);CivRegisterReplace<CivHooks::CvGame_getPlotUnits>(host, &ReplaceCvGame_getPlotUnits);

Code

2248void CvGame::getPlotUnits(CvPlot* pPlot, std::vector<CvUnit*>& plotUnits)2249{2250	plotUnits.erase(plotUnits.begin(), plotUnits.end());22512252	IDInfo* pUnitNode1;2253	IDInfo* pUnitNode2;2254	CvUnit* pLoopUnit1;2255	CvUnit* pLoopUnit2;2256	int iPass;2257	PlayerTypes activePlayer = getActivePlayer();2258	TeamTypes activeTeam = getActiveTeam();22592260	if(pPlot != NULL)2261	{2262		for(iPass = 0; iPass < 2; iPass++)2263		{2264			pUnitNode1 = pPlot->headUnitNode();22652266			while(pUnitNode1 != NULL)2267			{2268				pLoopUnit1 = ::getUnit(*pUnitNode1);2269				pUnitNode1 = pPlot->nextUnitNode(pUnitNode1);22702271				if(!(pLoopUnit1->isInvisible(activeTeam, true)))2272				{2273					if(!(pLoopUnit1->isCargo()))2274					{2275						if((pLoopUnit1->getOwner() == activePlayer) == (iPass == 0))2276						{2277							plotUnits.push_back(pLoopUnit1);22782279							if(pLoopUnit1->hasCargo())2280							{2281								pUnitNode2 = pPlot->headUnitNode();22822283								while(pUnitNode2 != NULL)2284								{2285									pLoopUnit2 = ::getUnit(*pUnitNode2);2286									pUnitNode2 = pPlot->nextUnitNode(pUnitNode2);22872288									if(!(pLoopUnit2->isInvisible(activeTeam, true)))2289									{2290										if(pLoopUnit2->getTransportUnit() == pLoopUnit1)2291										{2292											plotUnits.push_back(pLoopUnit2);2293										}2294									}2295								}2296							}2297						}2298					}2299				}2300			}2301		}2302	}2303}

Calls

Called by