From ec7f5035ca95489c32d7e49f4b0f8f1c76d36d7f Mon Sep 17 00:00:00 2001 From: celest Date: Tue, 5 Apr 2005 14:57:03 +0000 Subject: * Simplified Valaris' online_timer * Updated Fogwall, Spiderweb, and HP Conversion * Adding saving character online/offline for TXT char and login (unfinished) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1411 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/login_sql/login.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'src/login_sql/login.c') diff --git a/src/login_sql/login.c b/src/login_sql/login.c index 387f51a91..7c67b0174 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -152,36 +152,31 @@ struct dbt *online_db; //----------------------------------------------------- void add_online_user(int account_id) { - int *p; - if(register_users_online <= 0) - return; - p = (int*)aMalloc(sizeof(int)); - if (p == NULL) { - printf("add_online_user: memory allocation failure (malloc)!\n"); - exit(0); - } - *p = account_id; - numdb_insert(online_db, account_id, p); + int *p; + if(register_users_online <= 0) + return; + p = (int*)aMalloc(sizeof(int)); + *p = account_id; + numdb_insert(online_db, account_id, p); } int is_user_online(int account_id) { - int *p; - if(register_users_online <= 0) - return 0; + int *p; + if(register_users_online <= 0) + return 0; p = (int*)numdb_search(online_db, account_id); - if (p == NULL) - return 0; printf("Acccount %d\n",*p); - return 1; + + return (p != NULL); } void remove_online_user(int account_id) { - int *p; - if(register_users_online <= 0) - return; - p = (int*)numdb_erase(online_db,account_id); - aFree(p); + int *p; + if(register_users_online <= 0) + return; + p = (int*)numdb_erase(online_db,account_id); + aFree(p); } //----------------------------------------------------- @@ -1828,6 +1823,7 @@ int do_init(int argc,char **argv){ //initialize login server int i; + SERVER_TYPE = SERVER_LOGIN; //read login configue login_config_read( (argc>1)?argv[1]:LOGIN_CONF_NAME ); sql_config_read(SQL_CONF_NAME); -- cgit v1.2.3-70-g09d2