Compare commits
6 Commits
master
...
hotfix/iss
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5083913e0c | ||
![]() |
2f557bbbb1 | ||
![]() |
fad4a81c6d | ||
![]() |
aedb38771a | ||
![]() |
e1a8f0b7ef | ||
![]() |
80a6932658 |
@ -14776,7 +14776,7 @@ void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd){
|
||||
else
|
||||
return;
|
||||
|
||||
unit_calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir);
|
||||
unit_calc_pos(bl, sd->bl.x, sd->bl.y);
|
||||
ud = unit_bl2ud(bl);
|
||||
unit_walktoxy(bl, ud->to_x, ud->to_y, 4);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ int elemental_data_received(struct s_elemental *ele, bool flag) {
|
||||
ed->bl.m = sd->bl.m;
|
||||
ed->bl.x = sd->bl.x;
|
||||
ed->bl.y = sd->bl.y;
|
||||
unit_calc_pos(&ed->bl, sd->bl.x, sd->bl.y, sd->ud.dir);
|
||||
unit_calc_pos(&ed->bl, sd->bl.x, sd->bl.y);
|
||||
ed->bl.x = ed->ud.to_x;
|
||||
ed->bl.y = ed->ud.to_y;
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ void hom_alloc(struct map_session_data *sd, struct s_homunculus *hom)
|
||||
hd->bl.m = sd->bl.m;
|
||||
hd->bl.x = sd->bl.x;
|
||||
hd->bl.y = sd->bl.y;
|
||||
unit_calc_pos(&hd->bl, sd->bl.x, sd->bl.y, sd->ud.dir);
|
||||
unit_calc_pos(&hd->bl, sd->bl.x, sd->bl.y);
|
||||
hd->bl.x = hd->ud.to_x;
|
||||
hd->bl.y = hd->ud.to_y;
|
||||
|
||||
|
@ -385,7 +385,7 @@ bool mercenary_recv_data(struct s_mercenary *merc, bool flag)
|
||||
md->bl.m = sd->bl.m;
|
||||
md->bl.x = sd->bl.x;
|
||||
md->bl.y = sd->bl.y;
|
||||
unit_calc_pos(&md->bl, sd->bl.x, sd->bl.y, sd->ud.dir);
|
||||
unit_calc_pos(&md->bl, sd->bl.x, sd->bl.y);
|
||||
md->bl.x = md->ud.to_x;
|
||||
md->bl.y = md->ud.to_y;
|
||||
|
||||
|
@ -461,7 +461,7 @@ bool pet_data_init(struct map_session_data *sd, struct s_pet *pet)
|
||||
pd->bl.m = sd->bl.m;
|
||||
pd->bl.x = sd->bl.x;
|
||||
pd->bl.y = sd->bl.y;
|
||||
unit_calc_pos(&pd->bl, sd->bl.x, sd->bl.y, sd->ud.dir);
|
||||
unit_calc_pos(&pd->bl, sd->bl.x, sd->bl.y);
|
||||
pd->bl.x = pd->ud.to_x;
|
||||
pd->bl.y = pd->ud.to_y;
|
||||
|
||||
@ -1175,7 +1175,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
|
||||
if(pd->ud.walktimer != INVALID_TIMER && check_distance_blxy(&sd->bl, pd->ud.to_x,pd->ud.to_y, 3))
|
||||
return 0; // Already walking to him
|
||||
|
||||
unit_calc_pos(&pd->bl, sd->bl.x, sd->bl.y, sd->ud.dir);
|
||||
unit_calc_pos(&pd->bl, sd->bl.x, sd->bl.y);
|
||||
|
||||
if(!unit_walktoxy(&pd->bl,pd->ud.to_x,pd->ud.to_y,0))
|
||||
pet_randomwalk(pd,tick);
|
||||
|
@ -2436,80 +2436,26 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range,
|
||||
* @param bl: Object to calculate position
|
||||
* @param tx: X coordinate to go to
|
||||
* @param ty: Y coordinate to go to
|
||||
* @param dir: Direction which to be 2 cells from master's position
|
||||
* @return Success(0); Fail(1);
|
||||
*/
|
||||
int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir)
|
||||
int unit_calc_pos(struct block_list *bl, int tx, int ty)
|
||||
{
|
||||
int dx, dy, x, y;
|
||||
struct unit_data *ud = unit_bl2ud(bl);
|
||||
|
||||
nullpo_ret(ud);
|
||||
|
||||
if(dir > 7)
|
||||
return 1;
|
||||
|
||||
ud->to_x = tx;
|
||||
ud->to_y = ty;
|
||||
|
||||
// 2 cells from Master Position
|
||||
dx = -dirx[dir] * 2;
|
||||
dy = -diry[dir] * 2;
|
||||
x = tx + dx;
|
||||
y = ty + dy;
|
||||
map_search_freecell(bl, bl->m, &ud->to_x, &ud->to_y, 3, 3, 1|2);
|
||||
|
||||
if( !unit_can_reach_pos(bl, x, y, 0) ) {
|
||||
if( dx > 0 )
|
||||
x--;
|
||||
else if( dx < 0 )
|
||||
x++;
|
||||
if (!unit_can_reach_pos(bl, ud->to_x, ud->to_y, 0)) { // Attempt once more
|
||||
map_search_freecell(bl, bl->m, &ud->to_x, &ud->to_y, 3, 3, 1|2);
|
||||
|
||||
if( dy > 0 )
|
||||
y--;
|
||||
else if( dy < 0 )
|
||||
y++;
|
||||
|
||||
if( !unit_can_reach_pos(bl, x, y, 0) ) {
|
||||
int i;
|
||||
|
||||
for( i = 0; i < 12; i++ ) {
|
||||
int k = rnd()%8; // Pick a Random Dir
|
||||
|
||||
dx = -dirx[k] * 2;
|
||||
dy = -diry[k] * 2;
|
||||
x = tx + dx;
|
||||
y = ty + dy;
|
||||
|
||||
if( unit_can_reach_pos(bl, x, y, 0) )
|
||||
break;
|
||||
else {
|
||||
if( dx > 0 )
|
||||
x--;
|
||||
else if( dx < 0 )
|
||||
x++;
|
||||
|
||||
if( dy > 0 )
|
||||
y--;
|
||||
else if( dy < 0 )
|
||||
y++;
|
||||
|
||||
if( unit_can_reach_pos(bl, x, y, 0) )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( i == 12 ) {
|
||||
x = tx; y = tx; // Exactly Master Position
|
||||
|
||||
if( !unit_can_reach_pos(bl, x, y, 0) )
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (!unit_can_reach_pos(bl, ud->to_x, ud->to_y, 0))
|
||||
return 1;
|
||||
}
|
||||
|
||||
ud->to_x = x;
|
||||
ud->to_y = y;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ int unit_walktoxy(struct block_list *bl, short x, short y, unsigned char flag);
|
||||
int unit_walktobl(struct block_list *bl, struct block_list *target, int range, unsigned char flag);
|
||||
void unit_run_hit(struct block_list *bl, struct status_change *sc, struct map_session_data *sd, enum sc_type type);
|
||||
bool unit_run(struct block_list *bl, struct map_session_data *sd, enum sc_type type);
|
||||
int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir);
|
||||
int unit_calc_pos(struct block_list *bl, int tx, int ty);
|
||||
TIMER_FUNC(unit_delay_walktoxy_timer);
|
||||
TIMER_FUNC(unit_delay_walktobl_timer);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user