From 9d498c60fffb8e0b3bcc77aac0fdff027276a4bb Mon Sep 17 00:00:00 2001 From: Angelmelody Date: Wed, 15 Jul 2015 11:14:19 +0800 Subject: Follow up 98274e4 fix script command questactive warnings Signed-off-by: Angelmelody --- src/map/script.c | 19 ++++++++++++++----- 1 file 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; } -- cgit v1.2.3-70-g09d2