Possibly did what xoft wanted
This commit is contained in:
parent
3373daca26
commit
5d03e49c13
19
src/Item.cpp
19
src/Item.cpp
@ -99,6 +99,25 @@ bool cItem::IsFullStack(void) const
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cItem::CustomCopy(cItem & a_OtherItem, bool a_CopyType, bool a_CopyCount, bool a_CopyDamage, bool a_CopyEnchantments, bool a_CopyCustomName, bool a_CopyLore)
|
||||||
|
{
|
||||||
|
if (a_CopyType)
|
||||||
|
m_ItemType = a_OtherItem.m_ItemType;
|
||||||
|
if (a_CopyCount)
|
||||||
|
m_ItemCount = a_OtherItem.m_ItemCount;
|
||||||
|
if (a_CopyDamage)
|
||||||
|
m_ItemDamage = a_OtherItem.m_ItemDamage;
|
||||||
|
if (a_CopyEnchantments)
|
||||||
|
m_Enchantments = a_OtherItem.m_Enchantments;
|
||||||
|
if (a_CopyCustomName)
|
||||||
|
m_CustomName = a_OtherItem.m_CustomName;
|
||||||
|
if (a_CopyLore)
|
||||||
|
m_Lore = a_OtherItem.m_Lore;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char cItem::GetMaxStackSize(void) const
|
char cItem::GetMaxStackSize(void) const
|
||||||
{
|
{
|
||||||
|
@ -134,6 +134,9 @@ public:
|
|||||||
|
|
||||||
bool IsCustomNameEmpty(void) const { return (m_CustomName.empty()); }
|
bool IsCustomNameEmpty(void) const { return (m_CustomName.empty()); }
|
||||||
bool IsLoreEmpty(void) const { return (m_Lore.empty()); }
|
bool IsLoreEmpty(void) const { return (m_Lore.empty()); }
|
||||||
|
|
||||||
|
/** Copies specified internal variables from another item to this item */
|
||||||
|
void CustomCopy(cItem & a_OtherItem, bool a_CopyType, bool a_CopyCount, bool a_CopyDamage, bool a_CopyEnchantments, bool a_CopyCustomName, bool a_CopyLore);
|
||||||
|
|
||||||
|
|
||||||
/// Returns a copy of this item with m_ItemCount set to 1. Useful to preserve enchantments etc. on stacked items
|
/// Returns a copy of this item with m_ItemCount set to 1. Useful to preserve enchantments etc. on stacked items
|
||||||
|
@ -87,11 +87,8 @@ void cSlotArea::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickA
|
|||||||
{
|
{
|
||||||
DraggingItem.m_ItemCount = (char)(((float)Slot.m_ItemCount) / 2.f + 0.5f);
|
DraggingItem.m_ItemCount = (char)(((float)Slot.m_ItemCount) / 2.f + 0.5f);
|
||||||
Slot.m_ItemCount -= DraggingItem.m_ItemCount;
|
Slot.m_ItemCount -= DraggingItem.m_ItemCount;
|
||||||
DraggingItem.m_ItemType = Slot.m_ItemType;
|
|
||||||
DraggingItem.m_ItemDamage = Slot.m_ItemDamage;
|
DraggingItem.CustomCopy(Slot, true, false, true, true, true, true);
|
||||||
DraggingItem.m_Enchantments = Slot.m_Enchantments;
|
|
||||||
DraggingItem.m_CustomName = Slot.m_CustomName;
|
|
||||||
DraggingItem.m_Lore = Slot.m_Lore;
|
|
||||||
|
|
||||||
if (Slot.m_ItemCount <= 0)
|
if (Slot.m_ItemCount <= 0)
|
||||||
{
|
{
|
||||||
@ -104,14 +101,10 @@ void cSlotArea::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickA
|
|||||||
cItemHandler * Handler = ItemHandler(Slot.m_ItemType);
|
cItemHandler * Handler = ItemHandler(Slot.m_ItemType);
|
||||||
if ((DraggingItem.m_ItemCount > 0) && (Slot.m_ItemCount < Handler->GetMaxStackSize()))
|
if ((DraggingItem.m_ItemCount > 0) && (Slot.m_ItemCount < Handler->GetMaxStackSize()))
|
||||||
{
|
{
|
||||||
Slot.m_ItemType = DraggingItem.m_ItemType;
|
|
||||||
Slot.m_ItemCount++;
|
Slot.m_ItemCount++;
|
||||||
Slot.m_ItemDamage = DraggingItem.m_ItemDamage;
|
|
||||||
DraggingItem.m_ItemCount--;
|
DraggingItem.m_ItemCount--;
|
||||||
|
|
||||||
Slot.m_Enchantments = DraggingItem.m_Enchantments;
|
Slot.CustomCopy(DraggingItem, true, false, true, true, true, true);
|
||||||
Slot.m_CustomName = DraggingItem.m_CustomName;
|
|
||||||
Slot.m_Lore = DraggingItem.m_Lore;
|
|
||||||
}
|
}
|
||||||
if (DraggingItem.m_ItemCount <= 0)
|
if (DraggingItem.m_ItemCount <= 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user