Add 'is allied' check to Merchant AI

Gazebo

Lord of the Community Patch
Supporter
Joined
Sep 26, 2010
Messages
18,400
Location
Little Rock
Hey all,
I'm looking into modifying the Merchant AI for CSD in order to enable the AI to actively seek out new city-state allies once it has achieved 'ally' status with a different city-state. Currently, the AI is designed to simply send a great merchant to the closest, most easily-accessible city-state (as the goal here is money- influence was just a side bonus). Is there a way to add a check to the .cpp file to get the AI to choose its city state target for both proximity and friendship/alliance status?

Here's the block of code that needs the addition. My skills in this area hover around 0%, so any and all assistance would be appreciated.

Thanks!
Gazebo
Spoiler :

Code:
bool CvPlayerAI::GreatMerchantWantsCash()
{
	// slewis - everybody wants cash . . .
	// slewis - . . . except Venice. Venice wants to buy city states, unless it already has enough cities, then it doesn't want city states.
	bool bIsVenice = GetPlayerTraits()->IsNoAnnexing();
	if (bIsVenice)
	{
		if (getNumCities() >= 4)
		{
			return true;
		}
		else
		{
			return false;
		}
	}

	return true;
}

CvPlot* CvPlayerAI::FindBestMerchantTargetPlot(CvUnit* pGreatMerchant, bool bOnlySafePaths)
{
	CvAssertMsg(pGreatMerchant, "pGreatMerchant is null");
	if(!pGreatMerchant)
	{
		return NULL;
	}

	int iBestTurnsToReach = MAX_INT;
	CvPlot* pBestTargetPlot = NULL;
	int iPathTurns;
	UnitHandle pMerchant = UnitHandle(pGreatMerchant);
	CvTeam& kTeam = GET_TEAM(getTeam());

	//bool bIsVenice = GetPlayerTraits()->IsNoAnnexing();
	//bool bWantsCash = GreatMerchantWantsCash();

	// Loop through each city state
	for(int iI = 0; iI < MAX_PLAYERS; iI++)
	{
		CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iI);
		if (!kPlayer.isMinorCiv())
		{
			continue;
		}

		// if I'm Venice, I don't want to send a Merchant of Venice to a buy a city that I have trade routes 
		// with because it's probably more valuable as a trade partner than as an owned entity
		//if (!bWantsCash)
		//{
		//	if (bIsVenice)
		//	{
		//		if (GetTrade()->IsConnectedToPlayer(kPlayer.GetID()))
		//		{
		//			continue;
		//		}
		//	}
		//}

		CvPlot* pCSPlot = kPlayer.getStartingPlot();
		if (!pCSPlot)
		{
			continue;
		}

		if (!pCSPlot->isRevealed(getTeam()))
		{
			continue;
		}

		// Is this a minor we are friendly with?
		bool bMinorCivApproachIsCorrect = (GetDiplomacyAI()->GetMinorCivApproach(kPlayer.GetID()) != MINOR_CIV_APPROACH_CONQUEST);
		bool bNotAtWar = !kTeam.isAtWar(kPlayer.getTeam());
		bool bNotPlanningAWar = GetDiplomacyAI()->GetWarGoal(kPlayer.GetID()) == NO_WAR_GOAL_TYPE;

		if(bMinorCivApproachIsCorrect && bNotAtWar && bNotPlanningAWar)
		{
			// Search all the plots adjacent to this city (since can't enter the minor city plot itself)
			for(int jJ = 0; jJ < NUM_DIRECTION_TYPES; jJ++)
			{
				CvPlot* pAdjacentPlot = plotDirection(pCSPlot->getX(), pCSPlot->getY(), ((DirectionTypes)jJ));
				if(pAdjacentPlot != NULL)
				{
					// Make sure this is still owned by the city state and is revealed to us and isn't a water tile
					//if(pAdjacentPlot->getOwner() == (PlayerTypes)iI && pAdjacentPlot->isRevealed(getTeam()) && !pAdjacentPlot->isWater())
					bool bRightOwner = (pAdjacentPlot->getOwner() == (PlayerTypes)iI);
					bool bIsRevealed = pAdjacentPlot->isRevealed(getTeam());
					if(bRightOwner && bIsRevealed)
					{
						iPathTurns = TurnsToReachTarget(pMerchant, pAdjacentPlot, true /*bReusePaths*/, !bOnlySafePaths/*bIgnoreUnits*/);
						if(iPathTurns < iBestTurnsToReach)
						{
							iBestTurnsToReach = iPathTurns;
							pBestTargetPlot = pAdjacentPlot;
						}
					}
				}
			}
		}
	}

	return pBestTargetPlot;
}
 
