DLL development discussions

:) Already gained this impression.

I have a feeling it could be quicker to write it from the scratch, then to understand it.
 
But do you know the method which is an entry point for loading modules? Or a method which is en entry point for loading a single module? -- Something that takes a path to a module and loads it, and those thing.
 
:faint: Are we not loading module by module, but take a kind of data to load, search for it through all modules, load, take a kind of data to load, search for it through all modules, load, take ...?
 
:faint: Are we not loading module by module, but take a kind of data to load, search for it through all modules, load, take a kind of data to load, search for it through all modules, load, take ...?

I believe that the first step is loading the XML into an internal form which has all the correct modules combined in the correct form with the game options on inclusion and exclusion taken into account. Or is that what you are asking about?
 
I've been asking about this. But thank you, you were trying to help.

Actually I thought, there can be many different kinds of infos in one xml file, so the module loading reads an xml file many times. But I've reminded myself, we have rather one info kind per file. So in fact, it's not so horrible as I thought.
 
There are a very few files with many infos type in them but they are not supported by WoC so if you want to modify the settings you have to do it in that one file not in modules. Sounds is one of these.
 
@Koshling, can I turn off forgiving CvXMLLoadUtility::FindInInfoClass? I mean throw out the second parameter and make it always generate an error on a miss. The second parameter is used only once and when removed it from this call game still loads without errors. -- Or I would rather make an another method GetInInfoClass, which would be not forgiving and switch all current calls of Find to it.

I don't think we should be forgiving here. If there is an invalid reference in XML we should always inform about it, I believe.
 
Can I ask, which bright mind is the creator of this invention?

Code:
class cvInternalGlobals
{
...
	BoolExpr* getReplacementCondition();
	void setReplacementCondition(BoolExpr* pExpr);
	int getReplacementID();
	void setReplacementID(int iID);
	void resetReplacement();
	void updateReplacements();
...
}
 
I can't understand the code good (other than matlab I have non coding experience) but at a first glance it looks like a code developed by AIAndy.
Basically if in the gametext you had something like >< , >Blah< , >.< or similar instead of displaying those texts, the game showed the text used for the english language
 
Can I ask, which bright mind is the creator of this invention?

Code:
class cvInternalGlobals
{
...
	BoolExpr* getReplacementCondition();
	void setReplacementCondition(BoolExpr* pExpr);
	int getReplacementID();
	void setReplacementID(int iID);
	void resetReplacement();
	void updateReplacements();
...
}

That was AIAndy at SVN Revision 4911.
 
Well, I can't be sure as I've had no time to study it correctly. But looks like a very ill design.
 
Well, I can't be sure as I've had no time to study it correctly. But looks like a very ill design.

Or it could be a very good first design of a very ugly real world problem:D. In my experience it is often hard to come up with a first solution, but it is always easy to criticise it and come up with a better design later, once the path has been cut through the forest:lol:

If it is to do with language text then it may have been trying to keep the internal interface of the old method of loading the text while still providing an improved language support mechanism for getting the text.
 
Or it could be a very good first design of a very ugly real world problem:D. In my experience it is often hard to come up with a first solution, but it is always easy to criticise it and come up with a better design later, once the path has been cut through the forest:lol:

If it is to do with language text then it may have been trying to keep the internal interface of the old method of loading the text while still providing an improved language support mechanism for getting the text.
If it was about the text replacement, this place would maybe not be so bad. But it is about Info Classes loading. At the first glance, those functions looks like they are useless outside this process. If so, it is nothing like a very ugly real world problem. -- Unless we count laziness as one ...

Sorry I say so. I know, AIAndy has his star in the C2C Walk of Fame, but still bad, to use choose an easy way instead of the correct one. -- You do things like this too many times and you end in a place, where the code is unmanageable and you can't develop it anymore.
 
I can't say I have the slightest clue why you're criticizing his design but it does have a known flaw perhaps you could help me with.

