EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=590)
-   -   auto save timer... (https://www.eqemulator.org/forums/showthread.php?t=21809)

Cripp 11-02-2006 04:13 PM

auto save timer...
 
Hi i posted a thread about this a while ago but thought id post it again as it is a simple, but very useful. It is an auto save timer which basically does a #save every few minutes..

here is the .diff patch thingy..

Code:

--- client.h        2006/06/20 02:36:21        1.2
+++ client.h        2006/06/21 06:07:41        1.3
@@ -768,6 +768,7 @@
        Timer        ooc_timer;
        Timer        shield_timer;
        Timer        fishing_timer;
+        Timer        save_timer; // Cripp: client->save(2) auto save
 #ifdef REVERSE_AGGRO
        Timer        scanarea_timer;
 #endif
 
--- client.cpp        2006/06/20 02:36:20        1.2
+++ client.cpp        2006/06/21 06:07:41        1.3
@@ -143,6 +143,7 @@
        ooc_timer(1000),
        shield_timer(500),
        fishing_timer(8000),
+        save_timer(60000), // Cripp: client->save(2) auto save
 #ifdef REVERSE_AGGRO
        scanarea_timer(AIClientScanarea_delay),
 #endif
@@ -207,6 +207,7 @@
        npclevel = 0;
        pQueuedSaveWorkID = 0;
        position_timer_counter = 0;
+        save_timer.Disable(); // Cripp: client->save(2) auto save
        fishing_timer.Disable();
        shield_timer.Disable();
        dead_timer.Disable();
       
--- client_packet.cpp        2006/07/02 00:19:00        1.4
+++ client_packet.cpp        2006/07/08 20:19:32        1.5
@@ -6204,9 +6204,10 @@
       
        hpupdate_timer.Start();
        position_timer.Start();
+        save_timer.Start(); // Cripp: client->save(2) auto save
        SetDuelTarget(0);
        SetDueling(false);
       
--- client_process.cpp        2006/06/20 02:36:21        1.2
+++ client_process.cpp        2006/06/21 06:07:41        1.3
@@ -146,7 +146,14 @@
                if (fishing_timer.Check()) {
                        GoFish();
                }
+
+                if (save_timer.Check()) { // Cripp: client->save(2) auto save
+                        Save(2);
+                        Message(0, "%s successfully saved.", GetName());
+                        save_timer.Start(300000);
+                }
+
                if (bardsong_timer.Check() && bardsong != 0) {
                        //NOTE: this is kinda a heavy-handed check to make sure the mob still exists before
                        //doing the next pulse on them...

please leave any comments/questions u have.
thx, have fun.
-cripp

fathernitwit 11-06-2006 04:23 PM

I put this in, tunable with a rule.

One note is that the argument to save() tells it when to run the query. 2 means "block everything and save this bitch", where as 0 and 1 let it run the query in the background... that much more likely what you want.


All times are GMT -4. The time now is 11:35 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.