summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2015-03-15 15:06:21 -0300
committershennetsind <ind@henn.et>2015-03-15 15:06:21 -0300
commitfb5b5c9e6ed9a98f2ab1f388c5a5bc1d398e1ebe (patch)
treee421cafe6ca4ddef67b383cf5c7fa13e8d9c622f
parent179267151817a6794de457068e61b26be4217bd8 (diff)
downloadhercules-fb5b5c9e6ed9a98f2ab1f388c5a5bc1d398e1ebe.tar.gz
hercules-fb5b5c9e6ed9a98f2ab1f388c5a5bc1d398e1ebe.tar.bz2
hercules-fb5b5c9e6ed9a98f2ab1f388c5a5bc1d398e1ebe.tar.xz
hercules-fb5b5c9e6ed9a98f2ab1f388c5a5bc1d398e1ebe.zip
Follow up 8aee60e91807930e4d43965a20c8991b416d7f29
Added a new way to know whether a status has a duration (as the aforementioned commit made the previous method unusable). Special Thanks to Haruna! Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--src/map/status.c10
-rw-r--r--src/map/status.h1
2 files changed, 8 insertions, 3 deletions
diff --git a/src/map/status.c b/src/map/status.c
index c2640c070..3a4db3752 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -9597,14 +9597,18 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
++(sc->count);
sce = sc->data[type] = ers_alloc(status->data_ers, struct status_change_entry);
}
+
sce->val1 = val1;
sce->val2 = val2;
sce->val3 = val3;
sce->val4 = val4;
- if (tick >= 0)
+
+ if (tick >= 0) {
sce->timer = timer->add(timer->gettick() + tick, status->change_timer, bl->id, type);
- else {
+ sce->infinite_duration = false;
+ } else {
sce->timer = INVALID_TIMER; //Infinite duration
+ sce->infinite_duration = true;
if( sd )
chrif->save_scdata_single(sd->status.account_id,sd->status.char_id,type,sce);
}
@@ -9790,7 +9794,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
st = status->get_status_data(bl);
- if( sd && sce->timer == INVALID_TIMER && !sd->state.loggingout )
+ if( sd && sce->infinite_duration && !sd->state.loggingout )
chrif->del_scdata_single(sd->status.account_id,sd->status.char_id,type);
if (tid == INVALID_TIMER) {
diff --git a/src/map/status.h b/src/map/status.h
index f281a4d08..f0624587e 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1868,6 +1868,7 @@ struct sc_display_entry {
struct status_change_entry {
int timer;
int val1,val2,val3,val4;
+ bool infinite_duration;
};
struct status_change {