Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gamespy): show Turkish and Cyrillic chat lines

Olcay Seyganbf2c35f8080e
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp
index e39f77dcb..9aef84c0c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp
@@ -37,6 +37,7 @@
#include "GameClient/GameWindowManager.h"
#include "GameNetwork/GameSpy/PeerDefsImplementation.h"
#include "GameNetwork/GameSpy/PeerThread.h"
+#include "GameNetwork/Online/OnlineQueues.h"
#include "GameClient/InGameUI.h"
#ifdef _INTERNAL
// for occasional debugging...
@@ -214,6 +215,14 @@ void GameSpyInfo::addChat( AsciiString nick, Int profileID, UnicodeString msg, B
}
}
+/* EA's "Asian text" filter counted every character past U+00FF as Asian, which dropped any line with a
+ Turkish ı, ş or ğ (and all Cyrillic) for an English player, who has the filter on by default. Asian
+ scripts start at Hangul Jamo, U+1100. */
+static Bool isAsianChar( WideChar c )
+{
+ return c >= 0x1100;
+}
+
void GameSpyInfo::addChat( PlayerInfo p, UnicodeString msg, Bool isPublic, Bool isAction, GameWindow *win )
{
Int style;
@@ -233,7 +242,7 @@ void GameSpyInfo::addChat( PlayerInfo p, UnicodeString msg, Bool isPublic, Bool
Int length = msg.getLength();
for(Int i = 0; i < length; ++i)
{
- if(buff[i] >= 256)
+ if(isAsianChar(buff[i]))
return;
}
}
@@ -244,7 +253,7 @@ void GameSpyInfo::addChat( PlayerInfo p, UnicodeString msg, Bool isPublic, Bool
Bool hasUnicode = FALSE;
for(Int i = 0; i < length; ++i)
{
- if(buff[i] >= 256)
+ if(isAsianChar(buff[i]))
{
hasUnicode = TRUE;
break;
@@ -311,6 +320,9 @@ void GameSpyInfo::addChat( PlayerInfo p, UnicodeString msg, Bool isPublic, Bool
{
GadgetListBoxSetItemData(win, (void *)(intptr_t)p.m_profileID, index);
}
+ // what online_check.py reads to know a line reached a chat box, not only the log
+ if (OnlineIsEnabled())
+ DEBUG_LOG(("ONLINE CHATBOX row=%d from=%s text=%s\n", index, p.m_name.str(), WideCharAsUtf8( msg.str() ).str()));
}
Int GameSpyInfo::addText( UnicodeString message, Color c, GameWindow *win )