summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-14 16:21:12 +0200
committerHaru <haru@dotalux.com>2015-11-14 21:13:54 +0100
commitd8edfe7eb9e7d86da24c87198f03432b73e72284 (patch)
tree5f297cb815897d1b73b790b7ffc19cd8d82a46f8 /src/map/script.c
parent1d064776214d3f962b9af585555cca686906665a (diff)
downloadhercules-d8edfe7eb9e7d86da24c87198f03432b73e72284.tar.gz
hercules-d8edfe7eb9e7d86da24c87198f03432b73e72284.tar.bz2
hercules-d8edfe7eb9e7d86da24c87198f03432b73e72284.tar.xz
hercules-d8edfe7eb9e7d86da24c87198f03432b73e72284.zip
Changed struct map_session_data::queues into a VECTOR and renamed to ::script_queues
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/map/script.c b/src/map/script.c
index bf477968c..cfc7ed052 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -18891,12 +18891,8 @@ bool script_hqueue_add(int idx, int var)
VECTOR_PUSH(queue->entries, var);
if (var >= START_ACCOUNT_NUM && (sd = map->id2sd(var)) != NULL) {
- ARR_FIND(0, sd->queues_count, i, sd->queues[i] == -1);
-
- if (i == sd->queues_count)
- RECREATE(sd->queues, int, ++sd->queues_count);
-
- sd->queues[i] = idx;
+ VECTOR_ENSURE(sd->script_queues, 1, 1);
+ VECTOR_PUSH(sd->script_queues, idx);
}
return true;
}
@@ -18952,10 +18948,10 @@ bool script_hqueue_remove(int idx, int var)
VECTOR_ERASE(queue->entries, i);
if (var >= START_ACCOUNT_NUM && (sd = map->id2sd(var)) != NULL) {
- ARR_FIND(0, sd->queues_count, i, sd->queues[i] == -1);
+ ARR_FIND(0, VECTOR_LENGTH(sd->script_queues), i, VECTOR_INDEX(sd->script_queues, i) == queue->id);
- if (i != sd->queues_count)
- sd->queues[i] = -1;
+ if (i != VECTOR_LENGTH(sd->script_queues))
+ VECTOR_ERASE(sd->script_queues, i);
}
return true;
}
@@ -19107,10 +19103,10 @@ bool script_hqueue_clear(int idx)
if (entry >= START_ACCOUNT_NUM && (sd = map->id2sd(entry)) != NULL) {
int i;
- ARR_FIND(0, sd->queues_count, i, sd->queues[i] == idx);
+ ARR_FIND(0, VECTOR_LENGTH(sd->script_queues), i, VECTOR_INDEX(sd->script_queues, i) == queue->id);
- if (i != sd->queues_count)
- sd->queues[i] = -1;
+ if (i != VECTOR_LENGTH(sd->script_queues))
+ VECTOR_ERASE(sd->script_queues, i);
}
}
VECTOR_CLEAR(queue->entries);