New "mini" Feature: Added possibility to set optional Tag <mAbsolutePrice> in MercStartingGear.xml to define absolute prices for gearkits (by Tais)

- I put both (startup and gearkit selection in BR's) the initializations for gearkit prices into if's that will check if the absolute price is higher than -1 and lower or equal to 32000 (INT16)
- I also added the reading of the tag in xml_mercstartinggear.cpp, to be able to support zero priced gearkits in absolute prices I set the absolute price of a gearkit to -1 on opening tag of a gearkit, if there's an mAbsolutePrice tag set in the gearkit it will override the value, if not nothing happens and all will behave normal
- so nothing will change in 1.13 as it is, it will just give modders the ability to set absolute prices with a new tag

TODO: Maybe we should also add this optional <mAbsolutePrice> tag to the XML Editor in the future.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4868 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2011-12-27 15:39:52 +00:00
parent 133d921328
commit 7ba509cd40
5 changed files with 73 additions and 47 deletions
+10 -2
View File
@@ -66,11 +66,13 @@ MercStartingGearStartElementHandle(void *userData, const XML_Char *name, const X
else if(strcmp(name, "GEARKIT") == 0 && pData->curElement == ELEMENT)
{
pData->curElement = ELEMENT_SUBLIST;
pData->maxReadDepth++;
//tais: absolute price needs to be set to -1 at start of every gearkit, if there's no tag for it the value will stay -1 and will be ignored in the code
pData->curMercStartingGear.AbsolutePrice = -1;
}
else if(pData->curElement == ELEMENT_SUBLIST &&
(strcmp(name, "mPriceMod") == 0 ||
(strcmp(name, "mAbsolutePrice") == 0 ||
strcmp(name, "mPriceMod") == 0 ||
strcmp(name, "mHelmet") == 0 ||
strcmp(name, "mHelmetStatus") == 0 ||
strcmp(name, "mHelmetDrop") == 0 ||
@@ -206,6 +208,7 @@ MercStartingGearEndElementHandle(void *userData, const XML_Char *name)
pData->curArray[pData->curIndex][pData->curGears] = pData->curMercStartingGear; //write the armour into the table
//CHRISL: after writing the gearkit, we need to clear gear data so it won't inadvertantly be reused
pData->curMercStartingGear.PriceModifier = 0;
pData->curMercStartingGear.AbsolutePrice = -1;
for(unsigned int i = 0; i < pData->curMercStartingGear.inv.size(); i++)
{
pData->curMercStartingGear.inv[i] = 0;
@@ -229,6 +232,11 @@ MercStartingGearEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT_SUBLIST;
pData->curMercStartingGear.PriceModifier = (int) atol(pData->szCharData);
}
else if(strcmp(name, "mAbsolutePrice") == 0)
{
pData->curElement = ELEMENT_SUBLIST;
pData->curMercStartingGear.AbsolutePrice = (int) atol(pData->szCharData);
}
else if(strcmp(name, "mHelmet") == 0)
{
pData->curElement = ELEMENT_SUBLIST;