Bazaar developer reference

CvUnit::hurry()

Defined in
CvUnit.cpp, line 9275
Class
CvUnit
Hook name
CivHooks::CvUnit_hurry

Hooks

static bool BeforeCvUnit_hurry(CvUnit* self, bool& result);static void AfterCvUnit_hurry(CvUnit* self, bool& result);static bool ReplaceCvUnit_hurry(bool (*original)(CvUnit*), CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_hurry>(host, &BeforeCvUnit_hurry);CivRegisterAfter<CivHooks::CvUnit_hurry>(host, &AfterCvUnit_hurry);CivRegisterReplace<CivHooks::CvUnit_hurry>(host, &ReplaceCvUnit_hurry);

Code

9275bool CvUnit::hurry()9276{9277	CvCity* pCity;92789279	CvPlot* pPlot = plot();92809281	if(!canHurry(pPlot))9282	{9283		return false;9284	}92859286	pCity = pPlot->getPlotCity();92879288	if(pCity != NULL)9289	{9290		pCity->changeProduction(getHurryProduction(pPlot));9291	}92929293	if(pPlot->isActiveVisible(false))9294	{9295#if !defined(NO_ACHIEVEMENTS)9296		//Achievement check9297		if(pCity != NULL && pCity->getProductionBuilding() != NO_BUILDING)9298		{9299			CvBuildingEntry* pkProductionBuildinInfo = GC.getBuildingInfo(pCity->getProductionBuilding());9300			if(pkProductionBuildinInfo)9301			{9302				if(isLimitedWonderClass(pkProductionBuildinInfo->GetBuildingClassInfo()))9303				{9304					if(pCity->isHuman() && !GC.getGame().isGameMultiPlayer())9305					{9306						const char* pLeaderChar = GET_PLAYER(pCity->getOwner()).getLeaderTypeKey();9307						CvString szLeader = pLeaderChar;9308						if(szLeader == "LEADER_RAMESSES")9309						{9310							gDLL->UnlockAchievement(ACHIEVEMENT_SPECIAL_SPHINX);9311						}9312					}9313				}9314			}9315		}9316#endif9317	}93189319	if(IsGreatPerson())9320	{9321		CvPlayer& kPlayer = GET_PLAYER(getOwner());9322#if defined(MOD_EVENTS_GREAT_PEOPLE)9323		kPlayer.DoGreatPersonExpended(getUnitType(), this);9324#else9325		kPlayer.DoGreatPersonExpended(getUnitType());9326#endif9327	}93289329	kill(true);93309331	return true;9332}

Calls

Called by