Bazaar developer reference

CvActiveResolution::RemoveEffects(PlayerTypes)

Defined in
CvVotingClasses.cpp, line 1463
Class
CvActiveResolution
Hook name
CivHooks::CvActiveResolution_RemoveEffects

Hooks

static bool BeforeCvActiveResolution_RemoveEffects(CvActiveResolution* self, PlayerTypes ePlayer);static void AfterCvActiveResolution_RemoveEffects(CvActiveResolution* self, PlayerTypes ePlayer);static void ReplaceCvActiveResolution_RemoveEffects(void (*original)(CvActiveResolution*, PlayerTypes), CvActiveResolution* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvActiveResolution_RemoveEffects>(host, &BeforeCvActiveResolution_RemoveEffects);CivRegisterAfter<CivHooks::CvActiveResolution_RemoveEffects>(host, &AfterCvActiveResolution_RemoveEffects);CivRegisterReplace<CivHooks::CvActiveResolution_RemoveEffects>(host, &ReplaceCvActiveResolution_RemoveEffects);

Code

1463void CvActiveResolution::RemoveEffects(PlayerTypes ePlayer)1464{1465	CvPlayer* pPlayer = &GET_PLAYER(ePlayer);1466	CvAssertMsg(pPlayer != NULL, "Player is null when doing effects of an active resolution. Please send Anton your save file and version.");1467	if (pPlayer == NULL) return;14681469	CvLeague* pLeague = GC.getGame().GetGameLeagues()->GetLeague(GetLeague());1470	CvAssertMsg(pLeague != NULL, "League is null when doing effects of an active resolution. Please send Anton your save file and version.");1471	if (pLeague == NULL) return;14721473	// == Proposer Choices ==1474	ResolutionDecisionTypes eProposerDecision = GetProposerDecision()->GetType();1475	PlayerTypes eTargetPlayer = NO_PLAYER;1476	if (eProposerDecision == RESOLUTION_DECISION_ANY_MEMBER ||1477		eProposerDecision == RESOLUTION_DECISION_MAJOR_CIV_MEMBER ||1478		eProposerDecision == RESOLUTION_DECISION_OTHER_MAJOR_CIV_MEMBER)1479	{1480		eTargetPlayer = (PlayerTypes) GetProposerDecision()->GetDecision();1481	}1482	ResourceTypes eTargetLuxury = NO_RESOURCE;1483	if (eProposerDecision == RESOLUTION_DECISION_ANY_LUXURY_RESOURCE)1484	{1485		CvResourceInfo* pInfo = GC.getResourceInfo((ResourceTypes) GetProposerDecision()->GetDecision());1486		if (pInfo && pInfo->getResourceUsage() == RESOURCEUSAGE_LUXURY)1487		{1488			eTargetLuxury = (ResourceTypes) GetProposerDecision()->GetDecision();1489		}1490	}1491	ReligionTypes eTargetReligion = NO_RELIGION;1492	if (eProposerDecision == RESOLUTION_DECISION_RELIGION)1493	{1494		eTargetReligion = (ReligionTypes) GetProposerDecision()->GetDecision();1495	}1496	PolicyBranchTypes eTargetIdeology = NO_POLICY_BRANCH_TYPE;1497	if (eProposerDecision == RESOLUTION_DECISION_IDEOLOGY)1498	{1499		eTargetIdeology = (PolicyBranchTypes) GetProposerDecision()->GetDecision();1500	}15011502	// == Voter Choices ==1503	ResolutionDecisionTypes eVoterDecision = GetVoterDecision()->GetType();1504	PlayerTypes eVotedPlayer = NO_PLAYER;1505	if (eVoterDecision == RESOLUTION_DECISION_ANY_MEMBER ||1506		eVoterDecision == RESOLUTION_DECISION_MAJOR_CIV_MEMBER ||1507		eVoterDecision == RESOLUTION_DECISION_OTHER_MAJOR_CIV_MEMBER)1508	{1509		eVotedPlayer = (PlayerTypes) GetVoterDecision()->GetDecision();1510	}15111512	// == One Time Effects are not removed ==15131514	// == Ongoing Effects ==1515	if (GetEffects()->iGoldPerTurn != 0)1516	{1517		pPlayer->GetTreasury()->ChangeGoldPerTurnFromDiplomacy(-1 * GetEffects()->iGoldPerTurn);1518	}1519	if (GetEffects()->iResourceQuantity != 0)1520	{1521		CvAssertMsg(eTargetLuxury != NO_RESOURCE, "Subtracting NO_RESOURCE for a player. Please send Anton your save file and version.");1522		pPlayer->changeNumResourceTotal(eTargetLuxury, -1 * GetEffects()->iResourceQuantity);1523	}1524	if (GetEffects()->bEmbargoCityStates)1525	{1526		// Refresh trade routes1527	}1528	if (GetEffects()->bEmbargoPlayer)1529	{1530		CvAssertMsg(eTargetPlayer != NO_PLAYER, "Repealing an embargo on NO_PLAYER. Please send Anton your save file and version.");1531		// Refresh trade routes1532	}1533	if (GetEffects()->bNoResourceHappiness)1534	{1535		CvAssertMsg(eTargetLuxury != NO_RESOURCE, "Repealing a band on Happiness for NO_RESOURCE. Please send Anton your save file and version.");1536		// Refresh happiness1537	}1538	if (GetEffects()->iUnitMaintenanceGoldPercent != 0)1539	{1540		pPlayer->ChangeUnitGoldMaintenanceMod(-1 * GetEffects()->iUnitMaintenanceGoldPercent);1541	}1542	if (GetEffects()->iMemberDiscoveredTechMod != 0)1543	{1544		// Refresh research1545	}1546	if (GetEffects()->iCulturePerWonder != 0)1547	{1548		// Refresh yields1549	}1550	if (GetEffects()->iCulturePerNaturalWonder != 0)1551	{1552		// Refresh yields1553	}1554	if (GetEffects()->bNoTrainingNuclearWeapons)1555	{1556	}1557	if (GetEffects()->iVotesForFollowingReligion != 0)1558	{1559	}1560	if (GetEffects()->iHolyCityTourism != 0)1561	{1562		CvAssertMsg(eTargetReligion != NO_RELIGION, "No target religion when one was expected. Please send Anton your save file and version.");1563		/*1564		if (eTargetReligion != NO_RELIGION)1565		{1566			const CvReligion* pTargetReligion = GC.getGame().GetGameReligions()->GetReligion(eTargetReligion, ePlayer);1567			if (pTargetReligion != NULL)1568			{1569				CvPlot* pHolyCityPlot = GC.getMap().plot(pTargetReligion->m_iHolyCityX, pTargetReligion->m_iHolyCityY);1570				if (pHolyCityPlot != NULL && pHolyCityPlot->isCity())1571				{1572					CvCity* pHolyCity = pHolyCityPlot->getPlotCity();1573					if (pHolyCity != NULL && pHolyCity->getOwner() == ePlayer)1574					{1575						//antonjs: temp:1576						GET_PLAYER(ePlayer).GetTreasury()->ChangeGoldPerTurnFromDiplomacy(-1 * 100);1577					}1578				}1579			}1580		}1581		//antonjs: todo: OnHolyCityCaptured()1582		*/1583	}1584	if (GetEffects()->iReligionSpreadStrengthMod != 0)1585	{1586		CvAssertMsg(eTargetReligion != NO_RELIGION, "No target religion when one was expected. Please send Anton your save file and version.");1587		// Updated on CvGameReligions::DoTurn1588	}1589	if (GetEffects()->iVotesForFollowingIdeology != 0)1590	{1591	}1592	if (GetEffects()->iOtherIdeologyRebellionMod != 0)1593	{1594		CvAssertMsg(eTargetIdeology != NO_POLICY_BRANCH_TYPE, "No target ideology when one was expected. Please send Anton your save file and version.");1595		/*1596		if (eTargetIdeology != NO_POLICY_BRANCH_TYPE)1597		{1598			if (GET_PLAYER(ePlayer).GetPlayerPolicies()->GetLateGamePolicyTree() == eTargetIdeology)1599			{1600				//antonjs: temp:1601				GET_PLAYER(ePlayer).GetTreasury()->ChangeGoldPerTurnFromDiplomacy(-1 * 100);1602			}1603		}1604		//antonjs: todo: OnIdeologyChanged()1605		*/1606	}1607	if (GetEffects()->iArtsyGreatPersonRateMod != 0)1608	{1609	}1610	if (GetEffects()->iScienceyGreatPersonRateMod != 0)1611	{1612	}1613	if (GetEffects()->iGreatPersonTileImprovementCulture != 0)1614	{1615		// Loop through all Great Person tile improvements1616		for (int i = 0; i < GC.getNumImprovementInfos(); i++)1617		{1618			CvImprovementEntry* pInfo = GC.getImprovementInfo((ImprovementTypes)i);1619			if (pInfo != NULL && pInfo->IsCreatedByGreatPerson())1620			{1621					GET_PLAYER(ePlayer).changeImprovementYieldChange((ImprovementTypes)pInfo->GetID(), YIELD_CULTURE, -1 * GetEffects()->iGreatPersonTileImprovementCulture);1622			}1623		}1624		// Refresh yield1625	}1626	if (GetEffects()->iLandmarkCulture != 0)1627	{1628		CvImprovementEntry* pLandmarkInfo = GC.getImprovementInfo((ImprovementTypes)GC.getInfoTypeForString("IMPROVEMENT_LANDMARK"));1629		if (pLandmarkInfo != NULL)1630		{1631			GET_PLAYER(ePlayer).changeImprovementYieldChange((ImprovementTypes)pLandmarkInfo->GetID(), YIELD_CULTURE, -1 * GetEffects()->iLandmarkCulture);1632		}1633		// Refresh yield1634	}1635	1636	m_iTurnEnacted = -1;1637}

Calls

Called by