summaryrefslogtreecommitdiff
path: root/src/char_sql/char.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-27 19:17:00 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-27 19:17:00 +0000
commit4fe91e88780a26861e7e03d27f1136ed1cf43627 (patch)
tree0b5317018a7c80df4f4ebed38b3c114849eec444 /src/char_sql/char.c
parent25cfe6dc756d593adf93c245e45a92210381a8b4 (diff)
downloadhercules-4fe91e88780a26861e7e03d27f1136ed1cf43627.tar.gz
hercules-4fe91e88780a26861e7e03d27f1136ed1cf43627.tar.bz2
hercules-4fe91e88780a26861e7e03d27f1136ed1cf43627.tar.xz
hercules-4fe91e88780a26861e7e03d27f1136ed1cf43627.zip
Removed some unneccessary charserver code.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11825 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/char.c')
-rw-r--r--src/char_sql/char.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index da7dadb86..b44717d65 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -133,7 +133,6 @@ struct s_subnet {
int subnet_count = 0;
struct char_session_data {
- int fd;
int account_id, login_id1, login_id2, sex;
int found_char[MAX_CHARS];
char email[40]; // e-mail (default: a@a.com) by [Yor]
@@ -270,7 +269,6 @@ void set_char_online(int map_id, int char_id, int account_id)
void set_char_offline(int char_id, int account_id)
{
- struct mmo_charstatus *cp;
struct online_char_data* character;
//FIXME: usage of 'magic constant'; this needs to go! [ultramage]
@@ -281,7 +279,7 @@ void set_char_offline(int char_id, int account_id)
}
else
{
- cp = idb_get(char_db_,char_id);
+ struct mmo_charstatus* cp = idb_get(char_db_,char_id);
inter_guild_CharOffline(char_id, cp?cp->guild_id:-1);
if (cp)
idb_remove(char_db_,char_id);
@@ -343,7 +341,7 @@ static int char_db_kickoffline(DBKey key, void* data, va_list ap)
else if (character->waiting_disconnect == -1)
set_char_offline(character->char_id, character->account_id);
else return 0;
- return 1;
+ return 1; // WTF, pick one!
}
void set_all_offline(int id)
@@ -1573,8 +1571,8 @@ int char_family(int pl1, int pl2, int pl3)
static void char_auth_ok(int fd, struct char_session_data *sd)
{
struct online_char_data* character;
- if (max_connect_user && count_users() >= max_connect_user &&
- isGM(sd->account_id) < gm_allow_level) {
+ if (max_connect_user && count_users() >= max_connect_user && isGM(sd->account_id) < gm_allow_level)
+ {
// refuse connection (over populated)
WFIFOW(fd,0) = 0x6c;
WFIFOW(fd,2) = 0;
@@ -1586,8 +1584,7 @@ static void char_auth_ok(int fd, struct char_session_data *sd)
{ // check if character is not online already. [Skotlex]
if (character->server > -1)
{ //Character already online. KICK KICK KICK
- mapif_disconnectplayer(server_fd[character->server],
- character->account_id, character->char_id, 2);
+ mapif_disconnectplayer(server_fd[character->server], character->account_id, character->char_id, 2);
if (character->waiting_disconnect == -1)
character->waiting_disconnect = add_timer(gettick()+20000, chardb_waiting_disconnect, character->account_id, 0);
WFIFOW(fd,0) = 0x81;
@@ -1626,6 +1623,7 @@ int parse_fromlogin(int fd)
// so, if it isn't the login-server, we disconnect the session.
if( fd != login_fd )
set_eof(fd);
+
if(session[fd]->eof) {
if (fd == login_fd) {
ShowWarning("Connection to login-server lost (connection #%d).\n", fd);
@@ -2797,20 +2795,21 @@ int parse_char(int fd)
unsigned char buf[64];
unsigned short cmd;
int map_fd;
- struct char_session_data *sd;
+ struct char_session_data* sd;
uint32 ipl = session[fd]->client_addr;
sd = (struct char_session_data*)session[fd]->session_data;
+ // disconnect any player if no login-server.
if(login_fd < 0)
set_eof(fd);
- if(session[fd]->eof) { // disconnect any player (already connected to char-server or coming back from map-server) if login-server is diconnected.
- if (fd == login_fd)
- login_fd = -1;
+
+ if(session[fd]->eof)
+ {
if (sd != NULL)
- {
+ { // already authed client
struct online_char_data* data = idb_get(online_char_db, sd->account_id);
- if (!data || data->server== -1) //If it is not in any server, send it offline. [Skotlex]
+ if (!data || data->server == -1) //If it is not in any server, send it offline. [Skotlex]
set_char_offline(99,sd->account_id);
if (data && data->fd == fd)
data->fd = -1;
@@ -2844,7 +2843,6 @@ int parse_char(int fd)
CREATE(session[fd]->session_data, struct char_session_data, 1);
sd = (struct char_session_data*)session[fd]->session_data;
- sd->fd = fd;
sd->connect_until_time = 0; // unknown or unlimited (not displaying on map-server)
sd->account_id = RFIFOL(fd,2);
sd->login_id1 = RFIFOL(fd,6);