mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Bugfix: WF and DG merc speech was not working
o The file "SoundProfiles.xml" was referenced in the wrong directory - XML file reference cleanup and check - Deleted unused files git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5814 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1136,14 +1136,6 @@ if ( ReadXMLEmail == TRUE )
|
||||
}
|
||||
#endif
|
||||
|
||||
// WANNE: The file "TableData/Text/TacticalMessages.xml" is not yet used
|
||||
#if 0
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, TEXTFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
SGP_THROW_IFFALSE(ReadInLanguageLocation(fileName,FALSE,zlanguageText,0), TEXTFILENAME);
|
||||
#endif
|
||||
|
||||
#ifndef ENGLISH
|
||||
AddLanguagePrefix(fileName);
|
||||
if ( FileExists(fileName) )
|
||||
|
||||
+60
-118
@@ -61,23 +61,21 @@ typedef PARSE_STAGE;
|
||||
#define COMPATIBLEFACEITEMSFILENAME "Items\\CompatibleFaceItems.xml"
|
||||
#define MERGESFILENAME "Items\\Merges.xml"
|
||||
#define ATTACHMENTCOMBOMERGESFILENAME "Items\\AttachmentComboMerges.xml"
|
||||
// HEADROCK HAM 5: Item Transformations Filename
|
||||
#define ITEMTRANSFORMATIONSFILENAME "Items\\Item_Transformations.xml"
|
||||
#define MAGAZINESFILENAME "Items\\Magazines.xml"
|
||||
#define ARMOURSFILENAME "Items\\Armours.xml"
|
||||
#define EXPLOSIVESFILENAME "Items\\Explosives.xml"
|
||||
#define DRUGSFILENAME "Items\\Drugs.xml"
|
||||
#define FOODFILENAME "Items\\Food.xml"
|
||||
#define MERCHANTSFILENAME "NPCInventory\\Merchants.xml"
|
||||
#define CLOTHESFILENAME "Items\\Clothes.xml"
|
||||
#define RANDOMITEMFILENAME "Items\\RandomItem.xml"
|
||||
#define AMMOFILENAME "Items\\AmmoStrings.xml"
|
||||
#define AMMOTYPESFILENAME "Items\\AmmoTypes.xml"
|
||||
#define INCOMPATIBLEATTACHMENTSFILENAME "Items\\IncompatibleAttachments.xml"
|
||||
#define ATTACHMENTSLOTSFILENAME "Items\\AttachmentSlots.xml"
|
||||
#define IMPITEMCHOICESFILENAME "Inventory\\IMPItemChoices.xml"
|
||||
#define LOADBEARINGEQUIPMENTFILENAME "Items\\LoadBearingEquipment.xml"
|
||||
#define EXPLOSIONDATAFILENAME "Items\\ExplosionData.xml"
|
||||
|
||||
// Flugente: added new gun and item choices for different soldier classes
|
||||
#define ENEMYGUNCHOICESFILENAME "Inventory\\EnemyGunChoices.xml" // default selection
|
||||
#define GUNCHOICESFILENAME_ENEMY_ADMIN "Inventory\\GunChoices_Enemy_Admin.xml"
|
||||
#define GUNCHOICESFILENAME_ENEMY_REGULAR "Inventory\\GunChoices_Enemy_Regular.xml"
|
||||
@@ -85,7 +83,6 @@ typedef PARSE_STAGE;
|
||||
#define GUNCHOICESFILENAME_MILITIA_GREEN "Inventory\\GunChoices_Militia_Green.xml"
|
||||
#define GUNCHOICESFILENAME_MILITIA_REGULAR "Inventory\\GunChoices_Militia_Regular.xml"
|
||||
#define GUNCHOICESFILENAME_MILITIA_ELITE "Inventory\\GunChoices_Militia_Elite.xml"
|
||||
|
||||
#define ENEMYITEMCHOICESFILENAME "Inventory\\EnemyItemChoices.xml" // default selection
|
||||
#define ITEMCHOICESFILENAME_ENEMY_ADMIN "Inventory\\ItemChoices_Enemy_Admin.xml"
|
||||
#define ITEMCHOICESFILENAME_ENEMY_REGULAR "Inventory\\ItemChoices_Enemy_Regular.xml"
|
||||
@@ -93,19 +90,21 @@ typedef PARSE_STAGE;
|
||||
#define ITEMCHOICESFILENAME_MILITIA_GREEN "Inventory\\ItemChoices_Militia_Green.xml"
|
||||
#define ITEMCHOICESFILENAME_MILITIA_REGULAR "Inventory\\ItemChoices_Militia_Regular.xml"
|
||||
#define ITEMCHOICESFILENAME_MILITIA_ELITE "Inventory\\ItemChoices_Militia_Elite.xml"
|
||||
|
||||
// CHRISL:
|
||||
#define LOADBEARINGEQUIPMENTFILENAME "Items\\LoadBearingEquipment.xml"
|
||||
#define IMPITEMCHOICESFILENAME "Inventory\\IMPItemChoices.xml"
|
||||
#define LBEPOCKETFILENAME "Inventory\\Pockets.xml"
|
||||
// THE_BOB : added for pocket popup definitions
|
||||
#define LBEPOCKETPOPUPFILENAME "Inventory\\PocketPopups.xml"
|
||||
|
||||
#define MERCSTARTINGGEARFILENAME "Inventory\\MercStartingGear.xml"
|
||||
#define ENEMYWEAPONDROPSFILENAME "Inventory\\EnemyWeaponDrops.xml"
|
||||
#define ENEMYAMMODROPSFILENAME "Inventory\\EnemyAmmoDrops.xml"
|
||||
#define ENEMYEXPLOSIVEDROPSFILENAME "Inventory\\EnemyExplosiveDrops.xml"
|
||||
#define ENEMYARMOURDROPSFILENAME "Inventory\\EnemyArmourDrops.xml"
|
||||
#define ENEMYMISCDROPSFILENAME "Inventory\\EnemyMiscDrops.xml"
|
||||
|
||||
#ifdef JA2UB
|
||||
#define MERCSTARTINGGEAR25FILENAME "Inventory\\MercStartingGear25.xml" //ja25 ub
|
||||
#define MERCSTARTINGGEAR25FILENAME "Inventory\\MercStartingGear25.xml"
|
||||
#endif
|
||||
|
||||
#define MERCHANTSFILENAME "NPCInventory\\Merchants.xml"
|
||||
#define TONYINVENTORYFILENAME "NPCInventory\\TonyInventory.xml"
|
||||
#define DEVININVENTORYFILENAME "NPCInventory\\DevinInventory.xml"
|
||||
#define FRANZINVENTORYFILENAME "NPCInventory\\FranzInventory.xml"
|
||||
@@ -148,18 +147,15 @@ typedef PARSE_STAGE;
|
||||
#define ADITIONALDEALER_20_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_20_Inventory.xml"
|
||||
|
||||
#ifdef JA2UB
|
||||
#define BETTYINVENTORYFILENAME "NPCInventory\\BettyInventory.xml"
|
||||
#define RAULINVENTORYFILENAME "NPCInventory\\RaulInventory.xml"
|
||||
#define BETTYINVENTORYFILENAME "NPCInventory\\BettyInventory.xml"
|
||||
#define RAULINVENTORYFILENAME "NPCInventory\\RaulInventory.xml"
|
||||
#endif
|
||||
|
||||
#define BOBBYRAYSTRINGSFILENAME "BobbyRayStrings.xml"
|
||||
#define AMMOCALIBERSTRINGSFILENAME "AmmoCaliberStrings.xml"
|
||||
|
||||
#define SOUNDSFILENAME "Sounds\\Sounds.xml"
|
||||
#define BURSTSOUNDSFILENAME "Sounds\\BurstSounds.xml"
|
||||
#define SOUNDPROFILE "Sounds\\SoundsProfiles.xml"
|
||||
|
||||
#define EXPLOSIONDATAFILENAME "Items\\ExplosionData.xml"
|
||||
|
||||
#define SECTORLOADSCREENSFILENAME "Map\\SectorLoadscreens.xml"
|
||||
#define CITYTABLEFILENAME "Map\\Cities.xml"
|
||||
#define MOVEMENTCOSTFILENAME "Map\\MovementCosts.xml"
|
||||
#define ALTSECTORSFILENAME "Map\\AltSectors.xml"
|
||||
@@ -167,124 +163,73 @@ typedef PARSE_STAGE;
|
||||
#define ROAMINGMILITIAFILENAME "Map\\RestrictedRoamingMilitia.xml"
|
||||
#define EXTRAITEMSFILENAME "Map\\A9_0_ExtraItems" // ".xml" will be added @runtime
|
||||
#define EXTRAITEMSFILENAME2 "Map\\A11_0_ExtraItems" // ".xml" will be added @runtime
|
||||
#define SHIPPINGDESTINATIONSFILENAME "Map\\ShippingDestinations.xml"
|
||||
#define DELIVERYMETHODSFILENAME "Map\\DeliveryMethods.xml"
|
||||
#define DELIVERYMETHODSFILENAME "Map\\DeliveryMethods.xml"
|
||||
#define SECTORFACILITIESFILENAME "Map\\Facilities.xml"
|
||||
#define DYNAMICROAMINGFILENAME "Map\\DynamicRestrictions.xml"
|
||||
#define FACILITYTYPESFILENAME "Map\\FacilityTypes.xml"
|
||||
#define SECTORNAMESFILENAME "Map\\SectorNames.xml"
|
||||
#define COOLNESSBYSECTORFILENAME "Map\\CoolnessBySector.xml"
|
||||
#define BLOODCATPLACEMENTSFILENAME "Map\\BloodcatPlacements.xml"
|
||||
#define SECTORLEVEL1NAMESFILENAME "Map\\SectorNamesLevel_1.xml"
|
||||
#define SECTORLEVEL2NAMESFILENAME "Map\\SectorNamesLevel_2.xml"
|
||||
#define SECTORLEVEL3NAMESFILENAME "Map\\SectorNamesLevel_3.xml"
|
||||
|
||||
#define GARRISONFILENAME "Army\\GarrisonGroups.xml"
|
||||
#define PATROLFILENAME "Army\\PatrolGroups.xml"
|
||||
#define COMPOSITIONFILENAME "Army\\ArmyComposition.xml"
|
||||
#define UNIFORMCOLORSFILENAME "Army\\UniformColors.xml"
|
||||
|
||||
// WANNE: drops filename
|
||||
#define ENEMYWEAPONDROPSFILENAME "Inventory\\EnemyWeaponDrops.xml"
|
||||
#define ENEMYAMMODROPSFILENAME "Inventory\\EnemyAmmoDrops.xml"
|
||||
#define ENEMYEXPLOSIVEDROPSFILENAME "Inventory\\EnemyExplosiveDrops.xml"
|
||||
#define ENEMYARMOURDROPSFILENAME "Inventory\\EnemyArmourDrops.xml"
|
||||
#define ENEMYMISCDROPSFILENAME "Inventory\\EnemyMiscDrops.xml"
|
||||
|
||||
// WANNE: Sector loadscreens [2007-05-18]
|
||||
#define SECTORLOADSCREENSFILENAME "Map\\SectorLoadscreens.xml"
|
||||
|
||||
//zilpin: pellet spread patterns externalized in XML
|
||||
#define SPREADPATTERNSFILENAME "SpreadPatterns.xml"
|
||||
#define DELIVERYMETHODSFILENAME "Map\\DeliveryMethods.xml"
|
||||
|
||||
// Dealtar: Shipping destinations and delivery methods
|
||||
#define SHIPPINGDESTINATIONSFILENAME "Map\\ShippingDestinations.xml"
|
||||
#define DELIVERYMETHODSFILENAME "Map\\DeliveryMethods.xml"
|
||||
// Gotthard: Laptop Text files [2007-10-16]
|
||||
#define LAPTOPFLORISTTEXTFILENAME "Laptop\\Florist.xml"
|
||||
#define LAPTOPFUNERALTEXTFILENAME "Laptop\\Funeral.xml"
|
||||
#define LAPTOPBOBBYRAYSTEXTFILENAME "Laptop\\BobbyRays.xml"
|
||||
|
||||
// Gotthard: Website Picture/Text Locations [2007-11-04]
|
||||
#define LAPTOPFLORISTLOCATIONFILENAME "Laptop\\FloristPositions.xml"
|
||||
#define LAPTOPFUNERALLOCATIONFILENAME "Laptop\\FuneralPositions.xml"
|
||||
|
||||
#define EMAILSENDERNAMELIST "Email\\EmailSenderNameList.xml"
|
||||
#define EMAILMERCAVAILABLE "Email\\EmailMercAvailable.xml"
|
||||
#define EMAILMERCLEVELUP "Email\\EmailMercLevelUp.xml"
|
||||
#define EMAILOTHER "Email\\EmailOther.xml"
|
||||
#define EMAILINSURANCE "Email\\EmailInsurance.xml"
|
||||
|
||||
#define ENCYCLOPEDIALOCATIONFILENAME "Encyclopedia\\EncyclopediaLocations.xml"
|
||||
#define ENCYCLOPEDIAPROFILEFILENAME "Encyclopedia\\EncyclopediaProfiles.xml"
|
||||
#define ENCYCLOPEDIAINVENTORYFILENAME "Encyclopedia\\EncyclopediaInventory.xml"
|
||||
#define ENCYCLOPEDIAOTHERFILENAME "Encyclopedia\\EncyclopediaOthers.xml"
|
||||
#define ENCYCLOPEDIAQUESTSFILENAME "Encyclopedia\\EncyclopediaQuests.xml"
|
||||
|
||||
#define BRIEFINGROOMFILENAME "BriefingRoom\\BriefingRoom.xml"
|
||||
|
||||
#define MULTIPLAYERTEAMSFILENAME "Multiplayer\\RandomTeams.xml"
|
||||
|
||||
// HEADROCK HAM 3.4: Facility Locations [2009-05-19]
|
||||
#define SECTORFACILITIESFILENAME "Map\\Facilities.xml"
|
||||
// HEADROCK HAM 3.4: Dynamic Roaming Restrictions [2009-05-19]
|
||||
#define DYNAMICROAMINGFILENAME "Map\\DynamicRestrictions.xml"
|
||||
// HEADROCK HAM 3.5: Facility Types [2009-06-14]
|
||||
#define FACILITYTYPESFILENAME "Map\\FacilityTypes.xml"
|
||||
// HEADROCK HAM 3.6: Sector Names [2009-07-27]
|
||||
#define SECTORNAMESFILENAME "Map\\SectorNames.xml"
|
||||
// HEADROCK HAM 5: Coolness by Sector [2011-11-19]
|
||||
#define COOLNESSBYSECTORFILENAME "Map\\CoolnessBySector.xml"
|
||||
// HEADROCK PROFEX: Merc Profiles [2009-07-27]
|
||||
#define MERCPROFILESFILENAME "MercProfiles.xml"
|
||||
// HEADROCK PROFEX: Merc Opinions [2009-07-27]
|
||||
#define MERCOPINIONSFILENAME "MercOpinions.xml"
|
||||
// WANNE: The merc quotes
|
||||
#define MERCQUOTEFILENAME "MercQuote.xml"
|
||||
// HEADROCK HAM 3.6: Bloodcat Placements [2009-07-31]
|
||||
#define BLOODCATPLACEMENTSFILENAME "Map\\BloodcatPlacements.xml"
|
||||
// HEADROCK HAM 3.6: Uniform Colors [2009-09-29]
|
||||
#define UNIFORMCOLORSFILENAME "Army\\UniformColors.xml"
|
||||
#define ACTIONITEMSFILENAME "MapAction\\Actionitems.xml"
|
||||
|
||||
//SMALL FACES
|
||||
#define RPCFACESSMALLFILENAME "RPCFacesSmall.xml"
|
||||
#define LAYOUTMAINMENU "Layout\\LayoutMainMenu.xml"
|
||||
|
||||
//Hidden Names
|
||||
#define HIDDENNAMESFILENAME "HiddenNames.xml"
|
||||
|
||||
//Enemy Names
|
||||
#define ENEMYNAMESFILENAME "EnemyNames.xml"
|
||||
|
||||
//Enemy RANK
|
||||
#define ENEMYRANKFILENAME "EnemyRank.xml"
|
||||
|
||||
//CIV Names
|
||||
#define AIMAVAILABILITY "AimAvailability.xml"
|
||||
#define CIVGROUPNAMESFILENAME "CivGroupNames.xml"
|
||||
|
||||
#define ACTIONITEMSFILENAME "MapAction\\Actionitems.xml"
|
||||
|
||||
#define IMPPORTRAITS "IMPPortraits.xml"
|
||||
#define ENEMYNAMESFILENAME "EnemyNames.xml"
|
||||
#define ENEMYRANKFILENAME "EnemyRank.xml"
|
||||
#define FACEGEARFILENAME "FaceGear.xml"
|
||||
#define HIDDENNAMESFILENAME "HiddenNames.xml"
|
||||
#define IMPPORTRAITS "IMPPortraits.xml"
|
||||
#define MERCAVAILABILITY "MercAvailability.xml"
|
||||
#define MERCOPINIONSFILENAME "MercOpinions.xml"
|
||||
#define MERCPROFILESFILENAME "MercProfiles.xml"
|
||||
|
||||
#ifdef JA2UB
|
||||
// UB
|
||||
#define MERCPROFILESFILENAME25 "MercProfiles25.xml"
|
||||
// UB
|
||||
#define MERCOPINIONSFILENAME25 "MercOpinions25.xml"
|
||||
#define MERCPROFILESFILENAME25 "MercProfiles25.xml"
|
||||
#define MERCOPINIONSFILENAME25 "MercOpinions25.xml"
|
||||
#endif
|
||||
|
||||
#define SOUNDPROFILE "SoundsProfiles.xml"
|
||||
|
||||
#define RANDOMSTATS "RandomStats.xml"
|
||||
|
||||
#define SECTORLEVEL1NAMESFILENAME "Map\\SectorNamesLevel_1.xml"
|
||||
#define SECTORLEVEL2NAMESFILENAME "Map\\SectorNamesLevel_2.xml"
|
||||
#define SECTORLEVEL3NAMESFILENAME "Map\\SectorNamesLevel_3.xml"
|
||||
|
||||
#define LAYOUTMAINMENU "Layout\\LayoutMainMenu.xml"
|
||||
#define INTROFILESFILENAME "IntroFiles.xml"
|
||||
#define MERCAVAILABILITY "MercAvailability.xml"
|
||||
|
||||
#define AIMAVAILABILITY "AimAvailability.xml"
|
||||
|
||||
#define QUOTEARRAYFILENAME "MercQuote.xml"
|
||||
|
||||
#define FACEGEARFILENAME "FaceGear.xml"
|
||||
|
||||
//Sender Name List
|
||||
#define EMAILSENDERNAMELIST "Email\\EmailSenderNameList.xml"
|
||||
#define EMAILMERCAVAILABLE "Email\\EmailMercAvailable.xml"
|
||||
#define EMAILMERCLEVELUP "Email\\EmailMercLevelUp.xml"
|
||||
#define EMAILOTHER "Email\\EmailOther.xml"
|
||||
#define EMAILINSURANCE "Email\\EmailInsurance.xml"
|
||||
|
||||
|
||||
#define VEHICLESFILENAME "Vehicles.xml"
|
||||
|
||||
#define TEXTFILENAME "Text\\TacticalMessages.xml"
|
||||
|
||||
#define ENCYCLOPEDIALOCATIONFILENAME "Encyclopedia\\EncyclopediaLocations.xml"
|
||||
#define ENCYCLOPEDIAPROFILEFILENAME "Encyclopedia\\EncyclopediaProfiles.xml"
|
||||
#define ENCYCLOPEDIAINVENTORYFILENAME "Encyclopedia\\EncyclopediaInventory.xml"
|
||||
#define ENCYCLOPEDIAOTHERFILENAME "Encyclopedia\\EncyclopediaOthers.xml"
|
||||
#define ENCYCLOPEDIAQUESTSFILENAME "Encyclopedia\\EncyclopediaQuests.xml"
|
||||
#define BRIEFINGROOMFILENAME "BriefingRoom\\BriefingRoom.xml"
|
||||
|
||||
#define OLDAIMARCHIVEFILENAME "OldAIMArchive.xml"
|
||||
#define MERCQUOTEFILENAME "MercQuote.xml"
|
||||
#define OLDAIMARCHIVEFILENAME "OldAIMArchive.xml"
|
||||
#define RANDOMSTATS "RandomStats.xml"
|
||||
#define RPCFACESSMALLFILENAME "RPCFacesSmall.xml"
|
||||
#define SPREADPATTERNSFILENAME "SpreadPatterns.xml"
|
||||
#define VEHICLESFILENAME "Vehicles.xml"
|
||||
|
||||
extern BOOLEAN ReadInItemStats(STR fileName, BOOLEAN localizedVersion);
|
||||
extern BOOLEAN WriteItemStats();
|
||||
@@ -295,9 +240,6 @@ extern BOOLEAN WriteAttachmentStats();
|
||||
extern BOOLEAN ReadInAttachmentInfoStats(STR fileName);
|
||||
extern BOOLEAN WriteAttachmentInfoStats();
|
||||
|
||||
extern BOOLEAN ReadInStringArray(STR fileName);
|
||||
extern BOOLEAN WriteStringArray();
|
||||
|
||||
extern BOOLEAN ReadInMagazineStats(STR fileName);
|
||||
extern BOOLEAN WriteMagazineStats();
|
||||
|
||||
|
||||
@@ -773,10 +773,6 @@
|
||||
RelativePath=".\XML_SenderNameList.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_Strings.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XMLProperties.cpp"
|
||||
>
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
#ifdef JA2_PRECOMPILEDHEADERS
|
||||
#include "Tactical All.h"
|
||||
#else
|
||||
#include "sgp.h"
|
||||
#include "overhead types.h"
|
||||
#include "Sound Control.h"
|
||||
#include "overhead.h"
|
||||
#include "Event Pump.h"
|
||||
#include "weapons.h"
|
||||
#include "Animation Control.h"
|
||||
#include "sys globals.h"
|
||||
#include "Handle UI.h"
|
||||
#include "Isometric Utils.h"
|
||||
#include "worldman.h"
|
||||
#include "math.h"
|
||||
#include "points.h"
|
||||
#include "ai.h"
|
||||
#include "los.h"
|
||||
#include "renderworld.h"
|
||||
#include "opplist.h"
|
||||
#include "interface.h"
|
||||
#include "message.h"
|
||||
#include "campaign.h"
|
||||
#include "items.h"
|
||||
#include "text.h"
|
||||
#include "tile animation.h"
|
||||
#include "Dialogue Control.h"
|
||||
#include "SkillCheck.h"
|
||||
#include "explosion control.h"
|
||||
#include "Quests.h"
|
||||
#include "Physics.h"
|
||||
#include "Random.h"
|
||||
#include "Vehicles.h"
|
||||
#include "bullets.h"
|
||||
#include "morale.h"
|
||||
#include "meanwhile.h"
|
||||
#include "SkillCheck.h"
|
||||
#include "gamesettings.h"
|
||||
#include "SaveLoadMap.h"
|
||||
#include "Debug Control.h"
|
||||
#include "expat.h"
|
||||
#include "XML.h"
|
||||
#endif
|
||||
|
||||
struct
|
||||
{
|
||||
PARSE_STAGE curElement;
|
||||
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
|
||||
UINT32 maxArraySize;
|
||||
UINT32 curIndex;
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
}
|
||||
typedef stringParseData;
|
||||
|
||||
static void XMLCALL
|
||||
stringStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
stringParseData * pData = (stringParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(strcmp(name, "STRINGLIST") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "STRING") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
pData->curIndex++;
|
||||
}
|
||||
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
|
||||
pData->currentDepth++;
|
||||
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
stringCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
stringParseData * pData = (stringParseData *)userData;
|
||||
|
||||
if( (pData->currentDepth <= pData->maxReadDepth) &&
|
||||
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
|
||||
){
|
||||
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void XMLCALL
|
||||
stringEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
stringParseData * pData = (stringParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
||||
{
|
||||
if(strcmp(name, "STRINGLIST") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if(strcmp(name, "STRING") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
if(pData->curIndex < pData->maxArraySize)
|
||||
{
|
||||
swprintf(AmmoCaliber[pData->curIndex], L"%S", pData->szCharData);
|
||||
}
|
||||
}
|
||||
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
|
||||
pData->currentDepth--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOLEAN ReadInStringArray()
|
||||
{
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
|
||||
stringParseData pData;
|
||||
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Loading %s",AMMOCALIBERSTRINGSFILENAME ) );
|
||||
|
||||
// Open strings file
|
||||
hFile = FileOpen( AMMOCALIBERSTRINGSFILENAME, FILE_ACCESS_READ, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
//Read in block
|
||||
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
|
||||
{
|
||||
MemFree(lpcBuffer);
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
lpcBuffer[uiFSize] = 0; //add a null terminator
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
|
||||
XML_SetElementHandler(parser, stringStartElementHandle, stringEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, stringCharacterDataHandle);
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
pData.maxArraySize = MAXITEMS;
|
||||
pData.curIndex = 0xffffffff;
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
sprintf(errorBuf, "XML Parser Error in %s.xml: %s at line %d", AMMOCALIBERSTRINGSFILENAME, XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||
LiveMessage(errorBuf);
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
BOOLEAN WriteStringArray()
|
||||
{
|
||||
HWFILE hFile;
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("WriteStringArray"));
|
||||
//Debug code; make sure that what we got from the file is the same as what's there
|
||||
// Open a new file
|
||||
hFile = FileOpen( "TABLEDATA\\AmmoCaliberStrings out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
{
|
||||
UINT32 cnt;
|
||||
|
||||
FilePrintf(hFile,"<STRINGLIST>\r\n");
|
||||
for(cnt = 0;cnt < 29;cnt++)
|
||||
{
|
||||
FilePrintf(hFile,"\t<STRING>");
|
||||
|
||||
STR16 szRemainder = AmmoCaliber[cnt]; //the remaining string to be output (for making valid XML)
|
||||
|
||||
while(szRemainder[0] != '\0')
|
||||
{
|
||||
UINT32 uiCharLoc = wcscspn(szRemainder,L"&<>\'\"\0");
|
||||
CHAR16 invChar = szRemainder[uiCharLoc];
|
||||
|
||||
if(uiCharLoc)
|
||||
{
|
||||
szRemainder[uiCharLoc] = '\0';
|
||||
FilePrintf(hFile,"%S",szRemainder);
|
||||
szRemainder[uiCharLoc] = invChar;
|
||||
}
|
||||
|
||||
szRemainder += uiCharLoc;
|
||||
|
||||
switch(invChar)
|
||||
{
|
||||
case '&':
|
||||
FilePrintf(hFile,"&");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
case '<':
|
||||
FilePrintf(hFile,"<");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
case '>':
|
||||
FilePrintf(hFile,">");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
FilePrintf(hFile,"'");
|
||||
szRemainder++;
|
||||
break;
|
||||
|
||||
case '\"':
|
||||
FilePrintf(hFile,""");
|
||||
szRemainder++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// FilePrintf(hFile,"\t\t<STRING>%s</STRING>\r\n", AmmoCaliber[cnt]);
|
||||
|
||||
FilePrintf(hFile,"</STRING>\r\n");
|
||||
}
|
||||
FilePrintf(hFile,"</STRINGLIST>\r\n");
|
||||
}
|
||||
FileClose( hFile );
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user