Bazaar developer reference

CvUnit::canHurry(const CvPlot *, bool) const

Defined in
CvUnit.cpp, line 9220
Class
CvUnit
Hook name
CivHooks::CvUnit_canHurry

Hooks

static bool BeforeCvUnit_canHurry(const CvUnit* self, const CvPlot* pPlot, bool bTestVisible, bool& result);static void AfterCvUnit_canHurry(const CvUnit* self, const CvPlot* pPlot, bool bTestVisible, bool& result);static bool ReplaceCvUnit_canHurry(bool (*original)(const CvUnit*, const CvPlot*, bool), const CvUnit* self, const CvPlot* pPlot, bool bTestVisible);CivRegisterBefore<CivHooks::CvUnit_canHurry>(host, &BeforeCvUnit_canHurry);CivRegisterAfter<CivHooks::CvUnit_canHurry>(host, &AfterCvUnit_canHurry);CivRegisterReplace<CivHooks::CvUnit_canHurry>(host, &ReplaceCvUnit_canHurry);

Code

9220bool CvUnit::canHurry(const CvPlot* pPlot, bool bTestVisible) const9221{9222	if(isDelayedDeath())9223	{9224		return false;9225	}92269227	CvCity* pCity;92289229	if(getHurryProduction(pPlot) == 0)9230	{9231		return false;9232	}92339234	pCity = pPlot->getPlotCity();92359236	if(pCity == NULL)9237	{9238		return false;9239	}92409241	if(pCity->getProductionTurnsLeft() == 1)9242	{9243		return false;9244	}92459246	if(!bTestVisible)9247	{9248		if(!(pCity->isProductionBuilding()))9249		{9250			if (!pCity->isProductionUnit())9251			{9252				return false;9253			}9254			else9255			{9256				UnitTypes eUnit = pCity->getProductionUnit();9257				CvUnitEntry *pkUnit = GC.GetGameUnits()->GetEntry(eUnit);9258				if (pkUnit && GET_PLAYER(pCity->getOwner()).IsEnablesSSPartHurry())9259				{9260					if (pkUnit->GetSpaceshipProject() != NO_PROJECT)9261					{9262						return true;9263					}9264				}9265				return false;9266			}9267		}9268	}92699270	return true;9271}

Calls

Called by