mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
World items patch (by Asdow).
Adds timing logs to savegame function, similar to how we already had in loading a save file. Uses a global struct for unloaded sectors' inventory instead of using map item temp files every time unloaded inventory is accessed. From timing loading and saving functions with a save that has dozens of sectors with hundreds of items each, saving is a little bit slower than before, because map item temp files have to be written to disk just before the save, when that wasn't the case before (from ~0.3 s -> ~0.5s). It is offset by a decrease in loading a game (from ~1.1s -> 0.745s), once an older save is saved at least once. Any unloaded sector inventory access during gameplay is considerably faster and for example the autoresolve lag when militia is using sector equipment is completely gone for me. Preserves save game compatibility git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9277 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include "Interface.h"
|
||||
|
||||
#include "GameInitOptionsScreen.h"
|
||||
extern WorldItems gAllWorldItems;
|
||||
|
||||
// loyalty Omerta drops to and maxes out at if the player betrays the rebels
|
||||
#define HOSTILE_OMERTA_LOYALTY_RATING 10
|
||||
@@ -1128,19 +1129,20 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ,
|
||||
if( gWorldSectorX != sSectorX || gWorldSectorY != sSectorY || gbWorldSectorZ != sSectorZ )
|
||||
{
|
||||
// if the player has never been there, there's no temp file, and 0 items will get returned, preventing any stealing
|
||||
GetNumberOfWorldItemsFromTempItemFile( sSectorX, sSectorY, ( UINT8 )sSectorZ, &uiNumberOfItems, FALSE );
|
||||
const auto ii = FindWorldItemSector(sSectorX, sSectorY, (UINT8)sSectorZ);
|
||||
if (ii != -1)
|
||||
{
|
||||
uiNumberOfItems = gAllWorldItems.NumItems[ii];
|
||||
pItemList = gAllWorldItems.Items[ii];
|
||||
}
|
||||
|
||||
if( uiNumberOfItems == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pItemList.resize(uiNumberOfItems);//dnl ch75 271013
|
||||
|
||||
// now load items
|
||||
LoadWorldItemsFromTempItemFile( sSectorX, sSectorY, ( UINT8 )sSectorZ, pItemList );
|
||||
uiNewTotal = uiNumberOfItems;
|
||||
|
||||
// set up item list ptrs
|
||||
for( iCounter = 0; iCounter < uiNumberOfItems ; ++iCounter )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user