diff options
-rw-r--r-- | Changelog.txt | 2 | ||||
-rw-r--r-- | src/map/chrif.c | 30 |
2 files changed, 25 insertions, 7 deletions
diff --git a/Changelog.txt b/Changelog.txt index 56c1592ba..de465eae7 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,8 @@ Date Added 01/27 + * Kick all characters when the char server disconnects from the map + server [celest] * Added @changelook command for spriters to test view ID's [celest] * Added a check to Pneuma to prevent crashing [celest] * Tweaked garbage collection code after feedback from users 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); |