summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorDastgir <dastgirpojee@rocketmail.com>2015-07-20 18:26:25 +0530
committerDastgir <dastgirpojee@rocketmail.com>2015-07-20 18:26:25 +0530
commit4cf80b1e5f29c7973576863e0c4eee809e561702 (patch)
tree46933e0bcff309b6457547fd8b56298281a9c338 /src/map/script.c
parenta7c771a064f5beb5c7f5f3c09a4ad744ac7c7ef5 (diff)
parent5aaf2707e25b8fa369bf37da1d51d0a0ee203473 (diff)
downloadhercules-4cf80b1e5f29c7973576863e0c4eee809e561702.tar.gz
hercules-4cf80b1e5f29c7973576863e0c4eee809e561702.tar.bz2
hercules-4cf80b1e5f29c7973576863e0c4eee809e561702.tar.xz
hercules-4cf80b1e5f29c7973576863e0c4eee809e561702.zip
Merge branch 'master' of https://github.com/HerculesWS/Hercules
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;
}