C2C SVN Changelog

Update
Comprehensive revamp of Renaissance Era tech tree. (Forgot to post this, my apologies.)
 
Update

- Some new trade goods - fine wines. Three new trade goods each provided by a World Wonder which can't be built in the same city as the other great wine producing wonders.
 
Update

- Some new trade goods - fine wines. Three new trade goods each provided by a World Wonder which can't be built in the same city as the other great wine producing wonders.

So they are "wonder resources"?

Also in the building code I am kind of confused. It says that X Winery requires 3 X Winerys. If its a wonder how can you build 3 let alone have it require itself?
 
So they are "wonder resources"?

Also in the building code I am kind of confused. It says that X Winery requires 3 X Winerys. If its a wonder how can you build 3 let alone have it require itself?

Gah! I that should just be 3 wineries!

Edit Update

- Fix the wine trade goods so that a nation can only build one of the wine wonders.
 
Update
Change to Cavalry Tactics: move to X46 Y1, cost to 2400, prerequisites to Flintlock + Mounted Archery.
 
Updates
New Renaissance Mounted Units:
  • Carabinier
  • Dragoon
  • Lancer

Changes to existing Mounted Units:
  • Cuirassier and Conquistador: Moved to Matchlock + Armored Cavalry, cost lowered to 250, Strength lowered to 16, upgrade to Carabinier or Lancer
  • Cavalry, Camel Gunner, Apache Cavalry, Cossack, Mountie, Rurales: Moved to Rifling + Military Tradition

Also fixed a typo in the Jet Fighter that was causing an XML load failure.
 
Updates

- New improvement Mushroom Gatherer.
- New Resource Coca.
- Game text fixes for Jainism, Sikhism and "Bancing Bears"

Edit

- Fix first walls movie and Andean founding cut scene (again!)
 
Updates:
-Redid Power Civics
-Added in new Rule civics
-Changed some leader fav civics to ones that exist
-Changed some Event Info civic requirements
-Changed city limits on Monarchy and Despotism
-Switched names of Democracy and Republic to how they originally were
 
current svn not playable. i get 21 unhappiness from all civics that are not there yet.
 
Updates:
-Added 10 unhappiness from Mind Control
-Fixed civic screen glitch at bottom of screen
 
Updates
- To avoid siege weapons with no promotions available I moved Drill I to Warfare tech (where Log Ram is), Drill II to The Wheel tech (where Battering Ram is) and Drill III to Military Training (where Drill I use to be).
- Fixed Airport to require Aircraft resource.
- Fixed State Park, Ranger Station and Camp Grounds.
- Fixed Trade Route modifier on Sky Roads station.
- Fixed the Butchery so it upgrades to the Meat Packing Plant and that the Meat Packing Plant produces Raw Meat resource.
- Fixed Arcology upgrade path.
 
Here's a patch to make embassies grant visibility of capitals.

I noticed that contrary to the game text, it doesn't appear that embassies actually give you and the other player the ability to see each others' capitals. Looking in the code I saw that the feature had been commented and disabled because it was buggy. That seemed odd to me -- after all, the espionage system offers the exact same functionality, bug-free -- so I took a look at the code for it.

The bug was easy to spot after spending a little time figuring out how the visibility code fit together. (I'm talking about visibility as in whether we can see what's currently happening in a plot or not, not about whether the plot has ever been "revealed" or is still incognito, or whether we can pull up a city screen.) The visibility system works by keeping a 'reference count' for each team of how many things can see into a given plot. An idiom used when making a visibility-affecting change to an object is to 1) decrement the visibility counts due to the object's existence, 2) make the change, and 3) increment the visibility counts due to the object. Whoever implemented this code in the first place (correctly) copied this idiom... But then they put a loop around the whole thing, as teams can have multiple players. Naturally, this doesn't work. It also seems like they didn't really understand the visibility system, as they neglected some other changes needed when e.g. capitals move.

