Optimize updateFastFaceRow processing by removing some TileSpec copy (#5678)
[oweals/minetest.git] / src / chat.h
index db4146d35ba8ffd59dd6d2cf0159959a90a727b2..5de676a2e02e9debb0489126885d4fcbd4c652c5 100644 (file)
@@ -20,11 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #ifndef CHAT_HEADER
 #define CHAT_HEADER
 
-#include "irrlichttypes.h"
 #include <string>
 #include <vector>
 #include <list>
 
+#include "irrlichttypes.h"
+#include "util/enriched_string.h"
+
 // Chat console related classes
 
 struct ChatLine
@@ -32,11 +34,18 @@ struct ChatLine
        // age in seconds
        f32 age;
        // name of sending player, or empty if sent by server
-       std::wstring name;
+       EnrichedString name;
        // message text
-       std::wstring text;
+       EnrichedString text;
+
+       ChatLine(const std::wstring &a_name, const std::wstring &a_text):
+               age(0.0),
+               name(a_name),
+               text(a_text)
+       {
+       }
 
-       ChatLine(std::wstring a_name, std::wstring a_text):
+       ChatLine(const EnrichedString &a_name, const EnrichedString &a_text):
                age(0.0),
                name(a_name),
                text(a_text)
@@ -47,7 +56,7 @@ struct ChatLine
 struct ChatFormattedFragment
 {
        // text string
-       std::wstring text;
+       EnrichedString text;
        // starting column
        u32 column;
        // formatting
@@ -139,7 +148,7 @@ private:
 class ChatPrompt
 {
 public:
-       ChatPrompt(std::wstring prompt, u32 history_limit);
+       ChatPrompt(const std::wstring &prompt, u32 history_limit);
        ~ChatPrompt();
 
        // Input character or string
@@ -260,7 +269,7 @@ public:
        // Get the recent messages buffer
        ChatBuffer& getRecentBuffer();
        // Concatenate all recent messages
-       std::wstring getRecentChat();
+       EnrichedString getRecentChat();
        // Get the console prompt
        ChatPrompt& getPrompt();