From 848e73703eeb15c650aee38eef46714d3863474f Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Tue, 21 Apr 2020 02:30:39 +0200 Subject: Introduce auto-cast vector --- src/map/pc.c | 3 +++ src/map/pc.h | 1 + src/map/unit.c | 2 ++ 3 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/map/pc.c b/src/map/pc.c index 5faadf76a..411727c51 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1279,6 +1279,7 @@ static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expirat sd->bg_queue.client_has_bg_data = 0; sd->bg_queue.type = 0; + VECTOR_INIT(sd->auto_cast); // Initialize auto-cast vector. VECTOR_INIT(sd->channels); VECTOR_INIT(sd->script_queues); VECTOR_INIT(sd->achievement); // Achievements [Smokexyz/Hercules] @@ -5350,6 +5351,8 @@ static int pc_autocast_clear(struct map_session_data *sd) sd->autocast.itemskill_instant_cast = false; sd->autocast.itemskill_cast_on_self = false; + VECTOR_TRUNCATE(sd->auto_cast); // Truncate auto-cast vector. + return 1; } diff --git a/src/map/pc.h b/src/map/pc.h index e560df549..32b7197a8 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -193,6 +193,7 @@ struct map_session_data { struct regen_data regen; struct regen_data_sub sregen, ssregen; struct autocast_data autocast; + VECTOR_DECL(struct autocast_data) auto_cast; // Auto-cast vector. //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in //status_calc_pc, while special_state is recalculated in each call. [Skotlex] struct { diff --git a/src/map/unit.c b/src/map/unit.c index 19f09f83c..8bf0f2ce4 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2889,6 +2889,8 @@ static int unit_free(struct block_list *bl, enum clr_type clrtype) aFree(sd->instance); sd->instance = NULL; } + + VECTOR_CLEAR(sd->auto_cast); // Clear auto-cast vector. VECTOR_CLEAR(sd->channels); VECTOR_CLEAR(sd->script_queues); VECTOR_CLEAR(sd->achievement); // Achievement [Smokexyz/Hercules] -- cgit v1.2.3-60-g2f50