summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-07-20 20:36:08 +0200
committerMattes D <github@xoft.cz>2014-07-20 20:36:08 +0200
commitb41bd2da5c8ea5ec3eff200829c70755a903816f (patch)
treeb704bfa5d31f872e8e7836eb0bbb6e21af17ac35 /src
parentRevert "Only one instance of server can be started" (diff)
parentChatColor.h: The @deprecated tag slipped. Oops. (diff)
downloadcuberite-b41bd2da5c8ea5ec3eff200829c70755a903816f.tar
cuberite-b41bd2da5c8ea5ec3eff200829c70755a903816f.tar.gz
cuberite-b41bd2da5c8ea5ec3eff200829c70755a903816f.tar.bz2
cuberite-b41bd2da5c8ea5ec3eff200829c70755a903816f.tar.lz
cuberite-b41bd2da5c8ea5ec3eff200829c70755a903816f.tar.xz
cuberite-b41bd2da5c8ea5ec3eff200829c70755a903816f.tar.zst
cuberite-b41bd2da5c8ea5ec3eff200829c70755a903816f.zip
Diffstat (limited to 'src')
-rw-r--r--src/ChatColor.cpp48
-rw-r--r--src/ChatColor.h52
-rw-r--r--src/ClientHandle.cpp8
-rw-r--r--src/Entities/Player.cpp2
-rw-r--r--src/GroupManager.cpp2
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp4
6 files changed, 59 insertions, 57 deletions
diff --git a/src/ChatColor.cpp b/src/ChatColor.cpp
index 72a0a6928..e1317c287 100644
--- a/src/ChatColor.cpp
+++ b/src/ChatColor.cpp
@@ -2,31 +2,31 @@
#include "ChatColor.h"
-const std::string cChatColor::Color = "\xc2\xa7"; // or in other words: "§" in UTF-8
-const std::string cChatColor::Delimiter = "\xc2\xa7"; // or in other words: "§" in UTF-8
-const std::string cChatColor::Black = cChatColor::Color + "0";
-const std::string cChatColor::Navy = cChatColor::Color + "1";
-const std::string cChatColor::Green = cChatColor::Color + "2";
-const std::string cChatColor::Blue = cChatColor::Color + "3";
-const std::string cChatColor::Red = cChatColor::Color + "4";
-const std::string cChatColor::Purple = cChatColor::Color + "5";
-const std::string cChatColor::Gold = cChatColor::Color + "6";
-const std::string cChatColor::LightGray = cChatColor::Color + "7";
-const std::string cChatColor::Gray = cChatColor::Color + "8";
-const std::string cChatColor::DarkPurple = cChatColor::Color + "9";
-const std::string cChatColor::LightGreen = cChatColor::Color + "a";
-const std::string cChatColor::LightBlue = cChatColor::Color + "b";
-const std::string cChatColor::Rose = cChatColor::Color + "c";
-const std::string cChatColor::LightPurple = cChatColor::Color + "d";
-const std::string cChatColor::Yellow = cChatColor::Color + "e";
-const std::string cChatColor::White = cChatColor::Color + "f";
+const char * cChatColor::Color = "\xc2\xa7"; // or in other words: "§" in UTF-8
+const char * cChatColor::Delimiter = "\xc2\xa7"; // or in other words: "§" in UTF-8
+const char * cChatColor::Black = "\xc2\xa7""0";
+const char * cChatColor::Navy = "\xc2\xa7""1";
+const char * cChatColor::Green = "\xc2\xa7""2";
+const char * cChatColor::Blue = "\xc2\xa7""3";
+const char * cChatColor::Red = "\xc2\xa7""4";
+const char * cChatColor::Purple = "\xc2\xa7""5";
+const char * cChatColor::Gold = "\xc2\xa7""6";
+const char * cChatColor::LightGray = "\xc2\xa7""7";
+const char * cChatColor::Gray = "\xc2\xa7""8";
+const char * cChatColor::DarkPurple = "\xc2\xa7""9";
+const char * cChatColor::LightGreen = "\xc2\xa7""a";
+const char * cChatColor::LightBlue = "\xc2\xa7""b";
+const char * cChatColor::Rose = "\xc2\xa7""c";
+const char * cChatColor::LightPurple = "\xc2\xa7""d";
+const char * cChatColor::Yellow = "\xc2\xa7""e";
+const char * cChatColor::White = "\xc2\xa7""f";
-const std::string cChatColor::Random = cChatColor::Color + "k";
-const std::string cChatColor::Bold = cChatColor::Color + "l";
-const std::string cChatColor::Strikethrough = cChatColor::Color + "m";
-const std::string cChatColor::Underlined = cChatColor::Color + "n";
-const std::string cChatColor::Italic = cChatColor::Color + "o";
-const std::string cChatColor::Plain = cChatColor::Color + "r";
+const char * cChatColor::Random = "\xc2\xa7""k";
+const char * cChatColor::Bold = "\xc2\xa7""l";
+const char * cChatColor::Strikethrough = "\xc2\xa7""m";
+const char * cChatColor::Underlined = "\xc2\xa7""n";
+const char * cChatColor::Italic = "\xc2\xa7""o";
+const char * cChatColor::Plain = "\xc2\xa7""r";
diff --git a/src/ChatColor.h b/src/ChatColor.h
index 2189fd395..74eb7d5dc 100644
--- a/src/ChatColor.h
+++ b/src/ChatColor.h
@@ -9,33 +9,35 @@
class cChatColor
{
public:
- static const std::string Color;
- static const std::string Delimiter;
-
- static const std::string Black;
- static const std::string Navy;
- static const std::string Green;
- static const std::string Blue;
- static const std::string Red;
- static const std::string Purple;
- static const std::string Gold;
- static const std::string LightGray;
- static const std::string Gray;
- static const std::string DarkPurple;
- static const std::string LightGreen;
- static const std::string LightBlue;
- static const std::string Rose;
- static const std::string LightPurple;
- static const std::string Yellow;
- static const std::string White;
+ static const char * Delimiter;
+
+ /** @deprecated use ChatColor::Delimiter instead */
+ static const char * Color;
+
+ static const char * Black;
+ static const char * Navy;
+ static const char * Green;
+ static const char * Blue;
+ static const char * Red;
+ static const char * Purple;
+ static const char * Gold;
+ static const char * LightGray;
+ static const char * Gray;
+ static const char * DarkPurple;
+ static const char * LightGreen;
+ static const char * LightBlue;
+ static const char * Rose;
+ static const char * LightPurple;
+ static const char * Yellow;
+ static const char * White;
// Styles ( source: http://wiki.vg/Chat )
- static const std::string Random;
- static const std::string Bold;
- static const std::string Strikethrough;
- static const std::string Underlined;
- static const std::string Italic;
- static const std::string Plain;
+ static const char * Random;
+ static const char * Bold;
+ static const char * Strikethrough;
+ static const char * Underlined;
+ static const char * Italic;
+ static const char * Plain;
};
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index cf78b19c5..de4245b40 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -210,11 +210,11 @@ AString cClientHandle::FormatMessageType(bool ShouldAppendChatPrefixes, eMessage
{
if (ShouldAppendChatPrefixes)
{
- return Printf("%s[MSG: %s] %s%s", cChatColor::LightBlue.c_str(), a_AdditionalData.c_str(), cChatColor::White.c_str(), cChatColor::Italic.c_str());
+ return Printf("%s[MSG: %s] %s%s", cChatColor::LightBlue, a_AdditionalData.c_str(), cChatColor::White, cChatColor::Italic);
}
else
{
- return Printf("%s: %s", a_AdditionalData.c_str(), cChatColor::LightBlue.c_str());
+ return Printf("%s: %s", a_AdditionalData.c_str(), cChatColor::LightBlue);
}
}
}
@@ -533,9 +533,9 @@ void cClientHandle::HandlePing(void)
Printf(Reply, "%s%s%i%s%i",
Server.GetDescription().c_str(),
- cChatColor::Delimiter.c_str(),
+ cChatColor::Delimiter,
Server.GetNumPlayers(),
- cChatColor::Delimiter.c_str(),
+ cChatColor::Delimiter,
Server.GetMaxPlayers()
);
Kick(Reply);
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 698f77bf6..808b74023 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1524,7 +1524,7 @@ AString cPlayer::GetColor(void) const
{
if ( m_Color != '-' )
{
- return cChatColor::Color + m_Color;
+ return cChatColor::Delimiter + m_Color;
}
if ( m_Groups.size() < 1 )
diff --git a/src/GroupManager.cpp b/src/GroupManager.cpp
index 135a1636a..a1cc396cf 100644
--- a/src/GroupManager.cpp
+++ b/src/GroupManager.cpp
@@ -153,7 +153,7 @@ bool cGroupManager::LoadGroups()
AString Color = IniFile.GetValue(KeyName, "Color", "-");
if ((Color != "-") && (Color.length() >= 1))
{
- Group->SetColor(cChatColor::Color + Color[0]);
+ Group->SetColor(cChatColor::Delimiter + Color[0]);
}
else
{
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index e62f9d216..205407a5b 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -1021,9 +1021,9 @@ void cProtocolRecognizer::SendLengthlessServerPing(void)
// http://wiki.vg/wiki/index.php?title=Protocol&oldid=3099#Server_List_Ping_.280xFE.29
Printf(Reply, "%s%s%i%s%i",
Server->GetDescription().c_str(),
- cChatColor::Delimiter.c_str(),
+ cChatColor::Delimiter,
Server->GetNumPlayers(),
- cChatColor::Delimiter.c_str(),
+ cChatColor::Delimiter,
Server->GetMaxPlayers()
);
break;