Try this.

Code:
CvPlot* CvPlayerAI::FindBestMerchantTargetPlot(CvUnit* pGreatMerchant, bool bOnlySafePaths)
{
	CvAssertMsg(pGreatMerchant, "pGreatMerchant is null");
	if(!pGreatMerchant)
	{
		return NULL;
	}

	int iBestTurnsToReach = MAX_INT;
	CvPlot* pBestTargetPlot = NULL;
	int iPathTurns;
	UnitHandle pMerchant = UnitHandle(pGreatMerchant);
	CvTeam& kTeam = GET_TEAM(getTeam());

	//bool bIsVenice = GetPlayerTraits()->IsNoAnnexing();
	//bool bWantsCash = GreatMerchantWantsCash();

	// Loop through each city state
	for(int iI = 0; iI < MAX_PLAYERS; iI++)
	{
		CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iI);
		if (!kPlayer.isMinorCiv())
		{
			continue;
		}

		// if I'm Venice, I don't want to send a Merchant of Venice to a buy a city that I have trade routes 
		// with because it's probably more valuable as a trade partner than as an owned entity
		//if (!bWantsCash)
		//{
		//	if (bIsVenice)
		//	{
		//		if (GetTrade()->IsConnectedToPlayer(kPlayer.GetID()))
		//		{
		//			continue;
		//		}
		//	}
		//}

		CvPlot* pCSPlot = kPlayer.getStartingPlot();
		if (!pCSPlot)
		{
			continue;
		}

		if (!pCSPlot->isRevealed(getTeam()))
		{
			continue;
		}

		// Putmalk: Don't consider targets that we're friendly with an our influence is pretty high (i.e. at least 15 influence over the Ally threshold)
		if (kPlayer.GetMinorCivAI()->IsAllies(GetID()))
		{
			// If our friendship is already 15 influence or higher than the allied threshold, don't send our merchant there
			if(kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetID()) >= (kPlayer.GetMinorCivAI()->GetAlliesThreshold() + 15))
			{
				continue;
			}
		}

		// Is this a minor we are friendly with?
		bool bMinorCivApproachIsCorrect = (GetDiplomacyAI()->GetMinorCivApproach(kPlayer.GetID()) != MINOR_CIV_APPROACH_CONQUEST);
		bool bNotAtWar = !kTeam.isAtWar(kPlayer.getTeam());
		bool bNotPlanningAWar = GetDiplomacyAI()->GetWarGoal(kPlayer.GetID()) == NO_WAR_GOAL_TYPE;

		if(bMinorCivApproachIsCorrect && bNotAtWar && bNotPlanningAWar)
		{
			// Search all the plots adjacent to this city (since can't enter the minor city plot itself)
			for(int jJ = 0; jJ < NUM_DIRECTION_TYPES; jJ++)
			{
				CvPlot* pAdjacentPlot = plotDirection(pCSPlot->getX(), pCSPlot->getY(), ((DirectionTypes)jJ));
				if(pAdjacentPlot != NULL)
				{
					// Make sure this is still owned by the city state and is revealed to us and isn't a water tile
					//if(pAdjacentPlot->getOwner() == (PlayerTypes)iI && pAdjacentPlot->isRevealed(getTeam()) && !pAdjacentPlot->isWater())
					bool bRightOwner = (pAdjacentPlot->getOwner() == (PlayerTypes)iI);
					bool bIsRevealed = pAdjacentPlot->isRevealed(getTeam());
					if(bRightOwner && bIsRevealed)
					{
						iPathTurns = TurnsToReachTarget(pMerchant, pAdjacentPlot, true /*bReusePaths*/, !bOnlySafePaths/*bIgnoreUnits*/);
						if(iPathTurns < iBestTurnsToReach)
						{
							iBestTurnsToReach = iPathTurns;
							pBestTargetPlot = pAdjacentPlot;
						}
					}
				}
			}
		}
	}

	return pBestTargetPlot;
}
 
