From 8f3d851c422e444510b659a2f4f850cb5036e604 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> Date: Thu, 27 Jan 2005 15:53:28 +0000 Subject: Kick all characters when the char server disconnects from the map server git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1005 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/chrif.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/map/chrif.c b/src/map/chrif.c index cda7b42e2..185fe307d 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -992,6 +992,27 @@ int chrif_char_online(struct map_session_data *sd) return 0; } +/*========================================== + * + *------------------------------------------ + */ +int chrif_disconnect_sub(struct map_session_data* sd,va_list va) { + clif_authfail_fd(sd->fd,1); + map_quit(sd); + return 0; +} + +int chrif_disconnect(int fd) { + if(fd == char_fd) { + char_fd = -1; + sprintf(tmp_output,"Map Server disconnected from Char Server.\n\n"); + ShowWarning(tmp_output); + clif_foreachclient(chrif_disconnect_sub); + chrif_connected = 0; + } + close(fd); + return 0; +} /*========================================== * @@ -1003,13 +1024,8 @@ int chrif_parse(int fd) // only char-server can have an access to here. // so, if it isn't the char-server, we disconnect the session (fd != char_fd). if (fd != char_fd || session[fd]->eof) { - if (fd == char_fd) { - if (chrif_connected == 1) { - sprintf(tmp_output,"Map Server disconnected from Char Server.\n\n"); - ShowWarning(tmp_output); - chrif_connected=0; - } - char_fd = -1; + if (fd == char_fd && chrif_connected == 1) { + chrif_disconnect (fd); // check_connect_char_server(0, 0, 0, 0); } close(fd); -- cgit v1.2.3-70-g09d2