diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-07 00:07:47 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-07 00:07:47 +0000 |
commit | 1c388b20fe58a62b05aa7364def81f196a9d1146 (patch) | |
tree | 12aaa4d0ae4d9ce5838bbc6eb5916f477a9e0d33 /src/map/map.c | |
parent | 666e165062c189847ee654e8ac22d98075f75fe5 (diff) | |
download | hercules-1c388b20fe58a62b05aa7364def81f196a9d1146.tar.gz hercules-1c388b20fe58a62b05aa7364def81f196a9d1146.tar.bz2 hercules-1c388b20fe58a62b05aa7364def81f196a9d1146.tar.xz hercules-1c388b20fe58a62b05aa7364def81f196a9d1146.zip |
- Fixed Freezing Trap doing no damage (changed type from misc to weapon)
- Changed suiton's element to water (apparently fixes not being able to use water-based skills on it)
- Fixed Landmine doing no damage (decreased trigger range to 0 to match its splash range)
- Fixed the disguise commands using the wrong variable when attempting to disguise as an npc.
- Fixed a compilation warning on CELL_CHKNODAMAGE (which is a totally bad-ripoff of basilica cells anyway)
- Corrected and optimized npc_remove_map's npc array cleanup (@reloadscripts no longer report 'too many npcs per map and related dangling pointer crashes are fixed)
- Removed suspicious, yet totally unused npc_data variable 'n'
- HP loss item scripts can no longer kill you.
- Corrected the item-drop-rate check to avoid duplicate entries in @whodrops after a @reloadmobdb
- Cleaned up and optimized map_addnpc (there are never any gaps in the npc array so npc_num always points to the last valid entry)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12180 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 24 |
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; } /*========================================= |