Commit 1c4ddccd authored by nanahira's avatar nanahira

customizable extend time

parent 30dcb665
...@@ -25,6 +25,7 @@ Game* mainGame; ...@@ -25,6 +25,7 @@ Game* mainGame;
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
unsigned short aServerPort; unsigned short aServerPort;
unsigned short replay_mode; unsigned short replay_mode;
unsigned int extend_time;
HostInfo game_info; HostInfo game_info;
void Game::MainServerLoop() { void Game::MainServerLoop() {
......
...@@ -495,6 +495,7 @@ extern Game* mainGame; ...@@ -495,6 +495,7 @@ extern Game* mainGame;
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
extern unsigned short aServerPort; extern unsigned short aServerPort;
extern unsigned short replay_mode; extern unsigned short replay_mode;
extern unsigned int extend_time;
extern HostInfo game_info; extern HostInfo game_info;
#endif #endif
......
...@@ -63,6 +63,7 @@ int main(int argc, char* argv[]) { ...@@ -63,6 +63,7 @@ int main(int argc, char* argv[]) {
enable_log = 1; enable_log = 1;
ygo::aServerPort = 7911; ygo::aServerPort = 7911;
ygo::replay_mode = 0; ygo::replay_mode = 0;
ygo::extend_time = 0;
ygo::game_info.lflist = 0; ygo::game_info.lflist = 0;
ygo::game_info.rule = 0; ygo::game_info.rule = 0;
ygo::game_info.mode = 0; ygo::game_info.mode = 0;
...@@ -101,6 +102,7 @@ int main(int argc, char* argv[]) { ...@@ -101,6 +102,7 @@ int main(int argc, char* argv[]) {
ygo::game_info.draw_count = atoi(argv[10]); ygo::game_info.draw_count = atoi(argv[10]);
ygo::game_info.time_limit = atoi(argv[11]); ygo::game_info.time_limit = atoi(argv[11]);
ygo::replay_mode = atoi(argv[12]); ygo::replay_mode = atoi(argv[12]);
ygo::extend_time = atoi(argv[13]);
} }
ygo::mainGame = &_game; ygo::mainGame = &_game;
ygo::mainGame->MainServerLoop(); ygo::mainGame->MainServerLoop();
......
...@@ -15,6 +15,7 @@ unsigned short NetServer::last_sent = 0; ...@@ -15,6 +15,7 @@ unsigned short NetServer::last_sent = 0;
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
extern unsigned short replay_mode; extern unsigned short replay_mode;
extern unsigned int extend_time;
extern HostInfo game_info; extern HostInfo game_info;
void NetServer::InitDuel() void NetServer::InitDuel()
......
...@@ -9,6 +9,7 @@ namespace ygo { ...@@ -9,6 +9,7 @@ namespace ygo {
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
extern unsigned short aServerPort; extern unsigned short aServerPort;
extern unsigned short replay_mode; extern unsigned short replay_mode;
extern unsigned int extend_time;
#endif #endif
Replay::Replay() { Replay::Replay() {
is_recording = false; is_recording = false;
......
...@@ -9,6 +9,7 @@ namespace ygo { ...@@ -9,6 +9,7 @@ namespace ygo {
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
extern unsigned short replay_mode; extern unsigned short replay_mode;
extern unsigned int extend_time;
#endif #endif
SingleDuel::SingleDuel(bool is_match) { SingleDuel::SingleDuel(bool is_match) {
game_started = false; game_started = false;
...@@ -1743,7 +1744,7 @@ void SingleDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) { ...@@ -1743,7 +1744,7 @@ void SingleDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {
|| (curMsg == MSG_SELECT_BATTLECMD && rest < 2) || (curMsg == MSG_SELECT_BATTLECMD && rest < 2)
|| (curMsg == MSG_SELECT_CHAIN && resp != -1) || (curMsg == MSG_SELECT_CHAIN && resp != -1)
) )
++time_limit[dp->type]; time_limit[dp->type] += extend_time;
} }
#endif #endif
Process(); Process();
......
...@@ -9,6 +9,7 @@ namespace ygo { ...@@ -9,6 +9,7 @@ namespace ygo {
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
extern unsigned short replay_mode; extern unsigned short replay_mode;
extern unsigned int extend_time;
#endif #endif
TagDuel::TagDuel() { TagDuel::TagDuel() {
game_started = false; game_started = false;
...@@ -1806,14 +1807,14 @@ void TagDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) { ...@@ -1806,14 +1807,14 @@ void TagDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {
} }
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
int resp_type = dp->type < 2 ? 0 : 1; int resp_type = dp->type < 2 ? 0 : 1;
if(host_info.time_limit && len >= 4 && time_limit[resp_type] < host_info.time_limit) { if(extend_time && host_info.time_limit && len >= 4 && time_limit[resp_type] < host_info.time_limit) {
int resp = *(int*)pdata; int resp = *(int*)pdata;
int rest = resp & 0xffff; int rest = resp & 0xffff;
if((curMsg == MSG_SELECT_IDLECMD && rest < 6) if((curMsg == MSG_SELECT_IDLECMD && rest < 6)
|| (curMsg == MSG_SELECT_BATTLECMD && rest < 2) || (curMsg == MSG_SELECT_BATTLECMD && rest < 2)
|| (curMsg == MSG_SELECT_CHAIN && resp != -1) || (curMsg == MSG_SELECT_CHAIN && resp != -1)
) )
++time_limit[resp_type]; time_limit[resp_type] += extend_time;
} }
#endif #endif
Process(); Process();
......
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