summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-18 16:27:49 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-18 16:27:49 +0300
commit88bf50a01e60e7647c4c6c9f194a95e766ad1e5a (patch)
treeb67f3b2a07d83015c7aa3f525a5b789c7475ad45 /src/map/script.c
parent9a2f6e96f54ed1c3931bc441ed31da51bf785fdb (diff)
parent9d498c60fffb8e0b3bcc77aac0fdff027276a4bb (diff)
downloadhercules-88bf50a01e60e7647c4c6c9f194a95e766ad1e5a.tar.gz
hercules-88bf50a01e60e7647c4c6c9f194a95e766ad1e5a.tar.bz2
hercules-88bf50a01e60e7647c4c6c9f194a95e766ad1e5a.tar.xz
hercules-88bf50a01e60e7647c4c6c9f194a95e766ad1e5a.zip
Merge pull request #597 from QQfoolsorellina/master
Follow up 98274e4 fix script command questactive warnings
Diffstat (limited to 'src/map/script.c')
-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;
}