Commit 4218cf36 authored by mercury233's avatar mercury233

update tag timer

parent fd4817f5
......@@ -492,6 +492,11 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
RefreshExtra(0);
RefreshExtra(1);
start_duel(pduel, opt);
if(host_info.time_limit) {
time_elapsed = 0;
timeval timeout = { 1, 0 };
event_add(etimer, &timeout);
}
Process();
}
void TagDuel::Process() {
......@@ -1503,7 +1508,7 @@ void TagDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {
if(time_limit[resp_type] >= time_elapsed)
time_limit[resp_type] -= time_elapsed;
else time_limit[resp_type] = 0;
event_del(etimer);
time_elapsed = 0;
}
Process();
}
......@@ -1522,6 +1527,7 @@ void TagDuel::EndDuel() {
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
end_duel(pduel);
event_del(etimer);
pduel = 0;
}
void TagDuel::WaitforResponse(int playerid) {
......@@ -1548,9 +1554,8 @@ void TagDuel::TimeConfirm(DuelPlayer* dp) {
if(dp != cur_player[last_response])
return;
cur_player[last_response]->state = CTOS_RESPONSE;
time_elapsed = 0;
timeval timeout = {1, 0};
event_add(etimer, &timeout);
if(time_elapsed < 10)
time_elapsed = 0;
}
void TagDuel::RefreshMzone(int player, int flag, int use_cache) {
char query_buffer[0x4000];
......@@ -1712,7 +1717,10 @@ void TagDuel::TagTimer(evutil_socket_t fd, short events, void* arg) {
sd->EndDuel();
sd->DuelEndProc();
event_del(sd->etimer);
return;
}
timeval timeout = { 1, 0 };
event_add(sd->etimer, &timeout);
}
}
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