From e68708d62551a95f47af75bb843bb7a8c32a549c Mon Sep 17 00:00:00 2001 From: ultramage Date: Sat, 2 Feb 2008 08:16:53 +0000 Subject: Fixed npc reloading crash (bugreport:889) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12166 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.c | 10 +++++----- src/map/script.c | 2 +- src/map/vending.c | 2 +- 3 files changed, 7 insertions(+), 7 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; diff --git a/src/map/script.c b/src/map/script.c index 0b4435351..8e0125cf1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8236,7 +8236,7 @@ BUILDIN_FUNC(sc_end) bl = map_id2bl(potion_target); } - if( !bl ) return 0l; + if( !bl ) return 0; if( type >= 0 && type < SC_MAX ) { diff --git a/src/map/vending.c b/src/map/vending.c index dd0f7ad76..098bfa28f 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -237,7 +237,7 @@ void vending_openvending(struct map_session_data* sd, const char* message, bool clif_skill_fail(sd, MC_VENDING, 0, 0); return; } - + // check number of items in shop if( count < 1 || count > MAX_VENDING || count > 2 + vending_skill_lvl ) { // invalid item count -- cgit v1.2.3-70-g09d2