1
0

Change m_RepairCost to int.

This commit is contained in:
Howaner 2014-05-07 20:43:37 +02:00
parent e86bf64867
commit fbb6404cc8
6 changed files with 10 additions and 16 deletions

View File

@ -182,7 +182,7 @@ void cItem::FromJson(const Json::Value & a_Value)
m_FireworkItem.FadeColoursFromString(a_Value.get("FadeColours", "").asString(), m_FireworkItem);
}
m_RepairCost = (unsigned short)a_Value.get("RepairCost", 0).asInt();
m_RepairCost = a_Value.get("RepairCost", 0).asInt();
}
}

View File

@ -87,8 +87,8 @@ public:
m_Enchantments(a_CopyFrom.m_Enchantments),
m_CustomName (a_CopyFrom.m_CustomName),
m_Lore (a_CopyFrom.m_Lore),
m_FireworkItem(a_CopyFrom.m_FireworkItem),
m_RepairCost (a_CopyFrom.m_RepairCost)
m_FireworkItem(a_CopyFrom.m_FireworkItem),
{
}
@ -202,7 +202,7 @@ public:
AString m_CustomName;
AString m_Lore;
UInt16 m_RepairCost;
int m_RepairCost;
cFireworkItem m_FireworkItem;
};
// tolua_end

View File

@ -2282,7 +2282,7 @@ void cProtocol172::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata)
{
if (TagName == "RepairCost")
{
a_Item.m_RepairCost = (UInt16)NBT.GetInt(tag);
a_Item.m_RepairCost = NBT.GetInt(tag);
}
}
default: LOGD("Unimplemented NBT data when parsing!"); break;
@ -2460,7 +2460,7 @@ void cProtocol172::cPacketizer::WriteItem(const cItem & a_Item)
cFastNBTWriter Writer;
if (a_Item.m_RepairCost != 0)
{
Writer.AddInt("RepairCost", (Int32)a_Item.m_RepairCost);
Writer.AddInt("RepairCost", a_Item.m_RepairCost);
}
if (!a_Item.m_Enchantments.IsEmpty())
{

View File

@ -866,7 +866,7 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player)
m_MaximumCost = 0;
m_StackSizeToBeUsedInRepair = 0;
UInt16 RepairCost = Input.m_RepairCost;
int RepairCost = Input.m_RepairCost;
int NeedExp = 0;
bool IsEnchantBook = false;
if (!SecondInput.IsEmpty())
@ -982,15 +982,9 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player)
RepairCost = std::max(Input.m_RepairCost, SecondInput.m_RepairCost);
if (!Input.m_CustomName.empty())
{
if (RepairCost < 9)
{
RepairCost = 0;
}
else
{
RepairCost -= 9;
}
RepairCost -= 9;
}
RepairCost = std::max(RepairCost, 0);
RepairCost += 2;
Input.m_RepairCost = RepairCost;
}

View File

@ -108,7 +108,7 @@ void cNBTChunkSerializer::AddItem(const cItem & a_Item, int a_Slot, const AStrin
m_Writer.BeginCompound("tag");
if (a_Item.m_RepairCost > 0)
{
m_Writer.AddInt("RepairCost", (Int32)a_Item.m_RepairCost);
m_Writer.AddInt("RepairCost", a_Item.m_RepairCost);
}
if ((a_Item.m_CustomName != "") || (a_Item.m_Lore != ""))

View File

@ -668,7 +668,7 @@ bool cWSSAnvil::LoadItemFromNBT(cItem & a_Item, const cParsedNBT & a_NBT, int a_
int RepairCost = a_NBT.FindChildByName(TagTag, "RepairCost");
if ((RepairCost > 0) && (a_NBT.GetType(RepairCost) == TAG_Int))
{
a_Item.m_RepairCost = (UInt16)a_NBT.GetInt(RepairCost);
a_Item.m_RepairCost = a_NBT.GetInt(RepairCost);
}
// Load display name: