Advanced Diplomacy 2

I need a little help here. I need some SDK code for my Exchange POW trade item. I'm not good with the syntax, so everything I tried had an error.

Spoiler :
Code:
bool CvTeam::canExchangeHostages(TeamTypes eTeam) const
{
	for (int iTeam = 0; iTeam < MAX_CIV_TEAMS; ++iTeam)
	{
		if (iTeam != getID() && iTeam != eTeam)
		{
			CvTeam& kLoopTeam = GET_TEAM((TeamTypes)iTeam);
			if (kLoopTeam.isPermanentWarPeace(eTeam) != kLoopTeam.isPermanentWarPeace(getID()))
			{
				return false;
			}

			if (isPermanentWarPeace((TeamTypes)iTeam) != GET_TEAM(eTeam).isPermanentWarPeace((TeamTypes)iTeam))
			{
				return false;
			}
		}
	}

	return true;
}
// edead: end

I need some code here where you can only exchange hostages if both leaders MEMORY_DECLARED_WAR > 0. It'd prob be something similar to this
if (GET_PLAYER((PlayerTypes)iI).AI_getMemoryCount((PlayerTypes)iJ, MEMORY_WARMONGER > 1));
 
Well, I tried another addition to CvPlayer.cpp. However, in game, it isn't available when you have a declared war memory. Plus, I get a failed to initialize eTeam:
Spoiler :

Code:
	case TRADE_NON_AGGRESSION:
		for (iI = 0; iI < MAX_PLAYERS; iI++)
		{
			if (GC.getGameINLINE().isOption(GAMEOPTION_ADVANCED_DIPLOMACY))
			{
				if (getTeam() != GET_PLAYER(eWhoTo).getTeam())
				{
					if (!atWar(getTeam(), GET_PLAYER(eWhoTo).getTeam()))
					{	
						if (!(GET_TEAM(getTeam()).isHasNonAgression(GET_PLAYER(eWhoTo).getTeam())))
						{
							if (GET_TEAM(getTeam()).canNonAgression(GET_PLAYER(eWhoTo).getTeam()))
							{
								if (getCapitalCity() != NULL && GET_PLAYER(eWhoTo).getCapitalCity() != NULL)
								{
									TeamTypes eTeam;
					
									if ((GET_TEAM(getTeam()).AI_getMemoryCount(eTeam, MEMORY_DECLARED_WAR) > 0) && (GET_TEAM(GET_PLAYER(eWhoTo).getTeam()).AI_getMemoryCount(eTeam, MEMORY_DECLARED_WAR) > 0))
									{
										return true;
									}
 
I've almost finished adding things to my new version, but I'm running into errors when I start to add trade counters.

I start getting failed to cpmpress game data and then CTD upon map loading. I hope somebody can give me some advice after looking at the attached file. Thanks.
 
I've added tons of things. They are very nearly ready. However, the attitude messages when hovering over leaders do not show up for the new trades. Not sure why. In addition, the Open Borders attitude message has also disapeared.

I'll post a new revision later today prob so someone can hopefully take a look. Thanks.
 
OK Here is my lastest revision. Can't figure out what is wrong, but the attitude strings such as +1 Open Borders do not show up. Please take a look and let me know. Roamty or Keldeth?
 

Attachments

  • Advanced Diplomacy.7z
    1.5 MB · Views: 96
Playing the Original BTS game made me realize that the attitude messages don't always display. Not sure why though? Any thoughts.

However, I noticed the defensive pact attitude string always displays whenever you get it. Does anybody have any preferences or thoughts? Everything seems to work. Almost Done.
 
When I tried my WorldBuilder, I already saw that.
Some memories need > 1 instance before they start showing up with attitude messages.
I guess 1 instance of it is not enough.

Some like nukes or declare war, once is enough.
 
I guess the memories work the same as some of the attitude values then?

I've finished the new version mostly. Just need to comment stuff properly now. I added new attitude thresholds for the new trades including for trading contacts. In addition, I've included several additions such as AI, tech enables some of the trades, etc. I'll post the changelog with the new version.

Future plans may include adding some features from Total War such as Active Senate, some memories, & Condemn Civics. I might also ad tech diffusion with modifiers for Free Trade & Right of Passage, etc.
 
Uploaded the newest version:

-----Version 2.3-----
-POW Exchange lasts 5 turns and improves Diplomatic relations
-Negative Memories for cancelling Non Aggression Pact & Free Trade Agreements
-Negative Memory if don't return someone else's city from DPII
-Memory if you work a plot that is owned by another Civ
-Afforess isAlive checks for UN Votes
-Attitude Thresholds for Free Trade Agreement, NonAggression, POW Exchange, Right Of Passage, Contact trades
-AI Tech Values for new enabled trade techs
-Attitude Changes for Right of Passage, Embassy, Free Trade, & Non Aggression Pact
-MIssionary value adjusted for limited borders/open borders
-Refusing to go to war against someone gives you a memoery attitude boost to that part
-Defensive Pact Break Message by edead
-More Gold From Free Trade Agreement Trade Missions
-less likely to declare war if non agression or pow trade
-Refuseattitudethresholds moved from SDK to XML for easy modding
-removed uneeded sdk code of victory weights
-Improved Denial Checks
-Improved AI TradeValues
 
stolenrays,

I have noticed that with version 2.3 when you try to load a saved game it crashes. Usually this is due to the read/write in CvInfos not matching up, but I looked over the source and it looks correct. I wanted to bring this to your attention.
 
Top Bottom