- Bugfix: Encountered save somewhere that took a long time to load a sector. The problem was something like over 1400 items in a cell in the sector. I just changed the reallocation strategy to grow by 3/2 of current size rather than fixed 10 because the number of memcopy decrease significantly at risk of allocating a larger than needed array (13 resizes vs 140 resizes). That code had other problems but this helped quite a bit (by tazpn)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4671 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2011-10-02 20:06:19 +00:00
parent 4a72f0d75e
commit 5d278a3a77
+2 -1
View File
@@ -378,7 +378,8 @@ INT32 GetFreeWorldItemIndex( void )
}
uiOldNumWorldItems = guiNumWorldItems;
guiNumWorldItems += 10;
// 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)