summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-04-27 01:40:19 +0200
committerHaru <haru@dotalux.com>2016-04-27 01:40:19 +0200
commitcd86cccaefd4ecd13c68d95d7967f0d8f4f890ff (patch)
treedd8abdcbeee553c56feb62c23fa56f7cf0be009a /src/map/unit.c
parent9b7f03b129503362c6349e0c0f7f42637df32ab5 (diff)
parent1906d3327c586b72c6989f9ba4a7b95b25dc6341 (diff)
downloadhercules-cd86cccaefd4ecd13c68d95d7967f0d8f4f890ff.tar.gz
hercules-cd86cccaefd4ecd13c68d95d7967f0d8f4f890ff.tar.bz2
hercules-cd86cccaefd4ecd13c68d95d7967f0d8f4f890ff.tar.xz
hercules-cd86cccaefd4ecd13c68d95d7967f0d8f4f890ff.zip
Merge pull request #1269 from 4144/timersfix
Fix one of timer issue and add protection agains future issues like this
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index 7e4d94e0b..ac1e3e9b5 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1220,6 +1220,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
ud = unit->bl2ud(src);
if(ud == NULL) return 0;
+
sc = status->get_sc(src);
if (sc && !sc->count)
sc = NULL; //Unneeded
@@ -2289,11 +2290,18 @@ int unit_skillcastcancel(struct block_list *bl,int type)
// unit_data initialization process
void unit_dataset(struct block_list *bl) {
- struct unit_data *ud;
- nullpo_retv(ud = unit->bl2ud(bl));
+ struct unit_data *ud = unit->bl2ud(bl);
+ nullpo_retv(ud);
+
+ unit->init_ud(ud);
+ ud->bl = bl;
+}
+
+void unit_init_ud(struct unit_data *ud)
+{
+ nullpo_retv(ud);
- memset( ud, 0, sizeof( struct unit_data) );
- ud->bl = bl;
+ memset (ud, 0, sizeof(struct unit_data));
ud->walktimer = INVALID_TIMER;
ud->skilltimer = INVALID_TIMER;
ud->attacktimer = INVALID_TIMER;
@@ -2895,6 +2903,7 @@ void unit_defaults(void) {
/* */
unit->bl2ud = unit_bl2ud;
unit->bl2ud2 = unit_bl2ud2;
+ unit->init_ud = unit_init_ud;
unit->attack_timer = unit_attack_timer;
unit->walktoxy_timer = unit_walktoxy_timer;
unit->walktoxy_sub = unit_walktoxy_sub;