summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/map.c8
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/pc.c9
3 files changed, 15 insertions, 4 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 253ffe9bf..15a41f4c1 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3292,9 +3292,13 @@ int map_config_read(char *cfgName) {
} else if (strcmpi(w1, "delnpc") == 0) {
npc_delsrcfile(w2);
} else if (strcmpi(w1, "autosave_time") == 0) {
- autosave_interval = atoi(w2) * 1000;
- if (autosave_interval <= 0)
+ autosave_interval = atoi(w2);
+ if (!autosave_interval) //Revert to default saving.
autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
+ else if (autosave_interval > 0) //Pass from MS to seconds
+ autosave_interval *= 1000;
+ else if (autosave_interval > -100) //Use lower cap of 100ms
+ autosave_interval = -100;
} else if (strcmpi(w1, "save_settings") == 0) {
save_settings = atoi(w2);
} else if (strcmpi(w1, "motd_txt") == 0) {
diff --git a/src/map/map.h b/src/map/map.h
index f2faad936..75c6fe95a 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -155,7 +155,7 @@ enum {
//Don't change this, as the client seems to always send/receive 80 characters as it currently is. [Skotlex]
#define MESSAGE_SIZE 80
-#define DEFAULT_AUTOSAVE_INTERVAL 60*1000
+#define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000
//Specifies maps where players may hit each other
#define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || (agit_flag && map[m].flag.gvg_castle))
diff --git a/src/map/pc.c b/src/map/pc.c
index ebe80b90c..edd95ae8a 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -7095,6 +7095,9 @@ int pc_autosave(int tid,unsigned int tick,int id,int data)
if(save_flag==0)
last_save_fd=0;
+ if (autosave_interval < 0)
+ return 0; //Fixed interval for saving. [Skotlex]
+
interval = autosave_interval/(clif_countusers()+1);
if(interval <= 0)
interval = 1;
@@ -7510,7 +7513,11 @@ int do_init_pc(void) {
add_timer_func_list(pc_follow_timer, "pc_follow_timer");
natural_heal_prev_tick = gettick();
add_timer_interval(natural_heal_prev_tick + NATURAL_HEAL_INTERVAL, pc_natural_heal, 0, 0, NATURAL_HEAL_INTERVAL);
- add_timer(gettick() + autosave_interval, pc_autosave, 0, 0);
+
+ if (autosave_interval > 0) //Normal saving.
+ add_timer(gettick() + autosave_interval, pc_autosave, 0, 0);
+ else //Constant save interval.
+ add_timer_interval(gettick() -autosave_interval, pc_autosave, 0, 0, -autosave_interval);
if (battle_config.day_duration > 0 && battle_config.night_duration > 0) {
int day_duration = battle_config.day_duration;