Try this.

Code:
CvPlot* CvPlayerAI::FindBestMerchantTargetPlot(CvUnit* pGreatMerchant, bool bOnlySafePaths)
{
	CvAssertMsg(pGreatMerchant, "pGreatMerchant is null");
	if(!pGreatMerchant)
	{
		return NULL;
	}

	int iBestTurnsToReach = MAX_INT;
	CvPlot* pBestTargetPlot = NULL;
	int iPathTurns;
	UnitHandle pMerchant = UnitHandle(pGreatMerchant);
	CvTeam& kTeam = GET_TEAM(getTeam());

	//bool bIsVenice = GetPlayerTraits()->IsNoAnnexing();
	//bool bWantsCash = GreatMerchantWantsCash();

	// Loop through each city state
	for(int iI = 0; iI < MAX_PLAYERS; iI++)
	{
		CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iI);
		if (!kPlayer.isMinorCiv())
		{
			continue;
		}

		// if I'm Venice, I don't want to send a Merchant of Venice to a buy a city that I have trade routes 
		// with because it's probably more valuable as a trade partner than as an owned entity
		//if (!bWantsCash)
		//{
		//	if (bIsVenice)
		//	{
		//		if (GetTrade()->IsConnectedToPlayer(kPlayer.GetID()))
		//		{
		//			continue;
		//		}
		//	}
		//}

		CvPlot* pCSPlot = kPlayer.getStartingPlot();
		if (!pCSPlot)
		{
			continue;
		}

		if (!pCSPlot->isRevealed(getTeam()))
		{
			continue;
		}

		// Putmalk: Don't consider targets that we're friendly with an our influence is pretty high (i.e. at least 15 influence over the Ally threshold)
		if (kPlayer.GetMinorCivAI()->IsAllies(GetID()))
		{
			// If our friendship is already 15 influence or higher than the allied threshold, don't send our merchant there
			if(kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetID()) >= (kPlayer.GetMinorCivAI()->GetAlliesThreshold() + 15))
			{
				continue;
			}
		}

		// Is this a minor we are friendly with?
		bool bMinorCivApproachIsCorrect = (GetDiplomacyAI()->GetMinorCivApproach(kPlayer.GetID()) != MINOR_CIV_APPROACH_CONQUEST);
		bool bNotAtWar = !kTeam.isAtWar(kPlayer.getTeam());
		bool bNotPlanningAWar = GetDiplomacyAI()->GetWarGoal(kPlayer.GetID()) == NO_WAR_GOAL_TYPE;

		if(bMinorCivApproachIsCorrect && bNotAtWar && bNotPlanningAWar)
		{
			// Search all the plots adjacent to this city (since can't enter the minor city plot itself)
			for(int jJ = 0; jJ < NUM_DIRECTION_TYPES; jJ++)
			{
				CvPlot* pAdjacentPlot = plotDirection(pCSPlot->getX(), pCSPlot->getY(), ((DirectionTypes)jJ));
				if(pAdjacentPlot != NULL)
				{
					// Make sure this is still owned by the city state and is revealed to us and isn't a water tile
					//if(pAdjacentPlot->getOwner() == (PlayerTypes)iI && pAdjacentPlot->isRevealed(getTeam()) && !pAdjacentPlot->isWater())
					bool bRightOwner = (pAdjacentPlot->getOwner() == (PlayerTypes)iI);
					bool bIsRevealed = pAdjacentPlot->isRevealed(getTeam());
					if(bRightOwner && bIsRevealed)
					{
						iPathTurns = TurnsToReachTarget(pMerchant, pAdjacentPlot, true /*bReusePaths*/, !bOnlySafePaths/*bIgnoreUnits*/);
						if(iPathTurns < iBestTurnsToReach)
						{
							iBestTurnsToReach = iPathTurns;
							pBestTargetPlot = pAdjacentPlot;
						}
					}
				}
			}
		}
	}

	return pBestTargetPlot;
}


Excellent. I'll give this a shot tonight. Can I simply load the file this is a part of as part of the mod, or am I going to have to recompile the .dll in order to get this to work?

