diff options
author | Susu <bruant.bastien@gmail.com> | 2013-06-07 20:03:32 +0200 |
---|---|---|
committer | Susu <bruant.bastien@gmail.com> | 2013-06-07 20:03:32 +0200 |
commit | d73783f22b2bb881aab74524d153d89a5932a199 (patch) | |
tree | feea3cd428cee18be3da9bf0bee6d4570d9cad02 /src/login | |
parent | dc7f14c7dc9829061f8902354367bdc8467eb841 (diff) | |
download | hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.gz hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.bz2 hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.xz hercules-d73783f22b2bb881aab74524d153d89a5932a199.zip |
Hercules Renewal Phase One : pc, party, map, timer
Added iPc, iParty, iMap, iTimer to HPM exported interfaces
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/ipban_sql.c | 6 | ||||
-rw-r--r-- | src/login/login.c | 32 |
2 files changed, 19 insertions, 19 deletions
diff --git a/src/login/ipban_sql.c b/src/login/ipban_sql.c index 701d3bc1d..fd9f1a4a1 100644 --- a/src/login/ipban_sql.c +++ b/src/login/ipban_sql.c @@ -86,8 +86,8 @@ void ipban_init(void) if( login_config.ipban_cleanup_interval > 0 ) { // set up periodic cleanup of connection history and active bans - add_timer_func_list(ipban_cleanup, "ipban_cleanup"); - cleanup_timer_id = add_timer_interval(gettick()+10, ipban_cleanup, 0, 0, login_config.ipban_cleanup_interval*1000); + iTimer->add_timer_func_list(ipban_cleanup, "ipban_cleanup"); + cleanup_timer_id = iTimer->add_timer_interval(iTimer->gettick()+10, ipban_cleanup, 0, 0, login_config.ipban_cleanup_interval*1000); } else // make sure it gets cleaned up on login-server start regardless of interval-based cleanups ipban_cleanup(0,0,0,0); } @@ -100,7 +100,7 @@ void ipban_final(void) if( login_config.ipban_cleanup_interval > 0 ) // release data - delete_timer(cleanup_timer_id, ipban_cleanup); + iTimer->delete_timer(cleanup_timer_id, ipban_cleanup); ipban_cleanup(0,0,0,0); // always clean up on login-server stop diff --git a/src/login/login.c b/src/login/login.c index 2bfb9c730..159d99fee 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -109,7 +109,7 @@ static DBData create_online_user(DBKey key, va_list args) p->account_id = key.i; p->char_server = -1; p->waiting_disconnect = INVALID_TIMER; - return DB->ptr2data(p); + return iDB->ptr2data(p); } struct online_login_data* add_online_user(int char_server, int account_id) @@ -119,7 +119,7 @@ struct online_login_data* add_online_user(int char_server, int account_id) p->char_server = char_server; if( p->waiting_disconnect != INVALID_TIMER ) { - delete_timer(p->waiting_disconnect, waiting_disconnect_timer); + iTimer->delete_timer(p->waiting_disconnect, waiting_disconnect_timer); p->waiting_disconnect = INVALID_TIMER; } return p; @@ -132,7 +132,7 @@ void remove_online_user(int account_id) if( p == NULL ) return; if( p->waiting_disconnect != INVALID_TIMER ) - delete_timer(p->waiting_disconnect, waiting_disconnect_timer); + iTimer->delete_timer(p->waiting_disconnect, waiting_disconnect_timer); idb_remove(online_db, account_id); } @@ -154,14 +154,14 @@ static int waiting_disconnect_timer(int tid, unsigned int tick, int id, intptr_t */ static int online_db_setoffline(DBKey key, DBData *data, va_list ap) { - struct online_login_data* p = DB->data2ptr(data); + struct online_login_data* p = iDB->data2ptr(data); int server = va_arg(ap, int); if( server == -1 ) { p->char_server = -1; if( p->waiting_disconnect != INVALID_TIMER ) { - delete_timer(p->waiting_disconnect, waiting_disconnect_timer); + iTimer->delete_timer(p->waiting_disconnect, waiting_disconnect_timer); p->waiting_disconnect = INVALID_TIMER; } } @@ -175,7 +175,7 @@ static int online_db_setoffline(DBKey key, DBData *data, va_list ap) */ static int online_data_cleanup_sub(DBKey key, DBData *data, va_list ap) { - struct online_login_data *character= DB->data2ptr(data); + struct online_login_data *character= iDB->data2ptr(data); if (character->char_server == -2) //Unknown server.. set them offline remove_online_user(character->account_id); return 0; @@ -804,7 +804,7 @@ int parse_fromchar(int fd) p->char_server = id; if (p->waiting_disconnect != INVALID_TIMER) { - delete_timer(p->waiting_disconnect, waiting_disconnect_timer); + iTimer->delete_timer(p->waiting_disconnect, waiting_disconnect_timer); p->waiting_disconnect = INVALID_TIMER; } } @@ -913,12 +913,12 @@ int parse_fromchar(int fd) int mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { static int num_regs = 0; // registration counter static unsigned int new_reg_tick = 0; - unsigned int tick = gettick(); + unsigned int tick = iTimer->gettick(); struct mmo_account acc; //Account Registration Flood Protection by [Kevin] if( new_reg_tick == 0 ) - new_reg_tick = gettick(); + new_reg_tick = iTimer->gettick(); if( DIFF_TICK(tick, new_reg_tick) < 0 && num_regs >= allowed_regs ) { ShowNotice("Account registration denied (registration limit exceeded)\n"); return 3; @@ -1162,7 +1162,7 @@ void login_auth_ok(struct login_session_data* sd) WBUFL(buf,2) = sd->account_id; charif_sendallwos(-1, buf, 6); if( data->waiting_disconnect == INVALID_TIMER ) - data->waiting_disconnect = add_timer(gettick()+AUTH_TIMEOUT, waiting_disconnect_timer, sd->account_id, 0); + data->waiting_disconnect = iTimer->add_timer(iTimer->gettick()+AUTH_TIMEOUT, waiting_disconnect_timer, sd->account_id, 0); WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x81; @@ -1229,7 +1229,7 @@ void login_auth_ok(struct login_session_data* sd) data = add_online_user(-1, sd->account_id); // schedule deletion of this node - data->waiting_disconnect = add_timer(gettick()+AUTH_TIMEOUT, waiting_disconnect_timer, sd->account_id, 0); + data->waiting_disconnect = iTimer->add_timer(iTimer->gettick()+AUTH_TIMEOUT, waiting_disconnect_timer, sd->account_id, 0); } } @@ -1836,7 +1836,7 @@ int do_init(int argc, char** argv) // Online user database init online_db = idb_alloc(DB_OPT_RELEASE_DATA); - add_timer_func_list(waiting_disconnect_timer, "waiting_disconnect_timer"); + iTimer->add_timer_func_list(waiting_disconnect_timer, "waiting_disconnect_timer"); // Interserver auth init auth_db = idb_alloc(DB_OPT_RELEASE_DATA); @@ -1845,13 +1845,13 @@ int do_init(int argc, char** argv) set_defaultparse(parse_login); // every 10 minutes cleanup online account db. - add_timer_func_list(online_data_cleanup, "online_data_cleanup"); - add_timer_interval(gettick() + 600*1000, online_data_cleanup, 0, 0, 600*1000); + iTimer->add_timer_func_list(online_data_cleanup, "online_data_cleanup"); + iTimer->add_timer_interval(iTimer->gettick() + 600*1000, online_data_cleanup, 0, 0, 600*1000); // add timer to detect ip address change and perform update if (login_config.ip_sync_interval) { - add_timer_func_list(sync_ip_addresses, "sync_ip_addresses"); - add_timer_interval(gettick() + login_config.ip_sync_interval, sync_ip_addresses, 0, 0, login_config.ip_sync_interval); + iTimer->add_timer_func_list(sync_ip_addresses, "sync_ip_addresses"); + iTimer->add_timer_interval(iTimer->gettick() + login_config.ip_sync_interval, sync_ip_addresses, 0, 0, login_config.ip_sync_interval); } // Account database init |