diff options
Diffstat (limited to 'NorthstarDedicatedTest/clientchathooks.cpp')
-rw-r--r-- | NorthstarDedicatedTest/clientchathooks.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/NorthstarDedicatedTest/clientchathooks.cpp b/NorthstarDedicatedTest/clientchathooks.cpp index 62166cb2..74418c06 100644 --- a/NorthstarDedicatedTest/clientchathooks.cpp +++ b/NorthstarDedicatedTest/clientchathooks.cpp @@ -17,14 +17,14 @@ struct ChatTags static void CHudChat__AddGameLineHook(void* self, const char* message, int inboxId, bool isTeam, bool isDead) { - if (g_ClientSquirrelManager->setupfunc("CHudChat_ProcessMessageStartThread") != SQRESULT_ERROR) + // This hook is called for each HUD, but we only want our logic to run once. + if (self != *CHudChat::allHuds) { - // This hook is called for each HUD, but we only want our logic to run once. - if (!IsFirstHud(self)) - { - return; - } + return; + } + if (g_ClientSquirrelManager->setupfunc("CHudChat_ProcessMessageStartThread") != SQRESULT_ERROR) + { int senderId = inboxId & CUSTOM_MESSAGE_INDEX_MASK; bool isAnonymous = senderId == 0; bool isCustom = isAnonymous || (inboxId & CUSTOM_MESSAGE_INDEX_BIT); @@ -46,7 +46,12 @@ static void CHudChat__AddGameLineHook(void* self, const char* message, int inbox g_ClientSquirrelManager->call(5); } else - CHudChat__AddGameLine(self, message, inboxId, isTeam, isDead); + { + for (CHudChat* hud = *CHudChat::allHuds; hud != NULL; hud = hud->next) + { + CHudChat__AddGameLine(hud, message, inboxId, isTeam, isDead); + } + } } // void NSChatWrite( int context, string str ) |