This is the beginning of the Replacement Mechanism. What it does is allow for an object entry, such as a building, unit, trait (we have used this method extensively on a new trait set as a first example - located in ls612's modular traits file), promotion or whatever to be created that will completely replace the original of the same name IF a particular condition is met, usually and intended for Game Options.

Thus, for example in the traits, we were able to create a game option, Focused Traits. Then ls612 was able to make traits the way he felt they should be defined. He then used this method to have his traits replace the definitions of the core traits by the same name.

Core Trait definition example:
Code:
		<TraitInfo>
			<Type>TRAIT_AGGRESSIVE</Type>
			<Description>TXT_KEY_TRAIT_AGGRESSIVE</Description>
			<ShortDescription>TXT_KEY_TRAIT_AGGRESSIVE_SHORT</ShortDescription>
			<Civilopedia>TXT_KEY_TRAIT_AGGRESSIVE_PEDIA</Civilopedia>
			<Button>ART/Buttons/Traits/TraitAggressive.dds</Button>
			<PromotionLine>PROMOTIONLINE_AGGRESSIVE</PromotionLine>
			<iLinePriority>0</iLinePriority>
			<bNegativeTrait>0</bNegativeTrait>
			<bImpurePromotions>0</bImpurePromotions>
			<bImpurePropertyManipulators>1</bImpurePropertyManipulators>
			<Flavors>
				<Flavor>
					<FlavorType>FLAVOR_PRODUCTION</FlavorType>
					<iFlavor>1</iFlavor>
				</Flavor>
				<Flavor>
					<FlavorType>FLAVOR_ESPIONAGE</FlavorType>
					<iFlavor>-1</iFlavor>
				</Flavor>
				<Flavor>
					<FlavorType>FLAVOR_MILITARY</FlavorType>
					<iFlavor>10</iFlavor>
				</Flavor>
			</Flavors>
			<iHealth>0</iHealth>
			<iHappiness>0</iHappiness>
			<iMaxAnarchy>-1</iMaxAnarchy>
			<iUpkeepModifier>0</iUpkeepModifier>
			<iLevelExperienceModifier>0</iLevelExperienceModifier>
			<iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
			<iGreatGeneralRateModifier>0</iGreatGeneralRateModifier>
			<iDomesticGreatGeneralRateModifier>0</iDomesticGreatGeneralRateModifier>
			<iMaxGlobalBuildingProductionModifier>0</iMaxGlobalBuildingProductionModifier>
			<iMaxTeamBuildingProductionModifier>0</iMaxTeamBuildingProductionModifier>
			<iMaxPlayerBuildingProductionModifier>0</iMaxPlayerBuildingProductionModifier>
			<!-- Revolution Trait Effects Begin -->
			<iRevIdxLocal>0</iRevIdxLocal>
			<iRevIdxNational>0</iRevIdxNational>
			<iRevIdxHolyCityGood>0</iRevIdxHolyCityGood>
			<iRevIdxHolyCityBad>0</iRevIdxHolyCityBad>
			<fRevIdxNationalityMod>0</fRevIdxNationalityMod>
			<fRevIdxBadReligionMod>0</fRevIdxBadReligionMod>
			<fRevIdxGoodReligionMod>0</fRevIdxGoodReligionMod>
			<iRevIdxDistanceModifier>0</iRevIdxDistanceModifier>
			<bNonStateReligionCommerce>0</bNonStateReligionCommerce>
			<bUpgradeAnywhere>0</bUpgradeAnywhere>
			<!-- Revolution Trait Effects End -->
			<ExtraYieldThresholds/>
			<TradeYieldModifiers/>
			<CommerceChanges/>
			<CommerceModifiers/>
			<FreePromotionUnitCombatTypes>
				<FreePromotionUnitCombatType>
					<PromotionType>PROMOTION_COMBAT1</PromotionType>
						<UnitCombatTypes>
							<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
							<UnitCombatType>UNITCOMBAT_GUN</UnitCombatType>
							<UnitCombatType>UNITCOMBAT_HITECH</UnitCombatType>
							<UnitCombatType>UNITCOMBAT_ASSAULT_MECH</UnitCombatType>
						</UnitCombatTypes>
				</FreePromotionUnitCombatType>
				<FreePromotionUnitCombatType>
					<PromotionType>PROMOTION_AGGRESSIVE</PromotionType>
						<UnitCombatTypes>
							<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
						</UnitCombatTypes>
				</FreePromotionUnitCombatType>
			</FreePromotionUnitCombatTypes>
			<BuildingProductionModifierTypes>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_BARRACKS</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_GARRISON</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_BIOENHANCEMENT_CENTER</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_SIEGE_WORKSHOP</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_TR_WORKSHOP</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_CANNON_FORGE</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_FLETCHER</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_GLADIATOR_SCHOOL</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_AEROSPACE_COMPLEX</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_WARRIOR_HUT</BuildingType>
					<iBuildingProductionModifier>25</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_MERCENARY_CAMP</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_MERCENARY_STABLES</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_SALOON</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_PIRATES_COVE</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_MOB_STOREFRONT</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_REBEL_CAMP</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_TERRORISTS_COMPOUND</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_CROSSES</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_STOCKS</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_GALLOWS</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_GUILLOTINE</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_ELECTRIC_CHAIR</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_LETHAL_INJECTION</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_PUBLIC_STONING</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
			</BuildingProductionModifierTypes>
			<iAttitudeModifier>-1</iAttitudeModifier>
			<iMilitaryProductionModifier>10</iMilitaryProductionModifier>
			<PropertyManipulators>
  				<PropertySource>
   					<PropertySourceType>PROPERTYSOURCE_CONSTANT</PropertySourceType>
						<PropertyType>PROPERTY_CRIME</PropertyType>
						<GameObjectType>GAMEOBJECT_CITY</GameObjectType>
						<RelationType>RELATION_ASSOCIATED</RelationType>
						<iAmountPerTurn>9</iAmountPerTurn>
						<Active>
							<Greater>
								<PropertyType>PROPERTY_CRIME</PropertyType>
								<Constant>200</Constant>
							</Greater>
						</Active>
				</PropertySource>
			</PropertyManipulators>
		</TraitInfo>
And the replacement (which could just as validly have been placed in the same core file - does not require modularization):
Code:
		<TraitInfo>
			<Type>TRAIT_AGGRESSIVE</Type>
			<ReplacementID>TRAIT_LS612_AGGRESSIVE</ReplacementID>
			<Description>TXT_KEY_TRAIT_AGGRESSIVE</Description>
			<ShortDescription>TXT_KEY_TRAIT_AGGRESSIVE_SHORT</ShortDescription>
			<Button>ART/Buttons/Traits/TraitAggressive.dds</Button>
			<PromotionLine>PROMOTIONLINE_AGGRESSIVE</PromotionLine>
			<iLinePriority>0</iLinePriority>
			<bNegativeTrait>0</bNegativeTrait>
			<bImpurePromotions>0</bImpurePromotions>
			<bImpurePropertyManipulators>1</bImpurePropertyManipulators>
			<Flavors>
				<Flavor>
					<FlavorType>FLAVOR_PRODUCTION</FlavorType>
					<iFlavor>1</iFlavor>
				</Flavor>
				<Flavor>
					<FlavorType>FLAVOR_ESPIONAGE</FlavorType>
					<iFlavor>-1</iFlavor>
				</Flavor>
				<Flavor>
					<FlavorType>FLAVOR_MILITARY</FlavorType>
					<iFlavor>10</iFlavor>
				</Flavor>
			</Flavors>
			<iHealth>0</iHealth>
			<iHappiness>0</iHappiness>
			<iMaxAnarchy>-1</iMaxAnarchy>
			<iUpkeepModifier>0</iUpkeepModifier>
			<iLevelExperienceModifier>0</iLevelExperienceModifier>
			<iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
			<iGreatGeneralRateModifier>0</iGreatGeneralRateModifier>
			<iDomesticGreatGeneralRateModifier>0</iDomesticGreatGeneralRateModifier>
			<iMaxGlobalBuildingProductionModifier>0</iMaxGlobalBuildingProductionModifier>
			<iMaxTeamBuildingProductionModifier>0</iMaxTeamBuildingProductionModifier>
			<iMaxPlayerBuildingProductionModifier>0</iMaxPlayerBuildingProductionModifier>
			<!-- Revolution Trait Effects Begin -->
			<iRevIdxLocal>0</iRevIdxLocal>
			<iRevIdxNational>0</iRevIdxNational>
			<iRevIdxHolyCityGood>0</iRevIdxHolyCityGood>
			<iRevIdxHolyCityBad>0</iRevIdxHolyCityBad>
			<fRevIdxNationalityMod>0</fRevIdxNationalityMod>
			<fRevIdxBadReligionMod>0</fRevIdxBadReligionMod>
			<fRevIdxGoodReligionMod>0</fRevIdxGoodReligionMod>
			<iRevIdxDistanceModifier>0</iRevIdxDistanceModifier>
			<bNonStateReligionCommerce>0</bNonStateReligionCommerce>
			<bUpgradeAnywhere>0</bUpgradeAnywhere>
			<!-- Revolution Trait Effects End -->
			<ExtraYieldThresholds/>
			<TradeYieldModifiers/>
			<CommerceChanges/>
			<CommerceModifiers/>
			<FreePromotionUnitCombatTypes>
				<FreePromotionUnitCombatType>
					<PromotionType>PROMOTION_COMBAT1</PromotionType>
						<UnitCombatTypes>
							<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
							<UnitCombatType>UNITCOMBAT_GUN</UnitCombatType>
							<UnitCombatType>UNITCOMBAT_HITECH</UnitCombatType>
							<UnitCombatType>UNITCOMBAT_ASSAULT_MECH</UnitCombatType>
						</UnitCombatTypes>
				</FreePromotionUnitCombatType>
				<FreePromotionUnitCombatType>
					<PromotionType>PROMOTION_AGGRESSIVE</PromotionType>
						<UnitCombatTypes>
							<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
							<UnitCombatType>UNITCOMBAT_GUN</UnitCombatType>
							<UnitCombatType>UNITCOMBAT_HITECH</UnitCombatType>
							<UnitCombatType>UNITCOMBAT_ASSAULT_MECH</UnitCombatType>
						</UnitCombatTypes>
				</FreePromotionUnitCombatType>
			</FreePromotionUnitCombatTypes>
			<BuildingProductionModifierTypes>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_BARRACKS</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_GARRISON</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_BIOENHANCEMENT_CENTER</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_SIEGE_WORKSHOP</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_TR_WORKSHOP</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_CANNON_FORGE</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_FLETCHER</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_GLADIATOR_SCHOOL</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_AEROSPACE_COMPLEX</BuildingType>
					<iBuildingProductionModifier>100</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_WARRIOR_HUT</BuildingType>
					<iBuildingProductionModifier>25</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_MERCENARY_CAMP</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_MERCENARY_STABLES</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_SALOON</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_PIRATES_COVE</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_MOB_STOREFRONT</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_REBEL_CAMP</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_TERRORISTS_COMPOUND</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_CROSSES</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_STOCKS</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_GALLOWS</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_GUILLOTINE</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_ELECTRIC_CHAIR</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_LETHAL_INJECTION</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
				<BuildingProductionModifierType>
					<BuildingType>BUILDING_PUBLIC_STONING</BuildingType>
					<iBuildingProductionModifier>10</iBuildingProductionModifier>
				</BuildingProductionModifierType>
			</BuildingProductionModifierTypes>
			<iWarWearinessAccumulationModifier>-10</iWarWearinessAccumulationModifier>
			<iAttitudeModifier>0</iAttitudeModifier>
			<iMilitaryProductionModifier>0</iMilitaryProductionModifier>
			<ReplacementCondition>
				<And>
					<Has>
						<GOMType>GOM_OPTION</GOMType>
						<ID>GAMEOPTION_LS612_TRAITS</ID>
					</Has>
					<Not>
						<GOMType>GOM_OPTION</GOMType>
						<ID>GAMEOPTION_LEADERHEAD_LEVELUPS</ID>
					</Not>
				</And>
			</ReplacementCondition>
		</TraitInfo>

<ReplacementID>TRAIT_LS612_AGGRESSIVE</ReplacementID> becomes a second primary key... like a last name as it were.

It thus replaces the same <Type> used IF the replacement condition is met in the game (though I think the problem we have is that it's checking at load time rather than at gamestart):
Code:
<ReplacementCondition>
				<And>
					<Has>
						<GOMType>GOM_OPTION</GOMType>
						<ID>GAMEOPTION_LS612_TRAITS</ID>
					</Has>
					<Not>
						<GOMType>GOM_OPTION</GOMType>
						<ID>GAMEOPTION_LEADERHEAD_LEVELUPS</ID>
					</Not>
				</And>
			</ReplacementCondition>
 
@Koshilng, I can't finish incorporating xerces. Unfortunately, there are still some bugs which I can't corrects as I am leaving. And may be absent for a long time. Still I believe, the code is better then it was, so it would be good if you could find the bugs and apply it in C2C.

Most of data is read correctly. The game runs, but units are shifted and when you click next turn, you get CTD. -- I thought, could broke the non-xml code, as I've been find-and-cutting some code and could cut an extra line, which should be there. But I compered caches from my build and that from the repo and there are some differences, so it can be a problem with xml.

I've added a variant of FDataIOStream, which uses ASCII to store all strings and put a new line after each value. So the cache is more readable and you can use some comparing tool, like WinMarge or something, to find the place where something has been read wrong. -- That class is used only in debug build, and only for caching, so it should be safe. Just need to remember to clear cache when you switch between debug and release binary. -- I will commit the current revision only with this functionality added, so it will be possible to compare the proper cache with that from the xerces version.

Also -- xerces uses utf16 almost for everything so I switched tag names to be wchar_t.

Also -- now CvXMLLoadUtility is is fully responsible for getting anything from xml, so everything except CvXMLLoadUtility is now parser-independent. (There is still a getter GetCurrentXMLElement, which exposes a DOM objects, but it was only for debugging purpose.)

Also -- I started switching some design convention. All method which are of the form GetSomething(...) should fail an assertion, if they can't retrieve data. If we allow an optional value which can be missing, we should have another method like TryGetSomthing, GetOptionalSomthing or FindSomthing to get it without errors. This is safer.

I hope you will have some time and plug this code into c2c.

Take care. :)
 
Can I ask, which bright mind is the creator of this invention?

Code:
class cvInternalGlobals
{
...
	BoolExpr* getReplacementCondition();
	void setReplacementCondition(BoolExpr* pExpr);
	int getReplacementID();
	void setReplacementID(int iID);
	void resetReplacement();
	void updateReplacements();
...
}
All but the last of those are used to pass out information from the CvInfoBase XML read method (which cannot be freely altered because of usage by the exe). This copies the method used by the WoC module code right above your quoted lines.
If the placement bothers you feel free to move them elsewhere.
 
Because of the use of different formats there are errors with the cache then switching the dll between Debug<->Release.
I modified the CvXMLLoadUtilitySetMod.cpp to write a value into the CacheHeader to detect the switch like it is done then the CacheVersion is changed.
I attached the modified file maybe someone can add it to the svn.
The other way to solve this would be to use the same Stream for Debug and Release.
 

Attachments

Because of the use of different formats there are errors with the cache then switching the dll between Debug<->Release.
I modified the CvXMLLoadUtilitySetMod.cpp to write a value into the CacheHeader to detect the switch like it is done then the CacheVersion is changed.
I attached the modified file maybe someone can add it to the svn.
The other way to solve this would be to use the same Stream for Debug and Release.

Yeah, I was just banging my head against this... I'll give your solution a go and hopefully it'll do the trick. (THANKS! btw)
 
@Koshilng, I can't finish incorporating xerces. Unfortunately, there are still some bugs which I can't corrects as I am leaving. And may be absent for a long time. Still I believe, the code is better then it was, so it would be good if you could find the bugs and apply it in C2C.

Most of data is read correctly. The game runs, but units are shifted and when you click next turn, you get CTD. -- I thought, could broke the non-xml code, as I've been find-and-cutting some code and could cut an extra line, which should be there. But I compered caches from my build and that from the repo and there are some differences, so it can be a problem with xml.

I've added a variant of FDataIOStream, which uses ASCII to store all strings and put a new line after each value. So the cache is more readable and you can use some comparing tool, like WinMarge or something, to find the place where something has been read wrong. -- That class is used only in debug build, and only for caching, so it should be safe. Just need to remember to clear cache when you switch between debug and release binary. -- I will commit the current revision only with this functionality added, so it will be possible to compare the proper cache with that from the xerces version.

Also -- xerces uses utf16 almost for everything so I switched tag names to be wchar_t.

Also -- now CvXMLLoadUtility is is fully responsible for getting anything from xml, so everything except CvXMLLoadUtility is now parser-independent. (There is still a getter GetCurrentXMLElement, which exposes a DOM objects, but it was only for debugging purpose.)

Also -- I started switching some design convention. All method which are of the form GetSomething(...) should fail an assertion, if they can't retrieve data. If we allow an optional value which can be missing, we should have another method like TryGetSomthing, GetOptionalSomthing or FindSomthing to get it without errors. This is safer.

I hope you will have some time and plug this code into c2c.

Take care. :)

I'am going to switch the the xmlparser to xerxes_c using some of your changes. if don't get to many issues i thing i'am done with it next weekend.
 
I'am going to switch the the xmlparser to xerxes_c using some of your changes. if don't get to many issues i thing i'am done with it next weekend.

Cool! This was sounding rather promising when she was working on it.
 
Back
Top Bottom