summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlemongrass3110 <lemongrass3110@54d463be-8e91-2dee-dedb-b68131a5f0ec>2013-04-10 15:02:11 +0000
committershennetsind <ind@henn.et>2013-04-11 16:45:38 -0300
commite1f41ae8fdac977851bfd090a6e266a0dda8ed29 (patch)
tree9792f971338f659a58459a9e9737585ca7875e7c /src
parent12963a5aa4e6e6cbf167d44ef6e509855f725282 (diff)
downloadhercules-e1f41ae8fdac977851bfd090a6e266a0dda8ed29.tar.gz
hercules-e1f41ae8fdac977851bfd090a6e266a0dda8ed29.tar.bz2
hercules-e1f41ae8fdac977851bfd090a6e266a0dda8ed29.tar.xz
hercules-e1f41ae8fdac977851bfd090a6e266a0dda8ed29.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/map/npc.c12
-rw-r--r--src/map/npc.h5
2 files changed, 15 insertions, 2 deletions
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 ) )