diff --git a/TileEngine/Buildings.cpp b/TileEngine/Buildings.cpp index 0c32b62b..62b7cb92 100644 --- a/TileEngine/Buildings.cpp +++ b/TileEngine/Buildings.cpp @@ -59,8 +59,10 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot ) return( NULL ); } + // WDS - Clean up inventory handling // set up fake soldier for location testing - memset( &FakeSoldier, 0, sizeof( SOLDIERTYPE ) ); +// memset( &FakeSoldier, 0, SIZEOF_SOLDIERTYPE ); + FakeSoldier.initialize(); FakeSoldier.sGridNo = sDesiredSpot; FakeSoldier.bLevel = 1; FakeSoldier.bTeam = 1; diff --git a/TileEngine/Exit Grids.cpp b/TileEngine/Exit Grids.cpp index 5913b450..992150b9 100644 --- a/TileEngine/Exit Grids.cpp +++ b/TileEngine/Exit Grids.cpp @@ -256,9 +256,11 @@ UINT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSwe gubNPCAPBudget = 0; gubNPCDistLimit = ubRadius; + // WDS - Clean up inventory handling //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. - memset( &soldier, 0, sizeof( SOLDIERTYPE ) ); +// memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); + soldier.initialize(); soldier.bLevel = 0; soldier.bTeam = 1; soldier.sGridNo = pSoldier->sGridNo; diff --git a/TileEngine/Map Edgepoints.cpp b/TileEngine/Map Edgepoints.cpp index ebc1cb3f..a685d9db 100644 --- a/TileEngine/Map Edgepoints.cpp +++ b/TileEngine/Map Edgepoints.cpp @@ -123,7 +123,9 @@ void ValidateEdgepoints() UINT16 usValidEdgepoints; SOLDIERTYPE Soldier; - memset( &Soldier, 0, sizeof( SOLDIERTYPE ) ); + // WDS - Clean up inventory handling +// memset( &Soldier, 0, SIZEOF_SOLDIERTYPE ); + Soldier.initialize(); Soldier.bTeam = 1; //north @@ -435,7 +437,9 @@ void ClassifyEdgepoints() SOLDIERTYPE Soldier; INT16 sGridNo = -1; - memset( &Soldier, 0, sizeof( SOLDIERTYPE ) ); + // WDS - Clean up inventory handling +// memset( &Soldier, 0, SIZEOF_SOLDIERTYPE ); + Soldier.initialize(); Soldier.bTeam = 1; //north @@ -1636,7 +1640,9 @@ UINT8 CalcMapEdgepointClassInsertionCode( INT16 sGridNo ) INT16 sClosestSpot2 = NOWHERE, sClosestDist2 = 0x7FFF; BOOLEAN fPrimaryValid = FALSE, fSecondaryValid = FALSE; - memset( &Soldier, 0, sizeof( SOLDIERTYPE ) ); + // WDS - Clean up inventory handling +// memset( &Soldier, 0, SIZEOF_SOLDIERTYPE ); + Soldier.initialize(); Soldier.bTeam = 1; Soldier.sGridNo = sGridNo; diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 3df050ad..d9026c75 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -1695,8 +1695,9 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) // Write tileset ID FileWrite( hfile, &giCurrentTilesetID, sizeof( INT32 ), &uiBytesWritten ); + // WDS - Clean up inventory handling // Write SOLDIER CONTROL SIZE - uiSoldierSize = sizeof( SOLDIERTYPE ); + uiSoldierSize = SIZEOF_SOLDIERTYPE_POD; //SIZEOF_SOLDIERTYPE; FileWrite( hfile, &uiSoldierSize, sizeof( INT32 ), &uiBytesWritten ); @@ -2477,7 +2478,9 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) } if( basic.fDetailedPlacement ) { //skip static priority placement - LOADDATA( &priority, pBuffer, sizeof( SOLDIERCREATE_STRUCT ) ); + // WDS - Clean up inventory handling + LOADDATA( &priority, pBuffer, SIZEOF_SOLDIERCREATE_STRUCT_POD); //SIZEOF_SOLDIERCREATE_STRUCT ); + priority.CopyOldDataToNew(); if( priority.ubProfile != NO_PROFILE ) pTeam->ubProfile++; else diff --git a/TileEngine/worlddef.h b/TileEngine/worlddef.h index dba229c5..19bd32f9 100644 --- a/TileEngine/worlddef.h +++ b/TileEngine/worlddef.h @@ -104,9 +104,10 @@ #define ANY_SMOKE_EFFECT ( MAPELEMENT_EXT_CREATUREGAS | MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS | MAPELEMENT_EXT_BURNABLEGAS ) -typedef struct TAG_level_node +// WDS - Clean up inventory handling +struct LEVELNODE { - struct TAG_level_node *pNext; + struct LEVELNODE *pNext; UINT32 uiFlags; // flags struct UINT8 ubSumLights; // LIGHTING INFO @@ -114,7 +115,7 @@ typedef struct TAG_level_node union { - struct TAG_level_node *pPrevNode; // FOR LAND, GOING BACKWARDS POINTER + struct LEVELNODE *pPrevNode; // FOR LAND, GOING BACKWARDS POINTER STRUCTURE *pStructureData; // STRUCTURE DATA INT32 iPhysicsObjectID; // ID FOR PHYSICS ITEM INT32 uiAPCost; // FOR AP DISPLAY @@ -173,7 +174,7 @@ typedef struct TAG_level_node UINT8 ubNaturalShadeLevel; // LIGHTING INFO UINT8 ubFakeShadeLevel; // LIGHTING INFO -} LEVELNODE; +}; // LEVELNODE; #define LAND_START_INDEX 1