diff options
author | Streusel <streusel@gravity.co.kr> | 2015-05-15 21:01:18 -0700 |
---|---|---|
committer | Streusel <streusel@gravity.co.kr> | 2015-05-15 21:01:18 -0700 |
commit | b5915307d91b8bd31c554c60b57791383f88edda (patch) | |
tree | 771df8585f05a2153c5a57b19909672f847b23a1 /src | |
parent | 6e3f2f6a507d88603def67d8aefaba3a62297573 (diff) | |
download | hercules-b5915307d91b8bd31c554c60b57791383f88edda.tar.gz hercules-b5915307d91b8bd31c554c60b57791383f88edda.tar.bz2 hercules-b5915307d91b8bd31c554c60b57791383f88edda.tar.xz hercules-b5915307d91b8bd31c554c60b57791383f88edda.zip |
Added floor(), ceil() and log() functions for usage in scripts.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/script.c | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/src/map/script.c b/src/map/script.c index ed4f9e918..03f5b13a3 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -15476,8 +15476,35 @@ BUILDIN(compare) return true; } -// [zBuffer] List of mathematics commands ---> -BUILDIN(sqrt) +// List of mathematics commands ---> +BUILDIN(floor) +{ + double i, a; + i = script_getnum(st,2); + a = floor(i); + script_pushint(st,(int)a); + return true; +} + +BUILDIN(ceil) +{ + double i, a; + i = script_getnum(st,2); + a = ceil(i); + script_pushint(st,(int)a); + return true; +} + +BUILDIN(log) +{ + double i, a; + i = script_getnum(st,2); + a = log(i); + script_pushint(st,(int)a); + return true; +} + +BUILDIN(sqrt) //[zBuffer] { double i, a; i = script_getnum(st,2); @@ -15486,7 +15513,7 @@ BUILDIN(sqrt) return true; } -BUILDIN(pow) +BUILDIN(pow) //[zBuffer] { double i, a, b; a = script_getnum(st,2); @@ -15496,7 +15523,7 @@ BUILDIN(pow) return true; } -BUILDIN(distance) +BUILDIN(distance) //[zBuffer] { int x0, y0, x1, y1; @@ -15509,7 +15536,7 @@ BUILDIN(distance) return true; } -// <--- [zBuffer] List of mathematics commands +// <--- List of mathematics commands BUILDIN(min) { @@ -20052,11 +20079,14 @@ void script_parse_builtin(void) { BUILDIN_DEF(getiteminfo,"ii"), //[Lupus] returns Items Buy / sell Price, etc info BUILDIN_DEF(setiteminfo,"iii"), //[Lupus] set Items Buy / sell Price, etc info BUILDIN_DEF(getequipcardid,"ii"), //[Lupus] returns CARD ID or other info from CARD slot N of equipped item - // [zBuffer] List of mathematics commands ---> - BUILDIN_DEF(sqrt,"i"), - BUILDIN_DEF(pow,"ii"), - BUILDIN_DEF(distance,"iiii"), - // <--- [zBuffer] List of mathematics commands + // List of mathematics commands ---> + BUILDIN_DEF(floor,"i"), + BUILDIN_DEF(ceil,"i"), + BUILDIN_DEF(log,"i"), + BUILDIN_DEF(sqrt,"i"), //[zBuffer] + BUILDIN_DEF(pow,"ii"), //[zBuffer] + BUILDIN_DEF(distance,"iiii"), //[zBuffer] + // <--- List of mathematics commands BUILDIN_DEF(min, "i*"), BUILDIN_DEF(max, "i*"), BUILDIN_DEF(md5,"s"), |