Edit: Nevermind, that was a foolish question. Of course I need to compile the DLL, as it is a DLL file.

Thanks again!
Gazebo
 
Brilliant! It works like a charm. This fixes a long-standing issue I've had with CSD, but haven't had the energy to tackle.

Credit where credit is due, Putmalk &#8211; I'll make sure to append your name to v7 of the mod.

Cheers,
Gazebo

Glad it works!

You may change that value as much as you'd like (i.e. raise the buffer to 90 influence by changing 15 to 30, etc.)
 
Glad it works!

You may change that value as much as you'd like (i.e. raise the buffer to 90 influence by changing 15 to 30, etc.)

Indeed – your addition is invaluable, yet it is also easily comprehensible for a C++ novice such as myself. I may bump it to 90 to give the AI some headroom. Thanks again.

G
 
Building upon this modification, I wonder if it is possible to add an AI check to make it look for un-allied city-states? Or rather, make it ignore allied city-states over a certain threshold? For example, if there are two city-states, one a neighbor and one behind it, and the first one is allied with a rival that has over 90 influence (or some high amount) whereas the second one has no ally, can the AI then be trained to go after the one further away?

This would minimize some of the more extreme influence wars I'm seeing on neighboring city-states, as the AI might decide to just abandon that city-state to a rival and move on to an un-allied city-state.

I'm going to do a bit of spelunking myself, however any assistance would be greatly appreciated.

Edit: I see a sample of code that could be useful here:

Code:
// if the minor is allied with someone else
					if (pMinorCivAI->GetAlly() != NO_PLAYER)
					{
						iValue += iFriendshipWithMinor;
					}

I also see this piece, which goes into a bit more detail on the deductive process of the AI:

Code:
iFriendshipWithMinor = pMinorCivAI->GetEffectiveFriendshipWithMajor(eID);

					// Loop through other players to see if we can pass them
					for(iOtherMajorLoop = 0; iOtherMajorLoop < MAX_MAJOR_CIVS; iOtherMajorLoop++)
					{
						eOtherMajor = (PlayerTypes) iOtherMajorLoop;

						// Player must be alive
						if(!GET_PLAYER(eOtherMajor).isAlive())
							continue;

						iOtherPlayerFriendshipWithMinor = pMinorCivAI->GetEffectiveFriendshipWithMajor(eOtherMajor);

						// Player must have friendship with this major
						if(iOtherPlayerFriendshipWithMinor <= 0)
							continue;

						// They must have more friendship with this guy than us
						if(iFriendshipWithMinor <= iOtherPlayerFriendshipWithMinor)
							continue;

						// Only care if we'll actually be Allies or better
						bMediumGiftAllies = iFriendshipWithMinor + iMediumGiftFriendship >= pMinorCivAI->GetAlliesThreshold();
						bSmallGiftAllies = iFriendshipWithMinor + iSmallGiftFriendship >= pMinorCivAI->GetAlliesThreshold();

						// If we can pass them with a small gift, great
						if(bSmallGiftAllies && iOtherPlayerFriendshipWithMinor - iFriendshipWithMinor < iSmallGiftFriendship)
						{
							iValue += /*15*/ GC.getMC_SMALL_GIFT_WEIGHT_PASS_OTHER_PLAYER();
							sGiftInfo.bQuickBoost = true;
							sGiftInfo.eMajorRival = eOtherMajor;
						}
						// If a medium gift passes them up, that's good too
						else if(bMediumGiftAllies && iOtherPlayerFriendshipWithMinor - iFriendshipWithMinor < iMediumGiftFriendship)
						{
							iValue += /*10*/ GC.getMC_GIFT_WEIGHT_PASS_OTHER_PLAYER();
							sGiftInfo.eMajorRival = eOtherMajor;
						}
						// We're behind and we can't catch up right now, so zero-out the value
						else
							iValue = 0;
					}
 
Right. Try this. Untested.

