From 4e681ce12a3f9574c33dc1e11ca8665e8f04e8a0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 21 Feb 2015 17:47:45 +0300 Subject: Extend official_cell_stack_limit option. Now if this option is zero server will not count objects before comparing with official_cell_stack_limit. If set official_cell_stack_limit to zero it will heavy reduce CPU usage. --- src/map/battle.c | 2 +- src/map/mob.c | 2 +- src/map/unit.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/map/battle.c b/src/map/battle.c index d5f523208..f5357f94a 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6725,7 +6725,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, }, diff --git a/src/map/mob.c b/src/map/mob.c index a94650438..8a8e96508 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1311,7 +1311,7 @@ int mob_unlocktarget(struct mob_data *md, int64 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 && 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); } diff --git a/src/map/unit.c b/src/map/unit.c index 6e4efd533..b8e84492b 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -454,7 +454,7 @@ int unit_walktoxy_timer(int tid, int64 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 && 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 -- cgit v1.2.3-70-g09d2 From ad0dfc94fb7cd3c2f4099821b4b49153165a579f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 21 Feb 2015 19:09:58 +0300 Subject: Add battle config option check_occupied_cells. If set check_occupied_cells to 0 it will allow walk to occupied cells And it heavy reduce CPU usage on walking. --- conf/battle/misc.conf | 4 ++++ configure | 2 +- src/map/battle.c | 1 + src/map/battle.h | 1 + src/map/unit.c | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/conf/battle/misc.conf b/conf/battle/misc.conf index b9aaa2356..7d797d2eb 100644 --- a/conf/battle/misc.conf +++ b/conf/battle/misc.conf @@ -90,6 +90,10 @@ duel_only_on_same_map: no official_cell_stack_limit: 1 custom_cell_stack_limit: 1 +// If 0 while walking not check occupied cells +// If 1 while walking check occupied cells +check_occupied_cells: 1 + // Allow autotrade only in map with autotrade flag? // Set this to "no" will allow autotrade where no "autotrade" mapflag is set // Set this to "yes" to only allow autotrade on maps with "autotrade" mapflag diff --git a/configure b/configure index 0283c46f9..6a798c713 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in 35e1da2. +# From configure.in bc3bdec. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # diff --git a/src/map/battle.c b/src/map/battle.c index f5357f94a..b2ee9cf1d 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6728,6 +6728,7 @@ static const struct 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, }, + { "check_occupied_cells", &battle_config.check_occupied_cells, 1, 0, 1, }, // eAthena additions { "item_logarithmic_drops", &battle_config.logarithmic_drops, 0, 0, 1, }, diff --git a/src/map/battle.h b/src/map/battle.h index ddd98ec69..233c325cf 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -384,6 +384,7 @@ struct Battle_Config { int skill_wall_check; // [Skotlex] int official_cell_stack_limit; // [Playtester] int custom_cell_stack_limit; // [Skotlex] + int check_occupied_cells; // [4144] int skill_caster_check; // [Skotlex] int sc_castcancel; // [Skotlex] int pc_sc_def_rate; // [Skotlex] diff --git a/src/map/unit.c b/src/map/unit.c index b8e84492b..2e96e9c20 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -493,7 +493,7 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag) if( ud == NULL) return 0; - if ((flag&8) && !map->closest_freecell(bl->m, &x, &y, BL_CHAR|BL_NPC, 1)) //This might change x and y + if (battle_config.check_occupied_cells && (flag&8) && !map->closest_freecell(bl->m, &x, &y, BL_CHAR|BL_NPC, 1)) //This might change x and y return 0; if (!path->search(&wpd, bl->m, bl->x, bl->y, x, y, flag&1, CELL_CHKNOPASS)) // Count walk path cells -- cgit v1.2.3-70-g09d2