Bazaar developer reference

CvCity::processBuilding(BuildingTypes, int, bool, bool, bool)

Defined in
CvCity.cpp, line 6275
Class
CvCity
Hook name
CivHooks::CvCity_processBuilding

Hooks

static bool BeforeCvCity_processBuilding(CvCity* self, BuildingTypes eBuilding, int iChange, bool bFirst, bool bObsolete, bool arg4);static void AfterCvCity_processBuilding(CvCity* self, BuildingTypes eBuilding, int iChange, bool bFirst, bool bObsolete, bool arg4);static void ReplaceCvCity_processBuilding(void (*original)(CvCity*, BuildingTypes, int, bool, bool, bool), CvCity* self, BuildingTypes eBuilding, int iChange, bool bFirst, bool bObsolete, bool arg4);CivRegisterBefore<CivHooks::CvCity_processBuilding>(host, &BeforeCvCity_processBuilding);CivRegisterAfter<CivHooks::CvCity_processBuilding>(host, &AfterCvCity_processBuilding);CivRegisterReplace<CivHooks::CvCity_processBuilding>(host, &ReplaceCvCity_processBuilding);

Code

6275void CvCity::processBuilding(BuildingTypes eBuilding, int iChange, bool bFirst, bool bObsolete, bool /*bApplyingAllCitiesBonus*/)6276{6277	VALIDATE_OBJECT62786279	CvBuildingEntry* pBuildingInfo = GC.getBuildingInfo(eBuilding);62806281	if(pBuildingInfo == NULL)6282		return;62836284	BuildingClassTypes eBuildingClass = (BuildingClassTypes) pBuildingInfo->GetBuildingClassType();62856286	CvPlayer& owningPlayer = GET_PLAYER(getOwner());6287	CvTeam& owningTeam = GET_TEAM(getTeam());6288	CvCivilizationInfo& thisCiv = getCivilizationInfo();62896290	if(!(owningTeam.isObsoleteBuilding(eBuilding)) || bObsolete)6291	{6292		// One-shot items6293		if(bFirst && iChange > 0)6294		{6295			// Capital6296			if(pBuildingInfo->IsCapital())6297				owningPlayer.setCapitalCity(this);62986299			// Free Units6300			CvUnit* pFreeUnit;63016302			int iFreeUnitLoop;63036304			for(int iUnitLoop = 0; iUnitLoop < GC.getNumUnitInfos(); iUnitLoop++)6305			{6306				const UnitTypes eUnit = static_cast<UnitTypes>(iUnitLoop);6307				CvUnitEntry* pkUnitInfo = GC.getUnitInfo(eUnit);6308				if(pkUnitInfo)6309				{6310					for(iFreeUnitLoop = 0; iFreeUnitLoop < pBuildingInfo->GetNumFreeUnits(iUnitLoop); iFreeUnitLoop++)6311					{6312						// Get the right unit of this class for this civ6313						const UnitTypes eFreeUnitType = (UnitTypes)thisCiv.getCivilizationUnits((UnitClassTypes)pkUnitInfo->GetUnitClassType());63146315						// Great prophet?6316						if(GC.GetGameUnits()->GetEntry(eFreeUnitType)->IsFoundReligion())6317						{6318#if defined(MOD_GLOBAL_TRULY_FREE_GP)6319							GetCityCitizens()->DoSpawnGreatPerson(eFreeUnitType, true /*bIncrementCount*/, true, MOD_GLOBAL_TRULY_FREE_GP);6320#else6321							GetCityCitizens()->DoSpawnGreatPerson(eFreeUnitType, true /*bIncrementCount*/, true);6322#endif6323						}6324						else6325						{6326							pFreeUnit = owningPlayer.initUnit(eFreeUnitType, getX(), getY());63276328							// Bump up the count6329							if(pFreeUnit->IsGreatGeneral())6330							{6331#if defined(MOD_GLOBAL_TRULY_FREE_GP)6332								owningPlayer.incrementGreatGeneralsCreated(MOD_GLOBAL_TRULY_FREE_GP);6333#else6334								owningPlayer.incrementGreatGeneralsCreated();6335#endif6336								if (!pFreeUnit->jumpToNearestValidPlot())6337									pFreeUnit->kill(false);	// Could not find a valid spot!6338							}6339							else if(pFreeUnit->IsGreatAdmiral())6340							{6341#if defined(MOD_GLOBAL_TRULY_FREE_GP)6342								owningPlayer.incrementGreatAdmiralsCreated(MOD_GLOBAL_TRULY_FREE_GP);6343#else6344								owningPlayer.incrementGreatAdmiralsCreated();6345#endif6346								CvPlot *pSpawnPlot = owningPlayer.GetGreatAdmiralSpawnPlot(pFreeUnit);6347								if (pFreeUnit->plot() != pSpawnPlot)6348								{6349									pFreeUnit->setXY(pSpawnPlot->getX(), pSpawnPlot->getY());6350								}6351							}6352							else if (pkUnitInfo->GetUnitClassType() == GC.getInfoTypeForString("UNITCLASS_WRITER"))6353							{6354#if defined(MOD_GLOBAL_TRULY_FREE_GP)6355								owningPlayer.incrementGreatWritersCreated(MOD_GLOBAL_TRULY_FREE_GP);6356#else6357								owningPlayer.incrementGreatWritersCreated();6358#endif6359								if (!pFreeUnit->jumpToNearestValidPlot())6360									pFreeUnit->kill(false);	// Could not find a valid spot!6361							}							6362							else if (pkUnitInfo->GetUnitClassType() == GC.getInfoTypeForString("UNITCLASS_ARTIST"))6363							{6364#if defined(MOD_GLOBAL_TRULY_FREE_GP)6365								owningPlayer.incrementGreatArtistsCreated(MOD_GLOBAL_TRULY_FREE_GP);6366#else6367								owningPlayer.incrementGreatArtistsCreated();6368#endif6369								if (!pFreeUnit->jumpToNearestValidPlot())6370									pFreeUnit->kill(false);	// Could not find a valid spot!6371							}							6372							else if (pkUnitInfo->GetUnitClassType() == GC.getInfoTypeForString("UNITCLASS_MUSICIAN"))6373							{6374#if defined(MOD_GLOBAL_TRULY_FREE_GP)6375								owningPlayer.incrementGreatMusiciansCreated(MOD_GLOBAL_TRULY_FREE_GP);6376#else6377								owningPlayer.incrementGreatMusiciansCreated();6378#endif6379								if (!pFreeUnit->jumpToNearestValidPlot())6380									pFreeUnit->kill(false);	// Could not find a valid spot!6381							}							6382							else if (pFreeUnit->IsGreatPerson())6383							{6384#if defined(MOD_GLOBAL_SEPARATE_GP_COUNTERS)6385								if (MOD_GLOBAL_SEPARATE_GP_COUNTERS) {6386									if (pkUnitInfo->GetUnitClassType() == GC.getInfoTypeForString("UNITCLASS_MERCHANT")) {6387#if defined(MOD_GLOBAL_TRULY_FREE_GP)6388										owningPlayer.incrementGreatMerchantsCreated(MOD_GLOBAL_TRULY_FREE_GP);6389#else6390										owningPlayer.incrementGreatMerchantsCreated();6391#endif6392									} else if (pkUnitInfo->GetUnitClassType() == GC.getInfoTypeForString("UNITCLASS_SCIENTIST")) {6393#if defined(MOD_GLOBAL_TRULY_FREE_GP)6394										owningPlayer.incrementGreatScientistsCreated(MOD_GLOBAL_TRULY_FREE_GP);6395#else6396										owningPlayer.incrementGreatScientistsCreated();6397#endif6398									} else {6399#if defined(MOD_GLOBAL_TRULY_FREE_GP)6400										owningPlayer.incrementGreatEngineersCreated(MOD_GLOBAL_TRULY_FREE_GP);6401#else6402										owningPlayer.incrementGreatEngineersCreated();6403#endif6404									}6405								} else6406#endif6407#if defined(MOD_GLOBAL_TRULY_FREE_GP)6408								owningPlayer.incrementGreatPeopleCreated(MOD_GLOBAL_TRULY_FREE_GP);6409#else6410								owningPlayer.incrementGreatPeopleCreated();6411#endif6412								if (!pFreeUnit->jumpToNearestValidPlot())6413									pFreeUnit->kill(false);	// Could not find a valid spot!6414							}6415						}6416					}6417				}6418			}64196420			// Free building6421			BuildingClassTypes eFreeBuildingClassThisCity = (BuildingClassTypes)pBuildingInfo->GetFreeBuildingThisCity();6422			if(eFreeBuildingClassThisCity != NO_BUILDINGCLASS)6423			{6424				BuildingTypes eFreeBuildingThisCity = (BuildingTypes)(thisCiv.getCivilizationBuildings(eFreeBuildingClassThisCity));64256426				if (eFreeBuildingThisCity != NO_BUILDING)6427				{6428					m_pCityBuildings->SetNumRealBuilding(eFreeBuildingThisCity, 0);6429					m_pCityBuildings->SetNumFreeBuilding(eFreeBuildingThisCity, 1);6430				}6431			}64326433			// Free Great Work6434			GreatWorkType eGWType = pBuildingInfo->GetFreeGreatWork();6435			if (eGWType != NO_GREAT_WORK)6436			{6437				GreatWorkClass eClass = CultureHelpers::GetGreatWorkClass(eGWType);6438				int iGWindex = 	GC.getGame().GetGameCulture()->CreateGreatWork(eGWType, eClass, m_eOwner, owningPlayer.GetCurrentEra(), pBuildingInfo->GetDescription());6439				m_pCityBuildings->SetBuildingGreatWork(eBuildingClass, 0, iGWindex);6440			}64416442			// Tech boost for science buildings in capital6443			if(owningPlayer.GetPlayerTraits()->IsTechBoostFromCapitalScienceBuildings())6444			{6445				if(isCapital())6446				{6447					if(pBuildingInfo->IsScienceBuilding())6448					{6449						int iMedianTechResearch = owningPlayer.GetPlayerTechs()->GetMedianTechResearch();6450						iMedianTechResearch = (iMedianTechResearch * owningPlayer.GetMedianTechPercentage()) / 100;64516452						TechTypes eCurrentTech = owningPlayer.GetPlayerTechs()->GetCurrentResearch();6453						if(eCurrentTech == NO_TECH)6454						{6455							owningPlayer.changeOverflowResearch(iMedianTechResearch);6456						}6457						else6458						{6459							owningTeam.GetTeamTechs()->ChangeResearchProgress(eCurrentTech, iMedianTechResearch, owningPlayer.GetID());6460						}6461					}6462				}6463			}64646465			// TERRA COTTA AWESOME6466			if (pBuildingInfo->GetInstantMilitaryIncrease())6467			{6468				std::vector<UnitTypes> aExtraUnits;6469				std::vector<UnitAITypes> aExtraUnitAITypes;6470				CvUnit* pLoopUnit = NULL;6471				int iLoop = 0;6472				for(pLoopUnit = GET_PLAYER(m_eOwner).firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = GET_PLAYER(m_eOwner).nextUnit(&iLoop))6473				{6474					if (pLoopUnit->getDomainType() == DOMAIN_LAND && pLoopUnit->IsCombatUnit())6475					{6476						UnitTypes eCurrentUnitType = pLoopUnit->getUnitType();6477						UnitAITypes eCurrentUnitAIType = pLoopUnit->AI_getUnitAIType();64786479						// check for duplicate unit6480						bool bAddUnit = true;6481						for (uint ui = 0; ui < aExtraUnits.size(); ui++)6482						{6483							if (aExtraUnits[ui] == eCurrentUnitType)6484							{6485								bAddUnit = false;6486							}6487						}64886489						if (bAddUnit)6490						{6491							aExtraUnits.push_back(eCurrentUnitType);6492							aExtraUnitAITypes.push_back(eCurrentUnitAIType);6493						}6494					}6495				}64966497				for (uint ui = 0; ui < aExtraUnits.size(); ui++)6498				{6499					CvUnit* pNewUnit = GET_PLAYER(m_eOwner).initUnit(aExtraUnits[ui], m_iX, m_iY, aExtraUnitAITypes[ui]);6500					bool bJumpSuccess = pNewUnit->jumpToNearestValidPlot();6501					if (!bJumpSuccess)6502					{6503						pNewUnit->kill(false);6504						break;6505					}6506				}6507			}6508			// END TERRA COTTA AWESOME6509		}65106511		if(pBuildingInfo->GetTrainedFreePromotion() != NO_PROMOTION)6512		{6513			changeFreePromotionCount(((PromotionTypes)(pBuildingInfo->GetTrainedFreePromotion())), iChange);6514		}65156516		changeGreatPeopleRateModifier(pBuildingInfo->GetGreatPeopleRateModifier() * iChange);6517		changeFreeExperience(pBuildingInfo->GetFreeExperience() * iChange);6518		ChangeMaxAirUnits(pBuildingInfo->GetAirModifier() * iChange);6519		changeNukeModifier(pBuildingInfo->GetNukeModifier() * iChange);6520		changeHealRate(pBuildingInfo->GetHealRateChange() * iChange);6521		ChangeExtraHitPoints(pBuildingInfo->GetExtraCityHitPoints() * iChange);65226523		ChangeNoOccupiedUnhappinessCount(pBuildingInfo->IsNoOccupiedUnhappiness() * iChange);65246525#if !defined(MOD_API_EXTENSIONS)6526		// Trust the modder if they set a building to negative happiness6527		if(pBuildingInfo->GetHappiness() > 0)6528#endif6529		{6530			ChangeBaseHappinessFromBuildings(pBuildingInfo->GetHappiness() * iChange);6531		}65326533#if !defined(MOD_API_EXTENSIONS)6534		// Trust the modder if they set a building to negative global happiness6535		if(pBuildingInfo->GetUnmoddedHappiness() > 0)6536#endif6537		{6538			ChangeUnmoddedHappinessFromBuildings(pBuildingInfo->GetUnmoddedHappiness() * iChange);6539		}65406541		if(pBuildingInfo->GetUnhappinessModifier() != 0)6542		{6543			owningPlayer.ChangeUnhappinessMod(pBuildingInfo->GetUnhappinessModifier() * iChange);6544		}65456546		int iBuildingCulture = pBuildingInfo->GetYieldChange(YIELD_CULTURE);6547		if(iBuildingCulture > 0)6548		{6549			iBuildingCulture += owningPlayer.GetPlayerTraits()->GetCultureBuildingYieldChange();6550		}6551		ChangeJONSCulturePerTurnFromBuildings(iBuildingCulture * iChange);6552		changeCultureRateModifier(pBuildingInfo->GetCultureRateModifier() * iChange);6553		changePlotCultureCostModifier(pBuildingInfo->GetPlotCultureCostModifier() * iChange);6554		changePlotBuyCostModifier(pBuildingInfo->GetPlotBuyCostModifier() * iChange);6555#if defined(MOD_BUILDINGS_CITY_WORKING)6556		changeCityWorkingChange(pBuildingInfo->GetCityWorkingChange() * iChange);6557#endif65586559#if defined(MOD_BUILDINGS_CITY_AUTOMATON_WORKERS)6560		changeCityAutomatonWorkersChange(pBuildingInfo->GetCityAutomatonWorkersChange() * iChange);6561#endif65626563		int iBuildingFaith = pBuildingInfo->GetYieldChange(YIELD_FAITH);6564		ChangeFaithPerTurnFromBuildings(iBuildingFaith * iChange);6565		m_pCityReligions->ChangeReligiousPressureModifier(pBuildingInfo->GetReligiousPressureModifier() * iChange);65666567		PolicyTypes ePolicy;6568		for(int iPolicyLoop = 0; iPolicyLoop < GC.getNumPolicyInfos(); iPolicyLoop++)6569		{6570			ePolicy = (PolicyTypes) iPolicyLoop;65716572			if(owningPlayer.GetPlayerPolicies()->HasPolicy(ePolicy) && !owningPlayer.GetPlayerPolicies()->IsPolicyBlocked(ePolicy))6573			{6574				ChangeJONSCulturePerTurnFromPolicies(GC.getPolicyInfo(ePolicy)->GetBuildingClassCultureChange(eBuildingClass) * iChange);6575				ChangeFaithPerTurnFromPolicies(GC.getPolicyInfo(ePolicy)->GetBuildingClassYieldChanges(eBuildingClass, YIELD_FAITH) * iChange);6576			}6577		}65786579		changeMaxFoodKeptPercent(pBuildingInfo->GetFoodKept() * iChange);6580		changeMilitaryProductionModifier(pBuildingInfo->GetMilitaryProductionModifier() * iChange);6581		changeSpaceProductionModifier(pBuildingInfo->GetSpaceProductionModifier() * iChange);6582		m_pCityBuildings->ChangeBuildingProductionModifier(pBuildingInfo->GetBuildingProductionModifier() * iChange);6583		m_pCityBuildings->ChangeMissionaryExtraSpreads(pBuildingInfo->GetExtraMissionarySpreads() * iChange);6584		m_pCityBuildings->ChangeLandmarksTourismPercent(pBuildingInfo->GetLandmarksTourismPercent() * iChange);6585		m_pCityBuildings->ChangeGreatWorksTourismModifier(pBuildingInfo->GetGreatWorksTourismModifier() * iChange);6586		ChangeWonderProductionModifier(pBuildingInfo->GetWonderProductionModifier() * iChange);6587		changeCapturePlunderModifier(pBuildingInfo->GetCapturePlunderModifier() * iChange);6588		ChangeEspionageModifier(pBuildingInfo->GetEspionageModifier() * iChange);6589#if defined(MOD_RELIGION_CONVERSION_MODIFIERS)6590		ChangeConversionModifier(pBuildingInfo->GetConversionModifier() * iChange);6591		owningPlayer.ChangeConversionModifier(pBuildingInfo->GetGlobalConversionModifier() * iChange);6592#endif65936594		ChangeTradeRouteTargetBonus(pBuildingInfo->GetTradeRouteTargetBonus() * iChange);6595		ChangeTradeRouteRecipientBonus(pBuildingInfo->GetTradeRouteRecipientBonus() * iChange);6596		65976598		if (pBuildingInfo->AffectSpiesNow() && iChange > 0)6599		{6600			for (uint ui = 0; ui < MAX_MAJOR_CIVS; ui++)6601			{6602				PlayerTypes ePlayer = (PlayerTypes)ui;6603				GET_PLAYER(ePlayer).GetEspionage()->UpdateCity(this);6604			}6605		}66066607		// Resource loop6608		int iCulture, iFaith;6609		ResourceTypes eResource;6610		for(int iResourceLoop = 0; iResourceLoop < GC.getNumResourceInfos(); iResourceLoop++)6611		{6612			eResource = (ResourceTypes) iResourceLoop;66136614			// Does this building add resources?6615			int iNumResource = pBuildingInfo->GetResourceQuantity(iResourceLoop) * iChange;6616			if(iNumResource != 0)6617			{6618				owningPlayer.changeNumResourceTotal(eResource, iNumResource);6619			}66206621			// Do we have this resource local?6622			if(IsHasResourceLocal(eResource, /*bTestVisible*/ false))6623			{6624				// Our Building does give culture with eResource6625				iCulture = GC.getBuildingInfo(eBuilding)->GetResourceCultureChange(eResource);66266627				if(iCulture != 0)6628				{6629					ChangeJONSCulturePerTurnFromBuildings(iCulture * m_paiNumResourcesLocal[eResource]);6630				}66316632				// What about faith?6633				iFaith = GC.getBuildingInfo(eBuilding)->GetResourceFaithChange(eResource);66346635				if(iFaith != 0)6636				{6637					ChangeFaithPerTurnFromBuildings(iFaith * m_paiNumResourcesLocal[eResource]);6638				}6639			}6640		}66416642		if(pBuildingInfo->IsExtraLuxuries())6643		{6644			CvPlot* pLoopPlot;66456646			// Subtract off old luxury counts6647#if defined(MOD_GLOBAL_CITY_WORKING)6648			for(int iJ = 0; iJ < GetNumWorkablePlots(); iJ++)6649#else6650			for(int iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)6651#endif6652			{6653				pLoopPlot = plotCity(getX(), getY(), iJ);66546655				if(pLoopPlot != NULL && pLoopPlot->getOwner() == getOwner())6656				{6657					ResourceTypes eLoopResource = pLoopPlot->getResourceType();6658					if(eLoopResource != NO_RESOURCE && GC.getResourceInfo(eLoopResource)->getResourceUsage() == RESOURCEUSAGE_LUXURY)6659					{6660						if(owningTeam.GetTeamTechs()->HasTech((TechTypes) GC.getResourceInfo(eLoopResource)->getTechCityTrade()))6661						{6662							if(pLoopPlot == plot() || (pLoopPlot->getImprovementType() != NO_IMPROVEMENT && GC.getImprovementInfo(pLoopPlot->getImprovementType())->IsImprovementResourceTrade(eLoopResource)))6663							{6664								if(!pLoopPlot->IsImprovementPillaged())6665								{6666									owningPlayer.changeNumResourceTotal(pLoopPlot->getResourceType(), -pLoopPlot->getNumResourceForPlayer(getOwner()), /*bIgnoreResourceWarning*/ true);6667								}6668							}6669						}6670					}6671				}6672			}66736674			ChangeExtraLuxuryResources(iChange);66756676			// Add in new luxury counts6677#if defined(MOD_GLOBAL_CITY_WORKING)6678			for(int iJ = 0; iJ < GetNumWorkablePlots(); iJ++)6679#else6680			for(int iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)6681#endif6682			{6683				pLoopPlot = plotCity(getX(), getY(), iJ);66846685				if(pLoopPlot != NULL && pLoopPlot->getOwner() == getOwner())6686				{6687					ResourceTypes eLoopResource = pLoopPlot->getResourceType();6688					if(eLoopResource != NO_RESOURCE && GC.getResourceInfo(eLoopResource)->getResourceUsage() == RESOURCEUSAGE_LUXURY)6689					{6690						if(owningTeam.GetTeamTechs()->HasTech((TechTypes) GC.getResourceInfo(eLoopResource)->getTechCityTrade()))6691						{6692							if(pLoopPlot == plot() || (pLoopPlot->getImprovementType() != NO_IMPROVEMENT && GC.getImprovementInfo(pLoopPlot->getImprovementType())->IsImprovementResourceTrade(eLoopResource)))6693							{6694								if(!pLoopPlot->IsImprovementPillaged())6695								{6696									owningPlayer.changeNumResourceTotal(pLoopPlot->getResourceType(), pLoopPlot->getNumResourceForPlayer(getOwner()));6697								}6698							}6699						}6700					}6701				}6702			}6703		}67046705#if defined(MOD_API_UNIFIED_YIELDS)6706		CvBuildingClassInfo* pkBuildingClassInfo = GC.getBuildingClassInfo(eBuildingClass);6707#endif67086709		YieldTypes eYield;67106711		for(int iI = 0; iI < NUM_YIELD_TYPES; iI++)6712		{6713			eYield = (YieldTypes) iI;67146715			changeSeaPlotYield(eYield, (pBuildingInfo->GetSeaPlotYieldChange(eYield) * iChange));6716			changeRiverPlotYield(eYield, (pBuildingInfo->GetRiverPlotYieldChange(eYield) * iChange));6717			changeLakePlotYield(eYield, (pBuildingInfo->GetLakePlotYieldChange(eYield) * iChange));6718			changeSeaResourceYield(eYield, (pBuildingInfo->GetSeaResourceYieldChange(eYield) * iChange));6719			ChangeBaseYieldRateFromBuildings(eYield, ((pBuildingInfo->GetYieldChange(eYield) + m_pCityBuildings->GetBuildingYieldChange(eBuildingClass, eYield)) * iChange));6720			ChangeYieldPerPopTimes100(eYield, pBuildingInfo->GetYieldChangePerPop(eYield) * iChange);6721			ChangeYieldPerReligionTimes100(eYield, pBuildingInfo->GetYieldChangePerReligion(eYield) * iChange);6722			changeYieldRateModifier(eYield, (pBuildingInfo->GetYieldModifier(eYield) * iChange));67236724			CvPlayerPolicies* pPolicies = GET_PLAYER(getOwner()).GetPlayerPolicies();6725			changeYieldRateModifier(eYield, pPolicies->GetBuildingClassYieldModifier(eBuildingClass, eYield) * iChange);6726			ChangeBaseYieldRateFromBuildings(eYield, pPolicies->GetBuildingClassYieldChange(eBuildingClass, eYield) * iChange);6727#if defined(MOD_API_UNIFIED_YIELDS)6728			ChangeBaseYieldRateFromBuildings(eYield, GET_PLAYER(getOwner()).GetPlayerTraits()->GetBuildingClassYieldChange(eBuildingClass, eYield) * iChange);6729#endif67306731#if defined(MOD_API_UNIFIED_YIELDS)6732			if (pkBuildingClassInfo && isWorldWonderClass(*pkBuildingClassInfo))6733			{6734				if(eYield == YIELD_CULTURE)6735				{6736					ChangeJONSCulturePerTurnFromBuildings(GetPlayer()->GetYieldChangeWorldWonder(eYield) * iChange);6737					ChangeJONSCulturePerTurnFromBuildings(GetPlayer()->GetPlayerTraits()->GetYieldChangeWorldWonder(eYield) * iChange);6738				}6739				else if(eYield == YIELD_FAITH)6740				{6741					ChangeFaithPerTurnFromBuildings(GetPlayer()->GetYieldChangeWorldWonder(eYield) * iChange);6742					ChangeFaithPerTurnFromBuildings(GetPlayer()->GetPlayerTraits()->GetYieldChangeWorldWonder(eYield) * iChange);6743				}6744				else6745				{6746					ChangeBaseYieldRateFromBuildings(eYield, GetPlayer()->GetYieldChangeWorldWonder(eYield) * iChange);6747					ChangeBaseYieldRateFromBuildings(eYield, GetPlayer()->GetPlayerTraits()->GetYieldChangeWorldWonder(eYield) * iChange);6748				}6749			}6750#endif67516752			for(int iJ = 0; iJ < GC.getNumResourceInfos(); iJ++)6753			{6754				ChangeResourceExtraYield(((ResourceTypes)iJ), eYield, (GC.getBuildingInfo(eBuilding)->GetResourceYieldChange(iJ, eYield) * iChange));6755			}67566757			for(int iJ = 0; iJ < GC.getNumFeatureInfos(); iJ++)6758			{6759				ChangeFeatureExtraYield(((FeatureTypes)iJ), eYield, (GC.getBuildingInfo(eBuilding)->GetFeatureYieldChange(iJ, eYield) * iChange));6760			}67616762			for(int iJ = 0; iJ < GC.getNumTerrainInfos(); iJ++)6763			{6764				ChangeTerrainExtraYield(((TerrainTypes)iJ), eYield, (GC.getBuildingInfo(eBuilding)->GetTerrainYieldChange(iJ, eYield) * iChange));6765			}67666767#if defined(MOD_API_UNIFIED_YIELDS) && defined(MOD_API_PLOT_YIELDS)6768			for(int iJ = 0; iJ < GC.getNumPlotInfos(); iJ++)6769			{6770				ChangePlotExtraYield(((PlotTypes)iJ), eYield, (GC.getBuildingInfo(eBuilding)->GetPlotYieldChange(iJ, eYield) * iChange));6771			}6772#endif67736774			if(pBuildingInfo->GetEnhancedYieldTech() != NO_TECH)6775			{6776				if(owningTeam.GetTeamTechs()->HasTech((TechTypes)pBuildingInfo->GetEnhancedYieldTech()))6777				{6778					if(eYield == YIELD_CULTURE)6779					{6780						ChangeJONSCulturePerTurnFromBuildings(pBuildingInfo->GetTechEnhancedYieldChange(eYield) * iChange);6781					}6782					else if(eYield == YIELD_FAITH)6783					{6784						ChangeFaithPerTurnFromBuildings(pBuildingInfo->GetTechEnhancedYieldChange(eYield) * iChange);6785					}6786					else6787					{6788						ChangeBaseYieldRateFromBuildings(eYield, pBuildingInfo->GetTechEnhancedYieldChange(eYield) * iChange);6789					}6790				}6791			}67926793			int iBuildingClassBonus = owningPlayer.GetBuildingClassYieldChange(eBuildingClass, eYield);6794			if(iBuildingClassBonus > 0)6795			{6796				if(eYield == YIELD_CULTURE)6797				{6798					ChangeJONSCulturePerTurnFromBuildings(iBuildingClassBonus * iChange);6799				}6800				else if(eYield == YIELD_FAITH)6801				{6802					ChangeFaithPerTurnFromBuildings(iBuildingClassBonus * iChange);6803				}6804				else6805				{6806					ChangeBaseYieldRateFromBuildings(eYield, iBuildingClassBonus * iChange);6807				}6808			}6809		}68106811		if(GC.getBuildingInfo(eBuilding)->GetSpecialistType() != NO_SPECIALIST)6812		{6813			GetCityCitizens()->ChangeBuildingGreatPeopleRateChanges((SpecialistTypes) GC.getBuildingInfo(eBuilding)->GetSpecialistType(), pBuildingInfo->GetGreatPeopleRateChange() * iChange);6814		}68156816		for(int iI = 0; iI < GC.getNumUnitCombatClassInfos(); iI++)6817		{6818			const UnitCombatTypes eUnitCombatClass = static_cast<UnitCombatTypes>(iI);6819			CvBaseInfo* pkUnitCombatClassInfo = GC.getUnitCombatClassInfo(eUnitCombatClass);6820			if(pkUnitCombatClassInfo)6821			{6822				changeUnitCombatFreeExperience(eUnitCombatClass, pBuildingInfo->GetUnitCombatFreeExperience(iI) * iChange);6823				changeUnitCombatProductionModifier(eUnitCombatClass, pBuildingInfo->GetUnitCombatProductionModifier(iI) * iChange);6824			}6825		}68266827		for(int iI = 0; iI < NUM_DOMAIN_TYPES; iI++)6828		{6829			changeDomainFreeExperience(((DomainTypes)iI), pBuildingInfo->GetDomainFreeExperience(iI) * iChange);6830			changeDomainProductionModifier(((DomainTypes)iI), pBuildingInfo->GetDomainProductionModifier(iI) * iChange);6831		}68326833		// Process for our player6834		for(int iI = 0; iI < MAX_PLAYERS; iI++)6835		{6836			if(GET_PLAYER((PlayerTypes)iI).getTeam() == getTeam())6837			{6838				if(pBuildingInfo->IsTeamShare() || (iI == getOwner()))6839				{6840					GET_PLAYER((PlayerTypes)iI).processBuilding(eBuilding, iChange, bFirst, area());6841				}6842			}6843		}68446845		// Process for our team6846		owningTeam.processBuilding(eBuilding, iChange, bFirst);6847	}68486849	if(!bObsolete)6850	{6851		m_pCityBuildings->ChangeBuildingDefense(pBuildingInfo->GetDefenseModifier() * iChange);68526853		owningTeam.changeBuildingClassCount(eBuildingClass, iChange);6854		owningPlayer.changeBuildingClassCount(eBuildingClass, iChange);6855	}68566857	UpdateReligion(GetCityReligions()->GetReligiousMajority());68586859	owningPlayer.DoUpdateHappiness();68606861	setLayoutDirty(true);6862}

Calls

Called by