diff --git a/saco/chatwindow.cpp b/saco/chatwindow.cpp index 796ead8..eab5603 100644 --- a/saco/chatwindow.cpp +++ b/saco/chatwindow.cpp @@ -1,4 +1,5 @@ +#include #include "main.h" #include "game/util.h" @@ -374,3 +375,34 @@ void CChatWindow::FUNC_10067E00() } } } + +//---------------------------------------------------- + +void CChatWindow::WriteChatLog(int iType, char *szText, char *szName) +{ + time_t curTime = time(NULL); + + if(field_D) + { + FILE *f = fopen(field_11,"a"); + if(f) + { + // the frame reserves 68 bytes for this, strftime is still capped at 64 + char szTimestamp[68]; + strftime(szTimestamp,64,"[%H:%M:%S]",localtime(&curTime)); + + switch(iType) + { + case 2: + fprintf(f,"%s <%s> %s\r\n",szTimestamp,szName,szText); + break; + case 4: + case 8: + fprintf(f,"%s %s\r\n",szTimestamp,szText); + break; + } + + fclose(f); + } + } +} diff --git a/saco/chatwindow.h b/saco/chatwindow.h index 65ed3c2..c00340e 100644 --- a/saco/chatwindow.h +++ b/saco/chatwindow.h @@ -73,6 +73,8 @@ public: public: + void WriteChatLog(int iType, char *szText, char *szName); // .text:100677D0 + int sub_10067BE0(int a1, char *a2, char *a3, DWORD a4, DWORD a5); // .text:10067BE0 void AddChatMessage(PCHAR szName, DWORD dwColor, PCHAR szText); // .text:10068020