diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 0d5a0918..add6c773 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -1642,18 +1642,31 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId ) } UINT32 invsize = Menptr[ uiMercId ].inv.size(); - for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter ) + UINT32 uiFoundItems = 0; + Inventory invTemporaryBeforeDrop; + + if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || Menptr[ uiMercId ].bSectorZ != gbWorldSectorZ ) { - // slot found, - // check if actual item - if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true ) + for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter ) { - if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || Menptr[ uiMercId ].bSectorZ != gbWorldSectorZ ) + // slot found, + // check if actual item + if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true ) { - // Set flag for item... - AddItemsToUnLoadedSector( Menptr[ uiMercId ].sSectorX, Menptr[ uiMercId ].sSectorY, Menptr[ uiMercId ].bSectorZ , sGridNo, 1, &( Menptr[ uiMercId ].inv[ iCounter ]) , Menptr[ uiMercId ].pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE ); + invTemporaryBeforeDrop[uiFoundItems] = Menptr[ uiMercId ].inv[ iCounter ]; + uiFoundItems++; } - else + } + // anv: add all items at once (less file operations = less lag) + AddItemsToUnLoadedSector( Menptr[ uiMercId ].sSectorX, Menptr[ uiMercId ].sSectorY, Menptr[ uiMercId ].bSectorZ , sGridNo, uiFoundItems, &(invTemporaryBeforeDrop[0]) , Menptr[ uiMercId ].pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE ); + } + else + { + for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter ) + { + // slot found, + // check if actual item + if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true ) { AddItemToPool( sGridNo, &( Menptr[ uiMercId ].inv[ iCounter ] ) , 1, Menptr[ uiMercId ].pathing.bLevel, WORLD_ITEM_REACHABLE, 0 ); } diff --git a/Tactical/Food.cpp b/Tactical/Food.cpp index 15c63f7a..e9c74ea3 100644 --- a/Tactical/Food.cpp +++ b/Tactical/Food.cpp @@ -716,7 +716,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly ) ApplyFood( pSoldier, pObj, TRUE, FALSE ); // cannot reject to eat this, we chose to eat this ourself! // if we're full, finish - if ( pSoldier->bFoodLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold && pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold ) + if ( ( pSoldier->bFoodLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold || Food[foodtype].bFoodPoints == 0 ) && ( pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold|| Food[foodtype].bDrinkPoints == 0 ) ) return; } } diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 30b0c4d2..23c27fdf 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -7935,7 +7935,7 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ) return( fRet ); } -BOOLEAN CreateItems( UINT16 usItem, INT8 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj ) +BOOLEAN CreateItems( UINT16 usItem, INT16 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj ) { BOOLEAN fOk; fOk = CreateItem( usItem, bStatus, pObj ); diff --git a/Tactical/Items.h b/Tactical/Items.h index 77686044..18c62a2c 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -62,7 +62,7 @@ extern UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSo extern BOOLEAN EmptyWeaponMagazine( OBJECTTYPE * pWeapon, OBJECTTYPE *pAmmo, UINT32 subObject = 0 ); BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ); BOOLEAN CreateAmmo( UINT16 usItem, OBJECTTYPE * pObj, UINT16 ubShotsLeft = 0); -BOOLEAN CreateItems( UINT16 usItem, INT8 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj ); +BOOLEAN CreateItems( UINT16 usItem, INT16 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj ); BOOLEAN CreateMoney( UINT32 uiMoney, OBJECTTYPE * pObj ); extern UINT16 DefaultMagazine( UINT16 usItem ); UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard, UINT8 maxCoolness, INT8 bSoldierClass ); diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 87003323..44b08123 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -8207,6 +8207,10 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) sFinalSuppressionEffectiveness += (10 + (ubGunVolume - 85)); } } + + // remember effectiveness at this point before modyfing it depending on target's team + INT16 sFinalShooterDependentEffectiveness = sFinalSuppressionEffectiveness; + //////////////////////////////////////////////////////////////////////////////////////////////////// // Loop through every character. @@ -8243,9 +8247,9 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) // Flugente: added ini options for suppression effectiveness for player team and everybody else if ( pSoldier->bTeam == gbPlayerNum ) - sFinalSuppressionEffectiveness = sFinalSuppressionEffectiveness * gGameExternalOptions.usSuppressionEffectivenessPlayer / 100; + sFinalSuppressionEffectiveness = sFinalShooterDependentEffectiveness * gGameExternalOptions.usSuppressionEffectivenessPlayer / 100; else - sFinalSuppressionEffectiveness = sFinalSuppressionEffectiveness * gGameExternalOptions.usSuppressionEffectivenessAI / 100; + sFinalSuppressionEffectiveness = sFinalShooterDependentEffectiveness * gGameExternalOptions.usSuppressionEffectivenessAI / 100; // INI-Controlled intensity. SuppressionEffectiveness acts as a percentage applied to the number of lost APs. // To turn off the entire Suppression system, simply set the INI value to 0. (0% AP Loss) diff --git a/Tactical/Tactical Save.cpp b/Tactical/Tactical Save.cpp index d4eb8c42..04209eec 100644 --- a/Tactical/Tactical Save.cpp +++ b/Tactical/Tactical Save.cpp @@ -847,18 +847,20 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sG DeleteTempItemMapFile( sMapX, sMapY, bMapZ ); } + UINT16 uiLastFoundSpot = 0; //loop through all the objects to add for( uiLoop1=0; uiLoop1 < uiNumberOfItemsToAdd; uiLoop1++) { //Loop through the array to see if there is a free spot to add an item to it - for( cnt=0; cnt < uiNumberOfItems; cnt++) + for( cnt=uiLastFoundSpot; cnt < uiNumberOfItems; cnt++) { if( pWorldItems[ cnt ].fExists == FALSE ) { + // anv: remember first found free spot to not loop through entire inventory again for next added items + uiLastFoundSpot = cnt; //We have found a free spot, break break; - } - } + } } if( cnt == ( uiNumberOfItems ) ) {