- Removed support for negative autosave intervals, instead added a minsave_interval setting which specifies which is the minimum time between character saves. Default to 100ms (map_athena.conf).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8280 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-08-14 20:14:58 +00:00
parent 6e5a887656
commit c182e64c0d
6 changed files with 24 additions and 15 deletions

View File

@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/08/14 2006/08/14
* Removed support for negative autosave intervals, instead added a
minsave_interval setting which specifies which is the minimum time between
character saves. Default to 100ms (map_athena.conf). [Skotlex]
* Sacrifice no longer shows damage to self. [Skotlex] * Sacrifice no longer shows damage to self. [Skotlex]
* When Asura fails, the skill display will still come off. [Skotlex] * When Asura fails, the skill display will still come off. [Skotlex]
* Lots of cleaning of the Homun-code. Perhaps the crashes as of late will * Lots of cleaning of the Homun-code. Perhaps the crashes as of late will

View File

@ -1,6 +1,9 @@
Date Added Date Added
2006/08/14 2006/08/14
* Removed support for negative autosave intervals, instead added a
minsave_interval setting which specifies which is the minimum time between
character saves. Default to 100ms (map_athena.conf). [Skotlex]
* Modified emergency_call setting to allow for more specific configuration * Modified emergency_call setting to allow for more specific configuration
(woe/non-woe, gvg-grounds/non-gvg-grounds, disable from nowarpto maps), see (woe/non-woe, gvg-grounds/non-gvg-grounds, disable from nowarpto maps), see
skill.conf for details. [Skotlex] skill.conf for details. [Skotlex]

View File

@ -93,14 +93,16 @@ enable_spy: no
console: off console: off
// Database autosave time // Database autosave time
// When positive, all characters are saved on this time in seconds (example: // All characters are saved on this time in seconds (example:
// autosave of 60 secs with 60 characters online -> one char is saved every // autosave of 60 secs with 60 characters online -> one char is saved every
// second) // second)
// When negative, the timeslot is constant, in seconds (example: if -1, a
// character will be saved once a second, regardless of number of players
// online).
autosave_time: 300 autosave_time: 300
// Min database save intervals (in ms)
// Prevent saving characters faster than at this rate (prevents char-server
// save-load getting too high as character-count increases)
minsave_time: 100
// Apart from the autosave_time, players will also get saved when involved // Apart from the autosave_time, players will also get saved when involved
// in the following (add as needed): // in the following (add as needed):
// 1: after every successful trade // 1: after every successful trade

View File

@ -169,6 +169,7 @@ int map_num = 0;
int map_port=0; int map_port=0;
int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL; int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
int minsave_interval = 100;
int save_settings = 0xFFFF; int save_settings = 0xFFFF;
int charsave_method = 0; //Default 'OLD' Save method (SQL ONLY!) [Sirius] int charsave_method = 0; //Default 'OLD' Save method (SQL ONLY!) [Sirius]
int agit_flag = 0; int agit_flag = 0;
@ -3314,9 +3315,14 @@ int map_config_read(char *cfgName) {
npc_delsrcfile(w2); npc_delsrcfile(w2);
} else if (strcmpi(w1, "autosave_time") == 0) { } else if (strcmpi(w1, "autosave_time") == 0) {
autosave_interval = atoi(w2); autosave_interval = atoi(w2);
if (!autosave_interval) //Revert to default saving. if (autosave_interval < 1) //Revert to default saving.
autosave_interval = DEFAULT_AUTOSAVE_INTERVAL; autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
autosave_interval *= 1000; //Pass from sec to ms else
autosave_interval *= 1000; //Pass from sec to ms
} else if (strcmpi(w1, "minsave_time") == 0) {
minsave_interval= atoi(w2);
if (minsave_interval < 1)
minsave_interval = 1;
} else if (strcmpi(w1, "save_settings") == 0) { } else if (strcmpi(w1, "save_settings") == 0) {
save_settings = atoi(w2); save_settings = atoi(w2);
} else if (strcmpi(w1, "motd_txt") == 0) { } else if (strcmpi(w1, "motd_txt") == 0) {

View File

@ -1246,6 +1246,7 @@ struct chat_data {
extern struct map_data map[]; extern struct map_data map[];
extern int map_num; extern int map_num;
extern int autosave_interval; extern int autosave_interval;
extern int minsave_interval;
extern int save_settings; extern int save_settings;
extern int agit_flag; extern int agit_flag;
extern int night_flag; // 0=day, 1=night [Yor] extern int night_flag; // 0=day, 1=night [Yor]

View File

@ -7175,12 +7175,9 @@ int pc_autosave(int tid,unsigned int tick,int id,int data)
save_flag = 1; //Noone was saved, so save first found char. save_flag = 1; //Noone was saved, so save first found char.
map_foreachpc(pc_autosave_sub); map_foreachpc(pc_autosave_sub);
if (autosave_interval < 0)
return 0; //Fixed interval for saving. [Skotlex]
interval = autosave_interval/(clif_countusers()+1); interval = autosave_interval/(clif_countusers()+1);
if(interval <= 0) if(interval < minsave_interval)
interval = 1; interval = minsave_interval;
add_timer(gettick()+interval,pc_autosave,0,0); add_timer(gettick()+interval,pc_autosave,0,0);
return 0; return 0;
@ -7594,10 +7591,7 @@ int do_init_pc(void) {
natural_heal_prev_tick = gettick(); 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_interval(natural_heal_prev_tick + NATURAL_HEAL_INTERVAL, pc_natural_heal, 0, 0, NATURAL_HEAL_INTERVAL);
if (autosave_interval > 0) //Normal saving. add_timer(gettick() + autosave_interval, pc_autosave, 0, 0);
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) { if (battle_config.day_duration > 0 && battle_config.night_duration > 0) {
int day_duration = battle_config.day_duration; int day_duration = battle_config.day_duration;