summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-16 00:31:57 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-16 00:31:57 +0300
commitf099ecceb8b1ca40f990a2c28a8b8740ac0c8a8c (patch)
tree64b7449a501b510b969f48fc9bee93e93b913234
parent42cd207c4c5f0be387f85f4c89bdcf21929a7f84 (diff)
downloadevol-hercules-f099ecceb8b1ca40f990a2c28a8b8740ac0c8a8c.tar.gz
evol-hercules-f099ecceb8b1ca40f990a2c28a8b8740ac0c8a8c.tar.bz2
evol-hercules-f099ecceb8b1ca40f990a2c28a8b8740ac0c8a8c.tar.xz
evol-hercules-f099ecceb8b1ca40f990a2c28a8b8740ac0c8a8c.zip
Add script function delcells for delete cells/wall.
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/map.c9
-rw-r--r--src/emap/script.c7
-rw-r--r--src/emap/script.h1
4 files changed, 18 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 7f84c95..19fbc10 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -128,6 +128,7 @@ HPExport void plugin_init (void)
addScriptCommand("setbgteam", "ii", setBgTeam);
addScriptCommand("checknpccell", "siii", checkNpcCell);
addScriptCommand("setcells", "siiiiis", setCells);
+ addScriptCommand("delcells", "s", delCells);
do_init_langs();
diff --git a/src/emap/map.c b/src/emap/map.c
index efbb7e9..c072d79 100644
--- a/src/emap/map.c
+++ b/src/emap/map.c
@@ -387,13 +387,17 @@ void emap_setgatcell(int16 *mPtr, int16 *xPtr, int16 *yPtr, int *gatPtr)
bool emap_iwall_set(int16 *m, int16 *x, int16 *y, int *size, int8 *dir, bool *shootable, const char* wall_name)
{
ShowError("Unsupported set wall function\n");
+ hookStop();
return false;
}
void emap_iwall_get(struct map_session_data *sd)
{
if (!sd || map->list[sd->bl.m].iwall_num < 1)
+ {
+ hookStop();
return;
+ }
DBIterator* iter = db_iterator(map->iwall_db);
struct WallData *wall;
@@ -404,6 +408,7 @@ void emap_iwall_get(struct map_session_data *sd)
send_setwall_single(sd->fd, wall->m, wall->x1, wall->y1 , wall->x2 , wall->y2 , wall->mask);
}
dbi_destroy(iter);
+ hookStop();
}
void emap_iwall_remove(const char *name)
@@ -411,7 +416,10 @@ void emap_iwall_remove(const char *name)
struct WallData *wall;
if ((wall = (struct WallData *)strdb_get(map->iwall_db, name)) == NULL)
+ {
+ hookStop();
return; // Nothing to do
+ }
int x;
int y;
@@ -430,6 +438,7 @@ void emap_iwall_remove(const char *name)
send_setwall(m, x1, y1, x2, y2, mask, ALL_SAMEMAP);
map->list[wall->m].iwall_num--;
strdb_remove(map->iwall_db, wall->name);
+ hookStop();
}
bool emap_iwall_set2(int m, int x1, int y1, int x2, int y2, int mask, const char *name)
diff --git a/src/emap/script.c b/src/emap/script.c
index 530a13f..905bcf5 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -1827,3 +1827,10 @@ BUILDIN(setCells)
return true;
}
+
+BUILDIN(delCells)
+{
+ const char *name = script_getstr(st,2);
+ map->iwall_remove(name);
+ return true;
+}
diff --git a/src/emap/script.h b/src/emap/script.h
index ca00e6e..e6b8c70 100644
--- a/src/emap/script.h
+++ b/src/emap/script.h
@@ -61,5 +61,6 @@ BUILDIN(setBgTeam);
BUILDIN(chatJoin);
BUILDIN(checkNpcCell);
BUILDIN(setCells);
+BUILDIN(delCells);
#endif // EVOL_MAP_SCRIPT