Code:
// Putmalk: Don't consider targets that we're friendly with an our influence is pretty high (i.e. at least 15 influence over the Ally threshold)
		if (kPlayer.GetMinorCivAI()->IsAllies(GetID()))
		{
			// If our friendship is already 15 influence or higher than the allied threshold, don't send our merchant there
			if(kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetID()) >= (kPlayer.GetMinorCivAI()->GetAlliesThreshold() + 15))
			{
				continue;
			}
		}

		// Putmalk: Don't consider targets that have an ally with another major civ that our influence bonus wouldn't be enough to make some impact
		PlayerTypes eMajor;
		for(int iI = 0; iI < MAX_MAJOR_CIVS; iI++)
		{
			eMajor = (PlayerTypes) iI;
			// don't care about us or teammates
			if(GET_PLAYER(eMajor).getTeam() != getTeam())
			{
				// Only care if they are allies
				if(kPlayer.GetMinorCivAI()->IsAllies(eMajor))
				{
					// If their friendship after a trade mission is greater than the influence we would get from a gold gift of 250, then don't care
					// i.e. they have 120 influence, we have 40, and a 250 gold gift gives 15
					// 120 > (30 + 40 + 15)
					if(kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(eMajor) >		// Rival influence
						(pGreatMerchant->getTradeInfluence(kPlayer.getCapitalCity()->plot()) +	// 30 influence, Venice: 60 influence
						kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetID()) +		// Our current influence
						kPlayer.GetMinorCivAI()->GetFriendshipFromGoldGift(GetID(), GC.getMINOR_GOLD_GIFT_SMALL()))) // What we would get from a 250 gold gift to this player
					{
						continue;
					}
				}
			}
		}
 
Great, ill give this a shot. CSD disables gold gifts by default- would it be possible to cut out the last bit regarding gold gifts and still have the correct logic?

How does it disable it? If it changes the MINOR_GOLD_GIFT_SMALL global to 0 then the logic will work fine since the gold gift influence would return 0.
 
The initial logic still works (ignore a C-S if over 75 influence), however the new addition seems to be ignored by the AI. A city-state with 250 influence for civ A was still being sent diplomatic units by civs with zero influence, even though there was a neighboring city state with no ally. I'm not sure if it is a formatting issue or a logic issue. One thing I noticed is that there seems to be a discrepancy in open v. closed parentheses in this section:

Code:
if(kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(eMajor) >		// Rival influence
						(pGreatMerchant->getTradeInfluence(kPlayer.getCapitalCity()->plot()) +	// 30 influence, Venice: 60 influence
						kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetID()) +		// Our current influence
						kPlayer.GetMinorCivAI()->GetFriendshipFromGoldGift(GetID(), GC.getMINOR_GOLD_GIFT_SMALL()))) // What we would get from a 250 gold gift to this player
					{
						continue;

Perhaps I am wrong- it has been a long day. Thanks again for your help.
G
 
(if there was a discrepancy it wouldn't compile)

Either way, I double checked the logic and the syntax...everything seems fine???

kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(eMajor) this should return the current influence of eMajor
pGreatMerchant->getTradeInfluence(kPlayer.getCapitalCity()->plot()) this should return how much gold would we get if we conducted a trade mission in the minor civ's capital
kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetID()) this should return how much influence we have already
kPlayer.GetMinorCivAI()->GetFriendshipFromGoldGift(GetID(), GC.getMINOR_GOLD_GIFT_SMALL()) this should return how much influence we would get if we gave a small amount (should be 0)

Exactly what is the value of MINOR_GOLD_GIFT_SMALL? in the mod?
 
(if there was a discrepancy it wouldn't compile)

Either way, I double checked the logic and the syntax...everything seems fine???

kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(eMajor) this should return the current influence of eMajor
pGreatMerchant->getTradeInfluence(kPlayer.getCapitalCity()->plot()) this should return how much gold would we get if we conducted a trade mission in the minor civ's capital
kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetID()) this should return how much influence we have already
kPlayer.GetMinorCivAI()->GetFriendshipFromGoldGift(GetID(), GC.getMINOR_GOLD_GIFT_SMALL()) this should return how much influence we would get if we gave a small amount (should be 0)

Exactly what is the value of MINOR_GOLD_GIFT_SMALL? in the mod?

I made the value of gold gifts zero via SQL to keep from having to modify the AI .

this should return how much gold would we get
do you mean influence?
 
do you mean influence?

yeah, sorry. :P

Actually it wouldn't return 0 if gold is 0, it would return 5 (I don't think that's enough to make a difference).
 
yeah, sorry. :P

No worries, I assumed you did. It may be that the AI is considering this factor, but perhaps the proximity element is playing a bigger role (i.e. if the path to a city-state further away is not considered 'safe' it may eliminate it from the possible list). The AI is infinitely more competent now than it was, and is showing a bit more logic regarding choices of city-states than before. If you come up with anything else regarding this let me know.

G
 
No worries, I assumed you did. It may be that the AI is considering this factor, but perhaps the proximity element is playing a bigger role (i.e. if the path to a city-state further away is not considered 'safe' it may eliminate it from the possible list). The AI is infinitely more competent now than it was, and is showing a bit more logic regarding choices of city-states than before. If you come up with anything else regarding this let me know.

G

Actually it IS a logic error. Standby for edit.

edit: how's this?
Code:
if(kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(eMajor) >		// Rival influence
	(pGreatMerchant->getTradeInfluence(kPlayer.getCapitalCity()->plot()) +	// 30 influence, Venice: 60 influence
	kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetID()) +		// Our current influence
	kPlayer.GetMinorCivAI()->GetFriendshipFromGoldGift(GetID(), GC.getMINOR_GOLD_GIFT_SMALL())
	)
	) // What we would get from a 250 gold gift to this player
{
	continue;
}

