mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Optimize RandomMagazine() called when deploying to tactical sector (by sun_alf)
Timings Before: RandomMagazine: 90044 us (total 90044 us) RandomMagazine: 90007 us (total 180051 us) RandomMagazine: 100009 us (total 280060 us) After: RandomMagazine: 0 us (total 0 us) RandomMagazine: 0 us (total 0 us) RandomMagazine: 0 us (total 0 us) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9354 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1461,6 +1461,15 @@ UINT32 InitializeJA2(void)
|
||||
//}
|
||||
SGP_TRYCATCH_RETHROW(LoadExternalGameplayData(TABLEDATA_DIRECTORY, false),L"Loading external data failed");
|
||||
|
||||
// sun_alf: set itemId to each Magazine to avoid searching over Item[] on each MagazineClassIndexToItemType() call.
|
||||
for (int i = 0; i < gMAXITEMS_READ; i++)
|
||||
{
|
||||
if (Item[i].usItemClass == IC_AMMO)
|
||||
{
|
||||
Magazine[Item[i].ubClassIndex].uiIndex = Item[i].uiIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Load external text
|
||||
LoadAllExternalText();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user