blob: 572236b4b740a76d90bfec722ae0210cd536e8e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/* Project Starshatter 4.5
Destroyer Studios LLC
Copyright © 1997-2004. All Rights Reserved.
SUBSYSTEM: Stars.exe
FILE: NetChat.cpp
AUTHOR: John DiCamillo
OVERVIEW
========
Single chat message and sender
*/
#include "MemDebug.h"
#include "NetChat.h"
#include "NetLayer.h"
// +-------------------------------------------------------------------+
static int chat_id_key = 1000;
// +-------------------------------------------------------------------+
NetChatEntry::NetChatEntry(const NetUser* u, const char* s)
: id(chat_id_key++), msg(s)
{
if (u) {
user = u->Name();
color = u->GetColor();
}
else {
user = "unknown";
color = Color::Gray;
}
time = NetLayer::GetUTC();
}
NetChatEntry::NetChatEntry(int msg_id, const char* u, const char* s)
: id(msg_id), user(u), msg(s)
{
color = Color::Gray;
time = NetLayer::GetUTC();
if (id >= chat_id_key)
chat_id_key = id + 1;
}
NetChatEntry::~NetChatEntry()
{ }
|