summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-02 08:16:53 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-02 08:16:53 +0000
commite68708d62551a95f47af75bb843bb7a8c32a549c (patch)
tree584a96a773f5e801c7db24ca0003b5f2c689c932
parent4edd2cca4ff69edca3b222b80fb67a721808c441 (diff)
downloadhercules-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
-rw-r--r--src/map/map.c10
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/vending.c2
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