Originally posted by LDiCesare
The xml reflects exactly what is in the code. Thinking about it first is a good idea as it will also provide you with the interfaces (api) of the (public) classes you will manipulate.
The xml reflects exactly what is in the code. Thinking about it first is a good idea as it will also provide you with the interfaces (api) of the (public) classes you will manipulate.

Right now I am working on integrating the new system of diplomatic statuses into the rest of the game. I have pretty much succeeded, and about the only thing left now is the ability to read the stuff from the XML file. I have taken a look at the XML interface, and the ObjectBuilder class, and I think I kind of understand how the process works, but I am still not sure how I should go about putting the stuff together. Though I have not yet attempted to do it, I would like to first have a clear understanding of how the stuff works.
So, I guess I wil describe the data structure first. There is a class called DiplomaticStatuses. It contains all of the diplomatic statuses for the game. Inside, it has a setStatus() method, that takes in two civilizations, and a StatusStrength object. Now, status strength itself is an abstract class. But the acceptable values for the value to pass in are the children of the class, static classes: War, Peace, and Alliance.
Sooo, I suppose the XML should then look like this (on an example of delenda scenario):
Code:
<diplomaticstatuses> <status> <civilization>Rome</civilization> <civilization>Carthage</civilization> <diplomaticstrength> <war /> </diplomaticstrength> </status> </diplomaticstatuses>
Given that I include the xml interface and the appropriate static function in classes DiplomaticStatuses, and all of the subclasses of DiplomaticStrength. Is that how it is supposed to work, or am I missing something?
Comment