Commit 9e563791 authored by Fluorohydride's avatar Fluorohydride

Merge pull request #50 from zh99998/master

system custom chat message
parents 2802614b fb755bf9
......@@ -477,6 +477,14 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->gMutex.Lock();
mainGame->AddChatMsg(msg, mainGame->LocalPlayer(pkt->player));
mainGame->gMutex.Unlock();
} else if(pkt->player == 8){ //system custom message.
if(mainGame->chkIgnore1->isChecked())
break;
BufferIO::CopyWStr(pkt->msg, msg, 256);
msg[(len - 3) / 2] = 0;
mainGame->gMutex.Lock();
mainGame->AddChatMsg(msg, 8);
mainGame->gMutex.Unlock();
} else {
if(mainGame->chkIgnore2->isChecked())
break;
......
......@@ -759,12 +759,21 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
}
chatMsg[0].clear();
chatTiming[0] = 600;
if(player == 0)
switch(player){
case 0: //from host
chatMsg[0].append(dInfo.hostname);
else if(player == 1)
chatMsg[0].append(L": ");
break;
case 1: //from client
chatMsg[0].append(dInfo.clientname);
else chatMsg[0].append(L"[***]");
chatMsg[0].append(L": ");
chatMsg[0].append(L": ");
break;
case 8: //system custom message, no prefix.
break;
default: //from watcher or unknown
chatMsg[0].append(L"[***]: ");
}
chatMsg[0].append(msg);
}
void Game::ClearTextures() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment