From b651c4deb436370dc8ded2fcda979ef7e31bab6a Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 7 Feb 2017 13:50:28 +0200 Subject: [PATCH] [Server] In Item script functions, rename itemId into refId for clarity --- apps/openmw-mp/Script/Functions/Items.cpp | 20 ++++++++++---------- apps/openmw-mp/Script/Functions/Items.hpp | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Items.cpp b/apps/openmw-mp/Script/Functions/Items.cpp index b391f8ccf..82edb2c2c 100644 --- a/apps/openmw-mp/Script/Functions/Items.cpp +++ b/apps/openmw-mp/Script/Functions/Items.cpp @@ -24,12 +24,12 @@ unsigned int ItemFunctions::GetInventoryChangesSize(unsigned short pid) noexcept return player->inventoryChanges.count; } -void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const char *itemId, unsigned int count, int charge) noexcept +void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const char *refId, unsigned int count, int charge) noexcept { Player *player; GET_PLAYER(pid, player,); - player->equipedItems[slot].refId = itemId; + player->equipedItems[slot].refId = refId; player->equipedItems[slot].count = count; player->equipedItems[slot].charge = charge; } @@ -42,13 +42,13 @@ void ItemFunctions::UnequipItem(unsigned short pid, unsigned short slot) noexcep ItemFunctions::EquipItem(pid, slot, "", 0, -1); } -void ItemFunctions::AddItem(unsigned short pid, const char* itemId, unsigned int count, int charge) noexcept +void ItemFunctions::AddItem(unsigned short pid, const char* refId, unsigned int count, int charge) noexcept { Player *player; GET_PLAYER(pid, player, ); Item item; - item.refId = itemId; + item.refId = refId; item.count = count; item.charge = charge; @@ -56,13 +56,13 @@ void ItemFunctions::AddItem(unsigned short pid, const char* itemId, unsigned int player->inventoryChangesBuffer.action = InventoryChanges::ADD; } -void ItemFunctions::RemoveItem(unsigned short pid, const char* itemId, unsigned short count) noexcept +void ItemFunctions::RemoveItem(unsigned short pid, const char* refId, unsigned short count) noexcept { Player *player; GET_PLAYER(pid, player, ); Item item; - item.refId = itemId; + item.refId = refId; item.count = count; player->inventoryChangesBuffer.items.push_back(item); @@ -78,18 +78,18 @@ void ItemFunctions::ClearInventory(unsigned short pid) noexcept player->inventoryChangesBuffer.action = InventoryChanges::SET; } -bool ItemFunctions::HasItemEquipped(unsigned short pid, const char* itemId) +bool ItemFunctions::HasItemEquipped(unsigned short pid, const char* refId) { Player *player; GET_PLAYER(pid, player, false); for (int slot = 0; slot < MWWorld::InventoryStore::Slots; slot++) - if (Misc::StringUtils::ciEqual(player->equipedItems[slot].refId, itemId)) + if (Misc::StringUtils::ciEqual(player->equipedItems[slot].refId, refId)) return true; return false; } -const char *ItemFunctions::GetEquipmentItemId(unsigned short pid, unsigned short slot) noexcept +const char *ItemFunctions::GetEquipmentItemRefId(unsigned short pid, unsigned short slot) noexcept { Player *player; GET_PLAYER(pid, player, 0); @@ -113,7 +113,7 @@ int ItemFunctions::GetEquipmentItemCharge(unsigned short pid, unsigned short slo return player->equipedItems[slot].charge; } -const char *ItemFunctions::GetInventoryItemId(unsigned short pid, unsigned int i) noexcept +const char *ItemFunctions::GetInventoryItemRefId(unsigned short pid, unsigned int i) noexcept { Player *player; GET_PLAYER(pid, player, ""); diff --git a/apps/openmw-mp/Script/Functions/Items.hpp b/apps/openmw-mp/Script/Functions/Items.hpp index 6806cd7c1..4904d918a 100644 --- a/apps/openmw-mp/Script/Functions/Items.hpp +++ b/apps/openmw-mp/Script/Functions/Items.hpp @@ -18,11 +18,11 @@ \ {"HasItemEquipped", ItemFunctions::HasItemEquipped},\ \ - {"GetEquipmentItemId", ItemFunctions::GetEquipmentItemId},\ + {"GetEquipmentItemRefId", ItemFunctions::GetEquipmentItemRefId},\ {"GetEquipmentItemCount", ItemFunctions::GetEquipmentItemCount},\ {"GetEquipmentItemCharge", ItemFunctions::GetEquipmentItemCharge},\ \ - {"GetInventoryItemId", ItemFunctions::GetInventoryItemId},\ + {"GetInventoryItemRefId", ItemFunctions::GetInventoryItemRefId},\ {"GetInventoryItemCount", ItemFunctions::GetInventoryItemCount},\ {"GetInventoryItemCharge", ItemFunctions::GetInventoryItemCharge},\ \ @@ -36,20 +36,20 @@ public: static int GetEquipmentSize() noexcept; static unsigned int GetInventoryChangesSize(unsigned short pid) noexcept; - static void EquipItem(unsigned short pid, unsigned short slot, const char* itemId, unsigned int count, int charge) noexcept; + static void EquipItem(unsigned short pid, unsigned short slot, const char* refId, unsigned int count, int charge) noexcept; static void UnequipItem(unsigned short pid, unsigned short slot) noexcept; - static void AddItem(unsigned short pid, const char* itemId, unsigned int count, int charge) noexcept; - static void RemoveItem(unsigned short pid, const char* itemId, unsigned short count) noexcept; + static void AddItem(unsigned short pid, const char* refId, unsigned int count, int charge) noexcept; + static void RemoveItem(unsigned short pid, const char* refId, unsigned short count) noexcept; static void ClearInventory(unsigned short pid) noexcept; - static bool HasItemEquipped(unsigned short pid, const char* itemId); + static bool HasItemEquipped(unsigned short pid, const char* refId); - static const char *GetEquipmentItemId(unsigned short pid, unsigned short slot) noexcept; + static const char *GetEquipmentItemRefId(unsigned short pid, unsigned short slot) noexcept; static int GetEquipmentItemCount(unsigned short pid, unsigned short slot) noexcept; static int GetEquipmentItemCharge(unsigned short pid, unsigned short slot) noexcept; - static const char *GetInventoryItemId(unsigned short pid, unsigned int i) noexcept; + static const char *GetInventoryItemRefId(unsigned short pid, unsigned int i) noexcept; static int GetInventoryItemCount(unsigned short pid, unsigned int i) noexcept; static int GetInventoryItemCharge(unsigned short pid, unsigned int i) noexcept;