Ok, I ran across where you started discussing this project and I get what you're trying to do now.
I'm going to make Tech Commerce Modifier tags that should allow us to express the Language civics as technological advances, ie the bonuses will remain the same but will come on techs.
So you're looking for a Tech Commerce
Modifier which is a % rate modifier for the whole nation. You say it yourself that you're looking to achieve the same effect from earning a civic that comes from selecting a particular tech.
So the way to go about that is to make it go ahead and utilize most of the pre-existing programming that is already taking place via the same pathways that the Civic tag(s) is/are using. Now that I have a better idea of what you're trying to achieve, I can tell you that the tag used in the civics is:
<element type="CommerceModifiers" minOccurs="0"/>
Which is declared in the schema by:
Code:
<ElementType name="iCommerce" content="textOnly" dt:type="int"/>
<ElementType name="CommerceModifiers" content="eltOnly">
<element type="iCommerce" minOccurs="0" maxOccurs="*"/>
</ElementType>
Careful to search for iCommerce in the tech schema cuz its probably already declared elsewhere (but if not its necessary to declare it as done above.)
Then basically copy over to tech infos the same loading steps used for the civics (in CvInfos.h and CvInfos.cpp). I assume you'll find that part easy but if you'd like I'd be happy to go through the steps there for you as well. However, there's an interesting quirk here in CvInfos.h (and is included in some of the steps in CvInfos.cpp) that interacts with the text manager. Instead of just int getCommerceModifier(int i) const; you also have a call to the whole array as such:
Code:
int getCommerceModifier(int i) const;
int* getCommerceModifierArray() const;
and then you don't need more than the usual declaration for the underlying variable:
int* m_piCommerceModifier;
Then, much like above,
Code:
for (iI = 0; iI < MAX_PLAYERS; iI++)
{
if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID() && GET_PLAYER((PlayerTypes)iI).isAlive())
{
for (int iJ = 0; iJ < NUM_COMMERCE_TYPES; iJ++)
{
GET_PLAYER((PlayerTypes)iI).[COLOR="Red"]changeCommerceRateModifier[/COLOR](((CommerceTypes)iJ), GC.getTechInfo(eTech).[COLOR="Red"]getCommerceModifier[/COLOR](iJ) * iChange);
}
}
}
Note that the first 2 lines there are already set up in CvTeam so its only the rest of it that should go within the bracket after:
if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID() && GET_PLAYER((PlayerTypes)iI).isAlive())
Note the red is all that's different from the previous example I gave, in this case for the global % modifier. When I say Global in this case, I mean for the whole nation, not for all civs.
And as for processing? Done and done. This leaves just the text and ai remaining. I can help with the text but as I said, tech ai is something I haven't looked into much. I could sort that out too though with enough time and if you leave it for now, either Koshling will come around and instruct you there or I will figure it out (which I will sooner or later) and let you know (or you may have been able to sort it out yourself by then.)
So for text, this method makes the Text Manager MUCH easier too. It's basically a matter of following the Civic tag (or Trait tag as this exists for traits even before my trait tags)
You'll find this simple line under parseCivic:
Code:
// Commerce Modifier
setCommerceChangeHelp(szHelpText, L"", L"", gDLL->getText("TXT_KEY_CIVIC_IN_ALL_CITIES").GetCString(), GC.getCivicInfo(eCivic).getCommerceModifierArray(), true);
So all you need to do is add that in the parseTech function. Something like:
Code:
// Commerce Modifier
setCommerceChangeHelp([COLOR="SeaGreen"]szHelpText[/COLOR], L"", L"", gDLL->getText("TXT_KEY_CIVIC_IN_ALL_CITIES").GetCString(), GC.getTechInfo(eTech).getCommerceModifierArray(), true);
The green is a watch spot... sometimes that call can be different in the various parse functions. However, you DON'T usually have to change the text reference. Might want to search for it and take a look at how it displays but usually it'll say exactly what you want it to without any further effort (only now does so under tech definitions.)
You also might want to edit parseCommerceHelp to get specific as to where this value is coming from in the help popups by subtracting out your modifier's values from the base value it would normally be included in (coming from cvplayer) and add it separately so that it displays as a differing value that is included in the total. You can see there how Civics and Traits are divided up and displayed separately on the popup lists. You can follow the same example there with the Tech tag.
I know that you would rather stay within what is more basic, one tag for one value, but this mechanism is set up to make it much easier for you and to go about it with a tag for each commerce is really a painful reinventing of the wheel. It'd probably also make the AI portion more difficult as well, though I can't say that for sure. Additionally, this keeps things more open. Say, for example, someone rather bravely (not a plan of mine I assure you) decides to add a new Commerce to the game. It'd be ready for that too. But more importantly, this saves a LOT of coding work as the Civic and Trait tags are already plugging their values in everywhere those values should go so adding your new spring to that data river will ensure that all places that your data should plug in will naturally do so along the routes already defined.
Best of all, going about it this way has zero risk of savegame incompatibility.
And to make sure there's no misunderstanding here, the way the tag is expressed in the techinfos file would enable you to work with specific commerces, not all at once (necessarily.) It looks like this:
Code:
<CommerceModifiers>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>20</iCommerce>
<iCommerce>0</iCommerce>
</CommerceModifiers>
This would produce an extra 20% culture. The last one is unnecessary to list off as its just a 0 for Espionage, which would be the default if its missing, but I listed it here nevertheless just for the sake of the example.