diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-05-07 20:43:37 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-05-07 20:43:37 +0200 |
commit | fbb6404cc8793f5caef374e1eda243fa2d159eb5 (patch) | |
tree | 447e21fdc8b384721d36881d06160b0dfe2c43ab | |
parent | Where is the problem with clang? (diff) | |
download | cuberite-fbb6404cc8793f5caef374e1eda243fa2d159eb5.tar cuberite-fbb6404cc8793f5caef374e1eda243fa2d159eb5.tar.gz cuberite-fbb6404cc8793f5caef374e1eda243fa2d159eb5.tar.bz2 cuberite-fbb6404cc8793f5caef374e1eda243fa2d159eb5.tar.lz cuberite-fbb6404cc8793f5caef374e1eda243fa2d159eb5.tar.xz cuberite-fbb6404cc8793f5caef374e1eda243fa2d159eb5.tar.zst cuberite-fbb6404cc8793f5caef374e1eda243fa2d159eb5.zip |
-rw-r--r-- | src/Item.cpp | 2 | ||||
-rw-r--r-- | src/Item.h | 4 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 4 | ||||
-rw-r--r-- | src/UI/SlotArea.cpp | 12 | ||||
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.cpp | 2 | ||||
-rw-r--r-- | src/WorldStorage/WSSAnvil.cpp | 2 |
6 files changed, 10 insertions, 16 deletions
diff --git a/src/Item.cpp b/src/Item.cpp index d32164bc4..d6e8b224a 100644 --- a/src/Item.cpp +++ b/src/Item.cpp @@ -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(); } } diff --git a/src/Item.h b/src/Item.h index 2a1978aad..1ac9280fc 100644 --- a/src/Item.h +++ b/src/Item.h @@ -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 diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index c4fb9d424..f6849122f 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -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()) { diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index c4c95c7b1..13a9f9b92 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -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; } diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index b696a8f69..6b317663a 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -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 != "")) diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index b1c6238ab..875093910 100644 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -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: |