From e1f41ae8fdac977851bfd090a6e266a0dda8ed29 Mon Sep 17 00:00:00 2001 From: lemongrass3110 Date: Wed, 10 Apr 2013 15:02:11 +0000 Subject: New NPC range now working. Sorry guys, back in my days it was as easy as this, but I did not test it. So now tested and working. :) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17246 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/npc.c | 12 ++++++++++-- src/map/npc.h | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/map') diff --git a/src/map/npc.c b/src/map/npc.c index 124446d62..5cca94a87 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -96,6 +96,7 @@ static DBMap *npc_path_db; //For holding the view data of npc classes. [Skotlex] static struct view_data npc_viewdb[MAX_NPC_CLASS]; +static struct view_data npc_viewdb2[MAX_NPC_CLASS2_END-MAX_NPC_CLASS2_START]; static struct script_event_s { //Holds pointers to the commonly executed scripts for speedup. [Skotlex] @@ -108,8 +109,13 @@ 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_]; + if (npcdb_checkid(class_) || class_ == WARP_CLASS){ + if( class_ > MAX_NPC_CLASS2_START ){ + return &npc_viewdb2[class_-MAX_NPC_CLASS2_START]; + }else{ + return &npc_viewdb[class_]; + } + } return NULL; } @@ -3994,6 +4000,8 @@ int do_init_npc(void) npc_viewdb[0].class_ = INVISIBLE_CLASS; //Invisible class is stored here. for( i = 1; i < MAX_NPC_CLASS; i++ ) 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; ev_db = strdb_alloc((DBOptions)(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA),2*NAME_LENGTH+2+1); npcname_db = strdb_alloc(DB_OPT_BASE,NAME_LENGTH); diff --git a/src/map/npc.h b/src/map/npc.h index c2351a836..229363191 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -88,7 +88,12 @@ enum actor_classes INVISIBLE_CLASS = 32767, }; +// Old NPC range #define MAX_NPC_CLASS 1000 +// New NPC range +#define MAX_NPC_CLASS2_START 10000 +#define MAX_NPC_CLASS2_END 10049 + //Checks if a given id is a valid npc id. [Skotlex] //Since new npcs are added all the time, the max valid value is the one before the first mob (Scorpion = 1001) #define npcdb_checkid(id) ( ( (id) >= 46 && (id) <= 125) || (id) == HIDDEN_WARP_CLASS || ( (id) > 400 && (id) < MAX_NPC_CLASS ) || (id) == INVISIBLE_CLASS || ( (id) > 10000 && (id) < 10049 ) ) -- cgit v1.2.3-70-g09d2