Code:
=== modified file 'Sources/CvCity.cpp'
--- Sources/CvCity.cpp  2012-11-26 04:53:38 +0000
+++ Sources/CvCity.cpp  2012-12-06 05:34:18 +0000
@@ -1590,10 +1590,18 @@
                if (abEspionageVisibility[iI])
                {
                        pPlot->changeAdjacentSight((TeamTypes)iI, GC.getDefineINT("PLOT_VISIBILITY_RANGE"), false, NULL, false);
                }
        }
+
+       if (bCapital) {
+               for (iI = 0; iI < MAX_TEAMS; iI++) {
+                       if (GET_TEAM(GET_PLAYER(eOwner).getTeam()).isHasEmbassy((TeamTypes)iI)) {
+                               pPlot->changeAdjacentSight((TeamTypes)iI, GC.getDefineINT("PLOT_VISIBILITY_RANGE"), false, NULL, false);
+                       }
+               }
+       }

        GET_PLAYER(eOwner).setMaintenanceDirty(true);

        GC.getMapINLINE().updateWorkingCity();


=== modified file 'Sources/CvPlayer.cpp'
--- Sources/CvPlayer.cpp        2012-11-26 04:53:38 +0000
+++ Sources/CvPlayer.cpp        2012-12-06 06:04:21 +0000
@@ -14910,10 +14910,25 @@
                }
                else
                {
                        m_iCapitalCityID = FFreeList::INVALID_INDEX;
                }
+
+               if (pOldCapitalCity != NULL) {
+                       for (int iI = 0; iI < MAX_TEAMS; iI++) {
+                               if (GET_TEAM(getTeam()).isHasEmbassy((TeamTypes)iI)) {
+                                       pOldCapitalCity->plot()->changeAdjacentSight((TeamTypes)iI, GC.getDefineINT("PLOT_VISIBILITY_RANGE"), false, NULL, bUpdatePlotGroups);
+                               }
+                       }
+               }
+               if (pNewCapitalCity != NULL) {
+                       for (int iI = 0; iI < MAX_TEAMS; iI++) {
+                               if (GET_TEAM(getTeam()).isHasEmbassy((TeamTypes)iI)) {
+                                       pNewCapitalCity->plot()->changeAdjacentSight((TeamTypes)iI, GC.getDefineINT("PLOT_VISIBILITY_RANGE"), true, NULL, bUpdatePlotGroups);
+                               }
+                       }
+               }

                if (bUpdatePlotGroups)
                {
                        if (pOldCapitalCity != NULL)
                        {

=== modified file 'Sources/CvPlot.cpp'
--- Sources/CvPlot.cpp  2012-11-16 02:54:35 +0000
+++ Sources/CvPlot.cpp  2012-12-06 05:21:17 +0000
@@ -2393,15 +2393,17 @@
                /* Afforess                       Start          02/03/10                                              */
                /*                                                                                              */
                /* Embassy Allows Players to See Capitals                                                       */
                /************************************************************************************************/
                //Removed 3/7/10 due to bugs
-               /*if (pCity->isCapital())
+               //Reinserted 12/5/12
+               if (pCity->isCapital())
                {
+                       TeamTypes pTeam = pCity->getTeam();
                        for (iI = 0; iI < MAX_CIV_TEAMS; ++iI)
                        {
-                               if (GET_TEAM(pCity->getTeam()).isHasEmbassy((TeamTypes)iI))
+                               if (GET_TEAM(pTeam).isHasEmbassy((TeamTypes)iI))
                                {
                                        changeAdjacentSight((TeamTypes)iI, GC.getDefineINT("PLOT_VISIBILITY_RANGE"), bIncrement, NULL, bUpdatePlotGroups);
                                }
                        }
                }

=== modified file 'Sources/CvTeam.cpp'
--- Sources/CvTeam.cpp  2012-11-16 02:54:35 +0000
+++ Sources/CvTeam.cpp  2012-12-06 05:58:28 +0000
@@ -9015,25 +9015,30 @@
        FAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");
        FAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be within maximum bounds (invalid Index)");
     if (isHasEmbassy(eIndex) != bNewValue)
     {
        //Removed due to bugs
-       /*      CvCity* pCapital;
-               for (int iI = 0; iI < MAX_PLAYERS; iI++)
-               {
-                       if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID())
-                       {
+       //Fixed and reintroduced
+               CvCity* pCapital;
+               for (int iI = 0; iI < MAX_PLAYERS; ++iI) {
+                       if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID()) {
                                pCapital = GET_PLAYER((PlayerTypes)iI).getCapitalCity();
-                               if (pCapital != NULL)
-                               {
+                               if (pCapital != NULL) {
                                        pCapital->plot()->updateSight(false, true);
-                                       m_abEmbassy[eIndex] = bNewValue;
-                                       pCapital->plot()->updateSight(true, true);
                                }
                        }
-               }*/
+               }
                m_abEmbassy[eIndex] = bNewValue;
+               for (int iI = 0; iI < MAX_PLAYERS; ++iI) {
+                       if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID()) {
+                               pCapital = GET_PLAYER((PlayerTypes)iI).getCapitalCity();
+                               if (pCapital != NULL) {
+                                       pCapital->plot()->updateSight(true, true);
+                               }
+                       }
+               }
+               //m_abEmbassy[eIndex] = bNewValue;
     }
 }

 int CvTeam::getEmbassyTradingCount() const
 {

This works correctly so far on my system.
 
Here's a patch to make embassies grant visibility of capitals.

I noticed that contrary to the game text, it doesn't appear that embassies actually give you and the other player the ability to see each others' capitals. Looking in the code I saw that the feature had been commented and disabled because it was buggy. That seemed odd to me -- after all, the espionage system offers the exact same functionality, bug-free -- so I took a look at the code for it.

The bug was easy to spot after spending a little time figuring out how the visibility code fit together. (I'm talking about visibility as in whether we can see what's currently happening in a plot or not, not about whether the plot has ever been "revealed" or is still incognito, or whether we can pull up a city screen.) The visibility system works by keeping a 'reference count' for each team of how many things can see into a given plot. An idiom used when making a visibility-affecting change to an object is to 1) decrement the visibility counts due to the object's existence, 2) make the change, and 3) increment the visibility counts due to the object. Whoever implemented this code in the first place (correctly) copied this idiom... But then they put a loop around the whole thing, as teams can have multiple players. Naturally, this doesn't work. It also seems like they didn't really understand the visibility system, as they neglected some other changes needed when e.g. capitals move.

