Skip to content

Commit

Permalink
Added config option to keep direction for free cells
Browse files Browse the repository at this point in the history
  • Loading branch information
csnv committed Oct 29, 2023
1 parent a813120 commit 0f7e220
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions conf/map/battle/misc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/map/battle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/map/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/map/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0f7e220

Please sign in to comment.