From 0f7e220d28570ad1541988996f41e23cdd056824 Mon Sep 17 00:00:00 2001 From: csnv Date: Sun, 29 Oct 2023 13:56:35 +0100 Subject: [PATCH] Added config option to keep direction for free cells --- conf/map/battle/misc.conf | 6 ++++++ src/map/battle.c | 1 + src/map/battle.h | 1 + src/map/map.c | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conf/map/battle/misc.conf b/conf/map/battle/misc.conf index c103b510e25..6255dd2de72 100644 --- a/conf/map/battle/misc.conf +++ b/conf/map/battle/misc.conf @@ -117,6 +117,12 @@ duel_only_on_same_map: false official_cell_stack_limit: 1 custom_cell_stack_limit: 1 +// Take into consideration the character's walking direction when searching for free cells? +// Set this to "true" to start searching for free cells in the same direction as the character came from +// Set this to "false" to always start searching from EAST (official behavior) +// Note: This setting also makes groups of mobs disperse in circular fashion instead of linear +keep_dir_free_cell: false + // Check occupied cells while walking? (Note 1) check_occupied_cells: true diff --git a/src/map/battle.c b/src/map/battle.c index cdf3dee4938..7c601aafa9e 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7573,6 +7573,7 @@ static const struct config_data_old battle_data[] = { { "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, }, + { "keep_dir_free_cell", &battle_config.keep_dir_free_cell, 0, 0, 1, }, { "check_occupied_cells", &battle_config.check_occupied_cells, 1, 0, 1, }, // eAthena additions diff --git a/src/map/battle.h b/src/map/battle.h index 5f5aba80c60..5dd1259e2f5 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -359,6 +359,7 @@ struct Battle_Config { int bone_drop; int buyer_name; int dancing_weaponswitch_fix; + int keep_dir_free_cell; // eAthena additions int night_at_start; // added by [Yor] diff --git a/src/map/map.c b/src/map/map.c index b60a7db09ee..292b25e33d0 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1749,7 +1749,7 @@ static int map_search_free_cell(struct block_list *src, int16 m, int16 *x, int16 *------------------------------------------*/ static bool map_closest_freecell(int16 m, const struct block_list *bl, int16 *x, int16 *y, int type, int flag) { - enum unit_dir dir = UNIT_DIR_EAST; + enum unit_dir dir = battle_config.keep_dir_free_cell ? unit->getdir(bl) : UNIT_DIR_EAST; int16 tx; int16 ty; int costrange = 10;