Jump to content
XCOMUFO & Xenocide

Xml And Game Transactions


bpuk

Recommended Posts

OK, time to look at the schema for buying/selling :)

 

At the moment we have price/upkeep defined invididually in combatants.xml, crafts.xml and facilities.xml

 

no prices defined for items.

 

Should all the prices and upkeeps go in a transactions.xml file, or should I add (optional)price to the schema for items?

 

Also - which file should I be putting costs for scientists/engineers in?

 

Ta

Ben

Link to comment
Share on other sites

OK - I'm going with a transactions.xml - at least for items and personell, crafts/facilities may be added later (if needed)

<transactions>
   <action name="ActionName" keys="Ctrl-T"/>
   <transaction name="PERSONELL_ENGINEER" category="PERSONELL">
       <price purchase="75000" sell="0"/>
       <upkeep cost="2000"/>
   </transaction>
   <transaction name="PERSONELL_SCIENTIST" category="PERSONELL">
       <price purchase="75000" sell="0"/>
       <upkeep cost="2000"/>
   </transaction>    
   <transaction name="ITEM_PISTOL" category="SMALLARMS">
       <price purchase="5000" sell="2000"/>
       <upkeep cost="0"/>
   </transaction>    
     .... etc.
</transactions>

 

Figures, per usual, off the top of my head.

 

Comments?

 

Ta

Ben

Edited by bpuk
Link to comment
Share on other sites

<action name="ActionName" keys="Ctrl-T"/>

 

What's that? :D

 

BTW, I think upkeep cost can be included into price

<price purchase="75000" sell="0" upkeep="2000"/>

Unless there is a reason for separating.

 

*cough* copy-paste error... :Coffee:

 

OK, integrated into schema - upkeep optional. Slight changes (on further consideration)

 

<transactionTable>
<transaction name="PERSONELL_ENGINEER" purchasable="yes" buildable="no">
 <price purchase="75000" sell="0" upkeep="2000"/>
</transaction>
<transaction name="PERSONELL_SCIENTIST" purchasable="yes" buildable="no">
 <price purchase="75000" sell="0" upkeep="2000"/>
</transaction>    
<transaction name="ITEM_PISTOL" purchasable="yes" buildable="no">
 <price purchase="5000" sell="2000"/>
</transaction>  
</transactionTable>
<transactionCategories>
<category name="SMALLARMS">
 <item name="ITEM_PISTOL"/>
</category>
<category name="PERSONELL">
 <item name="PERSONELL_SCIENTIST"/>
 <item name="PERSONELL_ENGINEER"/>
</category>
</transactionCategories>

 

Splitting the categories is much easier to parse when it comes to building the buy/sell lists :)

 

Ta

Ben

Link to comment
Share on other sites

Sorry for (repeated) double post...

I've stripped the categories out of the [temp] schema for the moment, need to think on the best way of handling them. Possibly in a second file

 

Added transactions.{xml,xsd}

 

added core/transactions/transactions.{cpp,h} (Yes, I do have a reason for putting it here. There'll probably be another class pair, and possibly a third. Could be wrong though - if so, feel free to move it to staticdata and tell me off :))

 

class Transaction is the xenocide interface to the transaction.xml file

 

Basic testing done only, some old (commented) code still in there - will be modified and corrected in next patch.

 

Patch attached :D

 

Ta

Ben

 

EDIT 1: Found (stupid) mistake in attachment - removed

EDIT 2: Corrected stupid mistake - attached

transactions_xml_corrected.zip

Edited by bpuk
Link to comment
Share on other sites

×
×
  • Create New...