Browse Source

Rename handle to TF2EconDynAttribute

nosoop 1 year ago
parent
commit
c100718be8
5 changed files with 36 additions and 36 deletions
  1. 1 1
      mmsplugin.cpp
  2. 16 16
      natives.cpp
  3. 9 9
      natives.h
  4. 8 8
      scripting/include/tf_econ_dynamic.inc
  5. 2 2
      scripting/tf_econ_dynamic_compat.sp

+ 1 - 1
mmsplugin.cpp

@@ -24,7 +24,7 @@ bool DynSchema::SDK_OnLoad(char *error, size_t maxlen, bool late)
 	SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &DynSchema::Hook_LevelInitPost, true);
 
 	sharesys->AddNatives(myself, g_EconAttributeNatives);
-	g_EconInjectedAttributeType = g_pHandleSys->CreateType("EconInjectedAttribute", &g_EconInjectedAttributeHandler, 0, NULL, NULL, myself->GetIdentity(), NULL);
+	g_EconInjectedAttributeType = g_pHandleSys->CreateType("EconDynAttr", &g_EconInjectedAttributeHandler, 0, NULL, NULL, myself->GetIdentity(), NULL);
 
 	/* Prepare our manager */
 	if (!g_EconManager.Init(error, maxlen)) {

+ 16 - 16
natives.cpp

@@ -27,7 +27,7 @@ cell_t sm_EconAttributeCreate(IPluginContext *pContext, const cell_t *params) {
 			pContext->GetIdentity(), myself->GetIdentity(), NULL);
 }
 
-// void EconInjectedAttribute.SetClass(const char[] attrClass)
+// void TF2EconDynAttribute.SetClass(const char[] attrClass)
 cell_t sm_EconAttributeSetClass(IPluginContext *pContext, const cell_t *params) {
 	HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
 	HandleError err;
@@ -36,7 +36,7 @@ cell_t sm_EconAttributeSetClass(IPluginContext *pContext, const cell_t *params)
 	
 	AutoKeyValues *pContainer = nullptr;
 	if ((err = g_pHandleSys->ReadHandle(hndl, g_EconInjectedAttributeType, &sec, (void**) &pContainer)) != HandleError_None) {
-		return pContext->ThrowNativeError("Invalid EconInjectedAttribute handle %x (error: %d)", hndl, err);
+		return pContext->ThrowNativeError("Invalid TF2EconDynAttribute handle %x (error: %d)", hndl, err);
 	}
 	
 	char *value;
@@ -46,7 +46,7 @@ cell_t sm_EconAttributeSetClass(IPluginContext *pContext, const cell_t *params)
 	return 0;
 }
 
