XML development discussions and informations

olduser

Emperor
Joined
Aug 16, 2012
Messages
1,975
This thread is for everything xml related that also includes xml related parts of the dll.
 
I have a question i found something in SpawnInfos while creating the new schema.

The rateOverrideDefineName is supposed to be a DefineName and there can only be one per SpawnInfo. But they are sometimes used twice that is wrong only the first one is used so i remove the second one.

Also they have sometimes integers in them this is also wrong if this is something that is needed i can change the read code.
Code:
<rateOverrideDefineName>0</rateOverrideDefineName>
 
I have a question i found something in SpawnInfos while creating the new schema.

The rateOverrideDefineName is supposed to be a DefineName and there can only be one per SpawnInfo. But they are sometimes used twice that is wrong only the first one is used so i remove the second one.

Also they have sometimes integers in them this is also wrong if this is something that is needed i can change the read code.
Code:
<rateOverrideDefineName>0</rateOverrideDefineName>

At the moment there are only two defines for this in A_New_Dawn.XML one for sea critters and one for land. However it takes a number so that we could fine tune the spawn rate. I have not been using a number there for quite awhile as the two defines are enough now. IE it no longer needs to take a number.
 
At the moment there are only two defines for this in A_New_Dawn.XML one for sea critters and one for land. However it takes a number so that we could fine tune the spawn rate. I have not been using a number there for quite awhile as the two defines are enough now. IE it no longer needs to take a number.

The way it is coded in the dll it never took a number unless someone changed that some time ago. I replace the numbers with the defines.
 
Another question the Tag ProductionTraits was replaced but it is still used in some xml's.

From the Svn Log by Thunderbrd
GameOptionEdit Project (Traits) merge.

*Added requested changes to all unit files that change metal bonuses to ware versions of the same.
*Added Trait Option Edits method
*The above required adding some new tags to traitsinfos to control the option edits method and moving some tags in use in other files to generating the same effects on tags in the traitsinfos. Those tags that were used are listed here with what they were replaced by in the trait file:
*In BuildingInfos: ProductionTraits and HappinessTraits, moved to BuildingProductionModifierTypes and BuildingHappinessModifierTypes in TraitsInfos
*In UnitInfos: ProductionTraits, moved to UnitProductionModifierTypes in TraitsInfos
*In SpecialBuildingInfos: ProductionTraits, moved to Traits infos as SpecialBuildingProductionModifierTypes (On this and only this conversion, I found it was important to update ALL building schemas and infos files to eliminate ProductionTraits entirely due to a potential error if it were ever to be used - load sequence had to be slightly adjusted which set this up for big problems without absolute removal.)
*In SpecialUnitInfos: ProductionTraits, moved to Traits infos as SpecialUnitProductionModifierTypes.
*In ImprovementInfos: TraitYields moved to ImprovementYieldChanges in TraitsInfos file.
*Updated all current traits to reflect all data found throughout all above files. It was found to be necessary to include all modular entries in the core trait definitions - testing shows they are safely ignored if the module is turned off. However, if it ends up causing a problem, the trait entry causing trouble could be edited with a modular edit as well. But so far I'm not detecting issues with that.
 
I believe I left the tag in place to avoid any possible problems - also to leave a record of the previous uses to make sure there was something that could be fallen back on if necessary. However, the tags that are under the traits themselves are the only ones that work if I recall properly. I think at this point that if you're cleaning things up it would be ok to now remove the old uses of Production Traits.
 
Ok then i remove all the ProductionTraits.

Another thing i noticed that some Tags are in a different order in different modules compared with the core. I want to reorder them all so that they are the same across all files. The order will be based a bit on the way the Tags are read into the dll, i post more about it then i have more details. Also if there are sugestions how to order them just post them here.
 
Order was important in BtS where you had to have all the tags defined and in the right order. With WoC you did not have to have all the tags in modules. In C2C order also became optional up to a point. I hope you are not going to insist on the order being correct. If you are then we may need a real c2C editor rather than just edit XML;)
 
You think it is bad to have them all in the same order?
One bad thing when all have to be ordered the same is that you have to know exactly where to put them but you have to know that also when you have them in a different order in your module.
Another thing is if you use a proper xml editor you can see that while editing because the editor is aware of the schema.
 
I am a pensioner I can't afford a "proper" XML editor. Most people use Notepad++ or similar anyway. I use XML Marker free version.
 
