summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-06-16 10:22:35 +0000
committerflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-06-16 10:22:35 +0000
commite054cbbdb28a9b555faafd689282140c01d55b3e (patch)
treea0a637c944d902df0086900009a644c5b84d39e2 /src/map/map.c
parent83c890478d5588179ffd81b29a95d4bafd0fb118 (diff)
downloadhercules-e054cbbdb28a9b555faafd689282140c01d55b3e.tar.gz
hercules-e054cbbdb28a9b555faafd689282140c01d55b3e.tar.bz2
hercules-e054cbbdb28a9b555faafd689282140c01d55b3e.tar.xz
hercules-e054cbbdb28a9b555faafd689282140c01d55b3e.zip
* Merges from charmerge:
- Added DBMap::exists. (r14090) - Added sv_parse_next, a stepped version of sv_parse (delim-separated parser). (r14100 r14104) - Added missing fd check to do_close. (r14145) - Normalized, refactored and restructured some code (in preparation for shutdown/reconnect code). (r14145 r14150) - Changed the char select request code to allow the char-server to reject it. (player in map-server trying to go to char select) (r14150) - Added shutdown support to the servers. (incomplete) (r14152) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14851 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/map/map.c b/src/map/map.c
index c086b73c0..8209c1033 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3491,7 +3491,7 @@ void do_final(void)
#ifndef TXT_ONLY
map_sql_close();
#endif /* not TXT_ONLY */
- ShowStatus("Successfully terminated.\n");
+ ShowStatus("Finished.\n");
}
static int map_abort_sub(struct map_session_data* sd, va_list ap)
@@ -3573,6 +3573,27 @@ void set_server_type(void)
SERVER_TYPE = ATHENA_SERVER_MAP;
}
+
+/// Called when a terminate signal is received.
+void do_shutdown(void)
+{
+ if( runflag != MAPSERVER_ST_SHUTDOWN )
+ {
+ runflag = MAPSERVER_ST_SHUTDOWN;
+ ShowStatus("Shutting down...\n");
+ {
+ struct map_session_data* sd;
+ struct s_mapiterator* iter = mapit_getallusers();
+ for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
+ clif_GM_kick(NULL, sd);
+ mapit_free(iter);
+ flush_fifos();
+ }
+ chrif_check_shutdown();
+ }
+}
+
+
int do_init(int argc, char *argv[])
{
int i;
@@ -3710,6 +3731,12 @@ int do_init(int argc, char *argv[])
ShowNotice("Server is running on '"CL_WHITE"PK Mode"CL_RESET"'.\n");
ShowStatus("Server is '"CL_GREEN"ready"CL_RESET"' and listening on port '"CL_WHITE"%d"CL_RESET"'.\n\n", map_port);
+
+ if( runflag != CORE_ST_STOP )
+ {
+ shutdown_callback = do_shutdown;
+ runflag = MAPSERVER_ST_RUNNING;
+ }
return 0;
}