From 80b15beffec32c851f712fd504f043fc4800d19b Mon Sep 17 00:00:00 2001 From: nosoop Date: Wed, 23 Feb 2022 06:45:31 -0800 Subject: [PATCH] Drop caching from internal schema accessors Closes #14. --- scripting/tf_econ_data.sp | 8 ++------ scripting/tf_econ_data/attached_particle_systems.sp | 9 +++------ scripting/tf_econ_data/quality_definition.sp | 9 +-------- scripting/tf_econ_data/rarity_definition.sp | 9 +-------- 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/scripting/tf_econ_data.sp b/scripting/tf_econ_data.sp index 7708032..dcf3e24 100644 --- a/scripting/tf_econ_data.sp +++ b/scripting/tf_econ_data.sp @@ -13,7 +13,7 @@ #include #include -#define PLUGIN_VERSION "0.18.1" +#define PLUGIN_VERSION "0.18.2" public Plugin myinfo = { name = "[TF2] Econ Data", author = "nosoop", @@ -394,11 +394,7 @@ Address GetEconItemDefinition(int defindex) { } static Address GetEconDefaultItemDefinition() { - static Address s_pDefaultItemDefinition; - if (!s_pDefaultItemDefinition) { - s_pDefaultItemDefinition = GetEconItemDefinition(TF_ITEMDEF_DEFAULT); - } - return s_pDefaultItemDefinition; + return GetEconItemDefinition(TF_ITEMDEF_DEFAULT); } public int Native_GetAttributeDefinitionAddress(Handle hPlugin, int nParams) { diff --git a/scripting/tf_econ_data/attached_particle_systems.sp b/scripting/tf_econ_data/attached_particle_systems.sp index 2592226..35fccf9 100644 --- a/scripting/tf_econ_data/attached_particle_systems.sp +++ b/scripting/tf_econ_data/attached_particle_systems.sp @@ -210,12 +210,9 @@ static bool IsParticleSystemRightChild(int index) { // get address of attachedparticlesystem_t in CUtlRBTree by index static Address GetAttachedParticleSystemEntry(int index) { - static Address s_pParticleData; - if (!s_pParticleData) { - Address pParticleSystemTree = GetParticleSystemTree(); - s_pParticleData = DereferencePointer(pParticleSystemTree + view_as
(0x08)); - } - return s_pParticleData + view_as
(index * ATTACHED_PARTICLE_SYSTEM_STRUCT_SIZE); + Address pParticleSystemTree = GetParticleSystemTree(); + Address pParticleData = DereferencePointer(pParticleSystemTree + view_as
(0x08)); + return pParticleData + view_as
(index * ATTACHED_PARTICLE_SYSTEM_STRUCT_SIZE); } static Address GetParticleSystemTree() { diff --git a/scripting/tf_econ_data/quality_definition.sp b/scripting/tf_econ_data/quality_definition.sp index 24614f9..4f6407f 100644 --- a/scripting/tf_econ_data/quality_definition.sp +++ b/scripting/tf_econ_data/quality_definition.sp @@ -149,16 +149,9 @@ static int GetEconQualityDefinitionCount() { } static Address GetEconQualityDefinitionTree() { - static Address s_pItemQualityTree; - if (s_pItemQualityTree) { - return s_pItemQualityTree; - } - Address pSchema = GetEconItemSchema(); if (!pSchema) { return Address_Null; } - - s_pItemQualityTree = pSchema + offs_CEconItemSchema_ItemQualities; - return s_pItemQualityTree; + return pSchema + offs_CEconItemSchema_ItemQualities; } diff --git a/scripting/tf_econ_data/rarity_definition.sp b/scripting/tf_econ_data/rarity_definition.sp index 815b5d2..bc17ec2 100644 --- a/scripting/tf_econ_data/rarity_definition.sp +++ b/scripting/tf_econ_data/rarity_definition.sp @@ -132,16 +132,9 @@ static int GetEconRarityDefinitionCount() { } static Address GetEconRarityDefinitionTree() { - static Address s_pItemRarityTree; - if (s_pItemRarityTree) { - return s_pItemRarityTree; - } - Address pSchema = GetEconItemSchema(); if (!pSchema) { return Address_Null; } - - s_pItemRarityTree = pSchema + offs_CEconItemSchema_ItemRarities; - return s_pItemRarityTree; + return pSchema + offs_CEconItemSchema_ItemRarities; }