Code:
=== modified file 'Sources/CvCity.cpp'
--- Sources/CvCity.cpp  2012-11-26 04:53:38 +0000
+++ Sources/CvCity.cpp  2012-12-06 05:34:18 +0000
@@ -1590,10 +1590,18 @@
                if (abEspionageVisibility[iI])
                {
                        pPlot->changeAdjacentSight((TeamTypes)iI, GC.getDefineINT("PLOT_VISIBILITY_RANGE"), false, NULL, false);
                }
        }
+
+       if (bCapital) {
+               for (iI = 0; iI < MAX_TEAMS; iI++) {
+                       if (GET_TEAM(GET_PLAYER(eOwner).getTeam()).isHasEmbassy((TeamTypes)iI)) {
+                               pPlot->changeAdjacentSight((TeamTypes)iI, GC.getDefineINT("PLOT_VISIBILITY_RANGE"), false, NULL, false);
+                       }
+               }
+       }

        GET_PLAYER(eOwner).setMaintenanceDirty(true);

        GC.getMapINLINE().updateWorkingCity();


=== modified file 'Sources/CvPlayer.cpp'
--- Sources/CvPlayer.cpp        2012-11-26 04:53:38 +0000
+++ Sources/CvPlayer.cpp        2012-12-06 06:04:21 +0000
@@ -14910,10 +14910,25 @@
                }
                else
                {
                        m_iCapitalCityID = FFreeList::INVALID_INDEX;
                }
