summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2015-01-18 19:53:10 -0200
committershennetsind <ind@henn.et>2015-01-18 19:53:10 -0200
commit43a24c0c88bdf19935d15d1b8392e3527ff090cd (patch)
treeef62aae0a88ce703ef0fd6b06a84408bfd328781 /src/map
parent0285ddf7cee2f6569a513fe6118c43f99fd71279 (diff)
downloadhercules-43a24c0c88bdf19935d15d1b8392e3527ff090cd.tar.gz
hercules-43a24c0c88bdf19935d15d1b8392e3527ff090cd.tar.bz2
hercules-43a24c0c88bdf19935d15d1b8392e3527ff090cd.tar.xz
hercules-43a24c0c88bdf19935d15d1b8392e3527ff090cd.zip
For bug report 8367
While unable to reproduce, I implemented a countermeasure to the issue in question (settick failing, which'd cause blockskill[] not to be filled). Hopefully someone who can reproduce is able to shed some light on the conditions required, allowing for a proper fix to be made. http://hercules.ws/board/tracker/issue-8367-timer-settick-issue/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/skill.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 1fad55364..00c0caaa4 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -17890,7 +17890,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick)
sd->blockskill[idx] = false;
return -1;
}
-
+
if( battle_config.display_status_timers )
clif->skill_cooldown(sd, skill_id, tick);
@@ -17898,9 +17898,10 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick)
cd = ers_alloc(skill->cd_ers, struct skill_cd);
idb_put( skill->cd_db, sd->status.char_id, cd );
+
} else {
int i;
-
+
for(i = 0; i < cd->cursor; i++) {
if( cd->entry[i] && cd->entry[i]->skidx == idx )
break;
@@ -17912,8 +17913,25 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick)
cd->entry[i]->total = tick;
#endif
cd->entry[i]->started = now;
- timer->settick(cd->entry[i]->timer,now+tick);
- return 0;
+ if( timer->settick(cd->entry[i]->timer,now+tick) != -1 )
+ return 0;
+ else {
+ int cursor;
+ /** somehow, the timer vanished. (bugreport:8367) **/
+ ers_free(skill->cd_entry_ers, cd->entry[i]);
+
+ cd->entry[i] = NULL;
+
+ for( i = 0, cursor = 0; i < cd->cursor; i++ ) {
+ if( !cd->entry[i] )
+ continue;
+ if( cursor != i )
+ cd->entry[cursor] = cd->entry[i];
+ cursor++;
+ }
+
+ cd->cursor = cursor;
+ }
}
}