diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-11-02 02:25:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-11-04 23:24:24 +0300 |
commit | e8346ea6e4019fc98a97cbe3e0c4dad028df1652 (patch) | |
tree | 1254050a02ee42191a0f5952dc0918691d1c9c82 /src/map/status.c | |
parent | 41f3237e4537d7105fb47d56b455d31cf33c155c (diff) | |
download | hercules-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/status.c')
-rw-r--r-- | src/map/status.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/map/status.c b/src/map/status.c index e0893aa36..ccd1e6b11 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6809,7 +6809,7 @@ struct view_data *status_get_viewdata(struct block_list *bl) case BL_PC: return &BL_UCAST(BL_PC, bl)->vd; case BL_MOB: return BL_UCAST(BL_MOB, bl)->vd; case BL_PET: return &BL_UCAST(BL_PET, bl)->vd; - case BL_NPC: return BL_UCAST(BL_NPC, bl)->vd; + case BL_NPC: return &BL_UCAST(BL_NPC, bl)->vd; case BL_HOM: return BL_UCAST(BL_HOM, bl)->vd; case BL_MER: return BL_UCAST(BL_MER, bl)->vd; case BL_ELEM: return BL_UCAST(BL_ELEM, bl)->vd; @@ -6927,10 +6927,14 @@ void status_set_viewdata(struct block_list *bl, int class_) case BL_NPC: { struct npc_data *nd = BL_UCAST(BL_NPC, bl); - if (vd != NULL) - nd->vd = vd; - else + if (vd != NULL) { + memcpy(&nd->vd, vd, sizeof(struct view_data)); + } else if (pc->db_checkid(class_)) { + memset(&nd->vd, 0, sizeof(struct view_data)); + nd->vd.class = class_; + } else { ShowError("status_set_viewdata (NPC): No view data for class %d (name=%s)\n", class_, nd->name); + } } break; case BL_HOM: //[blackhole89] |