-// void EconInjectedAttribute.SetName(const char[] attrName)
+// void TF2EconDynAttribute.SetName(const char[] attrName)
 cell_t sm_EconAttributeSetName(IPluginContext *pContext, const cell_t *params) {
 	HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
 	HandleError err;
@@ -55,7 +55,7 @@ cell_t sm_EconAttributeSetName(IPluginContext *pContext, const cell_t *params) {
 	
 	AutoKeyValues *pContainer = nullptr;
 	if ((err = g_pHandleSys->ReadHandle(hndl, g_EconInjectedAttributeType, &sec, (void**) &pContainer)) != HandleError_None) {
-		return pContext->ThrowNativeError("Invalid EconInjectedAttribute handle %x (error: %d)", hndl, err);
+		return pContext->ThrowNativeError("Invalid TF2EconDynAttribute handle %x (error: %d)", hndl, err);
 	}
 	
 	char *value;
@@ -65,7 +65,7 @@ cell_t sm_EconAttributeSetName(IPluginContext *pContext, const cell_t *params) {
 	return 0;
 }
 
-// void EconInjectedAttribute.SetDescriptionFormat(const char[] attrDescFmt)
+// void TF2EconDynAttribute.SetDescriptionFormat(const char[] attrDescFmt)
 cell_t sm_EconAttributeSetDescriptionFormat(IPluginContext *pContext, const cell_t *params) {
 	HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
 	HandleError err;
@@ -74,7 +74,7 @@ cell_t sm_EconAttributeSetDescriptionFormat(IPluginContext *pContext, const cell
 	
 	AutoKeyValues *pContainer = nullptr;
 	if ((err = g_pHandleSys->ReadHandle(hndl, g_EconInjectedAttributeType, &sec, (void**) &pContainer)) != HandleError_None) {
-		return pContext->ThrowNativeError("Invalid EconInjectedAttribute handle %x (error: %d)", hndl, err);
+		return pContext->ThrowNativeError("Invalid TF2EconDynAttribute handle %x (error: %d)", hndl, err);
 	}
 	
 	char *value;
@@ -84,7 +84,7 @@ cell_t sm_EconAttributeSetDescriptionFormat(IPluginContext *pContext, const cell
 	return 0;
 }
 
-// void EconInjectedAttribute.SetCustom(const char[] key, const char[] value)
+// void TF2EconDynAttribute.SetCustom(const char[] key, const char[] value)
 cell_t sm_EconAttributeSetCustomKeyValue(IPluginContext *pContext, const cell_t *params) {
 	HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
 	HandleError err;
@@ -93,7 +93,7 @@ cell_t sm_EconAttributeSetCustomKeyValue(IPluginContext *pContext, const cell_t
 	
 	AutoKeyValues *pContainer = nullptr;
 	if ((err = g_pHandleSys->ReadHandle(hndl, g_EconInjectedAttributeType, &sec, (void**) &pContainer)) != HandleError_None) {
-		return pContext->ThrowNativeError("Invalid EconInjectedAttribute handle %x (error: %d)", hndl, err);
+		return pContext->ThrowNativeError("Invalid TF2EconDynAttribute handle %x (error: %d)", hndl, err);
 	}
 	
 	char *key, *value;
@@ -104,7 +104,7 @@ cell_t sm_EconAttributeSetCustomKeyValue(IPluginContext *pContext, const cell_t
 	return 0;
 }
 
-// void EconInjectedAttribute.SetDefIndex(int attrdef)
+// void TF2EconDynAttribute.SetDefIndex(int attrdef)
 cell_t sm_EconAttributeSetDefIndex(IPluginContext *pContext, const cell_t *params) {
 	HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
 	HandleError err;
@@ -113,7 +113,7 @@ cell_t sm_EconAttributeSetDefIndex(IPluginContext *pContext, const cell_t *param
 	
 	AutoKeyValues *pContainer = nullptr;
 	if ((err = g_pHandleSys->ReadHandle(hndl, g_EconInjectedAttributeType, &sec, (void**) &pContainer)) != HandleError_None) {
-		return pContext->ThrowNativeError("Invalid EconInjectedAttribute handle %x (error: %d)", hndl, err);
+		return pContext->ThrowNativeError("Invalid TF2EconDynAttribute handle %x (error: %d)", hndl, err);
 	}
 	
 	(*pContainer)->SetName(std::to_string(params[2]).c_str());
@@ -121,7 +121,7 @@ cell_t sm_EconAttributeSetDefIndex(IPluginContext *pContext, const cell_t *param
 	return 0;
 }
 
-// void EconInjectedAttribute.ClearDefIndex()
+// void TF2EconDynAttribute.ClearDefIndex()
 cell_t sm_EconAttributeClearDefIndex(IPluginContext *pContext, const cell_t *params) {
 	HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
 	HandleError err;
@@ -130,7 +130,7 @@ cell_t sm_EconAttributeClearDefIndex(IPluginContext *pContext, const cell_t *par
 	
 	AutoKeyValues *pContainer = nullptr;
 	if ((err = g_pHandleSys->ReadHandle(hndl, g_EconInjectedAttributeType, &sec, (void**) &pContainer)) != HandleError_None) {
-		return pContext->ThrowNativeError("Invalid EconInjectedAttribute handle %x (error: %d)", hndl, err);
+		return pContext->ThrowNativeError("Invalid TF2EconDynAttribute handle %x (error: %d)", hndl, err);
 	}
 	
 	(*pContainer)->SetName("auto");
@@ -138,7 +138,7 @@ cell_t sm_EconAttributeClearDefIndex(IPluginContext *pContext, const cell_t *par
 	return 0;
 }
 
-// bool EconInjectedAttribute.Register()
+// bool TF2EconDynAttribute.Register()
 cell_t sm_EconAttributeRegister(IPluginContext *pContext, const cell_t *params) {
 	HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
 	HandleError err;
@@ -147,7 +147,7 @@ cell_t sm_EconAttributeRegister(IPluginContext *pContext, const cell_t *params)
 	
 	AutoKeyValues *pContainer = nullptr;
 	if ((err = g_pHandleSys->ReadHandle(hndl, g_EconInjectedAttributeType, &sec, (void**) &pContainer)) != HandleError_None) {
-		return pContext->ThrowNativeError("Invalid EconInjectedAttribute handle %x (error: %d)", hndl, err);
+		return pContext->ThrowNativeError("Invalid TF2EconDynAttribute handle %x (error: %d)", hndl, err);
 	}
 	
 	
@@ -157,7 +157,7 @@ cell_t sm_EconAttributeRegister(IPluginContext *pContext, const cell_t *params)
 	return true;
 }
 
-// void EconInjectedAttribute.Clear();
+// void TF2EconDynAttribute.Clear();
 cell_t sm_EconAttributeClear(IPluginContext *pContext, const cell_t *params) {
 	HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
 	HandleError err;
@@ -166,7 +166,7 @@ cell_t sm_EconAttributeClear(IPluginContext *pContext, const cell_t *params) {
 	
 	AutoKeyValues *pContainer = nullptr;
 	if ((err = g_pHandleSys->ReadHandle(hndl, g_EconInjectedAttributeType, &sec, (void**) &pContainer)) != HandleError_None) {
-		return pContext->ThrowNativeError("Invalid EconInjectedAttribute handle %x (error: %d)", hndl, err);
+		return pContext->ThrowNativeError("Invalid TF2EconDynAttribute handle %x (error: %d)", hndl, err);
 	}
 	
 	KeyValues::AutoDelete empty("auto");

+ 9 - 9
natives.h

@@ -55,15 +55,15 @@ cell_t sm_EconAttributeRegister(IPluginContext *pContext, const cell_t *params);
 cell_t sm_EconAttributeClear(IPluginContext *pContext, const cell_t *params);
 
 const sp_nativeinfo_t g_EconAttributeNatives[] = {
-	{ "EconInjectedAttribute.EconInjectedAttribute", sm_EconAttributeCreate },
-	{ "EconInjectedAttribute.SetClass", sm_EconAttributeSetClass },
-	{ "EconInjectedAttribute.SetName", sm_EconAttributeSetName },
-	{ "EconInjectedAttribute.SetDescriptionFormat", sm_EconAttributeSetDescriptionFormat },
-	{ "EconInjectedAttribute.SetCustom", sm_EconAttributeSetCustomKeyValue },
-	{ "EconInjectedAttribute.SetDefIndex", sm_EconAttributeSetDefIndex },
-	{ "EconInjectedAttribute.ClearDefIndex", sm_EconAttributeClearDefIndex },
-	{ "EconInjectedAttribute.Register", sm_EconAttributeRegister },
-	{ "EconInjectedAttribute.Clear", sm_EconAttributeClear },
+	{ "TF2EconDynAttribute.TF2EconDynAttribute", sm_EconAttributeCreate },
+	{ "TF2EconDynAttribute.SetClass", sm_EconAttributeSetClass },
+	{ "TF2EconDynAttribute.SetName", sm_EconAttributeSetName },
+	{ "TF2EconDynAttribute.SetDescriptionFormat", sm_EconAttributeSetDescriptionFormat },
+	{ "TF2EconDynAttribute.SetCustom", sm_EconAttributeSetCustomKeyValue },
+	{ "TF2EconDynAttribute.SetDefIndex", sm_EconAttributeSetDefIndex },
+	{ "TF2EconDynAttribute.ClearDefIndex", sm_EconAttributeClearDefIndex },
+	{ "TF2EconDynAttribute.Register", sm_EconAttributeRegister },
+	{ "TF2EconDynAttribute.Clear", sm_EconAttributeClear },
 	
 	{NULL, NULL},
 };

+ 8 - 8
scripting/include/tf_econ_dynamic.inc

@@ -2,16 +2,16 @@
  * An InjectedAttribute is an abstraction over the KeyValues representation of an attribute
  * definition.
  */
-methodmap EconInjectedAttribute < Handle {
+methodmap TF2EconDynAttribute < Handle {
 	/**
-	 * Creates a new, empty EconInjectedAttribute handle.
+	 * Creates a new, empty TF2EconDynAttribute handle.
 	 * 
-	 * The attribute is not injected into the schema until EconInjectedAttribute.Register() is
+	 * The attribute is not injected into the schema until TF2EconDynAttribute.Register() is
 	 * called.
 	 * 
 	 * This handle should be freed by the calling plugin.
 	 */
-	public native EconInjectedAttribute();
+	public native TF2EconDynAttribute();
 	
 	/**
 	 * Sets the attribute class.  All values under the same attribute class are combined.
@@ -70,9 +70,9 @@ methodmap EconInjectedAttribute < Handle {
 	/**
 	 * Stores a copy of the attribute properties in the core plugin to be injected.
 	 * 
-	 * This operation does not clear existing values on the EconInjectedAttribute, so you can
-	 * create multiple attributes by repeatedly calling EconInjectedAttribute.SetName() and
-	 * EconInjectedAttribute.Register().
+	 * This operation does not clear existing values on the TF2EconDynAttribute, so you can
+	 * create multiple attributes by repeatedly calling TF2EconDynAttribute.SetName() and
+	 * TF2EconDynAttribute.Register().
 	 * 
 	 * If an attribute with the same name already exists and is not an injected attribute
 	 * managed by the core plugin, this will fail.
@@ -83,7 +83,7 @@ methodmap EconInjectedAttribute < Handle {
 	public native bool Register();
 	
 	/**
-	 * Imports the properties of an attribute by name to the EconInjectedAttribute handle,
+	 * Imports the properties of an attribute by name to the TF2EconDynAttribute handle,
 	 * replacing all values currently set.
 	 * 
 	 * @return    True if the attribute exists, otherwise false.

+ 2 - 2
scripting/tf_econ_dynamic_compat.sp

@@ -19,10 +19,10 @@ public Plugin myinfo = {
 	url = "https://github.com/nosoop/SMExt-TFEconDynamic"
 }
 
-static EconInjectedAttribute s_AttributeContext;
+static TF2EconDynAttribute s_AttributeContext;
 
 public void OnPluginStart() {
-	s_AttributeContext = new EconInjectedAttribute();
+	s_AttributeContext = new TF2EconDynAttribute();
 	
 	CreateAttributeConfigParsers();
 }