summaryrefslogtreecommitdiff
path: root/src/login_sql
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-05 14:57:03 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-05 14:57:03 +0000
commitec7f5035ca95489c32d7e49f4b0f8f1c76d36d7f (patch)
treefdf066cd04f332c90c78670fe94104e2f9c89e06 /src/login_sql
parent573c40f53e1d0fe29c72117fc4ca2d931b274d8c (diff)
downloadhercules-ec7f5035ca95489c32d7e49f4b0f8f1c76d36d7f.tar.gz
hercules-ec7f5035ca95489c32d7e49f4b0f8f1c76d36d7f.tar.bz2
hercules-ec7f5035ca95489c32d7e49f4b0f8f1c76d36d7f.tar.xz
hercules-ec7f5035ca95489c32d7e49f4b0f8f1c76d36d7f.zip
* 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
Diffstat (limited to 'src/login_sql')
-rw-r--r--src/login_sql/login.c38
1 files changed, 17 insertions, 21 deletions
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);