+
+               if (pOldCapitalCity != NULL) {
+                       for (int iI = 0; iI < MAX_TEAMS; iI++) {
+                               if (GET_TEAM(getTeam()).isHasEmbassy((TeamTypes)iI)) {
+                                       pOldCapitalCity->plot()->changeAdjacentSight((TeamTypes)iI, GC.getDefineINT("PLOT_VISIBILITY_RANGE"), false, NULL, bUpdatePlotGroups);
+                               }
+                       }
+               }
+               if (pNewCapitalCity != NULL) {
+                       for (int iI = 0; iI < MAX_TEAMS; iI++) {
+                               if (GET_TEAM(getTeam()).isHasEmbassy((TeamTypes)iI)) {
+                                       pNewCapitalCity->plot()->changeAdjacentSight((TeamTypes)iI, GC.getDefineINT("PLOT_VISIBILITY_RANGE"), true, NULL, bUpdatePlotGroups);
+                               }
+                       }
+               }

                if (bUpdatePlotGroups)
                {
                        if (pOldCapitalCity != NULL)
                        {

=== modified file 'Sources/CvPlot.cpp'
--- Sources/CvPlot.cpp  2012-11-16 02:54:35 +0000
+++ Sources/CvPlot.cpp  2012-12-06 05:21:17 +0000
@@ -2393,15 +2393,17 @@
                /* Afforess                       Start          02/03/10                                              */
                /*                                                                                              */
                /* Embassy Allows Players to See Capitals                                                       */
                /************************************************************************************************/
                //Removed 3/7/10 due to bugs
-               /*if (pCity->isCapital())
+               //Reinserted 12/5/12
+               if (pCity->isCapital())
                {
+                       TeamTypes pTeam = pCity->getTeam();
                        for (iI = 0; iI < MAX_CIV_TEAMS; ++iI)
                        {
-                               if (GET_TEAM(pCity->getTeam()).isHasEmbassy((TeamTypes)iI))
+                               if (GET_TEAM(pTeam).isHasEmbassy((TeamTypes)iI))
                                {
                                        changeAdjacentSight((TeamTypes)iI, GC.getDefineINT("PLOT_VISIBILITY_RANGE"), bIncrement, NULL, bUpdatePlotGroups);
                                }
                        }
                }

=== modified file 'Sources/CvTeam.cpp'
--- Sources/CvTeam.cpp  2012-11-16 02:54:35 +0000
+++ Sources/CvTeam.cpp  2012-12-06 05:58:28 +0000
@@ -9015,25 +9015,30 @@
        FAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");
        FAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be within maximum bounds (invalid Index)");
     if (isHasEmbassy(eIndex) != bNewValue)
     {
        //Removed due to bugs
-       /*      CvCity* pCapital;
-               for (int iI = 0; iI < MAX_PLAYERS; iI++)
-               {
-                       if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID())
-                       {
+       //Fixed and reintroduced
+               CvCity* pCapital;
+               for (int iI = 0; iI < MAX_PLAYERS; ++iI) {
+                       if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID()) {
                                pCapital = GET_PLAYER((PlayerTypes)iI).getCapitalCity();
-                               if (pCapital != NULL)
-                               {
+                               if (pCapital != NULL) {
                                        pCapital->plot()->updateSight(false, true);
-                                       m_abEmbassy[eIndex] = bNewValue;
-                                       pCapital->plot()->updateSight(true, true);
                                }
                        }
-               }*/
+               }
                m_abEmbassy[eIndex] = bNewValue;
+               for (int iI = 0; iI < MAX_PLAYERS; ++iI) {
+                       if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID()) {
+                               pCapital = GET_PLAYER((PlayerTypes)iI).getCapitalCity();
+                               if (pCapital != NULL) {
+                                       pCapital->plot()->updateSight(true, true);
+                               }
+                       }
+               }
+               //m_abEmbassy[eIndex] = bNewValue;
     }
 }

 int CvTeam::getEmbassyTradingCount() const
 {

This works correctly so far on my system.

Does anyone else have thoughts on this? I think it's a fairly good idea.
 
Back
Top Bottom