summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-23 12:23:23 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-23 12:23:23 +0000
commit2e3d951c7a966dca662c34dd6c1d5bd4a4a83984 (patch)
treecff02a7ddb0a34b670dc5e6de4f907f0de1cf9b3 /src/map
parent234baaab74a89d8b99f421130c7bb263e6f3832d (diff)
downloadhercules-2e3d951c7a966dca662c34dd6c1d5bd4a4a83984.tar.gz
hercules-2e3d951c7a966dca662c34dd6c1d5bd4a4a83984.tar.bz2
hercules-2e3d951c7a966dca662c34dd6c1d5bd4a4a83984.tar.xz
hercules-2e3d951c7a966dca662c34dd6c1d5bd4a4a83984.zip
really minor performance improvement on skill_check_condition_castbegin vs a player mounted on a wug, so that it doesn't unnecessarily allocate skill_get_requirement stuff when you won't be able to use the skill at all due to wug riding restrictions
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15945 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/skill.c51
1 files changed, 24 insertions, 27 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index d4a2f4c8c..3eea211ca 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -7708,8 +7708,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case RA_WUGMASTERY:
- if( sd )
- {
+ if( sd ) {
if( !pc_iswug(sd) )
pc_setoption(sd,sd->sc.option|OPTION_WUG);
else
@@ -11611,15 +11610,14 @@ int skill_isammotype (struct map_session_data *sd, int skill)
);
}
-int skill_check_condition_castbegin(struct map_session_data* sd, short skill, short lv)
-{
+int skill_check_condition_castbegin(struct map_session_data* sd, short skill, short lv) {
struct status_data *status;
struct status_change *sc;
struct skill_condition require;
int i;
nullpo_ret(sd);
-
+
if (lv <= 0 || sd->chatID) return 0;
if( pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill )
@@ -11689,16 +11687,29 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh
if( sc && ( sc->data[SC__SHADOWFORM] || sc->data[SC__IGNORANCE] ) )
return 0;
- switch( skill )
- { // Turn off check.
- case BS_MAXIMIZE: case NV_TRICKDEAD: case TF_HIDING: case AS_CLOAKING: case CR_AUTOGUARD:
- case ML_AUTOGUARD: case CR_DEFENDER: case ML_DEFENDER: case ST_CHASEWALK: case PA_GOSPEL:
- case CR_SHRINK: case TK_RUN: case GS_GATLINGFEVER: case TK_READYCOUNTER: case TK_READYDOWN:
- case TK_READYSTORM: case TK_READYTURN: case SG_FUSION: case RA_WUGDASH:
- if( sc && sc->data[status_skill2sc(skill)] )
- return 1;
+ switch( skill ) { // Turn off check.
+ case BS_MAXIMIZE: case NV_TRICKDEAD: case TF_HIDING: case AS_CLOAKING: case CR_AUTOGUARD:
+ case ML_AUTOGUARD: case CR_DEFENDER: case ML_DEFENDER: case ST_CHASEWALK: case PA_GOSPEL:
+ case CR_SHRINK: case TK_RUN: case GS_GATLINGFEVER: case TK_READYCOUNTER: case TK_READYDOWN:
+ case TK_READYSTORM: case TK_READYTURN: case SG_FUSION: case RA_WUGDASH:
+ if( sc && sc->data[status_skill2sc(skill)] )
+ return 1;
}
+ // Check the skills that can be used while mounted on a warg
+ if( pc_isridingwug(sd) ) {
+ switch( skill ) {
+ case HT_SKIDTRAP: case HT_LANDMINE: case HT_ANKLESNARE: case HT_SHOCKWAVE:
+ case HT_SANDMAN: case HT_FLASHER: case HT_FREEZINGTRAP: case HT_BLASTMINE:
+ case HT_CLAYMORETRAP: case HT_SPRINGTRAP: case RA_DETONATOR: case RA_CLUSTERBOMB:
+ case RA_WUGDASH: case RA_WUGRIDER:
+ break;
+ default:
+ clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0);
+ return 0;
+ }
+ }
+
if( lv < 1 || lv > MAX_SKILL_LEVEL )
return 0;
@@ -11706,20 +11717,6 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh
//Can only update state when weapon/arrow info is checked.
sd->state.arrow_atk = require.ammo?1:0;
-
- // Check the skills that can be used while mounted on a warg
- if( pc_isridingwug(sd) ) {
- switch( skill ) {
- case HT_SKIDTRAP: case HT_LANDMINE: case HT_ANKLESNARE: case HT_SHOCKWAVE:
- case HT_SANDMAN: case HT_FLASHER: case HT_FREEZINGTRAP: case HT_BLASTMINE:
- case HT_CLAYMORETRAP: case HT_SPRINGTRAP: case RA_DETONATOR: case RA_CLUSTERBOMB:
- case RA_WUGDASH: case RA_WUGRIDER:
- break;
- default:
- clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0);
- return 0;
- }
- }
// perform skill-specific checks (and actions)
switch( skill ) {