// Putmalk: Don't consider targets that have an ally with another major civ that our influence bonus wouldn't be enough to make some impact
PlayerTypes eMajor;
bool bHasHighAlly = false;
for(int iI = 0; iI < MAX_MAJOR_CIVS; iI++)
{
	eMajor = (PlayerTypes) iI;
	// don't care about us or teammates
	if(GET_PLAYER(eMajor).getTeam() != getTeam())
	{
		// Only care if they are allies
		if(kPlayer.GetMinorCivAI()->IsAllies(eMajor))
		{
			// If their friendship after a trade mission is greater than the influence we would get from a gold gift of 250, then don't care
			// i.e. they have 120 influence, we have 40, and a 250 gold gift gives 15
			// 120 > (30 + 40 + 15)
			if(kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(eMajor) >		// Rival influence
				(pGreatMerchant->getTradeInfluence(kPlayer.getCapitalCity()->plot()) +	// 30 influence, Venice: 60 influence
				kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetID()) +		// Our current influence
				kPlayer.GetMinorCivAI()->GetFriendshipFromGoldGift(GetID(), GC.getMINOR_GOLD_GIFT_SMALL()))) // What we would get from a 250 gold gift to this player
			{
				// If we got this far no need to evaluate this minor civ anymore
				bHasHighAlly = true;
				break;
			}
		}
	}
}

if(bHasHighAlly)
	continue;
 
Putmalk,

The top section of the edited bit you sent me is in there twice. Is that correct? I'm testing it now.

This is the part I'm referring to:
if(kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(eMajor) > // Rival influence
(pGreatMerchant->getTradeInfluence(kPlayer.getCapitalCity()->plot()) + // 30 influence, Venice: 60 influence
kPlayer.GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetID()) + // Our current influence
kPlayer.GetMinorCivAI()->GetFriendshipFromGoldGift(GetID(), GC.getMINOR_GOLD_GIFT_SMALL())
)
) // What we would get from a 250 gold gift to this player

Edit: It actually won't compile with that bit in, so I've removed it from the first part (the part beneath your commentary).

Edit 2: It seems to work, though testing is a bit more difficult because of the increased number of variables. Civs with neighbor minors that are heavily allied with another player are moving on to other city-states. I'll let you know more as I test it more.
 
Putmalk,

The top section of the edited bit you sent me is in there twice. Is that correct? I'm testing it now.

This is the part I'm referring to:

Edit: It actually won't compile with that bit in, so I've removed it from the first part (the part beneath your commentary).

Edit 2: It seems to work, though testing is a bit more difficult because of the increased number of variables. Civs with neighbor minors that are heavily allied with another player are moving on to other city-states. I'll let you know more as I test it more.

Yeah, sure, I probably just glanced over it, thinking it was the initial section (from the first drop of code I put in). It's what happens when you mess around in programmer's notepad without reading it fully. >.<
 
Back
Top Bottom