diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-02 08:16:53 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-02 08:16:53 +0000 |
commit | e68708d62551a95f47af75bb843bb7a8c32a549c (patch) | |
tree | 584a96a773f5e801c7db24ca0003b5f2c689c932 /src/map/map.c | |
parent | 4edd2cca4ff69edca3b222b80fb67a721808c441 (diff) | |
download | hercules-e68708d62551a95f47af75bb843bb7a8c32a549c.tar.gz hercules-e68708d62551a95f47af75bb843bb7a8c32a549c.tar.bz2 hercules-e68708d62551a95f47af75bb843bb7a8c32a549c.tar.xz hercules-e68708d62551a95f47af75bb843bb7a8c32a549c.zip |
Fixed npc reloading crash (bugreport:889)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12166 54d463be-8e91-2dee-dedb-b68131a5f0ec
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; |