mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-10 21:55:11 +01:00
Add user name to network messages
This commit is contained in:
parent
47f6f6d174
commit
7a35a744ec
@ -373,14 +373,14 @@ void Network::EncodeTextMessage(const char *str, bool broadcast)
|
||||
NetworkUpdate *dst = (NetworkUpdate *)this->cur_ud;
|
||||
struct NetworkUpdateTextMessage *tm = (struct NetworkUpdateTextMessage*)dst->data;
|
||||
char *p = (char*)tm->data;
|
||||
size_t len = strlen(str) + 1;
|
||||
size_t len = strlen(ThePrefs.NetworkName) + strlen(str) + 4;
|
||||
|
||||
tm->flags = broadcast ? NETWORK_UPDATE_TEXT_MESSAGE_BROADCAST : 0;
|
||||
len += (len & 3);
|
||||
dst = InitNetworkUpdate(dst, TEXT_MESSAGE,
|
||||
sizeof(NetworkUpdate) + sizeof(struct NetworkUpdateTextMessage) + len);
|
||||
memset(p, 0, len);
|
||||
strncpy(p, str, len - 1);
|
||||
snprintf(p, len - 1, "%s: %s", ThePrefs.NetworkName, str);
|
||||
|
||||
this->AddNetworkUpdate(dst);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user