summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-29 20:34:17 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-29 20:34:17 +0000
commit53e1375cb6926b55a1487b61e5616b299e34e2be (patch)
tree66c641be525b9db654c34f5ab008b813a34832f1 /src/map/map.c
parent9cde26c90a6c3e55eddbee619958aea9b22c8de7 (diff)
downloadhercules-53e1375cb6926b55a1487b61e5616b299e34e2be.tar.gz
hercules-53e1375cb6926b55a1487b61e5616b299e34e2be.tar.bz2
hercules-53e1375cb6926b55a1487b61e5616b299e34e2be.tar.xz
hercules-53e1375cb6926b55a1487b61e5616b299e34e2be.zip
- Added "do_abort" function to the core. It is invoked when the server has received a Segmentation Fault or Floating Point Exception signal. Currently the only one that uses it is the map-server, which then attempts to save all online characters before aborting.
- Note that due to the current coding of the sig plugin, do_abort will not be invoked if you use it! This plugin needs to be updated... - Cleaned up a bit the change element code. val1 is the elemental level, val2 is the element now. - Hardcoded the element and elemental level of SC_CHANGEUNDEAD. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10089 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/map/map.c b/src/map/map.c
index fba8faa88..9cf047d56 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3156,6 +3156,34 @@ void do_final(void) {
ShowStatus("Successfully terminated.\n");
}
+static int map_abort_sub(DBKey key,void * data,va_list ap)
+{
+ struct map_session_data *sd = (TBL_PC*)data;
+
+ if (!sd->state.auth || sd->state.waitingdisconnect || sd->state.finalsave)
+ return 0;
+
+ chrif_save(sd,1);
+ return 1;
+}
+
+
+//------------------------------
+// Function called when the server
+// has received a crash signal.
+//------------------------------
+void do_abort(void) {
+ //Save all characters and then flush the inter-connection.
+ if (!chrif_isconnect())
+ {
+ ShowFatalError("Server has crashed without a connection to the char-server, character data can't be saved!\n");
+ return;
+ }
+ ShowError("Server received crash signal! Attempting to save all online characters!\n");
+ map_foreachpc(map_abort_sub);
+ chrif_flush_fifo();
+}
+
/*======================================================
* Map-Server Version Screen [MC Cameri]
*------------------------------------------------------