summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-11-02 02:25:38 +0300
committerAndrei Karas <akaras@inbox.ru>2017-11-04 23:24:24 +0300
commite8346ea6e4019fc98a97cbe3e0c4dad028df1652 (patch)
tree1254050a02ee42191a0f5952dc0918691d1c9c82 /src/map/npc.c
parent41f3237e4537d7105fb47d56b455d31cf33c155c (diff)
downloadhercules-e8346ea6e4019fc98a97cbe3e0c4dad028df1652.tar.gz
hercules-e8346ea6e4019fc98a97cbe3e0c4dad028df1652.tar.bz2
hercules-e8346ea6e4019fc98a97cbe3e0c4dad028df1652.tar.xz
hercules-e8346ea6e4019fc98a97cbe3e0c4dad028df1652.zip
Allow each npc use own view_data structure.
Allow npc to use player classes (for older than 20170726 npc visible as players). View_data structure can be copied from predefined view_data lists created new if npc using player type.
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index de5335302..c9edb2595 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -114,6 +114,8 @@ bool npc_db_checkid(int id)
return true;
if (id >= MAX_NPC_CLASS2_START && id < MAX_NPC_CLASS2_END) // Second range
return true;
+ if (pc->db_checkid(id))
+ return true;
// Anything else is invalid
return false;
}
@@ -2706,6 +2708,7 @@ struct npc_data *npc_create_npc(enum npc_subtype subtype, int m, int x, int y, u
nd->area_size = AREA_SIZE + 1;
nd->class_ = class_;
nd->speed = 200;
+ nd->vd.class = 0;
return nd;
}
@@ -4999,7 +5002,6 @@ int do_init_npc(bool minimal) {
npc_viewdb[i].class = i;
for( i = MAX_NPC_CLASS2_START; i < MAX_NPC_CLASS2_END; i++ )
npc_viewdb2[i - MAX_NPC_CLASS2_START].class = i;
-
npc->ev_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, EVENT_NAME_LENGTH);
npc->ev_label_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, NAME_LENGTH);
npc->name_db = strdb_alloc(DB_OPT_BASE, NAME_LENGTH);