summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-06-01 23:01:40 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-06-01 23:01:40 +0000
commit0c6160d8de14fc9a5255309d12ef9fa33f6425a5 (patch)
treea4fce895d1c5490e2c3e3db8c3cefe2fe82afc5e /src
parent67a0736c51678e453497660ef7df7bd601e57101 (diff)
downloadhercules-0c6160d8de14fc9a5255309d12ef9fa33f6425a5.tar.gz
hercules-0c6160d8de14fc9a5255309d12ef9fa33f6425a5.tar.bz2
hercules-0c6160d8de14fc9a5255309d12ef9fa33f6425a5.tar.xz
hercules-0c6160d8de14fc9a5255309d12ef9fa33f6425a5.zip
Follow up r16209 moving on; yet another performance improvement. added 3 other states for the system to speed up. modified the scs_flag to be accurate (with one conditional flag they could stack and give undesired results e.g. with cloacking)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16210 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c15
-rw-r--r--src/map/status.c96
-rw-r--r--src/map/status.h13
3 files changed, 87 insertions, 37 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 7d508eb21..f5066551a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10010,18 +10010,11 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd)
if (fitem == NULL || fitem->bl.type != BL_ITEM || fitem->bl.m != sd->bl.m)
break;
-
- if (pc_cant_act(sd))
- break;
- if(sd->sc.count && (
- sd->sc.data[SC_HIDING] ||
- sd->sc.data[SC_CLOAKING] ||
- sd->sc.data[SC_TRICKDEAD] ||
- sd->sc.data[SC_BLADESTOP] ||
- sd->sc.data[SC_CLOAKINGEXCEED] ||
- (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOITEM))
- )
+ if( sd->sc.cant.pickup )
+ break;
+
+ if (pc_cant_act(sd))
break;
if (!pc_takeitem(sd, fitem))
diff --git a/src/map/status.c b/src/map/status.c
index 91cb23df7..21d2621d6 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -947,16 +947,16 @@ void initChangeTables(void) {
StatusChangeStateTable[SC_TRICKDEAD] |= SCS_NOMOVE;
StatusChangeStateTable[SC_BLADESTOP] |= SCS_NOMOVE;
StatusChangeStateTable[SC_BLADESTOP_WAIT] |= SCS_NOMOVE;
- StatusChangeStateTable[SC_SPIDERWEB] |= SCS_NOMOVE|SCS_CONDITION;
- StatusChangeStateTable[SC_DANCING] |= SCS_NOMOVE|SCS_CONDITION;
- StatusChangeStateTable[SC_GOSPEL] |= SCS_NOMOVE|SCS_CONDITION;
- StatusChangeStateTable[SC_BASILICA] |= SCS_NOMOVE|SCS_CONDITION;
+ StatusChangeStateTable[SC_SPIDERWEB] |= SCS_NOMOVE|SCS_NOMOVECOND;
+ StatusChangeStateTable[SC_DANCING] |= SCS_NOMOVE|SCS_NOMOVECOND;
+ StatusChangeStateTable[SC_GOSPEL] |= SCS_NOMOVE|SCS_NOMOVECOND;
+ StatusChangeStateTable[SC_BASILICA] |= SCS_NOMOVE|SCS_NOMOVECOND;
StatusChangeStateTable[SC_STOP] |= SCS_NOMOVE;
StatusChangeStateTable[SC_CLOSECONFINE] |= SCS_NOMOVE;
StatusChangeStateTable[SC_CLOSECONFINE2] |= SCS_NOMOVE;
- StatusChangeStateTable[SC_CLOAKING] |= SCS_NOMOVE|SCS_CONDITION;
+ StatusChangeStateTable[SC_CLOAKING] |= SCS_NOMOVE|SCS_NOMOVECOND;
StatusChangeStateTable[SC_MADNESSCANCEL] |= SCS_NOMOVE;
- StatusChangeStateTable[SC_GRAVITATION] |= SCS_NOMOVE|SCS_CONDITION;
+ StatusChangeStateTable[SC_GRAVITATION] |= SCS_NOMOVE|SCS_NOMOVECOND;
StatusChangeStateTable[SC_WHITEIMPRISON] |= SCS_NOMOVE;
StatusChangeStateTable[SC_ELECTRICSHOCKER] |= SCS_NOMOVE;
StatusChangeStateTable[SC_BITE] |= SCS_NOMOVE;
@@ -964,9 +964,37 @@ void initChangeTables(void) {
StatusChangeStateTable[SC_MAGNETICFIELD] |= SCS_NOMOVE;
StatusChangeStateTable[SC__MANHOLE] |= SCS_NOMOVE;
StatusChangeStateTable[SC_VACUUM_EXTREME] |= SCS_NOMOVE;
- StatusChangeStateTable[SC_FEAR] |= SCS_NOMOVE|SCS_CONDITION;
+ StatusChangeStateTable[SC_FEAR] |= SCS_NOMOVE|SCS_NOMOVECOND;
StatusChangeStateTable[SC_CURSEDCIRCLE_ATKER] |= SCS_NOMOVE;
StatusChangeStateTable[SC_CURSEDCIRCLE_TARGET] |= SCS_NOMOVE;
+
+ /* StatusChangeState (SCS_) NOPICKUPITEMS */
+ StatusChangeStateTable[SC_HIDING] |= SCS_NOPICKITEM;
+ StatusChangeStateTable[SC_CLOAKING] |= SCS_NOPICKITEM;
+ StatusChangeStateTable[SC_TRICKDEAD] |= SCS_NOPICKITEM;
+ StatusChangeStateTable[SC_BLADESTOP] |= SCS_NOPICKITEM;
+ StatusChangeStateTable[SC_CLOAKINGEXCEED] |= SCS_NOPICKITEM;
+ StatusChangeStateTable[SC_NOCHAT] |= SCS_NOPICKITEM|SCS_NOPICKITEMCOND;
+
+ /* StatusChangeState (SCS_) NODROPITEMS */
+ StatusChangeStateTable[SC_AUTOCOUNTER] |= SCS_NODROPITEM;
+ StatusChangeStateTable[SC_BLADESTOP] |= SCS_NODROPITEM;
+ StatusChangeStateTable[SC_NOCHAT] |= SCS_NODROPITEM|SCS_NODROPITEMCOND;
+
+ /* StatusChangeState (SCS_) NOCAST (skills) */
+ StatusChangeStateTable[SC_SILENCE] |= SCS_NOCAST;
+ StatusChangeStateTable[SC_STEELBODY] |= SCS_NOCAST;
+ StatusChangeStateTable[SC_BERSERK] |= SCS_NOCAST;
+ StatusChangeStateTable[SC_OBLIVIONCURSE] |= SCS_NOCAST;
+ StatusChangeStateTable[SC_WHITEIMPRISON] |= SCS_NOCAST;
+ StatusChangeStateTable[SC__INVISIBILITY] |= SCS_NOCAST;
+ StatusChangeStateTable[SC_CRYSTALIZE] |= SCS_NOCAST;
+ StatusChangeStateTable[SC__IGNORANCE] |= SCS_NOCAST;
+ StatusChangeStateTable[SC_DEEPSLEEP] |= SCS_NOCAST;
+ StatusChangeStateTable[SC_SATURDAYNIGHTFEVER] |= SCS_NOCAST;
+ StatusChangeStateTable[SC_CURSEDCIRCLE_TARGET] |= SCS_NOCAST;
+ StatusChangeStateTable[SC_SILENCE] |= SCS_NOCAST;
+
}
static void initDummyData(void)
@@ -1553,20 +1581,10 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int
(src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_num)
) { //Skills blocked through status changes...
if (!flag && ( //Blocked only from using the skill (stuff like autospell may still go through
- sc->data[SC_SILENCE] ||
+ sc->cant.cast ||
(sc->data[SC_MARIONETTE] && skill_num != CG_MARIONETTE) || //Only skill you can use is marionette again to cancel it
(sc->data[SC_MARIONETTE2] && skill_num == CG_MARIONETTE) || //Cannot use marionette if you are being buffed by another
- sc->data[SC_STEELBODY] ||
- sc->data[SC_BERSERK] ||
- sc->data[SC_OBLIVIONCURSE] ||
- sc->data[SC_WHITEIMPRISON] ||
- (sc->data[SC_STASIS] && skill_stasis_check(src, sc->data[SC_STASIS]->val2, skill_num)) ||
- sc->data[SC__INVISIBILITY] ||
- sc->data[SC_CRYSTALIZE] ||
- sc->data[SC__IGNORANCE] || // Target afflicted with this debuff cannot use skills or magic.
- sc->data[SC_DEEPSLEEP] ||
- sc->data[SC_SATURDAYNIGHTFEVER] ||
- sc->data[SC_CURSEDCIRCLE_TARGET]
+ (sc->data[SC_STASIS] && skill_stasis_check(src, sc->data[SC_STASIS]->val2, skill_num))
))
return 0;
@@ -3382,7 +3400,6 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str
}
}
void status_calc_state( struct block_list *bl, struct status_change *sc, enum scs_flag flag, bool start ) {
- bool has_condition = ( flag&SCS_CONDITION ) ? true : false;
/* no sc at all, we can zero without any extra weight over our conciousness */
if( !sc->count ) {
@@ -3390,9 +3407,9 @@ void status_calc_state( struct block_list *bl, struct status_change *sc, enum sc
return;
}
-
+ /* can move? */
if( flag&SCS_NOMOVE ) {
- if( !has_condition ) {
+ if( !(flag&SCS_NOMOVECOND) ) {
sc->cant.move += ( start ? 1 : -1 );
} else if(
(sc->data[SC_SPIDERWEB] && sc->data[SC_SPIDERWEB]->val1)
@@ -3412,7 +3429,37 @@ void status_calc_state( struct block_list *bl, struct status_change *sc, enum sc
}
}
- /* others e.g. cant.cast, cant.pickup (check clif_parse_TakeItem) */
+ /* can't use skills */
+ if( flag&SCS_NOCAST ) {
+ if( !(flag&SCS_NOCASTCOND) ) {
+ sc->cant.cast += ( start ? 1 : -1 );
+ } else {
+ /* to date there are usable conditions on nocast sclist */
+ sc->cant.cast += ( start ? 1 : -1 );
+ }
+ }
+
+ /* player-only states */
+ if( bl->type == BL_PC ) {
+
+ /* can pick items? */
+ if( flag&SCS_NOPICKITEM ) {
+ if( !(flag&SCS_NOPICKITEMCOND) ) {
+ sc->cant.pickup += ( start ? 1 : -1 );
+ } else if( (sc->data[SC_NOCHAT] && sc->data[SC_NOCHAT]->val1&MANNER_NOITEM) ) {
+ sc->cant.pickup += ( start ? 1 : -1 );
+ }
+ }
+
+ /* can drop items? */
+ if( flag&SCS_NODROPITEM ) {
+ if( !(flag&SCS_NODROPITEMCOND) ) {
+ sc->cant.drop += ( start ? 1 : -1 );
+ } else if( (sc->data[SC_NOCHAT] && sc->data[SC_NOCHAT]->val1&MANNER_NOITEM) ) {
+ sc->cant.drop += ( start ? 1 : -1 );
+ }
+ }
+ }
return;
}
@@ -8484,11 +8531,12 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
}
}
+ (sc->count)--;
+
if ( StatusChangeStateTable[type] )
status_calc_state(bl,sc,( enum scs_flag ) StatusChangeStateTable[type],false);
sc->data[type] = NULL;
- (sc->count)--;
vd = status_get_viewdata(bl);
calc_flag = StatusChangeFlagTable[type];
diff --git a/src/map/status.h b/src/map/status.h
index 5b6c2296a..5e52b572c 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1410,8 +1410,14 @@ enum manner_flags
/* Status Change State Flags */
enum scs_flag {
- SCS_CONDITION = 0x00000001, /* this implies the flag has a condition (if-checkin) */
- SCS_NOMOVE = 0x00000002, /* unit unable to move */
+ SCS_NOMOVECOND = 0x00000001, /* cond flag for nomove */
+ SCS_NOMOVE = 0x00000002, /* unit unable to move */
+ SCS_NOPICKITEMCOND = 0x00000004, /* cond flag for nopickitem */
+ SCS_NOPICKITEM = 0x00000008, /* player unable to pick up items */
+ SCS_NODROPITEMCOND = 0x00000010, /* cond flag for nodropitem */
+ SCS_NODROPITEM = 0x00000020, /* player unable to drop items */
+ SCS_NOCASTCOND = 0x00000040, /* cond flag for nocast */
+ SCS_NOCAST = 0x00000080, /* unit unable to cast skills */
};
//Define flags for the status_calc_bl function. [Skotlex]
@@ -1564,6 +1570,9 @@ struct status_change {
unsigned char jb_flag; //Joint Beat type flag
struct {
unsigned char move;
+ unsigned char pickup;
+ unsigned char drop;
+ unsigned char cast;
} cant;/* status change state flags */
//int sg_id; //ID of the previous Storm gust that hit you
short comet_x, comet_y; // Point where src casted Comet - required to calculate damage from this point