1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Advanced Diplomacy 2

Discussion in 'Civ4 - Mod Components' started by stolenrays, Dec 2, 2011.

  1. stolenrays

    stolenrays Deity

    Aug 2, 2009
    Advanced Diplomacy Mod v2.6

    This is Advanced Diplomacy 2.6. I isolated the updated code from ROM:AND and added it to Afforess's Advanced Diplomacy. I also fixed a few text bugs. Much of the text here is pulled from Affores's original thread.

    New Diplomacy Trades include embassies, right of passage, workers, military units, corporation HQ, General Secretary Vote.

    The AI:
    The AI will make trades for all different options, except for Corporations, (I am unsure there is ever a situation where the AI should sell or buy a corporation HQ); however the AI will properly value a Corporation HQ if a human offers to buy or sell one. There are several new trades for old items in Advanced Diplomacy as well. The AI will use techs and gold to encourage other AI's to declare war or trigger embargo's on their enemies. The AI will also sue for peace for it's friends.

    To Modders:
    There are 2 new XML tags controlling which workers and units can be traded, as well as 2 new XML tags for when Embassies and Right of Passages are unlocked. There are also 4 new XML tags for Leaders, for attitude trading thresholds for the new trades. They are all fairly well named and self explanatory. If you have any questions, please ask.

    This is pulled from the large codebase in A New Dawn, there may be bugs from mis-merged or forgotten code. If you find a bug, report it here, and I'll do my best to fix it.

    A Custom Game Option allows you to turn the mod on/off from the Custom Game Menu as requested. The Mod includes the Changed C++ files plus a working mod. Enjoy.

    -----Game Play-----
    Trading Embassies
    -Embassies are a vital agreement that must be made before Open Borders or any form of alliance can be made with any other civilizations.
    -Improves diplomatic relations (worsens if ambassador is recalled)
    -Can see inside their capital.
    -Espionage missions cost less.

    Trading Free Trade Agreement
    -Increases trade revenue.
    -Increases Gold from Trade Missions (+50%)
    -Decreases the cost of espionage.
    -Increases the spread of corporations.
    -May anger rivals
    -enabled via Banking Tech
    Negative Memory for cancelling Free Trade Agreements

    Trading Right of Passage
    -Rights of Passage are a limited form of Open Borders. They only allow non-combatants and trade through the borders.
    -enabled via The Wheel Tech
    -Cancelled if trading Open Borders because Open Borders includes this.

    Trading Contact
    -Players can sell contact with other civilizations, if they have not met the third party.

    Trading Workers
    -Players can buy and sell workers on the market.

    Trading Military Units
    -Siege machinery can be bought and sold to other players.

    Trading Corporation HQ's
    -Players can sell and buy the headquarter of corporations.

    General Secretary Vote
    -Once the UN is established, a pledge of the Gen Secretary Vote can be requested and given.

    Trading Non-Aggression Pact
    -Increases the attitude toward other civ.
    -enabled via Alphabet Tech
    less likely to declare war if non aggression
    -Negative Memory for cancelling Non Aggression Pact

    POW Exchange
    POW Exchange lasts 5 turns and improves Diplomatic relations
    -enabled via Nationalism Tech
    -Cannot be cancelled
    -less likely to declare war if pow trade

    Trading Prepare For War
    -The other civ makes preparations for War and then declares War.
    -A Custom Game Option turns the Mod on/off

    Nuclear Dissuasion
    -Custom GameOption
    -The possession of nuclear weapons reduces the chances that your rivals will consider a conflict against you.Depending on the state of your relationships, the number of atomic bombs they have and you have.

    Favorite Wonder
    -Positive attitude towards civs with your favorite wonder.

    Active Senate
    -An Active Senate Overrides Wars Unless Valid War Pretexts Exist.
    -Enabled via a specific civic
    -it may invalidate your declarations of war and/or force you to sign a peace treaty with your enemies.
    -decisions of the Senate depend in particular on the scale of the conflict, either potential or actual, and its real interest.
    -Valid Pretexts for war when an opponent make unpleasant acts to your nation, by a embargo, a negative vote, (any negative memory) an espionage mission, etc. ...,
    -Any war pretext is valid for one turn and throughout the conflict in case of a declaration of war.

    Shared Civic Attitude
    -Positive attitude for sharing civics with another civ

    Shared Enemy Attitude
    +2 attitude toward a Civ with an enemy in common

    Shared Friend Attitude
    +2 attitude toward a Civ with a common friend

    Closest Ally Text
    -Similar to Worst Enemy in reverse though

    New UN Votes
    -Prisoner Rights-Noncombatants Captured during War are Returned Upon Peace
    -Map Exchange-One time Worldwide Exchange of Maps between voting members.
    -Military Medicine Rights- +30% Heal Rate for Soldiers
    -Victim Rights-Refugees Return Upon City Liberation
    -No City Razing-No City Razing Upon Conquest
    -No Capital Punishment-+1:health: in All Cities
    -Culture Needs Empty Radius-Fixed Borders - Culture Expansion Requires Empty Radius
    -Barbarian Peace-Permanent Peace with Barbarians
    -Pacifism-Voting Exclusion Penalty for Aggressive Wars
    -Condemn Civics-condemnation of a civic. Choosing a condemned civic generates a diplomatic penalty from the voting members and exclude the civilization to the clan of members which can vote.
    -Ban Resources-UN can propose a resolution to make a resource disappear/reappear. In passing on a plot which have the prohibited resource, you can see a red note telling you that there were at that place, a source of this resource, now banned. Of course, this kind of resolution can be "un-voted" in which case the resource re-emerged on the map and can be further exploited. The interest of this type of resolution is clearly strategic, especially in a world where the players are not too inter-dependent. Custom Game Option
    -Prohibited Weapons-Building prohibited weapons generates a diplomatic penalty from the voting members and exclude the civilization to the clan of members which can vote. All are automatically destroyed if you vote for the resolution.

    New thresholds, contact values, and memory decays for Leaderheads.
    Memories for recalling ambassadors, warmongering, making peace, backstabing, and backstabbing friends, working a neighbor's plot, keeping someone else's city, causing pollution.
    Diplomacy Request
    -Players may request the AI to cease negotiations and resume at a time of their choosing.

    -----Note to Modmakers-----
    In the SDK files there is Advanced Diplomacy > and
    Advanced Diplomacy End in all of the places that there are changes to the original files.

    For Later
    -New trades enabled in worldbuilder (Limited Borders, Embassy)
    -Foreign Adviser gets new trade additions
    -Show hidden attitude mod
    -war demand is a tricky situation. The refusal attitude adjustment would help as you suggested.
    -add things top layerAi such as corporation trade and Secretary General Vote
    -Spy Mission Create a War Pretext
    -Fix prisoner rights UN Vote
    -Memory for violating airspace if no Open Borders
    -Update Concept info
    -City FLip penalty back in?
    -Cease Relations from AND2
    -War Reparations widget for Currency Tech
    -Fix Establish Embassy text

    -------Version History---------
    Spoiler :
    Version 2.8
    -all new memories, war pretexts have a GameOption
    -Removed duplicate contacted code in playerai.cpp
    -Added cancelled non aggression memory
    -Removed memory cap for worked plot
    -Added missing memories to python
    -Embassy node removed
    -GameOption for fav wonder and Shared Civic Attitude
    -make peace option
    -modifiers for embassy and Free Trade Agreement from AND2 in Gametext
    -War Reparations Trade from AND2
    -Fix for color of closest ally text
    -AND additions (embassy visibility fix, AI less likely to ask for help if they don't like you)

    Version 2.7
    -Mutual enemy attitude
    -Closest Ally of text
    -Mutual friends bonus attitude change

    Version 2.6
    -Add in Gameoption to Backstab, new votes
    -Added in missing can trade workers globaldefines
    -rearranged order of trades
    -Added Backstab memory to trigger for friends and teammates

    Version 2.51
    -Open Borders requires Right of Passage for bug fix
    -Bug Fixed where trading right of passage and open borders at same time did not cancel right of passage
    -Free Trade Agreement requires Open Borders
    -Typos for Condemn civic and capital punishment fixed

    Version 2.5
    -Condemn Civics
    -C2C Cvplayer has advanced diplomacy for new has embassy visibility fix
    -Obsolete Bonuses (Fur, Whales, Coal)

    Version 2.4
    -Active Senate from Total War (Denial, Senate Veto, War Pretext, enabled by civics)
    -New sound for senate action
    -New Concept Info
    -UN Votes from Total War (Prisoner Rights, Military Medicine Rights, Victim Rights, No City Razing, No Capital Punishment, Culture Needs Empty Radius, Barbarian Peace).
    -GameOption for new trades added
    -Denial You advanced
    -Denial We need it much
    -Condemn Special Units
    -Nuclear Dissuasion from Total War
    -Shared Civic Attitude from FFH2 (CivicInfos.xml tag-iShareAttitudeMod)
    -AI for Fav Wonder/Share Civic from C2C
    -Favorite Wonder from FFH2
    -Punctuation fixes for memories/attitudes
    -Active Senate GameOption
    -Penalty for aggressive wars.
    -Checkbox for Nuclear Dissuasion
    -Fix for Adv Diplomacy 2.3

    B]Version 2.3[/B]
    -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 memory 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
    -Refuseattitude thresholds moved from SDK to XML for easy modding
    -removed unneeded sdk code of victory weights
    -Improved Denial Checks
    -Improved AI TradeValues
    -Embassy/ enabled via ALphabet Tech
    -POW's enabled via Nationalism Tech
    -Rt of Passage enabled via The Wheel Tech
    -Non-Aggression Pacts enabled via Alphabet Tech
    -Free Trade Agreements enabled via Banking Tech

    Version 2.2
    -Added Koshling Denial Check
    -Added Techs are not worth more than gold
    -Removed remaining Pledge vote Code
    -Free trade Mod
    -Free Trade Agreement Espionage Mission Modifier
    -GlobalDenies-Remember War Ally Turns, Embassy Spy Mod
    -Merged New Diplomacy Option Mod (Do not Bother us)
    -Merged Non-Binding Non-Agression Pact (Xchange Hostages) from Edead's Sengoku MOD
    -Free Trade Mod GlobalDefines for Trade Missions (+50% Gold)
    -Xchange POW from Sengoku (Only after a ceasefire or a if has a mutual MEMORY_DECLARED_WAR-for later?
    -Improved DLL Commenting
    -Added many C2C Diplomacy coding tweaks

    Version 2.1
    -Added Roamty's SDK/XML Fixes
    -Removed Pledge Vote Code
    -Added Ripple's SDK fixes

    Version 2.0
    Added Free Trade Agreement
    Added Pledge General Secretary Vote
    Merged New diplomacy request Mod (Cease bothering us)

    Version 1.05
    Afforess's Original Advanced Diplomacy

    Afforess Created the original Advanced Diplomacy and after working with Dom Pedro II's original code from Test of Time.


    Attached Files:

  2. Cybah

    Cybah Emperor

    Jun 22, 2007
    What does Free Trade Agreement mean? In 1.05 you need Right of Passage for trade routes.
  3. stolenrays

    stolenrays Deity

    Aug 2, 2009
    -Increases trade revenue.
    -Decreases the cost of espionage.
    -Increases the spread of corporations.
    -May anger rivals
  4. Cruel

    Cruel King

    Jun 22, 2005
    São Paulo, Brazil
  5. mwonch

    mwonch Chieftain

    Mar 9, 2006
    I'm trying to add the Advanced Diplomacy 2 component to RevolutionDCM. There were previous errors due to duplication of code (mainly with Afforess' Ruthless AI), which were easily resolved. However, I can't figure this one out.

    The below Spoiler Tag contains the errors that I cannot resolve. I'm not a coder, so please respond as if to a 5 year old. :)

    Spoiler :

    CvPlayer.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvLeaderHeadInfo::getSecretaryGeneralVoteRefuseAtt itudeThreshold(void)const " (?getSecretaryGeneralVoteRefuseAttitudeThreshold@C vLeaderHeadInfo@@QBEHXZ) referenced in function "public: enum DenialTypes __thiscall CvPlayer::AI_secretaryGeneralTrade(enum VoteSourceTypes,enum PlayerTypes)const " (?AI_secretaryGeneralTrade@CvPlayer@@QBE?AW4Denial Types@@W4VoteSourceTypes@@W4PlayerTypes@@@Z)

    CvPlayer.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvLeaderHeadInfo::getWorkerRefuseAttitudeThreshold (void)const " (?getWorkerRefuseAttitudeThreshold@CvLeaderHeadInf o@@QBEHXZ) referenced in function "public: enum DenialTypes __thiscall CvPlayer::AI_workerTrade(class CvUnit *,enum PlayerTypes)const " (?AI_workerTrade@CvPlayer@@QBE?AW4DenialTypes@@PAV CvUnit@@W4PlayerTypes@@@Z)

    CvPlayer.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvLeaderHeadInfo::getMilitaryUnitRefuseAttitudeThr eshold(void)const " (?getMilitaryUnitRefuseAttitudeThreshold@CvLeaderH eadInfo@@QBEHXZ) referenced in function "public: enum DenialTypes __thiscall CvPlayer::AI_militaryUnitTrade(class CvUnit *,enum PlayerTypes)const " (?AI_militaryUnitTrade@CvPlayer@@QBE?AW4DenialType s@@PAVCvUnit@@W4PlayerTypes@@@Z)

    CvPlayer.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvLeaderHeadInfo::getCorporationRefuseAttitudeThre shold(void)const " (?getCorporationRefuseAttitudeThreshold@CvLeaderHe adInfo@@QBEHXZ) referenced in function "public: enum DenialTypes __thiscall CvPlayer::AI_corporationTrade(enum CorporationTypes,enum PlayerTypes)const " (?AI_corporationTrade@CvPlayer@@QBE?AW4DenialTypes @@W4CorporationTypes@@W4PlayerTypes@@@Z)

    CvTeamAI.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvLeaderHeadInfo::getEmbassyRefuseAttitudeThreshol d(void)const " (?getEmbassyRefuseAttitudeThreshold@CvLeaderHeadIn fo@@QBEHXZ) referenced in function "public: enum DenialTypes __thiscall CvTeamAI::AI_embassyTrade(enum TeamTypes)const " (?AI_embassyTrade@CvTeamAI@@QBE?AW4DenialTypes@@W4 TeamTypes@@@Z)

    These are the only errors I'm getting, and they're not allowing the DLL to successfully compile.

    I assume the files I'm supposed to look at are CvTeamAI.cpp and CvPlayer.cpp. I can find these lines but have no idea what to do. If necessary, I can easily attach the source files to a later reply, but I think if I have proper guidance that may not be necessary.

    Thanks in advance!

  6. stolenrays

    stolenrays Deity

    Aug 2, 2009
    I'll take a look at the source code again. I tested out the compililing before I updated it recently. One thing I would do is recheck and search for all the Advanced Diplomacy tags in the files. Make sure you merged them all.
  7. mwonch

    mwonch Chieftain

    Mar 9, 2006
    Thank you for the quick response!

    Everything was carefully added in and double-checked. Took two days, since some cpp files didn't even come close to matching one another (due to other previous merges). Nothing is missing from the source code. I did NOT recheck the py/xml entries. I have no idea if the obj files created while compiling the DLL actually check the XML and/or py files. If this is the case, please let me know and I'll double-check those, too.
  8. stolenrays

    stolenrays Deity

    Aug 2, 2009
    Unresolved externals mean that there is a code string missing somewhere. A new dawn merged Advanced Diplomacy and RevDCM. Maybe you could cross checkthose few files to see what is missing. I'm pretty sure your MS toolkit folder is in the wrong place or maybe the makefile is searching in the wrong place C:\Dev\Microsoft Visual C++ Toolkit 2003\bin\cl.ex
  9. mwonch

    mwonch Chieftain

    Mar 9, 2006
    The MS Toolkit call is fine. Until now, every DLL correctly compiled. So that ain't it.

    I also rechecked the files in question (I'm assuming they'd only be CVTeamAI.cpp and CvPlayer.cpp (I also rechecked the .h files just for kicks). There are no differences (that I can spot) in the newly added code...or in the older code. If there are missing lines of code, they are either NOT in those above-named files or I've reached the limit of what I can see and do.

    Were you able to spot anything?

  10. stolenrays

    stolenrays Deity

    Aug 2, 2009
  11. mwonch

    mwonch Chieftain

    Mar 9, 2006
    I'm trying to do that, but the problem is that WinMerge keeps getting hung up and crashing or forcing a shut-down via Task Manager. As a result, I think, whenever I open CvInfos.cpp to re-add the Adv Diplo 2 code, it shows ONE difference between the two very different files (meaning, the program outlines BOTH totally as if they are not the same file name...which they are). This may be how and why I'm missing some code for this merger.

    In order to do this right, I'll need another program that does the same thing as WinMerge, only made to work with 64-bit as well as 32. I have a 64-bit machine, and WInmerge states plainly that they have no plans to make such a version.

    Do you know of another program like WInMerge that I can grab and use? I don;t care if it costs, as long as it works without freezing or crashing...
  12. mwonch

    mwonch Chieftain

    Mar 9, 2006
    NVM the new program request. I found one that works a little better. I'll start over with adding Adv Diplomacy 2 and let you know the results. If I'm right, a change in program should help resolve these issues by catching what I may not have with WinMerge. I hope...
  13. Cruel

    Cruel King

    Jun 22, 2005
    São Paulo, Brazil
    What is the name of the new program?
  14. stolenrays

    stolenrays Deity

    Aug 2, 2009
  15. Cruel

    Cruel King

    Jun 22, 2005
    São Paulo, Brazil
    I use notepad++ too.
  16. Tholal

    Tholal Emperor

    May 19, 2009
    I recommend Beyond Compare. You can download a 30-day trial version.
  17. mwonch

    mwonch Chieftain

    Mar 9, 2006
    And...that's the one I picked! It's a little more advanced but not bad at all.
  18. mwonch

    mwonch Chieftain

    Mar 9, 2006
    For single page edits, I use either Notepad++ or TextPad. Both are pretty good, especially with maintaining specific formatting. I don't recall Notepad++ having the ability to compare and merge. Please correct me if I'm wrong...

    My new go-to program for merging is (now) BeyondCompare.
  19. mwonch

    mwonch Chieftain

    Mar 9, 2006
    Okay, after much aggravation and more than a few curse words, I've finally successfully compiled the new DLL with Advanced Diplomacy 2. Gee, and it only took 4 days! *thumbs up* Tell ya what, though...it was fun (overall). Perhaps I should learn how to code.

    There were a few places where the code was either duplicated or misplaced, but that is likely due to my own placements due to the other mods already active in many of these files. I will say, however, that anyone who merged Afforess' mod component Ruthless AI will find at least twice that the code is indeed duplicated (causing "already has a body" errors). So, I advise that anyone having the Ruthless AI modcom to be very careful when merging this one into the same set of files.

    The aforementioned misplacement MAY have been my doing, but since the errors about illegal breaks and such were NOT encompassed within mod tags probably not. As such, also be aware that there may be an extra } before an else command (not exactly sure which one, right now). If anyone gets the error about an illegal 'break' without a corresponding 'if' (and whatnot), simply go to the first error. if you see two '}' symbols before an ELSE statement, delete one of the symbols. That one little act will take care of the 5 or 6 following errors.

    Now I know why professional coders are so highly paid...

    Anyway, I compiled the thing and will test it in gameplay shortly after posting this. Thank you very much, Stolenrays, for the assistance. This is a great mod extract...
  20. mwonch

    mwonch Chieftain

    Mar 9, 2006
    Sorry, all, but this is a no-go. CTD every time. The game just won't run it, at least when adding it into RevolutionDCM.

    I've already spent far too much time on this, so I'm calling it a failure (mine, not yours) and moving on to other merges.


    If anyone has suggestions, I'm all ears.

Share This Page