From f099ecceb8b1ca40f990a2c28a8b8740ac0c8a8c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 16 Oct 2015 00:31:57 +0300 Subject: Add script function delcells for delete cells/wall. --- src/emap/init.c | 1 + src/emap/map.c | 9 +++++++++ src/emap/script.c | 7 +++++++ src/emap/script.h | 1 + 4 files changed, 18 insertions(+) (limited to 'src') 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 -- cgit v1.2.3-70-g09d2