summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-02-16 14:46:36 +0100
committerMattes D <github@xoft.cz>2014-02-16 14:46:36 +0100
commitec37e534654a541d3e20a433c6e1fe91636a1096 (patch)
tree89020c391a543ff6d7f8e2189d21749009fc11d8
parentMerge branch 'master' of https://github.com/mc-server/MCServer (diff)
parentAdd Locale to ClientHandle (diff)
downloadcuberite-ec37e534654a541d3e20a433c6e1fe91636a1096.tar
cuberite-ec37e534654a541d3e20a433c6e1fe91636a1096.tar.gz
cuberite-ec37e534654a541d3e20a433c6e1fe91636a1096.tar.bz2
cuberite-ec37e534654a541d3e20a433c6e1fe91636a1096.tar.lz
cuberite-ec37e534654a541d3e20a433c6e1fe91636a1096.tar.xz
cuberite-ec37e534654a541d3e20a433c6e1fe91636a1096.tar.zst
cuberite-ec37e534654a541d3e20a433c6e1fe91636a1096.zip
-rw-r--r--src/ClientHandle.cpp1
-rw-r--r--src/ClientHandle.h7
-rw-r--r--src/Protocol/Protocol132.cpp2
-rw-r--r--src/Protocol/Protocol14x.cpp2
-rw-r--r--src/Protocol/Protocol17x.cpp2
5 files changed, 11 insertions, 3 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index f8a707324..b46bcfd47 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -95,6 +95,7 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
m_ShouldCheckDownloaded(false),
m_NumExplosionsThisTick(0),
m_UniqueID(0),
+ m_Locale("en_GB"),
m_HasSentPlayerChunk(false)
{
m_Protocol = new cProtocolRecognizer(this);
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index 034fe07c2..5faa94004 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -155,6 +155,9 @@ public:
void SetViewDistance(int a_ViewDistance); // tolua_export
int GetViewDistance(void) const { return m_ViewDistance; } // tolua_export
+
+ void SetLocale(AString & a_Locale) { m_Locale = a_Locale; } // tolua_export
+ AString GetLocale(void) const { return m_Locale; } // tolua_export
int GetUniqueID() const { return m_UniqueID; } // tolua_export
@@ -308,7 +311,9 @@ private:
/// Set to true when the chunk where the player is is sent to the client. Used for spawning the player
bool m_HasSentPlayerChunk;
-
+
+ /// Client Settings
+ AString m_Locale;
/// Returns true if the rate block interactions is within a reasonable limit (bot protection)
diff --git a/src/Protocol/Protocol132.cpp b/src/Protocol/Protocol132.cpp
index 648e70151..1f9222a69 100644
--- a/src/Protocol/Protocol132.cpp
+++ b/src/Protocol/Protocol132.cpp
@@ -560,7 +560,7 @@ int cProtocol132::ParseLocaleViewDistance(void)
HANDLE_PACKET_READ(ReadChar, char, ViewDistance);
HANDLE_PACKET_READ(ReadChar, char, ChatFlags);
HANDLE_PACKET_READ(ReadChar, char, ClientDifficulty);
- // TODO: m_Client->HandleLocale(Locale);
+ m_Client->SetLocale(Locale);
// TODO: m_Client->HandleViewDistance(ViewDistance);
// TODO: m_Client->HandleChatFlags(ChatFlags);
// Ignoring client difficulty
diff --git a/src/Protocol/Protocol14x.cpp b/src/Protocol/Protocol14x.cpp
index f82e6de45..232b2718e 100644
--- a/src/Protocol/Protocol14x.cpp
+++ b/src/Protocol/Protocol14x.cpp
@@ -85,7 +85,7 @@ int cProtocol142::ParseLocaleViewDistance(void)
HANDLE_PACKET_READ(ReadChar, char, ChatFlags);
HANDLE_PACKET_READ(ReadChar, char, ClientDifficulty);
HANDLE_PACKET_READ(ReadChar, char, ShouldShowCape); // <-- new in 1.4.2
- // TODO: m_Client->HandleLocale(Locale);
+ m_Client->SetLocale(Locale);
// TODO: m_Client->HandleViewDistance(ViewDistance);
// TODO: m_Client->HandleChatFlags(ChatFlags);
// Ignoring client difficulty
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 1dfa5ec90..f7d13774d 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -1598,6 +1598,8 @@ void cProtocol172::HandlePacketClientSettings(cByteBuffer & a_ByteBuffer)
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, ChatColors);
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, Difficulty);
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, ShowCape);
+
+ m_Client->SetLocale(Locale);
// TODO: handle in m_Client
}