diff options
author | Haruna <haru@dotalux.com> | 2015-01-05 21:35:48 +0100 |
---|---|---|
committer | Haruna <haru@dotalux.com> | 2015-01-05 21:35:48 +0100 |
commit | 095aaf5d3a6b108b59cb98b3c63ad836be65a4ed (patch) | |
tree | 4fa98033b59af09377134c77e1500138db078ae5 /src/map/npc.c | |
parent | 3dc29e4a4ecdc2f474223461bd18d5beabcd9994 (diff) | |
parent | 046ed2c6e94bc3016351cadb6f4d792807acb63d (diff) | |
download | hercules-095aaf5d3a6b108b59cb98b3c63ad836be65a4ed.tar.gz hercules-095aaf5d3a6b108b59cb98b3c63ad836be65a4ed.tar.bz2 hercules-095aaf5d3a6b108b59cb98b3c63ad836be65a4ed.tar.xz hercules-095aaf5d3a6b108b59cb98b3c63ad836be65a4ed.zip |
Merge pull request #433 from 4144/viewdata
Add npcdb_checkid to npc interface.
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 04df22f2d..28709d34f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -75,7 +75,7 @@ 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){ + if (npc->db_checkid(class_) || class_ == WARP_CLASS){ if( class_ > MAX_NPC_CLASS2_START ){ return &npc_viewdb2[class_-MAX_NPC_CLASS2_START]; }else{ @@ -85,6 +85,13 @@ struct view_data* npc_get_viewdata(int class_) return NULL; } +//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) +bool npc_db_checkid(int id) +{ + return ((id >= 46 && id <= 125) || id == HIDDEN_WARP_CLASS || (id > 400 && id < MAX_NPC_CLASS) || id == INVISIBLE_CLASS || (id > MAX_NPC_CLASS2_START && id < MAX_NPC_CLASS2_END)); +} + /// Returns a new npc id that isn't being used in id_db. /// Fatal error if nothing is available. int npc_get_new_npc_id(void) { @@ -4745,4 +4752,5 @@ void npc_defaults(void) { npc->market_tosql = npc_market_tosql; npc->market_delfromsql = npc_market_delfromsql; npc->market_delfromsql_sub = npc_market_delfromsql_sub; + npc->db_checkid = npc_db_checkid; } |