summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-04-21 07:06:12 +0200
committerKenpachi Developer <Kenpachi.Developer@gmx.de>2020-05-10 21:30:32 +0200
commit77d59bad5d27a528fb503e19807bfc07cf2077b1 (patch)
tree8f226e657467354483c0660d18dc2750f0b603de /src/map
parentc5edda900937eb3156391dc8c2f726f34a34dba2 (diff)
downloadhercules-77d59bad5d27a528fb503e19807bfc07cf2077b1.tar.gz
hercules-77d59bad5d27a528fb503e19807bfc07cf2077b1.tar.bz2
hercules-77d59bad5d27a528fb503e19807bfc07cf2077b1.tar.xz
hercules-77d59bad5d27a528fb503e19807bfc07cf2077b1.zip
Add pc_autocast_remove() function
Diffstat (limited to 'src/map')
-rw-r--r--src/map/pc.c23
-rw-r--r--src/map/pc.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 6985ecff8..9c1342836 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5383,6 +5383,28 @@ static void pc_autocast_set_current(struct map_session_data *sd, int skill_id)
}
}
+/**
+ * Removes a specific entry from a character's auto-cast vector.
+ *
+ * @param sd The character.
+ * @param type The entry's auto-cast type.
+ * @param skill_id The entry's skill ID.
+ * @param skill_lv The entry's skill level.
+ *
+ **/
+static void pc_autocast_remove(struct map_session_data *sd, enum autocast_type type, int skill_id, int skill_lv)
+{
+ nullpo_retv(sd);
+
+ for (int i = 0; i < VECTOR_LENGTH(sd->auto_cast); i++) {
+ if (VECTOR_INDEX(sd->auto_cast, i).type == type && VECTOR_INDEX(sd->auto_cast, i).skill_id == skill_id
+ && VECTOR_INDEX(sd->auto_cast, i).skill_lv == skill_lv) {
+ VECTOR_ERASE(sd->auto_cast, i);
+ break;
+ }
+ }
+}
+
/*==========================================
* Add item on cart for given index.
* Return:
@@ -12915,6 +12937,7 @@ void pc_defaults(void)
pc->useitem = pc_useitem;
pc->autocast_clear = pc_autocast_clear;
pc->autocast_set_current = pc_autocast_set_current;
+ pc->autocast_remove = pc_autocast_remove;
pc->skillatk_bonus = pc_skillatk_bonus;
pc->skillheal_bonus = pc_skillheal_bonus;
diff --git a/src/map/pc.h b/src/map/pc.h
index 010de1e9d..9012a67cb 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -1035,6 +1035,7 @@ END_ZEROED_BLOCK; /* End */
int (*useitem) (struct map_session_data *sd,int n);
int (*autocast_clear) (struct map_session_data *sd);
void (*autocast_set_current) (struct map_session_data *sd, int skill_id);
+ void (*autocast_remove) (struct map_session_data *sd, enum autocast_type type, int skill_id, int skill_lv);
int (*skillatk_bonus) (struct map_session_data *sd, uint16 skill_id);
int (*skillheal_bonus) (struct map_session_data *sd, uint16 skill_id);