One bad thing then all have to be ordered the same is that you have to know exactly there to put them but you have to know that also then you have them in a different order in your module.

You are using 'then' and 'there' where English uses 'when' and 'where'. In complicated and unpunctuated sentences like this one, it could cause misunderstandings...:D
 
I am a pensioner I can't afford a "proper" XML editor. Most people use Notepad++ or similar anyway. I use XML Marker free version.

I did not mean a Premium Xml Editor for a couple hundred bugs. I use Visual Studio to edit xml it has IntelliSense for xml even in the free Express Editions. Then you type < in the editor it shows you the elements you can put there. I just have to setup the schema for Caveman2Cosmos in the right way to get this working.

I post more details about the tag order later and what i wrote earlier does not mean that all tags have to be in a strict order.

You are using 'then' and 'there' where English uses 'when' and 'where'. In complicated and unpunctuated sentences like this one, it could cause misunderstandings...:D

I'am sorry about that my english is not very good:(
 
Here is a example for MissionInfo.
The tags are in three groups the groups must be in order but the tags in the groups can be unordered.
The red group are tags from CvInfoBase the green group from CvHotkeyInfo and the blue group from CvMissionInfo.

Type
bForceOverwrite
bTypeDependency
AndDependencyTypes
OrDependencyTypes
Description
Help
Button

HotKey
bAltDown
bShiftDown
bCtrlDown
iHotKeyPriority
HotKeyAlt
bAltDownAlt
bShiftDownAlt
bCtrlDownAlt
iHotKeyPriorityAlt
iOrderPriority

Waypoint
EntityEventType
iTime
bTarget
bBuild
bSound
bVisible
 
I did not mean a Premium Xml Editor for a couple hundred bugs. I use Visual Studio to edit xml it has IntelliSense for xml even in the free Express Editions. Then you type < in the editor it shows you the elements you can put there. I just have to setup the schema for Caveman2Cosmos in the right way to get this working.

It is also possible to include a basic documentation in the schema that is another reason not to use a text editor for xml.

attachment.php
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    53.3 KB · Views: 368
Another thing i noticed that some Tags are in a different order in different modules compared with the core. I want to reorder them all so that they are the same across all files. The order will be based a bit on the way the Tags are read into the dll, i post more about it then i have more details. Also if there are sugestions how to order them just post them here.

A little update about this and some other things.

  • The tags can be unordered only tags like Type , BuildingClass... must come before all the others.
  • To easier identify Expression tags i rename them e.g. iAmountPerTurn will become ieAmountPerTurn(IntegerExpressionAmountPerTurn) or just AmountPerTurn.
  • It is possible to create a chm or html help containing the schema documentation. We can add a description for each tag and things like xml examples to that help file.
 
