I just realized something:
Ummm, Tavis... It's New Years Day! Shouldn't you be relaxing and / or nursing a hangover? We're all fanatics that love Civ III and enjoy talking about things like corruption details, but go ahead - enjoy some well deserved rest!
Originally posted by Qitai
Yeti> I do not know if this might be a problem. I hope I am just worrying too much. The proposed code seems to be able to handle one FP only. This is okay for epic games. But it might cause crashes if a scenario is made with multiple FPs.
It shouldn't cause crashes, but the additional palace flagged structures would only act like the C3C 1.12 FP does - they'd act like a courthouse in the specific city they are in, and increase empire wide OCN, but not result in an additional set of city ranks that would give you a new ring of productive cities around the structure.
To address this would require a variable sized data structure (a vector would work well if Firaxis is using the STL container classes). This structure could be populated either with the coords of the capitals, or with pointers to the city objects that contain the capitals. They may already be using something like this. I'm not sure, for example, if pRealCapital is defined as a special case, determined through a search to locate the capital's city, or is pulled out from an array that would also contain info on the FP, SPHQ, etc...
But anyway

With whatever data framework they have, the solution would be along the lines of what Tavis posted back on page 1 - calculating the distance from each loop city to whatever capital is closest to the city having its rank determined. Then only those cities closer to that specific capital would increment the rank. This allows every palace type structure to have it's own productive core and separate city rankings.
Originally posted by Qitai
Also, any possibility you can come up with a version of code which uses the minimum of Palace Rank and FP Rank? I prefer using minimum of the ranks rather than using the distance as the primary determinant.
At first I didn't understand what you were saying, but in writing up an explanation of how I understood things to work now (1.12) and how they were going to be changed for the beta patch, I think I figured out what you're asking
You mean that in a situation where a city is (for example) closer to the Forbidden Palace than THE Palace, but due to there being a lot of cities around the FP, and not many around the Palace, it's "Palace Rank" would actually be lower than it's "FP Rank", you'd want to use the lower of those two ranks? That would be odd because it would result in situations where a city is using its distance to one capital to calculate distance corruption, and it's rank relative to a different capital to calculate it's rank/OCN corruption.
I see an issue with this.
You're calculating a pair of city ranks for every city, disregarding distance. So now some of the cities between your Palace and FP are "taking" rankings away from other cities. Those cities that are the 7th, 12th, and 19th ranked from your Palace, that would normally have FP ranks because they're closer to the FP than the Palace, are making it so that the 20th and higher ranked Palace cities have ranks 3 higher than they normally would (and 2 higher for 13 - 18, etc...). So every time a single city between your FP and Palace benefits from this, every city further away is negatively affected. To address this I guess you'd have to redo the city rankings one you determined which capital they were going to be ranked relative to. In other words take the rankings 1, 2, 3, 4, 6, 7, 8, 10, 11 and change them to 1, 2, 3, 4, 5, 6, 7, 8, 9.
Contemplating the net effects of this:
With a palace and FP both surrounded by lots of cities, the effect would be minimal - a couple cities between them would have slightly lower corruptions, but another city would have slightly higher corruption.
Now consider a case where the FP is far away on another continent with 2 cities, while the Palace is back home with 20 other cities... Previously (PTW) the FP would have itself and cities ranked 1 and 2, the Palace would have itself and cities ranked 1 through 20. If the lowest rank was used, then suddenly the Palace would have cities ranked 1 through 11, and the FP would have cities ranked 1 through 11 - meaning that many cities suddenly had their rank drop by 9.
Distance corruption would still be higher than with an optimally placed FP, but overall corruption would be considerably lower - meaning that the FP was made stronger.
Hmm - third scenario - FP and Palace in the same city or very close. Well, being in the same city would break this algorithm... Being very close would result in a whole lot of shifting of ranks, which after renumbering, would almost double the size of your productive low corruption core - like you'd like to see.
So it has some definite plusses, but I see some question marks too, plus it would be harder to implement.