mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +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:
+12
-12
@@ -89,6 +89,7 @@
|
||||
class OBJECTTYPE;
|
||||
class SOLDIERTYPE;
|
||||
extern int POP_UP_BOX_X;
|
||||
extern WorldItems gAllWorldItems;
|
||||
|
||||
#include "MilitiaSquads.h"
|
||||
// HEADROCK HAM 3.5: Include Facility data
|
||||
@@ -8891,17 +8892,17 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
||||
else
|
||||
{
|
||||
// not loaded, load
|
||||
// get total number, visable and invisible
|
||||
BOOLEAN fReturn = GetNumberOfWorldItemsFromTempItemFile( targetX, targetY, bZ, &( uiTotalNumberOfRealItems_Target ), FALSE );
|
||||
Assert( fReturn );
|
||||
|
||||
if( uiTotalNumberOfRealItems_Target > 0 )
|
||||
{
|
||||
// allocate space for the list
|
||||
pWorldItem_Target.resize(uiTotalNumberOfRealItems_Target);//dnl ch75 271013
|
||||
|
||||
// now load into mem
|
||||
LoadWorldItemsFromTempItemFile( targetX, targetY, bZ, pWorldItem_Target );
|
||||
const auto i = FindWorldItemSector(targetX, targetY, bZ);
|
||||
if (i != -1)
|
||||
{
|
||||
uiTotalNumberOfRealItems_Target = gAllWorldItems.NumItems[i];
|
||||
pWorldItem_Target = gAllWorldItems.Items[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
uiTotalNumberOfRealItems_Target = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9027,8 +9028,7 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
||||
}
|
||||
else
|
||||
{
|
||||
//Save the Items to the the file
|
||||
SaveWorldItemsToTempItemFile( targetX, targetY, bZ, uiTotalNumberOfRealItems_Target, pWorldItem_Target );
|
||||
UpdateWorldItems(targetX, targetY, bZ, uiTotalNumberOfRealItems_Target, pWorldItem_Target);
|
||||
}
|
||||
|
||||
// award a bit of experience to the movers
|
||||
|
||||
Reference in New Issue
Block a user