mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-05-10 02:41:42 +00:00
Prevent duplicate messages in chat history
This commit is contained in:
parent
1805004135
commit
2decea5693
1 changed files with 5 additions and 0 deletions
|
|
@ -54,6 +54,11 @@ void sent_history_init(ArrayList *arrayList) {
|
|||
void sent_history_add_message(ArrayList *arrayList, const char *newMessage) {
|
||||
if (!configUseStandardKeyBindingsChat && (!newMessage || newMessage[0] != '/')) { return; }
|
||||
|
||||
// Don't add duplicate messages - check if the new message is the same as the last one
|
||||
if (arrayList->size > 0 && strcmp(arrayList->messages[arrayList->size - 1], newMessage) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (arrayList->size == MAX_HISTORY_SIZE) {
|
||||
for (s32 i = 1; i < MAX_HISTORY_SIZE; i++) {
|
||||
snprintf(arrayList->messages[i-1], MAX_CHAT_MSG_LENGTH, "%s", arrayList->messages[i]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue