Fix: In Release built with VS2008 the game crashes when parsing xmls.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7530 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2014-09-24 23:29:07 +00:00
parent 7558c84bc2
commit 58d9cf0925
2 changed files with 34 additions and 7 deletions
+13 -2
View File
@@ -83,6 +83,8 @@ structuredeconstructCharacterDataHandle(void *userData, const XML_Char *str, int
static void XMLCALL
structuredeconstructEndElementHandle(void *userData, const XML_Char *name)
{
static std::vector<UINT8> statictilevector;
structuredeconstructParseData * pData = (structuredeconstructParseData *)userData;
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
@@ -97,7 +99,16 @@ structuredeconstructEndElementHandle(void *userData, const XML_Char *name)
if(structuredeconstructcnt < pData->maxArraySize)
{
pData->curArray[structuredeconstructcnt] = pData->curFood; //write the data into the table
// for whatever reasons the game crashes in VS2008 Release builds when copying over the tilevector
// this seems odd, as this works just fine in VS2010 and VS2013, and also works in VS205 debug builds
// for now, copy over the content by hand
pData->curArray[structuredeconstructcnt].usDeconstructItem = pData->curFood.usDeconstructItem;
pData->curArray[structuredeconstructcnt].usItemToCreate= pData->curFood.usItemToCreate;
pData->curArray[structuredeconstructcnt].usCreatedItemStatus = pData->curFood.usCreatedItemStatus;
strncpy(pData->curArray[structuredeconstructcnt].szTileSetName, pData->curFood.szTileSetName, 20);
pData->curArray[structuredeconstructcnt].tilevector = statictilevector;
statictilevector.clear();
}
++structuredeconstructcnt;
@@ -126,7 +137,7 @@ structuredeconstructEndElementHandle(void *userData, const XML_Char *name)
else if(strcmp(name, "allowedtile") == 0)
{
pData->curElement = ELEMENT;
pData->curFood.tilevector.push_back( (UINT8) atol(pData->szCharData) );
statictilevector.push_back( (UINT8) atol(pData->szCharData) );
}
pData->maxReadDepth--;