summaryrefslogtreecommitdiffstats
path: root/src/UI
diff options
context:
space:
mode:
Diffstat (limited to 'src/UI')
-rw-r--r--src/UI/DropSpenserWindow.cpp2
-rw-r--r--src/UI/DropSpenserWindow.h2
-rw-r--r--src/UI/FurnaceWindow.cpp2
-rw-r--r--src/UI/MinecartWithChestWindow.h2
-rw-r--r--src/UI/SlotArea.h4
-rw-r--r--src/UI/Window.cpp8
-rw-r--r--src/UI/Window.h2
7 files changed, 13 insertions, 9 deletions
diff --git a/src/UI/DropSpenserWindow.cpp b/src/UI/DropSpenserWindow.cpp
index aeb7c64b7..121836e40 100644
--- a/src/UI/DropSpenserWindow.cpp
+++ b/src/UI/DropSpenserWindow.cpp
@@ -1,7 +1,7 @@
// DropSpenserWindow.cpp
-// Representing the UI window for the dropper/dispenser block
+// Representing the UI window for the dropper / dispenser block
#include "Globals.h"
#include "DropSpenserWindow.h"
diff --git a/src/UI/DropSpenserWindow.h b/src/UI/DropSpenserWindow.h
index edff936e5..cfc040493 100644
--- a/src/UI/DropSpenserWindow.h
+++ b/src/UI/DropSpenserWindow.h
@@ -1,7 +1,7 @@
// DropSpenserWindow.h
-// Representing the UI window for the dropper/dispenser block
+// Representing the UI window for the dropper / dispenser block
diff --git a/src/UI/FurnaceWindow.cpp b/src/UI/FurnaceWindow.cpp
index 132439ff3..a4e852fd8 100644
--- a/src/UI/FurnaceWindow.cpp
+++ b/src/UI/FurnaceWindow.cpp
@@ -41,7 +41,7 @@ void cFurnaceWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer &
}
else
{
- // Furnace Input/Fuel Slot
+ // Furnace Input / Fuel Slot
AreasInOrder.push_back(m_SlotAreas[1]); /* Inventory */
AreasInOrder.push_back(m_SlotAreas[2]); /* Hotbar */
super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, false);
diff --git a/src/UI/MinecartWithChestWindow.h b/src/UI/MinecartWithChestWindow.h
index a2b5283a6..87e8f6137 100644
--- a/src/UI/MinecartWithChestWindow.h
+++ b/src/UI/MinecartWithChestWindow.h
@@ -33,7 +33,7 @@ public:
a_ChestCart->GetWorld()->BroadcastSoundEffect("random.chestopen", a_ChestCart->GetPosX(), a_ChestCart->GetPosY(), a_ChestCart->GetPosZ(), 1, 1);
}
- virtual void DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea* a_ClickedArea, bool a_ShouldApply) override
+ virtual void DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply) override
{
cSlotAreas AreasInOrder;
diff --git a/src/UI/SlotArea.h b/src/UI/SlotArea.h
index 0e7ba2a50..664c6502c 100644
--- a/src/UI/SlotArea.h
+++ b/src/UI/SlotArea.h
@@ -239,7 +239,7 @@ public:
// cSlotAreaTemporary overrides:
virtual void Clicked (cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override;
- virtual void DblClicked (cPlayer & a_Player, int a_SlotNum);
+ virtual void DblClicked (cPlayer & a_Player, int a_SlotNum) override;
virtual void OnPlayerRemoved(cPlayer & a_Player) override;
virtual void SetSlot (int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override;
@@ -306,7 +306,7 @@ public:
void UpdateResult(cPlayer & a_Player);
protected:
- /** The maximum cost of repairing/renaming in the anvil. */
+ /** The maximum cost of repairing / renaming in the anvil. */
int m_MaximumCost;
/** The stack size of the second item where was used for repair */
diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp
index bb2e2a807..d1c08acec 100644
--- a/src/UI/Window.cpp
+++ b/src/UI/Window.cpp
@@ -21,19 +21,23 @@
-char cWindow::m_WindowIDCounter = 1;
+Byte cWindow::m_WindowIDCounter = 0;
cWindow::cWindow(WindowType a_WindowType, const AString & a_WindowTitle) :
- m_WindowID((++m_WindowIDCounter) % 127),
+ m_WindowID(static_cast<char>((++m_WindowIDCounter) % 127)),
m_WindowType(a_WindowType),
m_WindowTitle(a_WindowTitle),
m_IsDestroyed(false),
m_Owner(nullptr)
{
+ // The window ID is signed in protocol 1.7, unsigned in protocol 1.8. Keep out of trouble by using only 7 bits:
+ // Ref.: http://forum.mc-server.org/showthread.php?tid=1876
+ ASSERT((m_WindowID >= 0) && (m_WindowID < 127));
+
if (a_WindowType == wtInventory)
{
m_WindowID = 0;
diff --git a/src/UI/Window.h b/src/UI/Window.h
index 9821aade1..156028465 100644
--- a/src/UI/Window.h
+++ b/src/UI/Window.h
@@ -185,7 +185,7 @@ protected:
cWindowOwner * m_Owner;
- static char m_WindowIDCounter;
+ static Byte m_WindowIDCounter;
/// Sets the internal flag as "destroyed"; notifies the owner that the window is destroying
virtual void Destroy(void);