From 96d9ae4e4a1475f28c69f3fd344ec245a380ffc8 Mon Sep 17 00:00:00 2001 From: Kp Date: Thu, 14 Jul 2016 01:59:03 +0000 Subject: [PATCH] Optimize initial MultiLevelInv clear Change the clearing of MultiLevelInv during initialization to reduce wasted stores. MultiLevelInv has three fields. Field ::Initial is not accessed by MultiLevelInv_CountLevelPowerups, and is overwritten immediately afterward, so it does not need to be cleared first. Field ::Current is unconditionally cleared by MultiLevelInv_CountLevelPowerups, so it does not need to be cleared first. Field ::RespawnTimer is not accessed by MultiLevelInv_CountLevelPowerups, but needs to be cleared. Add a clear of field .RespawnTimer and remove the clear of the entire structure. --- similar/main/multi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/similar/main/multi.cpp b/similar/main/multi.cpp index 2b6e70e40..e164d2551 100644 --- a/similar/main/multi.cpp +++ b/similar/main/multi.cpp @@ -5097,9 +5097,9 @@ static void MultiLevelInv_CountPlayerInventory() void MultiLevelInv_InitializeCount() { - MultiLevelInv = {}; MultiLevelInv_CountLevelPowerups(); MultiLevelInv.Initial = MultiLevelInv.Current; + MultiLevelInv.RespawnTimer = {}; } void MultiLevelInv_Recount()