summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 153206101..cc8de1a3a 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1980,29 +1980,23 @@ bool mapit_exists(struct s_mapiterator* mapit)
/*==========================================
* map.npcへ追加 (warp等の領域持ちのみ)
*------------------------------------------*/
-int map_addnpc(int m,struct npc_data *nd)
+bool map_addnpc(int m,struct npc_data *nd)
{
- int i;
+ nullpo_retr(0, nd);
+
if( m < 0 || m >= map_num )
- return -1;
+ return false;
- ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == NULL );
- if( i == MAX_NPC_PER_MAP )
+ if( map[m].npc_num == MAX_NPC_PER_MAP )
{
ShowWarning("too many NPCs in one map %s\n",map[m].name);
- return -1;
+ return false;
}
- nullpo_retr(0, nd);
-
- if( i == map[m].npc_num )
- map[m].npc_num++;
-
- map[m].npc[i]=nd;
- nd->n = i;
+ map[m].npc[map[m].npc_num]=nd;
+ map[m].npc_num++;
idb_put(id_db,nd->bl.id,nd);
-
- return i;
+ return true;
}
/*=========================================