summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/map.c5
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/script.c10
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc4
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc17
5 files changed, 23 insertions, 15 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 780e6f535..90b304865 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3166,13 +3166,13 @@ void map_iwall_get(struct map_session_data *sd)
dbi_destroy(iter);
}
-void map_iwall_remove(const char *wall_name)
+bool map_iwall_remove(const char *wall_name)
{
struct iwall_data *iwall;
int16 i, x1, y1;
if( (iwall = (struct iwall_data *)strdb_get(map->iwall_db, wall_name)) == NULL )
- return; // Nothing to do
+ return false;
for( i = 0; i < iwall->size; i++ ) {
map->iwall_nextxy(iwall->x, iwall->y, iwall->dir, i, &x1, &y1);
@@ -3185,6 +3185,7 @@ void map_iwall_remove(const char *wall_name)
map->list[iwall->m].iwall_num--;
strdb_remove(map->iwall_db, iwall->wall_name);
+ return true;
}
/**
diff --git a/src/map/map.h b/src/map/map.h
index 5c4c6d59d..d6afdc160 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1293,7 +1293,7 @@ END_ZEROED_BLOCK;
bool (*iwall_set) (int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char* wall_name);
void (*iwall_get) (struct map_session_data *sd);
- void (*iwall_remove) (const char *wall_name);
+ bool (*iwall_remove) (const char *wall_name);
int (*addmobtolist) (unsigned short m, struct spawn_data *spawn); // [Wizputer]
void (*spawnmobs) (int16 m); // [Wizputer]
diff --git a/src/map/script.c b/src/map/script.c
index d11b6741a..3c5f4a232 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13998,9 +13998,15 @@ BUILDIN(setwall) {
map->iwall_set(m, x, y, size, dir, shootable, name);
return true;
}
-BUILDIN(delwall) {
+
+BUILDIN(delwall)
+{
const char *name = script_getstr(st,2);
- map->iwall_remove(name);
+
+ if (!map->iwall_remove(name)) {
+ ShowWarning("buildin_delwall: Non-existent '%s' provided.\n", name);
+ return false;
+ }
return true;
}
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index e72807ff8..21c3f76cb 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -4286,8 +4286,8 @@ typedef bool (*HPMHOOK_pre_map_iwall_set) (int16 *m, int16 *x, int16 *y, int *si
typedef bool (*HPMHOOK_post_map_iwall_set) (bool retVal___, int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char *wall_name);
typedef void (*HPMHOOK_pre_map_iwall_get) (struct map_session_data **sd);
typedef void (*HPMHOOK_post_map_iwall_get) (struct map_session_data *sd);
-typedef void (*HPMHOOK_pre_map_iwall_remove) (const char **wall_name);
-typedef void (*HPMHOOK_post_map_iwall_remove) (const char *wall_name);
+typedef bool (*HPMHOOK_pre_map_iwall_remove) (const char **wall_name);
+typedef bool (*HPMHOOK_post_map_iwall_remove) (bool retVal___, const char *wall_name);
typedef int (*HPMHOOK_pre_map_addmobtolist) (unsigned short *m, struct spawn_data **spawn);
typedef int (*HPMHOOK_post_map_addmobtolist) (int retVal___, unsigned short m, struct spawn_data *spawn);
typedef void (*HPMHOOK_pre_map_spawnmobs) (int16 *m);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index f02cdd8be..1fbc47731 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -44099,31 +44099,32 @@ void HP_map_iwall_get(struct map_session_data *sd) {
}
return;
}
-void HP_map_iwall_remove(const char *wall_name) {
+bool HP_map_iwall_remove(const char *wall_name) {
int hIndex = 0;
+ bool retVal___ = false;
if (HPMHooks.count.HP_map_iwall_remove_pre > 0) {
- void (*preHookFunc) (const char **wall_name);
+ bool (*preHookFunc) (const char **wall_name);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_map_iwall_remove_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_map_iwall_remove_pre[hIndex].func;
- preHookFunc(&wall_name);
+ retVal___ = preHookFunc(&wall_name);
}
if (*HPMforce_return) {
*HPMforce_return = false;
- return;
+ return retVal___;
}
}
{
- HPMHooks.source.map.iwall_remove(wall_name);
+ retVal___ = HPMHooks.source.map.iwall_remove(wall_name);
}
if (HPMHooks.count.HP_map_iwall_remove_post > 0) {
- void (*postHookFunc) (const char *wall_name);
+ bool (*postHookFunc) (bool retVal___, const char *wall_name);
for (hIndex = 0; hIndex < HPMHooks.count.HP_map_iwall_remove_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_map_iwall_remove_post[hIndex].func;
- postHookFunc(wall_name);
+ retVal___ = postHookFunc(retVal___, wall_name);
}
}
- return;
+ return retVal___;
}
int HP_map_addmobtolist(unsigned short m, struct spawn_data *spawn) {
int hIndex = 0;