Walkpath loop fix (fixes #198)

- Move requests one cell west will now be ignored if the target cell is occupied
- You can now set official_cell_stack_limit to 0 to completely disable it including the limitation above
This commit is contained in:
Playtester 2015-02-28 15:41:18 +01:00
parent 7d42cf2ba4
commit d4aa4c70a7
5 changed files with 13 additions and 5 deletions

View File

@ -92,6 +92,7 @@ duel_only_on_same_map: no
// Official - Only affects the walking routines of characters, including monsters.
// If a unit stops walking and is on a cell with more than stack limit
// characters on it, it will walk to the closest free cell.
// Set to 0 for no cell stacking checks and free movement.
// Custom - This variation will make every full cell to be considered a wall.
// NOTE: For the custom setting to take effect you have to use a server compiled
// with Cell Stack Limit support (see src/map/map.h)

View File

@ -7704,7 +7704,7 @@ static const struct _battle_data {
{ "bone_drop", &battle_config.bone_drop, 0, 0, 2, },
{ "buyer_name", &battle_config.buyer_name, 1, 0, 1, },
{ "skill_wall_check", &battle_config.skill_wall_check, 1, 0, 1, },
{ "official_cell_stack_limit", &battle_config.official_cell_stack_limit, 1, 1, 255, },
{ "official_cell_stack_limit", &battle_config.official_cell_stack_limit, 1, 0, 255, },
{ "custom_cell_stack_limit", &battle_config.custom_cell_stack_limit, 1, 1, 255, },
{ "dancing_weaponswitch_fix", &battle_config.dancing_weaponswitch_fix, 1, 0, 1, },

View File

@ -10074,6 +10074,13 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd)
if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH])
return;
RFIFOPOS(fd, packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0], &x, &y, NULL);
//A move command one cell west is only valid if the target cell is free
if(battle_config.official_cell_stack_limit > 0
&& sd->bl.x == x+1 && sd->bl.y == y && map_count_oncell(sd->bl.m, x, y, BL_CHAR|BL_NPC, 1))
return;
// Cloaking wall check is actually updated when you click to process next movement
// not when you move each cell. This is official behaviour.
if (sd->sc.data[SC_CLOAKING])
@ -10081,8 +10088,6 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd)
pc_delinvincibletimer(sd);
RFIFOPOS(fd, packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0], &x, &y, NULL);
//Set last idle time... [Skotlex]
if (battle_config.idletime_option&IDLE_WALK)
sd->idletime = last_tick;

View File

@ -1334,7 +1334,8 @@ int mob_unlocktarget(struct mob_data *md, unsigned int tick)
md->ud.target_to = 0;
unit_set_target(&md->ud, 0);
}
if(map_count_oncell(md->bl.m, md->bl.x, md->bl.y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) {
if(battle_config.official_cell_stack_limit > 0
&& map_count_oncell(md->bl.m, md->bl.x, md->bl.y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) {
unit_walktoxy(&md->bl, md->bl.x, md->bl.y, 8);
}

View File

@ -520,7 +520,8 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
ud->to_x = bl->x;
ud->to_y = bl->y;
if(map_count_oncell(bl->m, x, y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) {
if(battle_config.official_cell_stack_limit > 0
&& map_count_oncell(bl->m, x, y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) {
//Walked on occupied cell, call unit_walktoxy again
if(ud->steptimer != INVALID_TIMER) {
//Execute step timer on next step instead