mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
Improve loading speed of stash (by Moa)
- improved processing of sector stash (opening/closing) - improved loading speed of save games - improved processing of items droped by militia (most noteable after autoresolve) - and some other code related changes see: http://www.ja-galaxy-forum.com/board/ubbthreads.php/topics/325332/FIX_improve_loading_speed_of_s.html#Post325332 Notes: removed some functions, still in code so but renamed to *_OLD() because they are from Sirtech and should be kept as I have read in "§18) If possible, we don't just delete the old code, but comment it out (or #ifdef it out) for reference. We delete it only if it's really necessary." git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6434 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -13807,6 +13807,7 @@ BOOLEAN SOLDIERTYPE::SoldierCarriesTwoHandedWeapon( void )
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
extern void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, UINT16 naturalDirt = 100, BOOLEAN isUnderground = TRUE );
|
||||
// Flugente: Cool down/decay all items in inventory
|
||||
void SOLDIERTYPE::SoldierInventoryCoolDown(void)
|
||||
{
|
||||
@@ -13865,6 +13866,16 @@ void SOLDIERTYPE::SoldierInventoryCoolDown(void)
|
||||
if ( !gGameExternalOptions.fWeaponOverheating && !gGameExternalOptions.fDirtSystem && !gGameOptions.fFoodSystem )
|
||||
return;
|
||||
|
||||
#if TRUE //start reusing existing code from HandleItemCooldownFunctions, set to FALSE if original code should be used
|
||||
INT8 numStacks = (INT8)this->inv.size(); // remember inventorysize, so we don't call size() repeatedly
|
||||
extern UINT32 guiLastTacticalRealTime, guiLastStrategicTime;
|
||||
UINT32 secondsPassed = 5;//GetJA2Clock() > guiLastTacticalRealTime? (GetJA2Clock() - guiLastTacticalRealTime)/1000 : 0;
|
||||
for ( INT8 bLoop = 0; bLoop < numStacks; ++bLoop) // ... for all items in our inventory ...
|
||||
{
|
||||
HandleItemCooldownFunctions( &(this->inv[bLoop]), secondsPassed );
|
||||
}
|
||||
|
||||
#else //start using original redundant code
|
||||
// one hour has 60 minutes, with 12 5-second-intervals (cooldown values are based on 5-second values)
|
||||
FLOAT fooddecaymod = gGameExternalOptions.sFoodDecayModificator;
|
||||
|
||||
@@ -13966,6 +13977,7 @@ void SOLDIERTYPE::SoldierInventoryCoolDown(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //end using original code
|
||||
}
|
||||
|
||||
// Flugente: determine if we can rest our weapon on something. This can only happen when STANDING/CROUCHED. As a result, we get superior handling modifiers (we apply the PRONE modfiers)
|
||||
|
||||
@@ -820,7 +820,12 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sG
|
||||
WORLDITEM *pWorldItems;
|
||||
UINT32 cnt;
|
||||
UINT32 uiLoop1=0;
|
||||
|
||||
|
||||
if ( uiNumberOfItemsToAdd == 0 && fReplaceEntireFile == FALSE )
|
||||
{
|
||||
//Moa: nothing to do, so get out of here!
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
if( !GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &uiNumberOfItems, TRUE ) )
|
||||
{
|
||||
@@ -3364,26 +3369,28 @@ void SetNumberOfVisibleWorldItemsInSectorStructureForSector( INT16 sMapX, INT16
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Moa 09/19/13: changed loop upperbound from uiTotalNumberOfRealItems to uiTotalNumberOfItems,
|
||||
// this effectivly removes one entire loop in GetNumberOfActiveWorldItemsFromTempFile and 2 file reads.
|
||||
// also changed type of iCounter from INT32 to UINT32 and for in if-clauses from true to TRUE to get rid of unneccessary casts.
|
||||
void SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BOOLEAN fLoadingGame )
|
||||
{
|
||||
UINT32 uiTotalNumberOfItems = 0, uiTotalNumberOfRealItems = 0;
|
||||
UINT32 uiTotalNumberOfItems = 0;//, uiTotalNumberOfRealItems = 0;
|
||||
WORLDITEM * pTotalSectorList = NULL;
|
||||
UINT32 uiItemCount = 0;
|
||||
INT32 iCounter = 0;
|
||||
UINT32 iCounter = 0;
|
||||
BOOLEAN fReturn;
|
||||
|
||||
|
||||
/*
|
||||
// get total number, visable and invisible
|
||||
fReturn = GetNumberOfActiveWorldItemsFromTempFile( sMapX, sMapY, bMapZ, &( uiTotalNumberOfRealItems ) );
|
||||
if (fReturn == false)
|
||||
if (fReturn == TRUE)
|
||||
{
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("GetNumberOfActiveWorldItemsFromTempFile failed" ) );
|
||||
Assert( fReturn );
|
||||
}
|
||||
}*/
|
||||
|
||||
fReturn = GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &( uiTotalNumberOfItems ), FALSE );
|
||||
if (fReturn == false)
|
||||
if (fReturn == TRUE)
|
||||
{
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("GetNumberOfWorldItemsFromTempItemFile failed" ) );
|
||||
Assert( fReturn );
|
||||
@@ -3399,7 +3406,8 @@ void SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems( INT16 sMapX, INT
|
||||
}
|
||||
|
||||
// now run through list and
|
||||
for( iCounter = 0; ( UINT32 )( iCounter )< uiTotalNumberOfRealItems; iCounter++ )
|
||||
//for( iCounter = 0; ( UINT32 )( iCounter )< uiTotalNumberOfRealItems; iCounter++ )
|
||||
for( iCounter = 0; iCounter < uiTotalNumberOfItems; iCounter++ )
|
||||
{
|
||||
// if visible to player, then state fact
|
||||
if( IsMapScreenWorldItemVisibleInMapInventory( &pTotalSectorList[ iCounter ] ) )
|
||||
|
||||
@@ -11,8 +11,14 @@
|
||||
#define RT_FIRST_AID_GAIN_MODIFIER 12
|
||||
|
||||
|
||||
#define NUM_REAL_SEC_PER_TACTICAL_TURN 5000
|
||||
#ifndef NUM_SEC_IN_MIN
|
||||
#define NUM_SEC_IN_MIN 60
|
||||
#endif
|
||||
|
||||
#define NUM_REAL_SEC_PER_TACTICAL_TURN 5000
|
||||
|
||||
#define NUM_SEC_PER_STRATEGIC_TURN ( NUM_SEC_IN_MIN * 15 ) // Every fifteen minutes
|
||||
#define NUM_SEC_PER_TACTICAL_TURN 5
|
||||
#define RT_COMPRESSION_TACTICAL_TURN_MODIFIER 10
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user