summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-27 10:08:22 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-27 10:08:22 +0000
commit0ccaa850059dc60f52896ee86935f02e6d087780 (patch)
tree5fa23d6dd4468010d9321b3ba612c6b6f9cf2ed2 /src/map/script.c
parentc20592155c15b1cd60c0ba13c3f4a2f142fbe2cf (diff)
downloadhercules-0ccaa850059dc60f52896ee86935f02e6d087780.tar.gz
hercules-0ccaa850059dc60f52896ee86935f02e6d087780.tar.bz2
hercules-0ccaa850059dc60f52896ee86935f02e6d087780.tar.xz
hercules-0ccaa850059dc60f52896ee86935f02e6d087780.zip
- 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
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c24
1 files changed, 11 insertions, 13 deletions
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;
}