Skip to content

Commit

Permalink
Rename GetItemSlot to GetItemLoadoutSlot
Browse files Browse the repository at this point in the history
It seems like there's still some confusion, so I'll go ahead and tweak the native name.
  • Loading branch information
nosoop committed Aug 31, 2020
1 parent a9ba888 commit b9034c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion scripting/include/tf_econ_data.inc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ native bool TF2Econ_GetItemClassName(int itemdef, char[] buffer, int maxlen);
* More information about this distinction is available here:
* https://github.com/nosoop/SM-TFEconData/wiki/Porting-TF2IDB-and-TF2II-plugins-to-TFEconData#notes-about-loadout-slots
*/
native int TF2Econ_GetItemSlot(int itemdef, TFClassType playerClass);
native int TF2Econ_GetItemLoadoutSlot(int itemdef, TFClassType playerClass);

/**
* Returns the given item's equipment region mask. This mask can be and-tested with another
Expand Down Expand Up @@ -347,6 +347,15 @@ native Address TF2Econ_GetPaintKitDefinitionAddress(int protoDefIndex);
#pragma deprecated Use TF2Econ_IsValidItemDefinition instead
native bool TF2Econ_IsValidDefinitionIndex(int itemdef);

/**
* @deprecated Renamed native to TF2Econ_GetItemLoadoutSlot to remove the confusion on weapon
* and loadout slots.
*
* This native will still be present for backwards compatibility.
*/
#pragma deprecated Use TF2Econ_GetItemLoadoutSlot instead
native int TF2Econ_GetItemSlot(int itemdef, TFClassType playerClass);

public SharedPlugin __pl_tf_econ_data = {
name = "tf_econ_data",
file = "tf_econ_data.smx",
Expand Down
5 changes: 3 additions & 2 deletions scripting/tf_econ_data.sp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <stocksoup/handles>
#include <stocksoup/memory>

#define PLUGIN_VERSION "0.16.6"
#define PLUGIN_VERSION "0.16.7"
public Plugin myinfo = {
name = "[TF2] Econ Data",
author = "nosoop",
Expand Down Expand Up @@ -54,7 +54,7 @@ public APLRes AskPluginLoad2(Handle self, bool late, char[] error, int maxlen) {
CreateNative("TF2Econ_GetItemName", Native_GetItemName);
CreateNative("TF2Econ_GetLocalizedItemName", Native_GetLocalizedItemName);
CreateNative("TF2Econ_GetItemClassName", Native_GetItemClassName);
CreateNative("TF2Econ_GetItemSlot", Native_GetItemSlot);
CreateNative("TF2Econ_GetItemLoadoutSlot", Native_GetItemSlot);
CreateNative("TF2Econ_GetItemEquipRegionMask", Native_GetItemEquipRegionMask);
CreateNative("TF2Econ_GetItemEquipRegionGroupBits", Native_GetItemEquipRegionGroupBits);
CreateNative("TF2Econ_GetItemLevelRange", Native_GetItemLevelRange);
Expand Down Expand Up @@ -119,6 +119,7 @@ public APLRes AskPluginLoad2(Handle self, bool late, char[] error, int maxlen) {

// backwards-compatibile
CreateNative("TF2Econ_IsValidDefinitionIndex", Native_IsValidItemDefinition);
CreateNative("TF2Econ_GetItemSlot", Native_GetItemSlot);

return APLRes_Success;
}
Expand Down

0 comments on commit b9034c4

Please sign in to comment.