I still work on the xsd schema and i have a question there are 22 errors like this one in Modules\Hydro\HousingHousing_CIV4BuildingInfos.xml
Code:
		<BuildingInfo>
			<BuildingClass>BUILDINGCLASS_HOUSE_ERA3_LDLW</BuildingClass>
			<Type>BUILDING_HOUSE_ERA3_LDLW</Type>
			<SpecialBuildingType>NONE</SpecialBuildingType>
			<Description>TXT_KEY_BUILDING_HOUSE_ERA3_LDLW</Description>
			<Civilopedia>TXT_KEY_BUILDING_HOUSE_ERA3_LDLW_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_HOUSE_ERA3_LDLW_STRATEGY</Strategy>
			<Advisor>ADVISOR_GROWTH</Advisor>
			<ArtDefineTag>ART_DEF_BUILDING_HOUSE_ERA3_LDLW</ArtDefineTag>
			<MovieDefineTag>NONE</MovieDefineTag>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<bStateReligion>0</bStateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<PrereqCorporation>NONE</PrereqCorporation>
			<FoundsCorporation>NONE</FoundsCorporation>
			<GlobalReligionCommerce>NONE</GlobalReligionCommerce>
			<GlobalCorporationCommerce>NONE</GlobalCorporationCommerce>
			<VictoryPrereq>NONE</VictoryPrereq>
			<FreeStartEra>NONE</FreeStartEra>
			<MaxStartEra>NONE</MaxStartEra>
			<ObsoleteTech>NONE</ObsoleteTech>
			<PrereqTech>TECH_ELECTRICITY</PrereqTech>
			<Bonus>NONE</Bonus>
			<PrereqBonuses />
			<NoBonus>NONE</NoBonus>
			<PowerBonus>NONE</PowerBonus>
			<FreeBonus>NONE</FreeBonus>
			<iNumFreeBonuses>0</iNumFreeBonuses>
			<FreeBuilding>NONE</FreeBuilding>
			<FreePromotion>NONE</FreePromotion>
			<CivicOption>NONE</CivicOption>
			<GreatPeopleUnitClass>NONE</GreatPeopleUnitClass>
			<iGreatPeopleRateChange>0</iGreatPeopleRateChange>
			<iHurryAngerModifier>0</iHurryAngerModifier>
			<bBorderObstacle>0</bBorderObstacle>
			<bTeamShare>0</bTeamShare>
			<bWater>0</bWater>
			<bRiver>0</bRiver>
			<bPower>0</bPower>
			<bDirtyPower>0</bDirtyPower>
			<bAreaCleanPower>0</bAreaCleanPower>
			<DiploVoteType>NONE</DiploVoteType>
			<bForceTeamVoteEligible>0</bForceTeamVoteEligible>
			<bCapital>0</bCapital>
			<bGovernmentCenter>0</bGovernmentCenter>
			<bGoldenAge>0</bGoldenAge>
			<bAllowsNukes>0</bAllowsNukes>
			<bMapCentering>0</bMapCentering>
			<bNoUnhappiness>0</bNoUnhappiness>
			<bNoUnhealthyPopulation>0</bNoUnhealthyPopulation>
			<bBuildingOnlyHealthy>0</bBuildingOnlyHealthy>
			<bNeverCapture>0</bNeverCapture>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqReligion>0</bPrereqReligion>
			<bCenterInCity>0</bCenterInCity>
			<iAIWeight>0</iAIWeight>
			<iCost>-1</iCost>
			<iHurryCostModifier>100</iHurryCostModifier>
			<iAdvancedStartCost>-1</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMinAreaSize>-1</iMinAreaSize>
			<iConquestProb>50</iConquestProb>
			<iCitiesPrereq>0</iCitiesPrereq>
			<iTeamsPrereq>0</iTeamsPrereq>
			<iLevelPrereq>0</iLevelPrereq>
			<iMinLatitude>0</iMinLatitude>
			<iMaxLatitude>90</iMaxLatitude>
			<iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
			<iGreatGeneralRateModifier>0</iGreatGeneralRateModifier>
			<iDomesticGreatGeneralRateModifier>0</iDomesticGreatGeneralRateModifier>
			<iGlobalGreatPeopleRateModifier>0</iGlobalGreatPeopleRateModifier>
			<iAnarchyModifier>0</iAnarchyModifier>
			<iGoldenAgeModifier>0</iGoldenAgeModifier>
			<iGlobalHurryModifier>0</iGlobalHurryModifier>
			<iExperience>0</iExperience>
			<iGlobalExperience>0</iGlobalExperience>
			<iFoodKept>0</iFoodKept>
			<iAirlift>0</iAirlift>
			<iAirModifier>0</iAirModifier>
			<iAirUnitCapacity>0</iAirUnitCapacity>
			<iNukeModifier>0</iNukeModifier>
			<iNukeExplosionRand>0</iNukeExplosionRand>
			<iFreeSpecialist>0</iFreeSpecialist>
			<iAreaFreeSpecialist>0</iAreaFreeSpecialist>
			<iGlobalFreeSpecialist>0</iGlobalFreeSpecialist>
			<iMaintenanceModifier>0</iMaintenanceModifier>
			<iWarWearinessModifier>0</iWarWearinessModifier>
			<iGlobalWarWearinessModifier>0</iGlobalWarWearinessModifier>
			<iEnemyWarWearinessModifier>0</iEnemyWarWearinessModifier>
			<iHealRateChange>0</iHealRateChange>
			<iHealth>0</iHealth>
			<iAreaHealth>0</iAreaHealth>
			<iGlobalHealth>0</iGlobalHealth>
			<iHappiness>0</iHappiness>
			<iAreaHappiness>0</iAreaHappiness>
			<iGlobalHappiness>0</iGlobalHappiness>
			<iStateReligionHappiness>0</iStateReligionHappiness>
			<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
			<iMilitaryProductionModifier>0</iMilitaryProductionModifier>
			<iSpaceProductionModifier>0</iSpaceProductionModifier>
			<iGlobalSpaceProductionModifier>0</iGlobalSpaceProductionModifier>
			<iTradeRoutes>0</iTradeRoutes>
			<iCoastalTradeRoutes>0</iCoastalTradeRoutes>
			<iGlobalTradeRoutes>0</iGlobalTradeRoutes>
			<iTradeRouteModifier>0</iTradeRouteModifier>
			<iForeignTradeRouteModifier>0</iForeignTradeRouteModifier>
			<iGlobalPopulationChange>0</iGlobalPopulationChange>
			<iFreeTechs>0</iFreeTechs>
			<iDefense>0</iDefense>
			<iBombardDefense>0</iBombardDefense>
			<iAllCityDefense>0</iAllCityDefense>
			<iEspionageDefense>0</iEspionageDefense>
			<iAsset>0</iAsset>
			<iPower>0</iPower>
			<fVisibilityPriority>0.0</fVisibilityPriority>
			<SeaPlotYieldChanges />
			<RiverPlotYieldChanges />
			<GlobalSeaPlotYieldChanges />
			<YieldChanges>
				<iYield>0</iYield>
				<iYield>1</iYield>
				<iYield>0</iYield>
			</YieldChanges>
			<CommerceChanges>
				<iCommerce>1</iCommerce>
				<iCommerce>0</iCommerce>
				<iCommerce>3</iCommerce>
				<iCommerce>0</iCommerce>
			</CommerceChanges>
			<ObsoleteSafeCommerceChanges>
				<iCommerce>0</iCommerce>
				<iCommerce>0</iCommerce>
				<iCommerce>0</iCommerce>
			</ObsoleteSafeCommerceChanges>
			<CommerceChangeDoubleTimes />
			<CommerceModifiers />
			<GlobalCommerceModifiers />
			<SpecialistExtraCommerces />
			<StateReligionCommerces />
			<CommerceHappinesses />
			<ReligionChanges />
			<SpecialistCounts />
			<FreeSpecialistCounts />
			<CommerceFlexibles />
			<CommerceChangeOriginalOwners />
			<ConstructSound />
			<BonusHealthChanges />
			<BonusHappinessChanges />
			<BonusProductionModifiers />
			<UnitCombatFreeExperiences />
			<DomainFreeExperiences />
			<DomainProductionModifiers />
			<BuildingHappinessChanges />
			<PrereqBuildingClasses />
			<BuildingClassNeededs>
