Bazaar developer reference

CvCity::chooseProduction(UnitTypes, BuildingTypes, ProjectTypes, bool, bool)

Defined in
CvCity.cpp, line 2190
Class
CvCity
Hook name
CivHooks::CvCity_chooseProduction

Hooks

static bool BeforeCvCity_chooseProduction(CvCity* self, UnitTypes eTrainUnit, BuildingTypes eConstructBuilding, ProjectTypes eCreateProject, bool arg3, bool arg4);static void AfterCvCity_chooseProduction(CvCity* self, UnitTypes eTrainUnit, BuildingTypes eConstructBuilding, ProjectTypes eCreateProject, bool arg3, bool arg4);static void ReplaceCvCity_chooseProduction(void (*original)(CvCity*, UnitTypes, BuildingTypes, ProjectTypes, bool, bool), CvCity* self, UnitTypes eTrainUnit, BuildingTypes eConstructBuilding, ProjectTypes eCreateProject, bool arg3, bool arg4);CivRegisterBefore<CivHooks::CvCity_chooseProduction>(host, &BeforeCvCity_chooseProduction);CivRegisterAfter<CivHooks::CvCity_chooseProduction>(host, &AfterCvCity_chooseProduction);CivRegisterReplace<CivHooks::CvCity_chooseProduction>(host, &ReplaceCvCity_chooseProduction);

Code

2190void CvCity::chooseProduction(UnitTypes eTrainUnit, BuildingTypes eConstructBuilding, ProjectTypes eCreateProject, bool /*bFinish*/, bool /*bFront*/)2191{2192	VALIDATE_OBJECT2193	CvString strTooltip = GetLocalizedText("TXT_KEY_NOTIFICATION_NEW_CONSTRUCTION", getNameKey());21942195	CvNotifications* pNotifications = GET_PLAYER(getOwner()).GetNotifications();2196	if(pNotifications)2197	{2198		// Figure out what we just finished so we can package it into something the lua will understand2199		OrderTypes eOrder = NO_ORDER;2200		int iItemID = -1;22012202		if(eTrainUnit != NO_UNIT)2203		{2204			eOrder = ORDER_TRAIN;2205			iItemID = eTrainUnit;2206		}2207		else if(eConstructBuilding != NO_BUILDING)2208		{2209			eOrder = ORDER_CONSTRUCT;2210			iItemID = eConstructBuilding;2211		}2212		else if(eCreateProject != NO_PROJECT)2213		{2214			eOrder = ORDER_CREATE;2215			iItemID = eCreateProject;2216		}22172218		pNotifications->Add(NOTIFICATION_PRODUCTION, strTooltip, strTooltip, getX(), getY(), eOrder, iItemID);2219	}2220}

Calls

Called by