From 43fe20d3fa5793b185d5f399c5c48075d4d6f842 Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 23 Jun 2006 15:41:17 +0000 Subject: - Updated BD_INTOABYSS's unit flag to not affect mobs. - Changed setting for skill_nocast flag 16. It is no longer a "pk-mode map" setting, it's now a clone-forbidden skill. That is, skills with the flag 16 will never be copied by clones. If you use a PK-mode server, use flag 2 now to forbid skills from common maps. - Default skills from not being cloned are Magnus Exorcism and Turn Undead. - The map search free cell will now use the size of the map # of tries before giving up when the spawn area is the whole map. Added a check to inmediately give up when the number of spawn retries has reached the max specified (no_spawn_onplayer = 100). - Cleaned up a bit the clone code to account for the unit flags UF_NOPC/UF_NOMOB when the skill is not ground-based (accounts for self skill that causes a ground-tile to be placed, like Dances). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7315 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/map/map.c') diff --git a/src/map/map.c b/src/map/map.c index 0aa48b914..e24a4ba7f 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1484,8 +1484,10 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx if (rx >= 0 && ry >= 0) { tries = rx2*ry2; if (tries > 100) tries = 100; - } else - tries = 1000; //Must retry a lot for maps with many non-walkable tiles. + } else { + tries = map[m].xs*map[m].ys; + if (tries > 500) tries = 500; + } while(tries--) { *x = (rx >= 0)?(rand()%rx2-rx+bx):(rand()%(map[m].xs-2)+1); @@ -1498,12 +1500,15 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx { if(flag&2 && !unit_can_reach_pos(src, *x, *y, 1)) continue; - if(flag&4 && spawn++ < battle_config.no_spawn_on_player && - map_foreachinarea(map_count_sub, m, - *x-AREA_SIZE, *y-AREA_SIZE, *x+AREA_SIZE, *y+AREA_SIZE, BL_PC) - ) + if(flag&4) { + if (spawn >= 100) return 0; //Limit of retries reached. + if (spawn++ < battle_config.no_spawn_on_player && + map_foreachinarea(map_count_sub, m, + *x-AREA_SIZE, *y-AREA_SIZE, + *x+AREA_SIZE, *y+AREA_SIZE, BL_PC) + ) continue; - + } return 1; } } -- cgit v1.2.3-60-g2f50