From 0ccaa850059dc60f52896ee86935f02e6d087780 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 27 Nov 2007 10:08:22 +0000 Subject: - Cleaned some more the sc_end check so it is more generic and not so limited just to infinite endure. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11821 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 3ee1f04c1..4e81e752e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8120,20 +8120,18 @@ BUILDIN_FUNC(sc_end) bl = map_id2bl(potion_target); } - if( bl ) - { - if( type == SC_ENDURE ) - { //Required to terminate properly infinite endure. - struct status_change *sc = status_get_sc(bl); - struct status_change_entry *sce = sc?sc->data[type]:NULL; - if (sce) sce->val4 = 0; - } - if( type >= 0 ) - status_change_end(bl, type, INVALID_TIMER); - else - status_change_clear(bl, 2);// remove all effects - } + if( !bl ) return 0l; + if( type >= 0 && type < SC_MAX ) + { + struct status_change *sc = status_get_sc(bl); + struct status_change_entry *sce = sc?sc->data[type]:NULL; + if (!sce) return 0; + //This should help status_change_end force disabling the SC in case it has no limit. + sce->val1 = sce->val2 = sce->val3 = sce->val4 = 0; + status_change_end(bl, type, INVALID_TIMER); + } else + status_change_clear(bl, 2);// remove all effects return 0; } -- cgit v1.2.3-60-g2f50