summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-08 17:56:31 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-08 17:56:31 +0000
commit2de9fa2b9bcc944a5671a1965813a56b1e1dfd5c (patch)
tree14a7873c785ec04068a85dc4148e349d32d2e6a3 /src/map/npc.c
parent74c9a56b7aa52fff54fa4a34a2f31910307b37eb (diff)
downloadhercules-2de9fa2b9bcc944a5671a1965813a56b1e1dfd5c.tar.gz
hercules-2de9fa2b9bcc944a5671a1965813a56b1e1dfd5c.tar.bz2
hercules-2de9fa2b9bcc944a5671a1965813a56b1e1dfd5c.tar.xz
hercules-2de9fa2b9bcc944a5671a1965813a56b1e1dfd5c.zip
- Fixed @movenpc
- Cleaned up and improved the lootsearch routine to pick nearest item. - Added INVISIBLE_CLASS to the list of classes supported by npc_get_viewdata - Fixed trying to set the view_data for npcs who are located on a map, but have no visual data. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5959 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 13e1cc195..da1487809 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -68,6 +68,8 @@ static struct view_data npc_viewdb[MAX_NPC_CLASS];
struct view_data* npc_get_viewdata(int class_)
{ //Returns the viewdata for normal npc classes.
+ if (class_ == INVISIBLE_CLASS)
+ return &npc_viewdb[0];
if (npcdb_checkid(class_) || class_ == WARP_CLASS)
return &npc_viewdb[class_];
return NULL;
@@ -1887,7 +1889,8 @@ static int npc_parse_script (char *w1,char *w2,char *w3,char *w4,char *first_lin
nd->eventtimer[i] = -1;
if (m >= 0) {
nd->n = map_addnpc(m, nd);
- status_set_viewdata(&nd->bl, nd->class_);
+ if (class_ >= 0)
+ status_set_viewdata(&nd->bl, nd->class_);
status_change_init(&nd->bl);
unit_dataset(&nd->bl);
nd->ud.dir = dir;
@@ -2688,7 +2691,7 @@ static void npc_debug_warps_sub(struct npc_data *nd)
}
-static void npc_debug_warps()
+static void npc_debug_warps(void)
{
int m, i;
for (m = 0; m < map_num; m++)
@@ -2709,7 +2712,8 @@ int do_init_npc(void)
//Stock view data for normal npcs.
memset(&npc_viewdb, 0, sizeof(npc_viewdb));
- for (busy = 0; busy < MAX_NPC_CLASS; busy++)
+ npc_viewdb[0].class_ = INVISIBLE_CLASS; //Invisible class is stored here.
+ for (busy = 1; busy < MAX_NPC_CLASS; busy++)
npc_viewdb[busy].class_ = busy;
busy = 0;
// indoorrswtable.txt and etcinfo.txt [Celest]