summaryrefslogtreecommitdiff
path: root/src/map/npc_chat.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-12-28 00:24:24 +0100
committerHaru <haru@dotalux.com>2016-01-06 15:14:50 +0100
commit205558527913c42956bf5bbe2afbceac3dad1935 (patch)
tree137f1f8bf50c8b41c839cfe9d30a7e0fd7158469 /src/map/npc_chat.c
parentf878d5e2156dc88fb73d27473acfe01d72427bbd (diff)
downloadhercules-205558527913c42956bf5bbe2afbceac3dad1935.tar.gz
hercules-205558527913c42956bf5bbe2afbceac3dad1935.tar.bz2
hercules-205558527913c42956bf5bbe2afbceac3dad1935.tar.xz
hercules-205558527913c42956bf5bbe2afbceac3dad1935.zip
Replaced some map->id2sd calls with the proper map->id2XX function
- Also added new map->id2XX convenience functions for the other bl types. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/npc_chat.c')
-rw-r--r--src/map/npc_chat.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c
index db300e362..fef3ba99b 100644
--- a/src/map/npc_chat.c
+++ b/src/map/npc_chat.c
@@ -400,38 +400,46 @@ int npc_chat_sub(struct block_list* bl, va_list ap)
}
// Various script built-ins used to support these functions
-BUILDIN(defpattern) {
+BUILDIN(defpattern)
+{
int setid = script_getnum(st,2);
const char* pattern = script_getstr(st,3);
const char* label = script_getstr(st,4);
- struct npc_data* nd = (struct npc_data *)map->id2bl(st->oid);
+ struct npc_data *nd = map->id2nd(st->oid);
+ nullpo_retr(false, nd);
npc_chat->def_pattern(nd, setid, pattern, label);
return true;
}
-BUILDIN(activatepset) {
+BUILDIN(activatepset)
+{
int setid = script_getnum(st,2);
- struct npc_data* nd = (struct npc_data *)map->id2bl(st->oid);
+ struct npc_data *nd = map->id2nd(st->oid);
+ nullpo_retr(false, nd);
npc_chat->activate_pcreset(nd, setid);
return true;
}
-BUILDIN(deactivatepset) {
+BUILDIN(deactivatepset)
+{
int setid = script_getnum(st,2);
- struct npc_data* nd = (struct npc_data *)map->id2bl(st->oid);
+ struct npc_data *nd = map->id2nd(st->oid);
+ nullpo_retr(false, nd);
npc_chat->deactivate_pcreset(nd, setid);
return true;
}
-BUILDIN(deletepset) {
+BUILDIN(deletepset)
+{
int setid = script_getnum(st,2);
- struct npc_data* nd = (struct npc_data *)map->id2bl(st->oid);
+ struct npc_data *nd = map->id2nd(st->oid);
+ nullpo_retr(false, nd);
npc_chat->delete_pcreset(nd, setid);