summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authormomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-12-05 05:25:16 +0000
committermomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-12-05 05:25:16 +0000
commit784aae93bcd8d0ed59f5351921e103e7545e5ea6 (patch)
tree52d0abf56bd71d3738cac0b06914ad9f9d163eb8 /src/map/script.c
parent012bd2da191b99c55d7a4be9cb3685cfd56c3919 (diff)
downloadhercules-784aae93bcd8d0ed59f5351921e103e7545e5ea6.tar.gz
hercules-784aae93bcd8d0ed59f5351921e103e7545e5ea6.tar.bz2
hercules-784aae93bcd8d0ed59f5351921e103e7545e5ea6.tar.xz
hercules-784aae93bcd8d0ed59f5351921e103e7545e5ea6.zip
- Re-committed r16971/trunk/src/ (tid:74924).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16994 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index f1a422b7e..84512291e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -14135,7 +14135,7 @@ BUILDIN_FUNC(strpos) {
else
i = 0;
- if ( strlen(needle) == 0 ) {
+ if (needle[0] == '\0') {
script_pushint(st, -1);
return 0;
}
@@ -17227,6 +17227,45 @@ BUILDIN_FUNC(getrandgroupitem) {
return 0;
}
+/* cleanmap <map_name>;
+ * cleanfloor <map_name, <x0>, <y0>, <x1>, <y1>; */
+static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap)
+{
+ nullpo_ret(bl);
+ map_clearflooritem(bl);
+
+ return 0;
+}
+
+BUILDIN_FUNC(cleanmap)
+{
+ const char *map;
+ int m, index;
+ short x0, y0, x1, y1;
+
+ map = script_getstr(st, 2);
+ index = mapindex_name2id(map);
+ if (index)
+ m = map_mapindex2mapid(index);
+
+ if ((script_lastdata(st) - 2) < 4) {
+ map_foreachinmap(atcommand_cleanfloor_sub, m, BL_ITEM);
+ } else {
+ x0 = script_getnum(st, 3);
+ y0 = script_getnum(st, 4);
+ x1 = script_getnum(st, 5);
+ y1 = script_getnum(st, 6);
+ if (x0 > 0 && y0 > 0 && x1 > 0 && y1 > 0) {
+ map_foreachinarea(atcommand_cleanfloor_sub, m, x0, y0, x1, y1, BL_ITEM);
+ } else {
+ ShowError("cleanarea: invalid coordinate defined!\n");
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
// declarations that were supposed to be exported from npc_chat.c
#ifdef PCRE_SUPPORT
@@ -17668,6 +17707,8 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(get_revision,""),
BUILDIN_DEF(freeloop,"i"),
BUILDIN_DEF(getrandgroupitem, "ii"),
+ BUILDIN_DEF(cleanmap, "s"),
+ BUILDIN_DEF2(cleanmap, "cleanarea", "siiii"),
/**
* @commands (script based)
**/