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=20764)

Cripp 06-09-2006 08:27 AM

Auto save timer...
 
Not sure if this is already implamented at all in any way but it didnt look like it to me so i added it to my server.. heres what i did

first in client.h..
around line 770 after
Code:

        Timer        shield_timer;
        Timer        fishing_timer;

add
Code:

        Timer        save_timer;
so it looks like..
Code:

        Timer        shield_timer;
        Timer        fishing_timer;
        Timer        save_timer;

#ifdef REVERSE_AGGRO
        Timer        scanarea_timer;
#endif

NEXT..
in client.cpp, around line 145
after..
Code:

        shield_timer(500),
        fishing_timer(8000),

add
Code:

        save_timer(90000),
so it looks like
Code:

        shield_timer(500),
        fishing_timer(8000),
        save_timer(90000),

#ifdef REVERSE_AGGRO
        scanarea_timer(AIClientScanarea_delay),
#endif

Also,
in client.cpp, around line 212
after..
Code:

        pQueuedSaveWorkID = 0;
        position_timer_counter = 0;

add
Code:

        save_timer.Enable();
so it looks like
Code:

        pQueuedSaveWorkID = 0;
        position_timer_counter = 0;
        save_timer.Enable();
        fishing_timer.Disable();
        shield_timer.Disable();

Last,
in client_process.cpp, around line 148
after..
Code:

                if (fishing_timer.Check()) {
                        GoFish();
                }

add..
Code:

                if (save_timer.Check()) {
                        Save(2);
                        Message(0, "%s successfully saved.", GetName());
                        save_timer.Start(90000);
                }

so it looks like..
Code:

                if (fishing_timer.Check()) {
                        GoFish();
                }

                if (save_timer.Check()) {
                        Save(2);
                        Message(0, "%s successfully saved.", GetName());
                        save_timer.Start(90000);
                }

                if (bardsong_timer.Check() && bardsong != 0) {

If anyone can tweak it any better than it is, please do so.

Hope this helps, and hope its readable :D

edit: i would make a .diff file but i duno how :(

edit2: could also put an #ifdef ASAVE_TIMER #endif around all the additions and add #define ASAVE_TIMER in features.h to make it optional

fathernitwit 06-18-2006 09:01 AM

This is a good idea, bump this thread in a week or two if it does not get into CVS by then.

info on how to diff, feel free to expand on it:
http://www.eqemulator.net/wiki/wikka...akka=howtodiff

Cripp 06-23-2006 05:45 AM

Here are patches for exactly what i have..
client.cpp..
Code:

--- client.cpp        2006/06/20 02:36:20        1.2
+++ client.cpp        2006/06/21 06:07:41        1.3
@@ -143,6 +143,9 @@
        ooc_timer(1000),
        shield_timer(500),
        fishing_timer(8000),
+#ifdef CRIPP
+        save_timer(60000),
+#endif
 #ifdef REVERSE_AGGRO
        scanarea_timer(AIClientScanarea_delay),
 #endif
@@ -207,6 +210,9 @@
        npclevel = 0;
        pQueuedSaveWorkID = 0;
        position_timer_counter = 0;
+#ifdef CRIPP
+        save_timer.Enable();
+#endif
        fishing_timer.Disable();
        shield_timer.Disable();
        dead_timer.Disable();

client.h..
Code:

--- client.h        2006/06/20 02:36:21        1.2
+++ client.h        2006/06/21 06:07:41        1.3
@@ -768,6 +770,9 @@
        Timer        ooc_timer;
        Timer        shield_timer;
        Timer        fishing_timer;
+#ifdef CRIPP
+        Timer        save_timer;
+#endif
 #ifdef REVERSE_AGGRO
        Timer        scanarea_timer;
 #endif

client_process.cpp..
Code:

--- 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,15 @@
                if (fishing_timer.Check()) {
                        GoFish();
                }
-               
+
+#ifdef CRIPP
+                if (save_timer.Check()) {
+                        Save(2);
+                        Message(0, "%s successfully saved.", GetName());
+                        save_timer.Start(300000);
+                }
+#endif
+
                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...

hope this is a little more readable ;p
(I also changed the numbers a bit to make it less annoying)


All times are GMT -4. The time now is 12:24 PM.

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