[COLOR="Red"][B]				<PrereqOrBuildingClass>
					<BuildingClassType>BUILDINGCLASS_WATER_PIPES</BuildingClassType>
					<bPrereqBuildingClass>1</bPrereqBuildingClass>
				</PrereqOrBuildingClass>[/B][/COLOR]
				<BuildingClassNeeded>
					<BuildingClassType>BUILDINGCLASS_SEWER_SYSTEM</BuildingClassType>
					<bNeededInCity>1</bNeededInCity>
				</BuildingClassNeeded>
			</BuildingClassNeededs>
			<bPrereqPower>1</bPrereqPower>
			<SpecialistYieldChanges />
			<BonusYieldModifiers />
			<ImprovementFreeSpecialists />
			<Flavors />
			<HotKey />
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<ReplaceBuildings>
				<ReplaceBuilding>
					<BuildingClassType>BUILDINGCLASS_HOUSE_ERA4_LDLW</BuildingClassType>
					<bReplace>1</bReplace>
				</ReplaceBuilding>
				<ReplaceBuilding>
					<BuildingClassType>BUILDINGCLASS_COLONY_ARCO</BuildingClassType>
					<bReplace>1</bReplace>
				</ReplaceBuilding>
				<ReplaceBuilding>
					<BuildingClassType>BUILDINGCLASS_LAUNCH_ARCO</BuildingClassType>
					<bReplace>1</bReplace>
				</ReplaceBuilding>
			</ReplaceBuildings>
			<bAutoBuild>1</bAutoBuild>
		</BuildingInfo>

Now the question must the red marked BuildingClass go into PrereqOrBuildingClasses or must it just be changed to BuildingClassNeeded?

BTW. To anyone using Copy&Paste make sure what you Copy is correct because i already saw this some times across the xml files. One new e.g. Building was created with errors and then it has been copied a few times with the errors still in place:nono:
 
Back
Top Bottom