Commit 4dbad925 authored by mercury233's avatar mercury233

fix time limit 65535

parent e54a2b33
...@@ -2179,7 +2179,7 @@ int SingleDuel::MessageHandler(long fduel, int type) { ...@@ -2179,7 +2179,7 @@ int SingleDuel::MessageHandler(long fduel, int type) {
void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) { void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
SingleDuel* sd = static_cast<SingleDuel*>(arg); SingleDuel* sd = static_cast<SingleDuel*>(arg);
sd->time_elapsed++; sd->time_elapsed++;
if(sd->time_elapsed >= sd->time_limit[sd->last_response]) { if(sd->time_elapsed >= sd->time_limit[sd->last_response] || sd->time_limit[sd->last_response] <= 0) {
unsigned char wbuf[3]; unsigned char wbuf[3];
uint32 player = sd->last_response; uint32 player = sd->last_response;
wbuf[0] = MSG_WIN; wbuf[0] = MSG_WIN;
......
...@@ -74,10 +74,10 @@ protected: ...@@ -74,10 +74,10 @@ protected:
unsigned char duel_count; unsigned char duel_count;
unsigned char tp_player; unsigned char tp_player;
unsigned char match_result[3]; unsigned char match_result[3];
unsigned short time_limit[2]; short time_limit[2];
unsigned short time_elapsed; short time_elapsed;
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
unsigned short time_compensator[2]; short time_compensator[2];
#endif #endif
}; };
......
...@@ -2308,7 +2308,7 @@ int TagDuel::MessageHandler(long fduel, int type) { ...@@ -2308,7 +2308,7 @@ int TagDuel::MessageHandler(long fduel, int type) {
void TagDuel::TagTimer(evutil_socket_t fd, short events, void* arg) { void TagDuel::TagTimer(evutil_socket_t fd, short events, void* arg) {
TagDuel* sd = static_cast<TagDuel*>(arg); TagDuel* sd = static_cast<TagDuel*>(arg);
sd->time_elapsed++; sd->time_elapsed++;
if(sd->time_elapsed >= sd->time_limit[sd->last_response]) { if(sd->time_elapsed >= sd->time_limit[sd->last_response] || sd->time_limit[sd->last_response] <= 0) {
unsigned char wbuf[3]; unsigned char wbuf[3];
uint32 player = sd->last_response; uint32 player = sd->last_response;
wbuf[0] = MSG_WIN; wbuf[0] = MSG_WIN;
......
...@@ -71,10 +71,10 @@ protected: ...@@ -71,10 +71,10 @@ protected:
unsigned char last_response; unsigned char last_response;
Replay last_replay; Replay last_replay;
unsigned char turn_count; unsigned char turn_count;
unsigned short time_limit[2]; short time_limit[2];
unsigned short time_elapsed; short time_elapsed;
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
unsigned short time_compensator[2]; short time_compensator[2];
#endif #endif
}; };
......
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