summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAngelmelody <Angelmelody@gmail.com>2015-07-15 11:14:19 +0800
committerAngelmelody <Angelmelody@gmail.com>2015-07-15 11:15:11 +0800
commit9d498c60fffb8e0b3bcc77aac0fdff027276a4bb (patch)
tree1a7897f21c01c3341d8bacbc1ea38c9c1193a052 /src/map
parentebfc9c3f8d740414b13fff86bad44d077d7ae81e (diff)
downloadhercules-9d498c60fffb8e0b3bcc77aac0fdff027276a4bb.tar.gz
hercules-9d498c60fffb8e0b3bcc77aac0fdff027276a4bb.tar.bz2
hercules-9d498c60fffb8e0b3bcc77aac0fdff027276a4bb.tar.xz
hercules-9d498c60fffb8e0b3bcc77aac0fdff027276a4bb.zip
Follow up 98274e4 fix script command questactive warnings
Signed-off-by: Angelmelody <Angelmelody@gmail.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/map/script.c b/src/map/script.c
index f2fce3a8f..30af4d0f7 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -17177,18 +17177,27 @@ BUILDIN(changequest) {
BUILDIN(questactive) {
struct map_session_data *sd = script->rid2sd(st);
- int quest_progress = 0;
+ int qid, i;
- if (sd == NULL)
+ if (sd == NULL) {
+ ShowError("questactive: no player attached!");
return false;
+ }
+
+ qid = script_getnum(st, 2);
+
+ ARR_FIND(0, sd->avail_quests, i, sd->quest_log[i].quest_id == qid );
- if (quest->check(sd, script_getnum(st, 2), HAVEQUEST) == Q_ACTIVE)
+ if( i >= sd->avail_quests ) {
+ script_pushint(st, 0);
+ return true;
+ }
+
+ if(sd->quest_log[i].state == Q_ACTIVE)
script_pushint(st, 1);
else
script_pushint(st, 0);
- script_pushint(st, quest_progress);
-
return true;
}