summaryrefslogtreecommitdiffstats
path: root/src/UI/Window.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-04-21 23:29:50 +0200
committerMattes D <github@xoft.cz>2015-04-21 23:29:50 +0200
commite08e932e7a2342c0a20e752fbbc8f0316f729e62 (patch)
treea99e995df3c92f6aad3bd9343c164676f5285184 /src/UI/Window.cpp
parentHotfixed some chunk presence issues when generating. (diff)
downloadcuberite-e08e932e7a2342c0a20e752fbbc8f0316f729e62.tar
cuberite-e08e932e7a2342c0a20e752fbbc8f0316f729e62.tar.gz
cuberite-e08e932e7a2342c0a20e752fbbc8f0316f729e62.tar.bz2
cuberite-e08e932e7a2342c0a20e752fbbc8f0316f729e62.tar.lz
cuberite-e08e932e7a2342c0a20e752fbbc8f0316f729e62.tar.xz
cuberite-e08e932e7a2342c0a20e752fbbc8f0316f729e62.tar.zst
cuberite-e08e932e7a2342c0a20e752fbbc8f0316f729e62.zip
Diffstat (limited to 'src/UI/Window.cpp')
-rw-r--r--src/UI/Window.cpp8
1 files changed, 6 insertions, 2 deletions
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;