mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Brief: //dnl ch75
- More map editor fixes and map inventory pool performance improvement for big maps. Details: - Fix not showing expected messagebox on exit (ALT+x) which also throw exception and goes to improper mapeditor exit. - Fix second annoying sticky message which shouldn't popup during map loading and performing RemoveProhibitedAttachments. - Fix CTD when delete all enemies or civilians or all of them in map. - Fix some std exception when reporting for missing optional xml file. - Fix memory and map corruption in old mapeditors if loaded old map has item with invalid attachment and we try to attach something else. - As years ago pInventoryPoolList had migrated from WORLDITEM* array to std::vector<WORLDITEM> it was time to do that with gWorldItems too, all necessary functions which need to be adopted to gWorldItems std::vector type are also changed. - Resize code for gWorldItems is changed hoping will lead into less corruption problems as now could occur in mapeditor and game when code automatically doing attachment changes. - Change code for handling map inventory which now should be fast enough to support AIMNAS project which will probably deal with thousands of items per map. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6554 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1680,7 +1680,7 @@ void IndicateSelectedMerc( INT16 sID )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if we made it this far, then we have a new merc cursor indicator to draw.
|
//if we made it this far, then we have a new merc cursor indicator to draw.
|
||||||
if( gpSelected == NULL || gpSelected->pSoldier )
|
if( gpSelected && gpSelected->pSoldier )//dnl ch75 261013
|
||||||
gsSelectedMercGridNo = gpSelected->pSoldier->sGridNo;
|
gsSelectedMercGridNo = gpSelected->pSoldier->sGridNo;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1430,6 +1430,7 @@ void ToggleAttachment( GUI_BUTTON *btn, INT32 reason )
|
|||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
UINT16 usAttachment = 0;
|
UINT16 usAttachment = 0;
|
||||||
|
ResizeWorldItems();//dnl ch75 021113 to prevent memory corruption during resize if somehow in created item we manage to put invalid attachment (DRAGUNOV with SNIPERCOPE problem in older mapeditors)
|
||||||
for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ )
|
for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ )
|
||||||
{ //Loop through and find the button that was just modified
|
{ //Loop through and find the button that was just modified
|
||||||
switch( i )
|
switch( i )
|
||||||
@@ -1469,6 +1470,7 @@ void ToggleCeramicPlates( GUI_BUTTON *btn, INT32 reason )
|
|||||||
{
|
{
|
||||||
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||||
{
|
{
|
||||||
|
ResizeWorldItems();//dnl ch75 021113 just precaution to prevent eventual memory corruption during resize if somehow AttachObject find invalid attachment
|
||||||
gfCeramicPlates ^= TRUE;
|
gfCeramicPlates ^= TRUE;
|
||||||
if( gfCeramicPlates )
|
if( gfCeramicPlates )
|
||||||
{
|
{
|
||||||
@@ -1490,6 +1492,7 @@ void ToggleDetonator( GUI_BUTTON *btn, INT32 reason )
|
|||||||
{
|
{
|
||||||
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||||
{
|
{
|
||||||
|
ResizeWorldItems();//dnl ch75 021113 just precaution to prevent eventual memory corruption during resize if somehow AttachObject find invalid attachment
|
||||||
if( !gfDetonator )
|
if( !gfDetonator )
|
||||||
{
|
{
|
||||||
gfDetonator = TRUE;
|
gfDetonator = TRUE;
|
||||||
|
|||||||
@@ -2051,7 +2051,6 @@ void HandleKeyboardShortcuts( )
|
|||||||
if( gfEditingDoor )
|
if( gfEditingDoor )
|
||||||
KillDoorEditing();
|
KillDoorEditing();
|
||||||
iCurrentAction = ACTION_QUIT_GAME;
|
iCurrentAction = ACTION_QUIT_GAME;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
@@ -2313,7 +2312,7 @@ UINT32 PerformSelectedAction( void )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_QUIT_GAME:
|
case ACTION_QUIT_GAME:
|
||||||
gfProgramIsRunning = FALSE;
|
//gfProgramIsRunning = FALSE;//dnl ch75 251013 throw exception on exit without showing message box
|
||||||
case ACTION_EXIT_EDITOR:
|
case ACTION_EXIT_EDITOR:
|
||||||
if( EditModeShutdown( ) )
|
if( EditModeShutdown( ) )
|
||||||
{
|
{
|
||||||
@@ -2741,6 +2740,11 @@ UINT32 ProcessEditscreenMessageBoxResponse()
|
|||||||
{
|
{
|
||||||
gfConfirmExitFirst = FALSE;
|
gfConfirmExitFirst = FALSE;
|
||||||
iEditorToolbarState = TBAR_MODE_EXIT_EDIT;
|
iEditorToolbarState = TBAR_MODE_EXIT_EDIT;
|
||||||
|
if(iCurrentAction == ACTION_QUIT_GAME)//dnl ch75 251013
|
||||||
|
{
|
||||||
|
iEditorToolbarState = TBAR_MODE_QUIT_GAME;
|
||||||
|
gfProgramIsRunning = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return EDIT_SCREEN;
|
return EDIT_SCREEN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6105,7 +6105,7 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
|||||||
CHAR16 wSectorName[ 64 ];
|
CHAR16 wSectorName[ 64 ];
|
||||||
GetShortSectorString( sMapX, sMapY, wSectorName );
|
GetShortSectorString( sMapX, sMapY, wSectorName );
|
||||||
|
|
||||||
WORLDITEM* pWorldItem_Target = NULL;
|
std::vector<WORLDITEM> pWorldItem_Target;//dnl ch75 271013
|
||||||
|
|
||||||
// now loop over all sectors from which we take stuff, and move the equipment
|
// now loop over all sectors from which we take stuff, and move the equipment
|
||||||
std::map<UINT8, UINT8>::iterator itend = sectormercmap.end();
|
std::map<UINT8, UINT8>::iterator itend = sectormercmap.end();
|
||||||
@@ -6136,11 +6136,7 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
|||||||
UINT32 uiTotalNumberOfRealItems_Target = 0;
|
UINT32 uiTotalNumberOfRealItems_Target = 0;
|
||||||
|
|
||||||
// use the new map
|
// use the new map
|
||||||
if ( pWorldItem_Target )
|
pWorldItem_Target.clear();//dnl ch75 021113
|
||||||
{
|
|
||||||
delete[] pWorldItem_Target;
|
|
||||||
pWorldItem_Target = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( gWorldSectorX == targetX )&&( gWorldSectorY == targetY ) && (gbWorldSectorZ == bZ ) )
|
if( ( gWorldSectorX == targetX )&&( gWorldSectorY == targetY ) && (gbWorldSectorZ == bZ ) )
|
||||||
{
|
{
|
||||||
@@ -6157,7 +6153,7 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
|||||||
if( uiTotalNumberOfRealItems_Target > 0 )
|
if( uiTotalNumberOfRealItems_Target > 0 )
|
||||||
{
|
{
|
||||||
// allocate space for the list
|
// allocate space for the list
|
||||||
pWorldItem_Target = new WORLDITEM[ uiTotalNumberOfRealItems_Target ];
|
pWorldItem_Target.resize(uiTotalNumberOfRealItems_Target);//dnl ch75 271013
|
||||||
|
|
||||||
// now load into mem
|
// now load into mem
|
||||||
LoadWorldItemsFromTempItemFile( targetX, targetY, bZ, pWorldItem_Target );
|
LoadWorldItemsFromTempItemFile( targetX, targetY, bZ, pWorldItem_Target );
|
||||||
@@ -6236,7 +6232,7 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
|||||||
WORLDITEM* pWorldItem_tmp = NULL;
|
WORLDITEM* pWorldItem_tmp = NULL;
|
||||||
if( ( gWorldSectorX != targetX ) || ( gWorldSectorY != targetY ) || (gbWorldSectorZ != bZ ) )
|
if( ( gWorldSectorX != targetX ) || ( gWorldSectorY != targetY ) || (gbWorldSectorZ != bZ ) )
|
||||||
{
|
{
|
||||||
pWorldItem_tmp = new WORLDITEM[ uiTotalNumberOfRealItems_Target ];
|
std::vector<WORLDITEM> pWorldItem_tmp(uiTotalNumberOfRealItems_Target);//dnl ch75 271013
|
||||||
|
|
||||||
// copy over old inventory
|
// copy over old inventory
|
||||||
UINT32 newcount = 0;
|
UINT32 newcount = 0;
|
||||||
@@ -6250,11 +6246,7 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// use the new map
|
// use the new map
|
||||||
if ( pWorldItem_Target )
|
pWorldItem_Target.clear();//dnl ch75 021113
|
||||||
{
|
|
||||||
delete[] pWorldItem_Target;
|
|
||||||
pWorldItem_Target = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pWorldItem_Target = pWorldItem_tmp;
|
pWorldItem_Target = pWorldItem_tmp;
|
||||||
}
|
}
|
||||||
@@ -6271,12 +6263,6 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
|||||||
SaveWorldItemsToTempItemFile( targetX, targetY, bZ, uiTotalNumberOfRealItems_Target, pWorldItem_Target );
|
SaveWorldItemsToTempItemFile( targetX, targetY, bZ, uiTotalNumberOfRealItems_Target, pWorldItem_Target );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pWorldItem_tmp )
|
|
||||||
{
|
|
||||||
delete[] pWorldItem_tmp;
|
|
||||||
pWorldItem_tmp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// award a bit of experience to the movers
|
// award a bit of experience to the movers
|
||||||
UINT16 itemsperperson = moveditems / (*it).second;
|
UINT16 itemsperperson = moveditems / (*it).second;
|
||||||
UINT16 weightperperson = movedweight / (*it).second;
|
UINT16 weightperperson = movedweight / (*it).second;
|
||||||
|
|||||||
@@ -457,7 +457,7 @@ void HourlyStealUpdate()
|
|||||||
// we loop over this sector's inventory and look for something shiny. We will pick it up if we hae enough space in our inventory
|
// we loop over this sector's inventory and look for something shiny. We will pick it up if we hae enough space in our inventory
|
||||||
// open sector inv
|
// open sector inv
|
||||||
UINT32 uiTotalNumberOfRealItems = 0;
|
UINT32 uiTotalNumberOfRealItems = 0;
|
||||||
WORLDITEM* pWorldItem = NULL;
|
std::vector<WORLDITEM> pWorldItem;//dnl ch75 271013
|
||||||
BOOLEAN fReturn = FALSE;
|
BOOLEAN fReturn = FALSE;
|
||||||
|
|
||||||
if( ( gWorldSectorX == pSoldier->sSectorX ) && ( gWorldSectorY == pSoldier->sSectorY ) && (gbWorldSectorZ == pSoldier->bSectorZ ) )
|
if( ( gWorldSectorX == pSoldier->sSectorX ) && ( gWorldSectorY == pSoldier->sSectorY ) && (gbWorldSectorZ == pSoldier->bSectorZ ) )
|
||||||
@@ -479,7 +479,7 @@ void HourlyStealUpdate()
|
|||||||
if( uiTotalNumberOfRealItems > 0 )
|
if( uiTotalNumberOfRealItems > 0 )
|
||||||
{
|
{
|
||||||
// allocate space for the list
|
// allocate space for the list
|
||||||
pWorldItem = new WORLDITEM[ uiTotalNumberOfRealItems ];
|
pWorldItem.resize(uiTotalNumberOfRealItems);//dnl ch75 271013
|
||||||
|
|
||||||
if ( !uiTotalNumberOfRealItems )
|
if ( !uiTotalNumberOfRealItems )
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -84,5 +84,5 @@ BOOLEAN SwitchToInventoryPoolQ(UINT8 newidx);
|
|||||||
// Flugente: handle various cooldown functions over an array of items in a specific sector.
|
// Flugente: handle various cooldown functions over an array of items in a specific sector.
|
||||||
// if fWithMinutes = true, adjust cooldown for time since sector was last entered
|
// if fWithMinutes = true, adjust cooldown for time since sector was last entered
|
||||||
// otherwise its used for a turn-precise cooldown
|
// otherwise its used for a turn-precise cooldown
|
||||||
void HandleSectorCooldownFunctions( INT16 sMapX, INT16 sMapY, INT8 sMapZ, WORLDITEM* pWorldItem, UINT32 size, BOOLEAN fWithMinutes, BOOLEAN fUndo = FALSE);
|
void HandleSectorCooldownFunctions( INT16 sMapX, INT16 sMapY, INT8 sMapZ, std::vector<WORLDITEM>& pWorldItem, UINT32 size, BOOLEAN fWithMinutes, BOOLEAN fUndo = FALSE);//dnl ch75 271013
|
||||||
void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, UINT16 naturalDirt = 100, BOOLEAN isUnderground = FALSE);
|
void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, UINT16 naturalDirt = 100, BOOLEAN isUnderground = FALSE);
|
||||||
@@ -2162,6 +2162,7 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
|
|||||||
RemoveCharacterFromSquads( pSoldier );
|
RemoveCharacterFromSquads( pSoldier );
|
||||||
|
|
||||||
WORLDITEM WorldItem;
|
WORLDITEM WorldItem;
|
||||||
|
std::vector<WORLDITEM> pWorldItem(1);//dnl ch75 271013
|
||||||
|
|
||||||
// Is this the first one..?
|
// Is this the first one..?
|
||||||
if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED )
|
if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED )
|
||||||
@@ -2186,9 +2187,9 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
|
|||||||
WorldItem.bVisible = FALSE;
|
WorldItem.bVisible = FALSE;
|
||||||
WorldItem.bRenderZHeightAboveLevel = 0;
|
WorldItem.bRenderZHeightAboveLevel = 0;
|
||||||
pSoldier->inv[ i ].MoveThisObjectTo(WorldItem.object);
|
pSoldier->inv[ i ].MoveThisObjectTo(WorldItem.object);
|
||||||
|
//dnl ch75 271013
|
||||||
AddWorldItemsToUnLoadedSector( gModSettings.ubInitialPOWSectorX, gModSettings.ubInitialPOWSectorY, 0,
|
pWorldItem[0] = WorldItem;
|
||||||
gModSettings.iInitialPOWItemGridNo[ gStrategicStatus.ubNumCapturedForRescue ], 1, &WorldItem, FALSE );
|
AddWorldItemsToUnLoadedSector( gModSettings.ubInitialPOWSectorX, gModSettings.ubInitialPOWSectorY, 0, gModSettings.iInitialPOWItemGridNo[ gStrategicStatus.ubNumCapturedForRescue ], 1, pWorldItem, FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2219,9 +2220,9 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
|
|||||||
WorldItem.bVisible = FALSE;
|
WorldItem.bVisible = FALSE;
|
||||||
WorldItem.bRenderZHeightAboveLevel = 0;
|
WorldItem.bRenderZHeightAboveLevel = 0;
|
||||||
pSoldier->inv[ i ].MoveThisObjectTo(WorldItem.object);
|
pSoldier->inv[ i ].MoveThisObjectTo(WorldItem.object);
|
||||||
|
//dnl ch75 271013
|
||||||
AddWorldItemsToUnLoadedSector( gModSettings.ubMeanwhileInterrogatePOWSectorX, gModSettings.ubMeanwhileInterrogatePOWSectorY, 0,
|
pWorldItem[0] = WorldItem;
|
||||||
gModSettings.iMeanwhileInterrogatePOWItemGridNo[ gStrategicStatus.ubNumCapturedForRescue ], 1, &WorldItem, FALSE );
|
AddWorldItemsToUnLoadedSector( gModSettings.ubMeanwhileInterrogatePOWSectorX, gModSettings.ubMeanwhileInterrogatePOWSectorY, 0, gModSettings.iMeanwhileInterrogatePOWItemGridNo[ gStrategicStatus.ubNumCapturedForRescue ], 1, pWorldItem, FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -423,12 +423,9 @@ void HandleDelayedItemsArrival( UINT32 uiReason )
|
|||||||
INT32 sStartGridNo;
|
INT32 sStartGridNo;
|
||||||
UINT32 uiNumWorldItems, uiLoop;
|
UINT32 uiNumWorldItems, uiLoop;
|
||||||
BOOLEAN fOk;
|
BOOLEAN fOk;
|
||||||
WORLDITEM * pTemp = 0;
|
std::vector<WORLDITEM> pTemp;//dnl ch75 271013
|
||||||
UINT8 ubLoop;
|
UINT8 ubLoop;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#if 0
|
|
||||||
if (uiReason == NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS + NPC_ACTION_RETURN_STOLEN_SHIPMENT_ITEMS )
|
if (uiReason == NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS + NPC_ACTION_RETURN_STOLEN_SHIPMENT_ITEMS )
|
||||||
{
|
{
|
||||||
if ( gMercProfiles[ PABLO ].bMercStatus == MERC_IS_DEAD )
|
if ( gMercProfiles[ PABLO ].bMercStatus == MERC_IS_DEAD )
|
||||||
@@ -504,11 +501,7 @@ void HandleDelayedItemsArrival( UINT32 uiReason )
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pTemp = new WORLDITEM[ uiNumWorldItems];
|
pTemp.resize(uiNumWorldItems);//dnl ch75 271013
|
||||||
if (!pTemp)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fOk = LoadWorldItemsFromTempItemFile( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, pTemp );
|
fOk = LoadWorldItemsFromTempItemFile( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, pTemp );
|
||||||
if (fOk)
|
if (fOk)
|
||||||
{
|
{
|
||||||
@@ -522,13 +515,6 @@ void HandleDelayedItemsArrival( UINT32 uiReason )
|
|||||||
AddWorldItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, 0, uiNumWorldItems, pTemp, TRUE );
|
AddWorldItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, 0, uiNumWorldItems, pTemp, TRUE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pTemp) {
|
|
||||||
delete [] pTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddSecondAirportAttendant( void )
|
void AddSecondAirportAttendant( void )
|
||||||
|
|||||||
@@ -1111,7 +1111,7 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ,
|
|||||||
{
|
{
|
||||||
// remove random items in sector
|
// remove random items in sector
|
||||||
UINT32 uiNumberOfItems = 0, iCounter = 0;
|
UINT32 uiNumberOfItems = 0, iCounter = 0;
|
||||||
WORLDITEM *pItemList;
|
std::vector<WORLDITEM> pItemList;//dnl ch75 271013
|
||||||
UINT32 uiNewTotal = 0;
|
UINT32 uiNewTotal = 0;
|
||||||
CHAR16 wSectorName[ 128 ];
|
CHAR16 wSectorName[ 128 ];
|
||||||
|
|
||||||
@@ -1138,7 +1138,7 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pItemList = new WORLDITEM[ uiNumberOfItems ];
|
pItemList.resize(uiNumberOfItems);//dnl ch75 271013
|
||||||
|
|
||||||
// now load items
|
// now load items
|
||||||
LoadWorldItemsFromTempItemFile( sSectorX, sSectorY, ( UINT8 )sSectorZ, pItemList );
|
LoadWorldItemsFromTempItemFile( sSectorX, sSectorY, ( UINT8 )sSectorZ, pItemList );
|
||||||
@@ -1167,9 +1167,6 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ,
|
|||||||
{
|
{
|
||||||
AddWorldItemsToUnLoadedSector( sSectorX, sSectorY, ( UINT8 )sSectorZ, 0, uiNumberOfItems, pItemList, TRUE );
|
AddWorldItemsToUnLoadedSector( sSectorX, sSectorY, ( UINT8 )sSectorZ, 0, uiNumberOfItems, pItemList, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// mem free
|
|
||||||
delete[]( pItemList );
|
|
||||||
}
|
}
|
||||||
else // handle a loaded sector
|
else // handle a loaded sector
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -209,6 +209,8 @@ void AddExtraItems(UINT8 x, UINT8 y, UINT8 z, bool sectorIsLoaded)
|
|||||||
}
|
}
|
||||||
|
|
||||||
strcat(fileName, ".xml");
|
strcat(fileName, ".xml");
|
||||||
|
if(!FileExists(fileName))//dnl ch75 261013 just to avoid sdd::exception under debug from VFS when file not exist
|
||||||
|
return;
|
||||||
|
|
||||||
// Open extra items file
|
// Open extra items file
|
||||||
HWFILE hFile;
|
HWFILE hFile;
|
||||||
|
|||||||
+41
-2
@@ -7394,8 +7394,29 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
|
|||||||
case ')':
|
case ')':
|
||||||
SelectAllCharactersInSquad( 19 ); // internal squad #s start at 0
|
SelectAllCharactersInSquad( 19 ); // internal squad #s start at 0
|
||||||
break;
|
break;
|
||||||
|
case '\''://dnl ch75 021113
|
||||||
|
#ifdef _DEBUG
|
||||||
|
// temporary add soldiers to your list for equipment inspection and general testing
|
||||||
|
for(UINT32 ubLoop=0; ubLoop<guiNumMercSlots&&gGameExternalOptions.fEnableInventoryPoolQ; ubLoop++)
|
||||||
|
{
|
||||||
|
if(MercSlots[ubLoop] != NULL && MercSlots[ubLoop]->bTeam == ENEMY_TEAM && MercSlots[ubLoop]->bActive)
|
||||||
|
{
|
||||||
|
for(int i=0; i<CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; i++)
|
||||||
|
{
|
||||||
|
if(gCharactersList[i].usSolID == MercSlots[ubLoop]->ubID)
|
||||||
|
break;
|
||||||
|
if(gCharactersList[i].usSolID == 0 && gCharactersList[i].fValid == FALSE)
|
||||||
|
{
|
||||||
|
gCharactersList[i].usSolID = MercSlots[ubLoop]->ubID;
|
||||||
|
gCharactersList[i].fValid = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fTeamPanelDirty = TRUE;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
if( fAlt )
|
if( fAlt )
|
||||||
{
|
{
|
||||||
@@ -7881,6 +7902,24 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case 'Q'://dnl ch75 021113
|
||||||
|
#ifdef _DEBUG
|
||||||
|
extern UINT8 gInventoryPoolIndex;
|
||||||
|
if(fShowMapInventoryPool == TRUE && gInventoryPoolIndex == '0')
|
||||||
|
{
|
||||||
|
if(gGameExternalOptions.fEnableInventoryPoolQ)
|
||||||
|
{
|
||||||
|
gGameExternalOptions.fEnableInventoryPoolQ = FALSE;
|
||||||
|
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"InventoryPoolQ disabled.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gGameExternalOptions.fEnableInventoryPoolQ = TRUE;
|
||||||
|
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"InventoryPoolQ enabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
if( gfPreBattleInterfaceActive )
|
if( gfPreBattleInterfaceActive )
|
||||||
{ //activate autoresolve in prebattle interface.
|
{ //activate autoresolve in prebattle interface.
|
||||||
|
|||||||
@@ -6207,28 +6207,6 @@ BOOLEAN ContinuePastBoobyTrapInMapScreen( OBJECTTYPE *pObject, SOLDIERTYPE *pSol
|
|||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Well, clears all item pools
|
|
||||||
void ClearAllItemPools( )
|
|
||||||
{
|
|
||||||
INT32 cnt;
|
|
||||||
|
|
||||||
for ( cnt = 0; cnt < WORLD_MAX; cnt++ )
|
|
||||||
{
|
|
||||||
RemoveItemPool( cnt, 0 );
|
|
||||||
RemoveItemPool( cnt, 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Refresh item pools
|
|
||||||
void RefreshItemPools( WORLDITEM * pItemList, INT32 iNumberOfItems )
|
|
||||||
{
|
|
||||||
ClearAllItemPools( );
|
|
||||||
|
|
||||||
RefreshWorldItemsIntoItemPools( pItemList, iNumberOfItems );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
INT32 FindNearestAvailableGridNoForItem( INT32 sSweetGridNo, INT8 ubRadius )
|
INT32 FindNearestAvailableGridNoForItem( INT32 sSweetGridNo, INT8 ubRadius )
|
||||||
{
|
{
|
||||||
INT32 sTop, sBottom;
|
INT32 sTop, sBottom;
|
||||||
|
|||||||
@@ -3671,7 +3671,7 @@ UINT32 ItemFitness_WithAmmo( OBJECTTYPE* pObj, UINT8 idx, UINT32 uiBullets )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// retreives the next free slot in pWorldItem (we want to keep it short and not add too many items)
|
// retreives the next free slot in pWorldItem (we want to keep it short and not add too many items)
|
||||||
UINT32 GetNextFreeIndex( WORLDITEM* pWorldItem, UINT32 uiMaxCount, UINT32 uiCount )
|
UINT32 GetNextFreeIndex( std::vector<WORLDITEM>& pWorldItem, UINT32 uiMaxCount, UINT32 uiCount )//dnl ch75 271013
|
||||||
{
|
{
|
||||||
for( ; uiCount < uiMaxCount; ++uiCount )
|
for( ; uiCount < uiMaxCount; ++uiCount )
|
||||||
{
|
{
|
||||||
@@ -3711,10 +3711,10 @@ struct ItemSearchStruct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// evaluate an object an remember it if it is the best so far
|
// evaluate an object an remember it if it is the best so far
|
||||||
void EvaluateObjForItem( WORLDITEM* pWorldItem, OBJECTTYPE* pObj, UINT32 uiCount, ItemSearchStruct* pSi )
|
void EvaluateObjForItem( std::vector<WORLDITEM>& pWorldItem, OBJECTTYPE* pObj, UINT32 uiCount, ItemSearchStruct* pSi )//dnl ch75 271013
|
||||||
{
|
{
|
||||||
// safety first
|
// safety first
|
||||||
if ( !pWorldItem || !pObj || !pSi )
|
if ( pWorldItem.empty() || !pObj || !pSi )
|
||||||
// THIS SHOULDN'T HAPPEN!
|
// THIS SHOULDN'T HAPPEN!
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -3732,10 +3732,10 @@ void EvaluateObjForItem( WORLDITEM* pWorldItem, OBJECTTYPE* pObj, UINT32 uiCount
|
|||||||
}
|
}
|
||||||
|
|
||||||
// special version of EvaluateObjForItem(): we take the existing ammo count into consideration
|
// special version of EvaluateObjForItem(): we take the existing ammo count into consideration
|
||||||
void EvaluateObjForItem_WithAmmo( WORLDITEM* pWorldItem, OBJECTTYPE* pObj, UINT32 uiCount, ItemSearchStruct* pSi, UINT32 uiBullets )
|
void EvaluateObjForItem_WithAmmo( std::vector<WORLDITEM>& pWorldItem, OBJECTTYPE* pObj, UINT32 uiCount, ItemSearchStruct* pSi, UINT32 uiBullets )//dnl ch75 271013
|
||||||
{
|
{
|
||||||
// safety first
|
// safety first
|
||||||
if ( !pWorldItem || !pObj || !pSi )
|
if ( pWorldItem.empty() || !pObj || !pSi )
|
||||||
// THIS SHOULDN'T HAPPEN!
|
// THIS SHOULDN'T HAPPEN!
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -3754,10 +3754,10 @@ void EvaluateObjForItem_WithAmmo( WORLDITEM* pWorldItem, OBJECTTYPE* pObj, UINT3
|
|||||||
|
|
||||||
// forward declaration for default parameter
|
// forward declaration for default parameter
|
||||||
// if pSi has an entry, move gun from pWorldItem into pp
|
// if pSi has an entry, move gun from pWorldItem into pp
|
||||||
void SearchItemRetrieval( WORLDITEM* pWorldItem, ItemSearchStruct* pSi, SOLDIERCREATE_STRUCT *pp, UINT8 usTake = 1 );
|
void SearchItemRetrieval( std::vector<WORLDITEM>& pWorldItem, ItemSearchStruct* pSi, SOLDIERCREATE_STRUCT *pp, UINT8 usTake = 1 );//dnl ch75 271013
|
||||||
|
|
||||||
// if pSi has an entry, move gun from pWorldItem into pp
|
// if pSi has an entry, move gun from pWorldItem into pp
|
||||||
void SearchItemRetrieval( WORLDITEM* pWorldItem, ItemSearchStruct* pSi, SOLDIERCREATE_STRUCT *pp, UINT8 usTake )
|
void SearchItemRetrieval( std::vector<WORLDITEM>& pWorldItem, ItemSearchStruct* pSi, SOLDIERCREATE_STRUCT *pp, UINT8 usTake )//dnl ch75 271013
|
||||||
{
|
{
|
||||||
if ( pSi->found && !pSi->done )
|
if ( pSi->found && !pSi->done )
|
||||||
{
|
{
|
||||||
@@ -3869,7 +3869,7 @@ void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX,
|
|||||||
BOOLEAN fReturn = FALSE;
|
BOOLEAN fReturn = FALSE;
|
||||||
UINT32 uiTotalNumberOfRealItems = 0;
|
UINT32 uiTotalNumberOfRealItems = 0;
|
||||||
UINT32 uiNumOriginalItems = 0;
|
UINT32 uiNumOriginalItems = 0;
|
||||||
WORLDITEM* pWorldItem = NULL;
|
std::vector<WORLDITEM> pWorldItem;//dnl ch75 271013
|
||||||
SOLDIERCREATE_STRUCT tmp;
|
SOLDIERCREATE_STRUCT tmp;
|
||||||
UINT32 uiCount = 0;
|
UINT32 uiCount = 0;
|
||||||
INT32 dummygridno = NOWHERE;
|
INT32 dummygridno = NOWHERE;
|
||||||
@@ -3895,7 +3895,7 @@ void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX,
|
|||||||
if( uiTotalNumberOfRealItems > 0 )
|
if( uiTotalNumberOfRealItems > 0 )
|
||||||
{
|
{
|
||||||
// allocate space for the list
|
// allocate space for the list
|
||||||
pWorldItem = new WORLDITEM[ uiTotalNumberOfRealItems ];
|
pWorldItem.resize(uiTotalNumberOfRealItems);//dnl ch75 271013
|
||||||
|
|
||||||
// now load into mem
|
// now load into mem
|
||||||
LoadWorldItemsFromTempItemFile( sTargetX, sTargetY, 0, pWorldItem );
|
LoadWorldItemsFromTempItemFile( sTargetX, sTargetY, 0, pWorldItem );
|
||||||
@@ -3939,7 +3939,7 @@ void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX,
|
|||||||
UINT32 uiNewInvSize = max(uiTotalNumberOfRealItems, existingitemsfound + numnewitems);
|
UINT32 uiNewInvSize = max(uiTotalNumberOfRealItems, existingitemsfound + numnewitems);
|
||||||
|
|
||||||
// create a bigger inventory wit big enough size
|
// create a bigger inventory wit big enough size
|
||||||
WORLDITEM* pWorldItem_tmp = new WORLDITEM[ uiNewInvSize ];
|
std::vector<WORLDITEM> pWorldItem_tmp(uiNewInvSize);//dnl ch75 271013
|
||||||
|
|
||||||
// copy over old inventory
|
// copy over old inventory
|
||||||
for( uiCount = 0; uiCount < uiTotalNumberOfRealItems; ++uiCount )
|
for( uiCount = 0; uiCount < uiTotalNumberOfRealItems; ++uiCount )
|
||||||
@@ -3976,7 +3976,6 @@ void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX,
|
|||||||
|
|
||||||
// use the new map
|
// use the new map
|
||||||
uiTotalNumberOfRealItems = uiNewInvSize;
|
uiTotalNumberOfRealItems = uiNewInvSize;
|
||||||
delete[] pWorldItem;
|
|
||||||
pWorldItem = pWorldItem_tmp;
|
pWorldItem = pWorldItem_tmp;
|
||||||
/////////////////////////////// ADD ITEMS FROM STRUCT TO SECTOR /////////////////////////////////////////////////////
|
/////////////////////////////// ADD ITEMS FROM STRUCT TO SECTOR /////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -4053,7 +4052,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
|
|||||||
{
|
{
|
||||||
BOOLEAN fReturn = FALSE;
|
BOOLEAN fReturn = FALSE;
|
||||||
UINT32 uiTotalNumberOfRealItems = 0;
|
UINT32 uiTotalNumberOfRealItems = 0;
|
||||||
WORLDITEM* pWorldItem = NULL;
|
std::vector<WORLDITEM> pWorldItem;//dnl ch75 271013
|
||||||
UINT32 uiCount = 0;
|
UINT32 uiCount = 0;
|
||||||
INT32 dummygridno = NOWHERE; // this gridno will be the new position of items we create (ammo crates)
|
INT32 dummygridno = NOWHERE; // this gridno will be the new position of items we create (ammo crates)
|
||||||
BOOLEAN fNightTime = NightTime();
|
BOOLEAN fNightTime = NightTime();
|
||||||
@@ -4105,7 +4104,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
|
|||||||
if( uiTotalNumberOfRealItems > 0 )
|
if( uiTotalNumberOfRealItems > 0 )
|
||||||
{
|
{
|
||||||
// allocate space for the list
|
// allocate space for the list
|
||||||
pWorldItem = new WORLDITEM[ uiTotalNumberOfRealItems ];
|
pWorldItem.resize(uiTotalNumberOfRealItems);//dnl ch75 271013
|
||||||
|
|
||||||
if ( !uiTotalNumberOfRealItems )
|
if ( !uiTotalNumberOfRealItems )
|
||||||
return;
|
return;
|
||||||
@@ -4629,7 +4628,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
|
|||||||
for(INT16 i = 0; i < pObj->ubNumberOfObjects; ++i)
|
for(INT16 i = 0; i < pObj->ubNumberOfObjects; ++i)
|
||||||
newammo += (*pObj)[i]->data.ubShotsLeft;
|
newammo += (*pObj)[i]->data.ubShotsLeft;
|
||||||
|
|
||||||
UINT32 addammo = min(usSelectedGunBulletsNeeded - usSelectedGunBulletCount, newammo);
|
UINT32 addammo = min((UINT32)(usSelectedGunBulletsNeeded - usSelectedGunBulletCount), newammo);//dnl ch75 271013
|
||||||
|
|
||||||
SpawnFittingAmmo( pp, &(pp->Inv[ HANDPOS ]), ammotype, addammo );
|
SpawnFittingAmmo( pp, &(pp->Inv[ HANDPOS ]), ammotype, addammo );
|
||||||
|
|
||||||
@@ -4726,7 +4725,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
|
|||||||
UINT32 uiNewInvSize = uiTotalNumberOfRealItems + 1;
|
UINT32 uiNewInvSize = uiTotalNumberOfRealItems + 1;
|
||||||
|
|
||||||
// create a bigger inventory wit big enough size
|
// create a bigger inventory wit big enough size
|
||||||
WORLDITEM* pWorldItem_tmp = new WORLDITEM[ uiNewInvSize ];
|
std::vector<WORLDITEM> pWorldItem_tmp(uiNewInvSize);//dnl ch75 271013
|
||||||
|
|
||||||
// copy over old inventory
|
// copy over old inventory
|
||||||
for( uiCount = 0; uiCount < uiTotalNumberOfRealItems; ++uiCount )
|
for( uiCount = 0; uiCount < uiTotalNumberOfRealItems; ++uiCount )
|
||||||
@@ -4747,7 +4746,6 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
|
|||||||
|
|
||||||
// use the new map
|
// use the new map
|
||||||
uiTotalNumberOfRealItems = uiNewInvSize;
|
uiTotalNumberOfRealItems = uiNewInvSize;
|
||||||
delete[] pWorldItem;
|
|
||||||
pWorldItem = pWorldItem_tmp;
|
pWorldItem = pWorldItem_tmp;
|
||||||
}
|
}
|
||||||
///////////////////////////////// 3rd loop afterwork /////////////////////////////////////////////////////////
|
///////////////////////////////// 3rd loop afterwork /////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -483,9 +483,13 @@ LBENODE* OBJECTTYPE::GetLBEPointer(unsigned int index)
|
|||||||
|
|
||||||
bool OBJECTTYPE::exists()
|
bool OBJECTTYPE::exists()
|
||||||
{
|
{
|
||||||
|
#if 0//dnl ch75 011113
|
||||||
if(this == NULL)
|
if(this == NULL)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
return (ubNumberOfObjects > 0 && usItem != NOTHING);
|
return (ubNumberOfObjects > 0 && usItem != NOTHING);
|
||||||
|
#else
|
||||||
|
return(this && ubNumberOfObjects && usItem);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBJECTTYPE::SpliceData(OBJECTTYPE& sourceObject, unsigned int numToSplice, StackedObjects::iterator beginIter)
|
void OBJECTTYPE::SpliceData(OBJECTTYPE& sourceObject, unsigned int numToSplice, StackedObjects::iterator beginIter)
|
||||||
@@ -1671,7 +1675,7 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src)
|
|||||||
(*this)[x]->attachments.resize(usAttachmentSlotIndexVector.size());
|
(*this)[x]->attachments.resize(usAttachmentSlotIndexVector.size());
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
RemoveProhibitedAttachments(NULL, this, this->usItem);
|
AttachDefaultAttachments(this);//RemoveProhibitedAttachments(NULL, this, this->usItem);//dnl ch75 261013
|
||||||
//just a precaution
|
//just a precaution
|
||||||
//ADB ubWeight has been removed, see comments in OBJECTTYPE
|
//ADB ubWeight has been removed, see comments in OBJECTTYPE
|
||||||
//this->ubWeight = CalculateObjectWeight(this);
|
//this->ubWeight = CalculateObjectWeight(this);
|
||||||
|
|||||||
+36
-22
@@ -2448,7 +2448,7 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( fAttemptingAttachment && ValidAttachmentClass( usAttachment, pObj->usItem ) )
|
if ( fAttemptingAttachment && fDisplayMessage && ValidAttachmentClass( usAttachment, pObj->usItem ) )//dnl ch75 251013
|
||||||
{
|
{
|
||||||
// well, maybe the player thought he could
|
// well, maybe the player thought he could
|
||||||
CHAR16 zTemp[ 100 ];
|
CHAR16 zTemp[ 100 ];
|
||||||
@@ -5594,7 +5594,7 @@ IMPORTANT: If you use AttachObject/RemoveAttachment with fRemoveProhibited TRUE
|
|||||||
*/
|
*/
|
||||||
void RemoveProhibitedAttachments(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, UINT16 usItem, BOOLEAN fOnlyRemoveWhenSlotsChange)
|
void RemoveProhibitedAttachments(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, UINT16 usItem, BOOLEAN fOnlyRemoveWhenSlotsChange)
|
||||||
{
|
{
|
||||||
if(!pObj->exists())
|
if(!pObj->exists() || !(*pObj)[0]->AttachmentListSize())//dnl ch75 261013
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(UsingNewAttachmentSystem()==true){
|
if(UsingNewAttachmentSystem()==true){
|
||||||
@@ -5708,20 +5708,26 @@ void RemoveProhibitedAttachments(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, UINT16
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// put it on the ground
|
// put it on the ground //dnl ch75 281013
|
||||||
INT32 sGridNo = 1;
|
INT32 sGridNo = NOWHERE;
|
||||||
|
UINT8 ubLevel = 0;
|
||||||
if(guiCurrentItemDescriptionScreen == MAP_SCREEN && fShowMapInventoryPool)
|
for(int i=0; i<guiNumWorldItems; i++)
|
||||||
{
|
{
|
||||||
AutoPlaceObjectInInventoryStash(&(*iter), sGridNo);
|
if(gWorldItems[i].fExists && (pObj == &gWorldItems[i].object))
|
||||||
//AddItemToPool( sGridNo, &(*iter), 1, pathing, WORLD_ITEM_REACHABLE, 0 );
|
{
|
||||||
|
sGridNo = gWorldItems[i].sGridNo;
|
||||||
|
ubLevel = gWorldItems[i].ubLevel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
if(sGridNo != NOWHERE)
|
||||||
{
|
{
|
||||||
AddItemToPool( sGridNo, &(*iter), 1, 0, WORLD_ITEM_REACHABLE, 0 );
|
if(guiCurrentItemDescriptionScreen == MAP_SCREEN && fShowMapInventoryPool)
|
||||||
|
AutoPlaceObjectInInventoryStash(&(*iter), sGridNo);
|
||||||
|
else
|
||||||
|
AddItemToPool(sGridNo, &(*iter), 1, ubLevel, WORLD_ITEM_REACHABLE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iter = tempAttachList.erase(iter);
|
iter = tempAttachList.erase(iter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -7860,17 +7866,7 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj )
|
|||||||
pObj->AttachObject(NULL,&defaultAttachment, FALSE);
|
pObj->AttachObject(NULL,&defaultAttachment, FALSE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if(gGameOptions.ubAttachmentSystem || gfEditMode)
|
AttachDefaultAttachments(pObj);//dnl ch75 261013
|
||||||
{
|
|
||||||
for(UINT8 cnt=0; cnt<MAX_DEFAULT_ATTACHMENTS; cnt++)
|
|
||||||
{
|
|
||||||
if(Item[usItem].defaultattachments[cnt] == NONE)
|
|
||||||
break;
|
|
||||||
OBJECTTYPE defaultAttachment;
|
|
||||||
CreateItem(Item[usItem].defaultattachments[cnt], (*pObj)[0]->data.gun.bGunStatus, &defaultAttachment);
|
|
||||||
pObj->AttachObject(NULL, &defaultAttachment, FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15329,3 +15325,21 @@ UINT8 GetInventorySleepModifier( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
return( modifier );
|
return( modifier );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AttachDefaultAttachments(OBJECTTYPE *pObj, BOOLEAN fAllDefaultAttachments)//dnl ch75 261013
|
||||||
|
{
|
||||||
|
if(pObj->usItem && gGameOptions.ubAttachmentSystem)
|
||||||
|
{
|
||||||
|
RemoveProhibitedAttachments(NULL, pObj, pObj->usItem);
|
||||||
|
//Madd: ok, so this drives me nuts -- why bother with default attachments if the map isn't going to load them for you?
|
||||||
|
//this should fix that...
|
||||||
|
for(UINT8 cnt=0; cnt<MAX_DEFAULT_ATTACHMENTS; cnt++)
|
||||||
|
{
|
||||||
|
if(Item[pObj->usItem].defaultattachments[cnt] == NONE || !(gGameOptions.ubAttachmentSystem && Item[Item[pObj->usItem].defaultattachments[cnt]].inseparable || fAllDefaultAttachments))
|
||||||
|
break;
|
||||||
|
OBJECTTYPE defaultAttachment;
|
||||||
|
CreateItem(Item[pObj->usItem].defaultattachments[cnt], (*pObj)[0]->data.gun.bGunStatus, &defaultAttachment);
|
||||||
|
pObj->AttachObject(NULL, &defaultAttachment, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -524,6 +524,8 @@ INT32 GetPercentRangeBonus( OBJECTTYPE * pObj );
|
|||||||
// silversurfer: returns the SleepModifier from the characters inventory
|
// silversurfer: returns the SleepModifier from the characters inventory
|
||||||
UINT8 GetInventorySleepModifier( SOLDIERTYPE *pSoldier );
|
UINT8 GetInventorySleepModifier( SOLDIERTYPE *pSoldier );
|
||||||
|
|
||||||
|
void AttachDefaultAttachments(OBJECTTYPE *pObj, BOOLEAN fAllDefaultAttachments=TRUE);//dnl ch75 261013
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2621,7 +2621,7 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
|
|||||||
{
|
{
|
||||||
pp->Inv[ i ] = spp->Inv[ i ];
|
pp->Inv[ i ] = spp->Inv[ i ];
|
||||||
//WarmSteel - if someone in the map editor placed a wrong attachment on this gun, fix it.
|
//WarmSteel - if someone in the map editor placed a wrong attachment on this gun, fix it.
|
||||||
RemoveProhibitedAttachments(NULL, &pp->Inv[i], pp->Inv[i].usItem);
|
AttachDefaultAttachments(&pp->Inv[i]);//RemoveProhibitedAttachments(NULL, &pp->Inv[i], pp->Inv[i].usItem);//dnl ch75 261013
|
||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-79
@@ -570,7 +570,7 @@ BOOLEAN LoadMapTempFilesFromSavedGameFile( HWFILE hFile )
|
|||||||
BOOLEAN UpdateWorldItemsTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
BOOLEAN UpdateWorldItemsTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||||
{
|
{
|
||||||
UINT32 uiTotalNumberOfItems=0;
|
UINT32 uiTotalNumberOfItems=0;
|
||||||
WORLDITEM* pTotalSectorList = NULL;
|
std::vector<WORLDITEM> pTotalSectorList;//dnl ch75 271013
|
||||||
BOOLEAN fReturn = GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &( uiTotalNumberOfItems ), FALSE );
|
BOOLEAN fReturn = GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &( uiTotalNumberOfItems ), FALSE );
|
||||||
if (fReturn == false)
|
if (fReturn == false)
|
||||||
{
|
{
|
||||||
@@ -581,7 +581,7 @@ BOOLEAN UpdateWorldItemsTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
|||||||
if( uiTotalNumberOfItems > 0 )
|
if( uiTotalNumberOfItems > 0 )
|
||||||
{
|
{
|
||||||
// allocate space for the list
|
// allocate space for the list
|
||||||
pTotalSectorList = new WORLDITEM[ uiTotalNumberOfItems ];
|
pTotalSectorList.resize(uiTotalNumberOfItems);//dnl ch75 271013
|
||||||
|
|
||||||
LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pTotalSectorList );
|
LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pTotalSectorList );
|
||||||
int backup = guiCurrentSaveGameVersion;
|
int backup = guiCurrentSaveGameVersion;
|
||||||
@@ -590,15 +590,6 @@ BOOLEAN UpdateWorldItemsTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
|||||||
guiCurrentSaveGameVersion = backup;
|
guiCurrentSaveGameVersion = backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if anything was alloced, then get rid of it
|
|
||||||
if( pTotalSectorList != NULL )
|
|
||||||
{
|
|
||||||
delete[]( pTotalSectorList );
|
|
||||||
pTotalSectorList = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -626,7 +617,7 @@ BOOLEAN UpdateCIVTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 uiNumberOfItems, WORLDITEM *pData )
|
BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 uiNumberOfItems, std::vector<WORLDITEM>& pData, BOOLEAN fUpdateVisibleItems )//dnl ch75 271013
|
||||||
{
|
{
|
||||||
HWFILE hFile;
|
HWFILE hFile;
|
||||||
UINT32 uiNumBytesWritten=0;
|
UINT32 uiNumBytesWritten=0;
|
||||||
@@ -668,14 +659,15 @@ BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT
|
|||||||
|
|
||||||
SetSectorFlag( sMapX, sMapY, bMapZ, SF_ITEM_TEMP_FILE_EXISTS );
|
SetSectorFlag( sMapX, sMapY, bMapZ, SF_ITEM_TEMP_FILE_EXISTS );
|
||||||
|
|
||||||
SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems( sMapX, sMapY, bMapZ, FALSE );
|
if( fUpdateVisibleItems )//dnl ch75 311013
|
||||||
|
SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems( sMapX, sMapY, bMapZ, FALSE );
|
||||||
|
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN LoadWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, WORLDITEM *pData )
|
BOOLEAN LoadWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, std::vector<WORLDITEM>& pData )//dnl ch75 271013
|
||||||
{
|
{
|
||||||
UINT32 uiNumBytesRead=0;
|
UINT32 uiNumBytesRead=0;
|
||||||
HWFILE hFile;
|
HWFILE hFile;
|
||||||
@@ -817,7 +809,7 @@ BOOLEAN GetNumberOfWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bM
|
|||||||
BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sGridNo, UINT32 uiNumberOfItemsToAdd, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, BOOLEAN fReplaceEntireFile )
|
BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sGridNo, UINT32 uiNumberOfItemsToAdd, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, BOOLEAN fReplaceEntireFile )
|
||||||
{
|
{
|
||||||
UINT32 uiNumberOfItems=0;
|
UINT32 uiNumberOfItems=0;
|
||||||
WORLDITEM *pWorldItems;
|
std::vector<WORLDITEM> pWorldItems;//dnl ch75 271013
|
||||||
UINT32 cnt;
|
UINT32 cnt;
|
||||||
UINT32 uiLoop1=0;
|
UINT32 uiLoop1=0;
|
||||||
|
|
||||||
@@ -834,18 +826,12 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sG
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Allocate memeory for the item
|
//Allocate memeory for the item
|
||||||
pWorldItems = new WORLDITEM[uiNumberOfItems];
|
pWorldItems.resize(uiNumberOfItems);
|
||||||
if( pWorldItems == NULL )
|
|
||||||
{
|
|
||||||
//Error Allocating memory for the temp item array
|
|
||||||
return( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
//Load in the sectors Item Info
|
//Load in the sectors Item Info
|
||||||
if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) )
|
if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) )
|
||||||
{
|
{
|
||||||
//error reading in the items from the Item mod file
|
//error reading in the items from the Item mod file
|
||||||
delete[] pWorldItems;
|
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -876,6 +862,7 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sG
|
|||||||
|
|
||||||
if( cnt == ( uiNumberOfItems ) )
|
if( cnt == ( uiNumberOfItems ) )
|
||||||
{
|
{
|
||||||
|
#if 0//dnl ch75 271013
|
||||||
//Error, there wasnt a free spot. Reallocate memory for the array
|
//Error, there wasnt a free spot. Reallocate memory for the array
|
||||||
WORLDITEM* pTemp = new WORLDITEM[uiNumberOfItems + 1];
|
WORLDITEM* pTemp = new WORLDITEM[uiNumberOfItems + 1];
|
||||||
if( pTemp == NULL )
|
if( pTemp == NULL )
|
||||||
@@ -894,6 +881,9 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sG
|
|||||||
|
|
||||||
//set the spot were the item is to be added
|
//set the spot were the item is to be added
|
||||||
cnt = uiNumberOfItems - 1;
|
cnt = uiNumberOfItems - 1;
|
||||||
|
#else
|
||||||
|
pWorldItems.resize(++uiNumberOfItems);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
pWorldItems[ cnt ].fExists = TRUE;
|
pWorldItems[ cnt ].fExists = TRUE;
|
||||||
@@ -931,10 +921,6 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sG
|
|||||||
//Save the Items to the the file
|
//Save the Items to the the file
|
||||||
SaveWorldItemsToTempItemFile( sMapX, sMapY, bMapZ, uiNumberOfItems, pWorldItems );
|
SaveWorldItemsToTempItemFile( sMapX, sMapY, bMapZ, uiNumberOfItems, pWorldItems );
|
||||||
|
|
||||||
|
|
||||||
//Free the memory used to load in the item array
|
|
||||||
delete[]( pWorldItems );
|
|
||||||
|
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1497,9 +1483,9 @@ UINT32 GetLastTimePlayerWasInSector(INT16 sMapX, INT16 sMapY, INT8 sMapZ)
|
|||||||
BOOLEAN LoadAndAddWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
BOOLEAN LoadAndAddWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||||
{
|
{
|
||||||
UINT32 uiNumberOfItems=0;
|
UINT32 uiNumberOfItems=0;
|
||||||
WORLDITEM *pWorldItems = NULL;
|
std::vector<WORLDITEM> pWorldItems;//dnl ch75 271013
|
||||||
UINT32 cnt;
|
UINT32 cnt;
|
||||||
INT32 sNewGridNo;
|
INT32 sNewGridNo;
|
||||||
|
|
||||||
//Get the number of items from the file
|
//Get the number of items from the file
|
||||||
if( !GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &uiNumberOfItems, TRUE ) )
|
if( !GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &uiNumberOfItems, TRUE ) )
|
||||||
@@ -1510,12 +1496,7 @@ BOOLEAN LoadAndAddWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
|||||||
|
|
||||||
if( uiNumberOfItems )
|
if( uiNumberOfItems )
|
||||||
{
|
{
|
||||||
pWorldItems = new WORLDITEM[ uiNumberOfItems ];
|
pWorldItems.resize(uiNumberOfItems);//dnl ch75 271013
|
||||||
if( pWorldItems == NULL )
|
|
||||||
{
|
|
||||||
//Error Allocating memory for the temp item array
|
|
||||||
return( FALSE );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1540,7 +1521,6 @@ BOOLEAN LoadAndAddWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
|||||||
//Load the World Items from the file
|
//Load the World Items from the file
|
||||||
if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) )
|
if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) )
|
||||||
{
|
{
|
||||||
delete[]( pWorldItems );
|
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1593,8 +1573,6 @@ BOOLEAN LoadAndAddWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[]( pWorldItems );
|
|
||||||
|
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1925,12 +1903,12 @@ BOOLEAN LoadRottingCorpsesFromTempCorpseFile( INT16 sMapX, INT16 sMapY, INT8 bMa
|
|||||||
// Rewritten to load the temp file once, update with the list, and then write it. This was getting insane as items piled up in sectors.
|
// Rewritten to load the temp file once, update with the list, and then write it. This was getting insane as items piled up in sectors.
|
||||||
// A few dozen read, update, writes was okay but a few hundred is pushing it.
|
// A few dozen read, update, writes was okay but a few hundred is pushing it.
|
||||||
|
|
||||||
BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sGridNo, UINT32 uiNumberOfItemsToAdd, WORLDITEM *pWorldItem, BOOLEAN fOverWrite )
|
BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sGridNo, UINT32 uiNumberOfItemsToAdd, std::vector<WORLDITEM>& pWorldItem, BOOLEAN fOverWrite )//dnl ch75 271013
|
||||||
{
|
{
|
||||||
UINT32 uiLoop;
|
UINT32 uiLoop;
|
||||||
UINT32 uiLastItemPos;
|
UINT32 uiLastItemPos;
|
||||||
UINT32 uiNumberOfItems;
|
UINT32 uiNumberOfItems;
|
||||||
WORLDITEM *pWorldItems;
|
std::vector<WORLDITEM> pWorldItems;//dnl ch75 271013
|
||||||
|
|
||||||
if( !GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &uiNumberOfItems, TRUE ) )
|
if( !GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &uiNumberOfItems, TRUE ) )
|
||||||
{
|
{
|
||||||
@@ -1939,22 +1917,15 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Allocate memory for the item
|
//Allocate memory for the item
|
||||||
pWorldItems = new WORLDITEM[ uiNumberOfItems ];
|
pWorldItems.resize(uiNumberOfItems);//dnl ch75 271013
|
||||||
if( pWorldItems == NULL )
|
|
||||||
{
|
|
||||||
//Error Allocating memory for the temp item array
|
|
||||||
return( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
//Load in the sectors Item Info
|
//Load in the sectors Item Info
|
||||||
if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) )
|
if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) )
|
||||||
{
|
{
|
||||||
//error reading in the items from the Item mod file
|
//error reading in the items from the Item mod file
|
||||||
delete[] pWorldItems;
|
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//if we are to replace the entire file
|
//if we are to replace the entire file
|
||||||
if( fOverWrite )
|
if( fOverWrite )
|
||||||
{
|
{
|
||||||
@@ -1983,6 +1954,7 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT
|
|||||||
|
|
||||||
if( uiLastItemPos == ( uiNumberOfItems ) )
|
if( uiLastItemPos == ( uiNumberOfItems ) )
|
||||||
{
|
{
|
||||||
|
#if 0//dnl ch75 271013
|
||||||
//Error, there wasnt a free spot. Reallocate memory for the array
|
//Error, there wasnt a free spot. Reallocate memory for the array
|
||||||
WORLDITEM* pTemp;
|
WORLDITEM* pTemp;
|
||||||
pTemp = new WORLDITEM [uiNumberOfItems + 1];
|
pTemp = new WORLDITEM [uiNumberOfItems + 1];
|
||||||
@@ -1999,6 +1971,9 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT
|
|||||||
|
|
||||||
//Increment the total number of item in the array
|
//Increment the total number of item in the array
|
||||||
uiNumberOfItems++;
|
uiNumberOfItems++;
|
||||||
|
#else
|
||||||
|
pWorldItems.resize(++uiNumberOfItems);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
pWorldItems[ uiLastItemPos ].fExists = TRUE;
|
pWorldItems[ uiLastItemPos ].fExists = TRUE;
|
||||||
@@ -2025,10 +2000,6 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT
|
|||||||
//Save the Items to the the file
|
//Save the Items to the the file
|
||||||
SaveWorldItemsToTempItemFile( sMapX, sMapY, bMapZ, uiNumberOfItems, pWorldItems );
|
SaveWorldItemsToTempItemFile( sMapX, sMapY, bMapZ, uiNumberOfItems, pWorldItems );
|
||||||
|
|
||||||
|
|
||||||
//Free the memory used to load in the item array
|
|
||||||
delete[]( pWorldItems );
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// The old excruciatingly inefficient code
|
// The old excruciatingly inefficient code
|
||||||
for( uiLoop=0; uiLoop<uiNumberOfItems; uiLoop++)
|
for( uiLoop=0; uiLoop<uiNumberOfItems; uiLoop++)
|
||||||
@@ -2255,7 +2226,7 @@ void LoadNPCInformationFromProfileStruct()
|
|||||||
BOOLEAN GetNumberOfActiveWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 *pNumberOfData )
|
BOOLEAN GetNumberOfActiveWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 *pNumberOfData )
|
||||||
{
|
{
|
||||||
UINT32 uiNumberOfItems=0;
|
UINT32 uiNumberOfItems=0;
|
||||||
WORLDITEM *pWorldItems;
|
std::vector<WORLDITEM> pWorldItems;//dnl ch75 271013
|
||||||
UINT32 cnt;
|
UINT32 cnt;
|
||||||
UINT32 uiNumberOfActive=0;
|
UINT32 uiNumberOfActive=0;
|
||||||
BOOLEAN fFileLoaded = FALSE;
|
BOOLEAN fFileLoaded = FALSE;
|
||||||
@@ -2300,12 +2271,7 @@ BOOLEAN GetNumberOfActiveWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8
|
|||||||
//If there items in the data file
|
//If there items in the data file
|
||||||
if( uiNumberOfItems != 0 )
|
if( uiNumberOfItems != 0 )
|
||||||
{
|
{
|
||||||
pWorldItems = new WORLDITEM[ uiNumberOfItems ];
|
pWorldItems.resize(uiNumberOfItems);//dnl ch75 271013
|
||||||
if( pWorldItems == NULL )
|
|
||||||
{
|
|
||||||
//Error Allocating memory for the temp item array
|
|
||||||
return( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
//Load the World Items from the file
|
//Load the World Items from the file
|
||||||
if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) )
|
if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) )
|
||||||
@@ -2317,7 +2283,6 @@ BOOLEAN GetNumberOfActiveWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8
|
|||||||
if( pWorldItems[cnt].fExists )
|
if( pWorldItems[cnt].fExists )
|
||||||
uiNumberOfActive++;
|
uiNumberOfActive++;
|
||||||
}
|
}
|
||||||
delete[]( pWorldItems );
|
|
||||||
}
|
}
|
||||||
*pNumberOfData = uiNumberOfActive;
|
*pNumberOfData = uiNumberOfActive;
|
||||||
}
|
}
|
||||||
@@ -2834,7 +2799,7 @@ BOOLEAN GetSectorFlagStatus( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, UINT32 uiFla
|
|||||||
BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiFlags )
|
BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiFlags )
|
||||||
{
|
{
|
||||||
UINT32 uiNumberOfItems;
|
UINT32 uiNumberOfItems;
|
||||||
WORLDITEM *pWorldItems=NULL;
|
std::vector<WORLDITEM> pWorldItems;//dnl ch75 271013
|
||||||
UINT i;
|
UINT i;
|
||||||
UINT8 bCount=0;
|
UINT8 bCount=0;
|
||||||
UINT16 uiFlagsForWorldItems=0;
|
UINT16 uiFlagsForWorldItems=0;
|
||||||
@@ -2903,12 +2868,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
|||||||
if( uiNumberOfItems )
|
if( uiNumberOfItems )
|
||||||
{
|
{
|
||||||
//allocate memory for the world item array
|
//allocate memory for the world item array
|
||||||
pWorldItems = new WORLDITEM[ uiNumberOfItems ];
|
pWorldItems.resize(uiNumberOfItems);//dnl ch75 271013
|
||||||
if( pWorldItems == NULL )
|
|
||||||
{
|
|
||||||
//Error Allocating memory for the temp item array
|
|
||||||
return( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
//loop through all the soldiers items and add them to the world item array
|
//loop through all the soldiers items and add them to the world item array
|
||||||
bCount = 0;
|
bCount = 0;
|
||||||
@@ -2999,10 +2959,6 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
|||||||
//Add the rotting corpse info to the sectors unloaded rotting corpse file
|
//Add the rotting corpse info to the sectors unloaded rotting corpse file
|
||||||
AddRottingCorpseToUnloadedSectorsRottingCorpseFile( sMapX, sMapY, bMapZ, &Corpse);
|
AddRottingCorpseToUnloadedSectorsRottingCorpseFile( sMapX, sMapY, bMapZ, &Corpse);
|
||||||
|
|
||||||
//FRee the memory used for the pWorldItem array
|
|
||||||
delete[]( pWorldItems );
|
|
||||||
pWorldItems = NULL;
|
|
||||||
|
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3375,7 +3331,7 @@ void SetNumberOfVisibleWorldItemsInSectorStructureForSector( INT16 sMapX, INT16
|
|||||||
void SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BOOLEAN fLoadingGame )
|
void SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BOOLEAN fLoadingGame )
|
||||||
{
|
{
|
||||||
UINT32 uiTotalNumberOfItems = 0;//, uiTotalNumberOfRealItems = 0;
|
UINT32 uiTotalNumberOfItems = 0;//, uiTotalNumberOfRealItems = 0;
|
||||||
WORLDITEM * pTotalSectorList = NULL;
|
std::vector<WORLDITEM> pTotalSectorList;//dnl ch75 271013
|
||||||
UINT32 uiItemCount = 0;
|
UINT32 uiItemCount = 0;
|
||||||
UINT32 iCounter = 0;
|
UINT32 iCounter = 0;
|
||||||
BOOLEAN fReturn;
|
BOOLEAN fReturn;
|
||||||
@@ -3399,7 +3355,7 @@ void SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems( INT16 sMapX, INT
|
|||||||
if( uiTotalNumberOfItems > 0 )
|
if( uiTotalNumberOfItems > 0 )
|
||||||
{
|
{
|
||||||
// allocate space for the list
|
// allocate space for the list
|
||||||
pTotalSectorList = new WORLDITEM[ uiTotalNumberOfItems ];
|
pTotalSectorList.resize(uiTotalNumberOfItems);//dnl ch75 271013
|
||||||
|
|
||||||
// now load into mem
|
// now load into mem
|
||||||
LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pTotalSectorList );
|
LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pTotalSectorList );
|
||||||
@@ -3416,13 +3372,6 @@ void SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems( INT16 sMapX, INT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if anything was alloced, then get rid of it
|
|
||||||
if( pTotalSectorList != NULL )
|
|
||||||
{
|
|
||||||
delete[]( pTotalSectorList );
|
|
||||||
pTotalSectorList = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef JA2BETAVERSION
|
#ifdef JA2BETAVERSION
|
||||||
if( fLoadingGame && guiCurrentSaveGameVersion >= 86 )
|
if( fLoadingGame && guiCurrentSaveGameVersion >= 86 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ BOOLEAN SaveCurrentSectorsInformationToTempItemFile( );
|
|||||||
BOOLEAN LoadCurrentSectorsInformationFromTempItemsFile();
|
BOOLEAN LoadCurrentSectorsInformationFromTempItemsFile();
|
||||||
|
|
||||||
// Loads a World Item array from that sectors temp item file
|
// Loads a World Item array from that sectors temp item file
|
||||||
BOOLEAN LoadWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, WORLDITEM *pData );
|
BOOLEAN LoadWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, std::vector<WORLDITEM>& pData );//dnl ch75 271013
|
||||||
|
|
||||||
BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 uiNumberOfItems, WORLDITEM *pData );
|
BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 uiNumberOfItems, std::vector<WORLDITEM>& pData, BOOLEAN fUpdateVisibleItems=TRUE );//dnl ch75 271013
|
||||||
|
|
||||||
//When the savegame version changes, load the temp files, then immediately save them again in the new format
|
//When the savegame version changes, load the temp files, then immediately save them again in the new format
|
||||||
BOOLEAN UpdateWorldItemsTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ );
|
BOOLEAN UpdateWorldItemsTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ );
|
||||||
@@ -59,7 +59,7 @@ BOOLEAN UpdateWorldItemsTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ );
|
|||||||
BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sGridNo, UINT32 uiNumberOfItems, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, BOOLEAN fReplaceEntireFile );
|
BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sGridNo, UINT32 uiNumberOfItems, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, BOOLEAN fReplaceEntireFile );
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sGridNo, UINT32 uiNumberOfItems, WORLDITEM *pWorldItem, BOOLEAN fOverWrite );
|
BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sGridNo, UINT32 uiNumberOfItems, std::vector<WORLDITEM>& pWorldItem, BOOLEAN fOverWrite );//dnl ch75 271013
|
||||||
|
|
||||||
//Deletes all the Temp files in the Maps\Temp directory
|
//Deletes all the Temp files in the Maps\Temp directory
|
||||||
BOOLEAN InitTacticalSave( BOOLEAN fCreateTempDir );
|
BOOLEAN InitTacticalSave( BOOLEAN fCreateTempDir );
|
||||||
|
|||||||
@@ -113,9 +113,9 @@
|
|||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
#include "fresh_header.h"
|
#include "fresh_header.h"
|
||||||
|
|
||||||
|
|
||||||
#include "IMP Skill Trait.h" // added by Flugente
|
#include "IMP Skill Trait.h" // added by Flugente
|
||||||
#include "SkillMenu.h" // added by Flugente
|
#include "SkillMenu.h" // added by Flugente
|
||||||
|
#include "Map Screen Interface Map Inventory.h"//dnl ch75 021113
|
||||||
|
|
||||||
//forward declarations of common classes to eliminate includes
|
//forward declarations of common classes to eliminate includes
|
||||||
class OBJECTTYPE;
|
class OBJECTTYPE;
|
||||||
@@ -2368,7 +2368,14 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
|||||||
ClearDisplayedListOfTacticalStrings( );
|
ClearDisplayedListOfTacticalStrings( );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#if 0//dnl ch75 021113
|
||||||
|
case '\"':
|
||||||
|
Testing(1);
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
Testing(2);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case '1':
|
case '1':
|
||||||
|
|
||||||
if( fAlt )
|
if( fAlt )
|
||||||
@@ -2496,6 +2503,9 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '$':
|
case '$':
|
||||||
|
if(fCtrl && gGameExternalOptions.fEnableInventoryPoolQ)//dnl ch75 021113
|
||||||
|
DisplaySectorItemsInfo();
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Flugente: trait skill selection menu. Yes, screw squad 13
|
// Flugente: trait skill selection menu. Yes, screw squad 13
|
||||||
INT32 usMapPos;
|
INT32 usMapPos;
|
||||||
@@ -3416,23 +3426,21 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
//CHRISL: This will create a large number of objects for checking overloading
|
//CHRISL: This will create a large number of objects for checking overloading //dnl ch75 251013
|
||||||
if( fAlt && fCtrl )
|
if(fAlt && fCtrl)
|
||||||
{
|
{
|
||||||
INT32 tempMapPos = usMapPos;
|
if(CHEATER_CHEAT_LEVEL())
|
||||||
if( CHEATER_CHEAT_LEVEL( ) )
|
|
||||||
{
|
{
|
||||||
for(UINT16 i = 1; i < 1300; i++)
|
for(UINT16 i=FIRST_WEAPON; i<MAXITEMS; i++)
|
||||||
{
|
{
|
||||||
if(i == OWNERSHIP || i == CHALICE)
|
if(i == 1580 || Item[i].ubWeight == 0 && !(i == 257 || i == 1006 || i == 1026 || i == 1183))//dnl!!! items 257, 1006, 1026, 1183 had weight 0 which need to be changed in xml
|
||||||
continue;
|
continue;
|
||||||
//tempMapPos = sMapPos + (i / 200);
|
|
||||||
CreateItem(i, 100, &gTempObject);
|
CreateItem(i, 100, &gTempObject);
|
||||||
AddItemToPool( tempMapPos, &gTempObject, VISIBLE , 0, WORLD_ITEM_REACHABLE, 0 );
|
AddItemToPool(usMapPos, &gTempObject, VISIBLE , 0, WORLD_ITEM_REACHABLE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
|
|
||||||
if( fAlt )
|
if( fAlt )
|
||||||
|
|||||||
+28
-40
@@ -30,7 +30,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Global dynamic array of all of the items in a loaded map.
|
//Global dynamic array of all of the items in a loaded map.
|
||||||
WORLDITEM * gWorldItems = NULL;
|
std::vector<WORLDITEM> gWorldItems;//dnl ch75 261013
|
||||||
UINT32 guiNumWorldItems = 0;
|
UINT32 guiNumWorldItems = 0;
|
||||||
|
|
||||||
WORLDBOMB * gWorldBombs = NULL;
|
WORLDBOMB * gWorldBombs = NULL;
|
||||||
@@ -393,43 +393,16 @@ void FindPanicBombsAndTriggers( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INT32 GetFreeWorldItemIndex( void )
|
UINT32 GetFreeWorldItemIndex(void)//dnl ch75 271013
|
||||||
{
|
{
|
||||||
UINT32 uiCount;
|
UINT32 uiCount;
|
||||||
WORLDITEM *newWorldItems;
|
for(uiCount=0; uiCount<gWorldItems.size(); uiCount++)
|
||||||
UINT32 uiOldNumWorldItems;
|
if(gWorldItems[uiCount].fExists == FALSE)
|
||||||
|
return(uiCount);
|
||||||
for(uiCount=0; uiCount < guiNumWorldItems; uiCount++)
|
ResizeWorldItems();
|
||||||
{
|
return(uiCount);
|
||||||
if ( gWorldItems[ uiCount ].fExists == FALSE )
|
|
||||||
return( (INT32)uiCount );
|
|
||||||
}
|
|
||||||
|
|
||||||
uiOldNumWorldItems = guiNumWorldItems;
|
|
||||||
// grow by 3/2 as a better strategy, minimum 10
|
|
||||||
guiNumWorldItems = max(10, guiNumWorldItems * 3 / 2);
|
|
||||||
//Allocate new table with max+10 items.
|
|
||||||
newWorldItems = new WORLDITEM [ guiNumWorldItems ];
|
|
||||||
if (newWorldItems == NULL)
|
|
||||||
{
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gWorldItems)
|
|
||||||
{
|
|
||||||
for (unsigned int x = 0; x < uiOldNumWorldItems; ++x)
|
|
||||||
{
|
|
||||||
newWorldItems[x] = gWorldItems[x];
|
|
||||||
}
|
|
||||||
delete[] gWorldItems;
|
|
||||||
}
|
|
||||||
gWorldItems = newWorldItems;
|
|
||||||
|
|
||||||
// Return uiCount.....
|
|
||||||
return( uiCount );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UINT32 GetNumUsedWorldItems( void )
|
UINT32 GetNumUsedWorldItems( void )
|
||||||
{
|
{
|
||||||
UINT32 uiCount, uiNumItems;
|
UINT32 uiCount, uiNumItems;
|
||||||
@@ -446,7 +419,22 @@ UINT32 GetNumUsedWorldItems( void )
|
|||||||
return( uiNumItems );
|
return( uiNumItems );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResizeWorldItems(void)//dnl ch75 271013
|
||||||
|
{
|
||||||
|
#ifdef INVFIX_Moa
|
||||||
|
// grow by 3/2 as a better strategy, minimum 10
|
||||||
|
guiNumWorldItems = max(10, guiNumWorldItems * 3 / 2);
|
||||||
|
//Allocate new table with max+10 items.
|
||||||
|
gWorldItems.resize(guiNumWorldItems);
|
||||||
|
#else
|
||||||
|
guiNumWorldItems = gWorldItems.size();
|
||||||
|
if(guiNumWorldItems - GetNumUsedWorldItems() < 100)
|
||||||
|
{
|
||||||
|
gWorldItems.resize(guiNumWorldItems + 100);
|
||||||
|
guiNumWorldItems = gWorldItems.size();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT8 soldierID )
|
INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT8 soldierID )
|
||||||
{
|
{
|
||||||
@@ -538,7 +526,7 @@ void RemoveItemFromWorld( INT32 iItemIndex )
|
|||||||
void TrashWorldItems()
|
void TrashWorldItems()
|
||||||
{
|
{
|
||||||
UINT32 i;
|
UINT32 i;
|
||||||
if( gWorldItems )
|
if( !gWorldItems.empty() )//dnl ch75 271013
|
||||||
{
|
{
|
||||||
for( i = 0; i < guiNumWorldItems; i++ )
|
for( i = 0; i < guiNumWorldItems; i++ )
|
||||||
{
|
{
|
||||||
@@ -547,9 +535,9 @@ void TrashWorldItems()
|
|||||||
RemoveItemFromPool( gWorldItems[ i ].sGridNo, i, gWorldItems[ i ].ubLevel );
|
RemoveItemFromPool( gWorldItems[ i ].sGridNo, i, gWorldItems[ i ].ubLevel );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] gWorldItems;
|
#ifdef INVFIX_Moa//dnl ch75 311013
|
||||||
gWorldItems = NULL;
|
gWorldItems.clear();
|
||||||
guiNumWorldItems = 0;
|
#endif
|
||||||
}
|
}
|
||||||
if ( gWorldBombs )
|
if ( gWorldBombs )
|
||||||
{
|
{
|
||||||
@@ -847,7 +835,7 @@ void DeleteWorldItemsBelongingToQueenIfThere( void )
|
|||||||
|
|
||||||
|
|
||||||
// Refresh item pools
|
// Refresh item pools
|
||||||
void RefreshWorldItemsIntoItemPools( WORLDITEM * pItemList, INT32 iNumberOfItems )
|
void RefreshWorldItemsIntoItemPools( std::vector<WORLDITEM>& pItemList, INT32 iNumberOfItems )//dnl ch75 271013
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public:
|
|||||||
#define SIZEOF_WORLDITEM_POD (offsetof(WORLDITEM, endOfPod))
|
#define SIZEOF_WORLDITEM_POD (offsetof(WORLDITEM, endOfPod))
|
||||||
#define _OLD_SIZEOF_WORLDITEM_POD (offsetof(_OLD_WORLDITEM, endOfPod))
|
#define _OLD_SIZEOF_WORLDITEM_POD (offsetof(_OLD_WORLDITEM, endOfPod))
|
||||||
|
|
||||||
extern WORLDITEM *gWorldItems;
|
extern std::vector<WORLDITEM> gWorldItems;//dnl ch75 261013
|
||||||
extern UINT32 guiNumWorldItems;
|
extern UINT32 guiNumWorldItems;
|
||||||
|
|
||||||
INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT8 soldierID );
|
INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT8 soldierID );
|
||||||
@@ -133,7 +133,8 @@ extern INT32 FindWorldItemForBombInGridNo( INT32 sGridNo, INT8 bLevel);
|
|||||||
// Flugente: is there a planted tripwire at this gridno? fKnown = TRUE: only return true if we know of that one already
|
// Flugente: is there a planted tripwire at this gridno? fKnown = TRUE: only return true if we know of that one already
|
||||||
extern INT32 FindWorldItemForTripwireInGridNo( INT32 sGridNo, INT8 bLevel, BOOLEAN fKnown = TRUE );
|
extern INT32 FindWorldItemForTripwireInGridNo( INT32 sGridNo, INT8 bLevel, BOOLEAN fKnown = TRUE );
|
||||||
|
|
||||||
void RefreshWorldItemsIntoItemPools( WORLDITEM * pItemList, INT32 iNumberOfItems );
|
void ResizeWorldItems(void);//dnl ch75 271013
|
||||||
|
void RefreshWorldItemsIntoItemPools( std::vector<WORLDITEM>& pItemList, INT32 iNumberOfItems );//dnl ch75 271013
|
||||||
void CoolDownWorldItems( ); // Flugente: Cool/decay down all items in this sector
|
void CoolDownWorldItems( ); // Flugente: Cool/decay down all items in this sector
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -3893,7 +3893,7 @@ void HandleExplosionQueue( void )
|
|||||||
|
|
||||||
uiCurrentTime = GetJA2Clock();
|
uiCurrentTime = GetJA2Clock();
|
||||||
// WDS 07/25/2008 - Avoid error where gWorldItems and/or gWorldBombs is nil
|
// WDS 07/25/2008 - Avoid error where gWorldItems and/or gWorldBombs is nil
|
||||||
if (gWorldBombs && gWorldItems) {
|
if (gWorldBombs && !gWorldItems.empty()) {//dnl ch75 271013
|
||||||
for ( uiIndex = 0; uiIndex < gubElementsOnExplosionQueue; uiIndex++ )
|
for ( uiIndex = 0; uiIndex < gubElementsOnExplosionQueue; uiIndex++ )
|
||||||
{
|
{
|
||||||
if ( gExplosionQueue[ uiIndex ].fExists && uiCurrentTime >= gExplosionQueue[ uiIndex ].uiTimeStamp )
|
if ( gExplosionQueue[ uiIndex ].fExists && uiCurrentTime >= gExplosionQueue[ uiIndex ].uiTimeStamp )
|
||||||
|
|||||||
Reference in New Issue
Block a user