diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-07-17 16:16:51 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-07-17 16:16:51 +0000 |
commit | 4a2c67dc47ffc7c33eea340ea96e3d0ba57e359e (patch) | |
tree | 1005a1e32bfedd0711c3ffb9f1b3e816cfa87d6a /src/map/pc.c | |
parent | e378e27b012798c880f27e25c7471eb9cc537499 (diff) | |
download | hercules-4a2c67dc47ffc7c33eea340ea96e3d0ba57e359e.tar.gz hercules-4a2c67dc47ffc7c33eea340ea96e3d0ba57e359e.tar.bz2 hercules-4a2c67dc47ffc7c33eea340ea96e3d0ba57e359e.tar.xz hercules-4a2c67dc47ffc7c33eea340ea96e3d0ba57e359e.zip |
- Should have fixed the Cart Termination damage code to be scaled correctly when you change the max cart weight. Thanks to The Ultra Mage for the error clarification.
- Implemented Grandcross weird property where if there's noone on the path it'll hit twice for the skill's reported damage, and when there is (or you cant knockback the target) it'll do a splash attack that hits twice for 500% to all affected targets.
- Some cleaning of the combo code. TK Rankers will now get their combo-time extended each time they trigger a kick, enabling them to do "unlimited combos".
- Modified the autosave function to use a sweep across the player db instead of across connected clients. This will cause non-connected players (like autotraders) to also be saved on a regular interval, may help with possible data-loss from said characters on unclean shutdowns.
- Added function map_foreachpc
- Removed the code that forces aggressive mobs to go after a Homun instead of their master (no reason why there should be such a condition).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7721 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index f7c93c94f..3396de798 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -7093,25 +7093,38 @@ int pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y) * 自動セ?ブ 各クライアント *------------------------------------------ */ -static int last_save_fd,save_flag; -static int pc_autosave_sub(struct map_session_data *sd,va_list ap) +static int last_save_id=0,save_flag=0; +static int pc_autosave_sub(DBKey key,void * data,va_list app) { - nullpo_retr(0, sd); + struct map_session_data *sd = (TBL_PC*)data; + + if(sd->bl.id == last_save_id) { + save_flag = 1; + return 1; + } - Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd); + if(save_flag != 1) //Not our turn to save yet. + return 0; - if(save_flag==0 && sd->fd>last_save_fd && !sd->state.waitingdisconnect) - { - // pet - if(sd->status.pet_id > 0 && sd->pd) - intif_save_petdata(sd->status.account_id,&sd->pet); + if (sd->state.waitingdisconnect) //Invalid char to save. + return 0; - chrif_save(sd,0); - save_flag=1; - last_save_fd = sd->fd; - } + //Save char. + last_save_id = sd->bl.id; + save_flag=2; - return 0; + // pet + if(sd->status.pet_id > 0 && sd->pd) + intif_save_petdata(sd->status.account_id,&sd->pet); + + if(sd->state.finalsave) + { //Save ack hasn't returned from char-server yet? Retry. + ShowDebug("pc_autosave: Resending to save logging out char %d:%d (save ack from char-server hasn't arrived yet)\n", sd->status.account_id, sd->status.char_id); + sd->state.finalsave = 0; + chrif_save(sd,1); + } else + chrif_save(sd,0); + return 1; } /*========================================== @@ -7122,10 +7135,11 @@ int pc_autosave(int tid,unsigned int tick,int id,int data) { int interval; - save_flag=0; - clif_foreachclient(pc_autosave_sub); - if(save_flag==0) - last_save_fd=0; + if(save_flag == 2) //Someone was saved on last call, normal cycle + save_flag = 0; + else + save_flag = 1; //Noone was saved, so save first found char. + map_foreachpc(pc_autosave_sub); if (autosave_interval < 0) return 0; //Fixed interval for saving. [Skotlex] |