changed chatmsgs to use time instead of ticks

This commit is contained in:
Alfred Eriksson 2009-01-24 16:09:20 +00:00
parent 01d74a6d4d
commit b28ede2da2
2 changed files with 4 additions and 4 deletions

View file

@ -14,7 +14,7 @@ void CHAT::on_reset()
{ {
mode = MODE_NONE; mode = MODE_NONE;
for(int i = 0; i < MAX_LINES; i++) for(int i = 0; i < MAX_LINES; i++)
lines[i].tick = -1000000; lines[i].time = -1000000;
current_line = 0; current_line = 0;
} }
@ -97,7 +97,7 @@ void CHAT::on_message(int msgtype, void *rawmsg)
void CHAT::add_line(int client_id, int team, const char *line) void CHAT::add_line(int client_id, int team, const char *line)
{ {
current_line = (current_line+1)%MAX_LINES; current_line = (current_line+1)%MAX_LINES;
lines[current_line].tick = client_tick(); lines[current_line].time = time_get();
lines[current_line].client_id = client_id; lines[current_line].client_id = client_id;
lines[current_line].team = team; lines[current_line].team = team;
lines[current_line].name_color = -2; lines[current_line].name_color = -2;
@ -158,7 +158,7 @@ void CHAT::on_render()
for(i = 0; i < MAX_LINES; i++) for(i = 0; i < MAX_LINES; i++)
{ {
int r = ((current_line-i)+MAX_LINES)%MAX_LINES; int r = ((current_line-i)+MAX_LINES)%MAX_LINES;
if(client_tick() > lines[r].tick+50*15) if(time_get() > lines[r].time+15*time_freq())
break; break;
float begin = x; float begin = x;

View file

@ -12,7 +12,7 @@ class CHAT : public COMPONENT
struct LINE struct LINE
{ {
int tick; int64 time;
int client_id; int client_id;
int team; int team;
int name_color; int name_color;