diff options
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/map/map.c b/src/map/map.c index 448648f28..bd12e418b 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1838,18 +1838,18 @@ int map_addnpc(int m,struct npc_data *nd) if( m < 0 || m >= map_num ) return -1; - ARR_FIND( 0, MAX_NPC_PER_MAP, i, map[m].npc[i] == NULL ); + ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == NULL ); if( i == MAX_NPC_PER_MAP ) { ShowWarning("too many NPCs in one map %s\n",map[m].name); return -1; } + nullpo_retr(0, nd); + if( i == map[m].npc_num ) map[m].npc_num++; - nullpo_retr(0, nd); - map[m].npc[i]=nd; nd->n = i; idb_put(id_db,nd->bl.id,nd); @@ -2317,8 +2317,8 @@ int map_eraseipport(unsigned short mapindex, uint32 ip, uint16 port) } /*========================================== -* Map cache reading -*===========================================*/ + * Map cache reading + *==========================================*/ int map_readfromcache(struct map_data *m, FILE *fp) { struct map_cache_main_header header; |