- Changed slave chasing from using unit_walktobl to map_search_freecell + unit_walktoxy, since the previous behaviour makes all slaves always end up on the same cell.

- Changed some function declarations to take x,y arguments as short rather than int.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6024 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-04-13 00:45:55 +00:00
parent 4ad8a11d07
commit 0a5c14f801
8 changed files with 19 additions and 14 deletions

View File

@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/04/12 2006/04/12
* Changed slave chasing from using unit_walktobl to map_search_freecell +
unit_walktoxy, since the previous behaviour makes all slaves always end up
on the same cell. [Skotlex]
* Removed area of effect of Assumptio. [Skotlex] * Removed area of effect of Assumptio. [Skotlex]
* Added "can't act" delay update when an auto-spell triggers. [Skotlex] * Added "can't act" delay update when an auto-spell triggers. [Skotlex]
* Expanded the warp warning so that it also warns when a warps takes you to * Expanded the warp warning so that it also warns when a warps takes you to

View File

@ -1380,7 +1380,7 @@ static int map_count_sub(struct block_list *bl,va_list ap)
* &4 = there shouldn't be any players around the target tile (use the no_spawn_on_player setting) * &4 = there shouldn't be any players around the target tile (use the no_spawn_on_player setting)
*------------------------------------------ *------------------------------------------
*/ */
int map_search_freecell(struct block_list *src, int m, int *x,int *y, int rx, int ry, int flag) { int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx, int ry, int flag) {
int tries, spawn=0; int tries, spawn=0;
int bx, by; int bx, by;
int rx2 = 2*rx+1; int rx2 = 2*rx+1;

View File

@ -1248,7 +1248,7 @@ int map_addobject(struct block_list *);
int map_delobject(int); int map_delobject(int);
int map_delobjectnofree(int id); int map_delobjectnofree(int id);
void map_foreachobject(int (*)(struct block_list*,va_list),int,...); void map_foreachobject(int (*)(struct block_list*,va_list),int,...);
int map_search_freecell(struct block_list *src, int m, int *x,int *y, int rx, int ry, int flag); int map_search_freecell(struct block_list *src, int m, short *x, short *y, int rx, int ry, int flag);
// //
int map_quit(struct map_session_data *); int map_quit(struct map_session_data *);
// npc // npc

View File

@ -256,7 +256,7 @@ int mob_get_random_id(int type, int flag, int lv) {
*------------------------------------------ *------------------------------------------
*/ */
int mob_once_spawn (struct map_session_data *sd, char *mapname, int mob_once_spawn (struct map_session_data *sd, char *mapname,
int x, int y, const char *mobname, int class_, int amount, const char *event) short x, short y, const char *mobname, int class_, int amount, const char *event)
{ {
struct mob_data *md = NULL; struct mob_data *md = NULL;
struct spawn_data data; struct spawn_data data;
@ -633,7 +633,7 @@ int mob_spawn (struct mob_data *md)
if ((md->spawn->x == 0 && md->spawn->y == 0) || md->spawn->xs || md->spawn->ys) if ((md->spawn->x == 0 && md->spawn->y == 0) || md->spawn->xs || md->spawn->ys)
{ //Monster can be spawned on an area. { //Monster can be spawned on an area.
int x, y, xs, ys; short x, y, xs, ys;
if (md->spawn->x == 0 && md->spawn->y == 0) if (md->spawn->x == 0 && md->spawn->y == 0)
xs = ys = -1; xs = ys = -1;
else { else {
@ -917,8 +917,10 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
(md->master_dist>MOB_SLAVEDISTANCE || md->master_dist == 0) && (md->master_dist>MOB_SLAVEDISTANCE || md->master_dist == 0) &&
unit_can_move(&md->bl)) unit_can_move(&md->bl))
{ {
short x = bl->x, y = bl->y;
mob_stop_attack(md); mob_stop_attack(md);
unit_walktobl(&md->bl, bl, MOB_SLAVEDISTANCE, 0); if (map_search_freecell(&md->bl, bl->m, &x, &y, MOB_SLAVEDISTANCE, MOB_SLAVEDISTANCE, 1))
unit_walktoxy(&md->bl, x, y, 0);
} }
} else if (bl->m != md->bl.m && map_flag_gvg(md->bl.m)) { } else if (bl->m != md->bl.m && map_flag_gvg(md->bl.m)) {
//Delete the summoned mob if it's in a gvg ground and the master is elsewhere. [Skotlex] //Delete the summoned mob if it's in a gvg ground and the master is elsewhere. [Skotlex]
@ -2305,7 +2307,7 @@ int mob_warpslave_sub(struct block_list *bl,va_list ap)
{ {
struct mob_data *md=(struct mob_data *)bl; struct mob_data *md=(struct mob_data *)bl;
struct block_list *master; struct block_list *master;
int x,y,range=0; short x,y,range=0;
master = va_arg(ap, struct block_list*); master = va_arg(ap, struct block_list*);
range = va_arg(ap, int); range = va_arg(ap, int);
@ -2388,7 +2390,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id)
amount+=k; //Increase final value by same amount to preserve total number to summon. amount+=k; //Increase final value by same amount to preserve total number to summon.
} }
for(;k<amount;k++) { for(;k<amount;k++) {
int x,y; short x,y;
data.class_ = value[k%count]; //Summon slaves in round-robin fashion. [Skotlex] data.class_ = value[k%count]; //Summon slaves in round-robin fashion. [Skotlex]
if (mobdb_checkid(data.class_) == 0) if (mobdb_checkid(data.class_) == 0)
continue; continue;
@ -2667,7 +2669,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
{ {
// <20>ê<EFBFBD>ŠŽwè // <20>ê<EFBFBD>ŠŽwè
struct block_list *bl = NULL; struct block_list *bl = NULL;
int x = 0, y = 0; short x = 0, y = 0;
if (ms[i].target <= MST_AROUND) { if (ms[i].target <= MST_AROUND) {
switch (ms[i].target) { switch (ms[i].target) {
case MST_TARGET: case MST_TARGET:

View File

@ -114,7 +114,7 @@ int mobdb_searchname_array(struct mob_db** data, int size, const char *str);
int mobdb_checkid(const int id); int mobdb_checkid(const int id);
struct view_data* mob_get_viewdata(int class_); struct view_data* mob_get_viewdata(int class_);
int mob_once_spawn(struct map_session_data *sd,char *mapname, int mob_once_spawn(struct map_session_data *sd,char *mapname,
int x,int y,const char *mobname,int class_,int amount,const char *event); short x,short y,const char *mobname,int class_,int amount,const char *event);
int mob_once_spawn_area(struct map_session_data *sd,char *mapname, int mob_once_spawn_area(struct map_session_data *sd,char *mapname,
int x0,int y0,int x1,int y1, int x0,int y0,int x1,int y1,
const char *mobname,int class_,int amount,const char *event); const char *mobname,int class_,int amount,const char *event);

View File

@ -2349,7 +2349,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id,int data )
switch(skl->skill_id) { switch(skl->skill_id) {
case RG_INTIMIDATE: case RG_INTIMIDATE:
if (unit_warp(src,-1,-1,-1,3) == 0) { if (unit_warp(src,-1,-1,-1,3) == 0) {
int x,y; short x,y;
map_search_freecell(src, 0, &x, &y, 1, 1, 0); map_search_freecell(src, 0, &x, &y, 1, 1, 0);
if (!status_isdead(target)) if (!status_isdead(target))
unit_warp(target, -1, x, y, 3); unit_warp(target, -1, x, y, 3);
@ -6003,7 +6003,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
case WZ_METEOR: //ƒ?ƒeƒIƒXƒg?ƒ€ case WZ_METEOR: //ƒ?ƒeƒIƒXƒg?ƒ€
{ {
int flag=0, area = skill_get_splash(skillid, skilllv); int flag=0, area = skill_get_splash(skillid, skilllv);
int tmpx, tmpy, x1 = 0, y1 = 0; short tmpx, tmpy, x1 = 0, y1 = 0;
if (sc && sc->data[SC_MAGICPOWER].timer != -1) if (sc && sc->data[SC_MAGICPOWER].timer != -1)
flag = flag|2; //Store the magic power flag for future use. [Skotlex] flag = flag|2; //Store the magic power flag for future use. [Skotlex]
for(i=0;i<2+(skilllv>>1);i++) { for(i=0;i<2+(skilllv>>1);i++) {

View File

@ -423,7 +423,7 @@ int unit_getdir(struct block_list *bl)
//Warps a unit/ud to a given map/position. //Warps a unit/ud to a given map/position.
//In the case of players, pc_setpos is used. //In the case of players, pc_setpos is used.
//it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks. //it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks.
int unit_warp(struct block_list *bl,int m,int x,int y,int type) int unit_warp(struct block_list *bl,int m,short x,short y,int type)
{ {
struct unit_data *ud; struct unit_data *ud;
nullpo_retr(0, bl); nullpo_retr(0, bl);

View File

@ -25,7 +25,7 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int
// 位置の強制移動(吹き飛ばしなど) // 位置の強制移動(吹き飛ばしなど)
int unit_movepos(struct block_list *bl,int dst_x,int dst_y, int easy, int checkpath); int unit_movepos(struct block_list *bl,int dst_x,int dst_y, int easy, int checkpath);
int unit_warp(struct block_list *bl, int map, int x, int y, int type); int unit_warp(struct block_list *bl, int map, short x, short y, int type);
int unit_setdir(struct block_list *bl,unsigned char dir); int unit_setdir(struct block_list *bl,unsigned char dir);
int unit_getdir(struct block_list *bl); int unit_getdir(struct block_list *bl);