diff --git a/changelog b/changelog index 753b6d3..dd09fea 100644 --- a/changelog +++ b/changelog @@ -35,6 +35,9 @@ export (QQ's a zone into a tarball)t Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) (lots of major bugfixes too) +[Dec 28 2008] - Rumble + Fixed bad usage of num_of_saving_throws and moved define to structs.h. (thanks Vatiken) + Added trigedit variables questdone and quest. (thanks Jamdog) [Dec 23 2008] - Rumble Fix for drink containers improperly showing empty due to unlimited container addition. (thanks Parnassus) Fix for qedit crash when trying to list non-existent next quest. (thanks Tails) diff --git a/src/db.c b/src/db.c index 185451c..9bafb97 100644 --- a/src/db.c +++ b/src/db.c @@ -1495,7 +1495,7 @@ static void parse_simple_mob(FILE *mob_f, int i, int nr) /* These are now save applies; base save numbers for MOBs are now from the * warrior save table. */ - for (j = 0; j < 5; j++) + for (j = 0; j < NUM_OF_SAVING_THROWS; j++) GET_SAVE(mob_proto + i, j) = 0; } diff --git a/src/dg_variables.c b/src/dg_variables.c index f6feee1..b0168bc 100644 --- a/src/dg_variables.c +++ b/src/dg_variables.c @@ -22,7 +22,7 @@ #include "spells.h" #include "oasis.h" #include "class.h" - +#include "quest.h" /* Utility functions */ @@ -859,6 +859,33 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, } snprintf(str, slen, "%d", GET_QUESTPOINTS(c)); } + else if (!str_cmp(field, "quest")) + { + if (IS_NPC(c)) + strcpy(str, "0"); + else { + if ((GET_QUEST(c) != NOTHING) && (real_quest(GET_QUEST(c)) == NOTHING)) + snprintf(str, slen, "%d", GET_QUEST(c)); + else + strcpy(str, "0"); + } + } + else if (!str_cmp(field, "questdone")) + { + if (IS_NPC(c)) + strcpy(str, "0"); + else { + if (subfield && *subfield) { + int q_num = atoi(subfield); + if (is_complete(c, q_num)) + strcpy(str, "1"); + else + strcpy(str, "0"); + } + else + strcpy(str, "0"); + } + } break; case 'r': if (!str_cmp(field, "room")) { /* in NOWHERE, return the void */ diff --git a/src/players.c b/src/players.c index ca4a094..a7f0b84 100644 --- a/src/players.c +++ b/src/players.c @@ -20,7 +20,6 @@ #include "interpreter.h" #include "genolc.h" /* for strip_cr */ #include "config.h" /* for pclean_criteria[] */ -#include "spells.h" /* for NUM_OF_SAVING_THROWS */ #include "dg_scripts.h" /* To enable saving of player variables to disk */ #include "quest.h" diff --git a/src/spells.h b/src/spells.h index 6c3674d..7a9d99f 100644 --- a/src/spells.h +++ b/src/spells.h @@ -149,8 +149,6 @@ #define SAVING_PETRI 2 #define SAVING_BREATH 3 #define SAVING_SPELL 4 -/* Equals the total number of SAVING_* defines */ -#define NUM_OF_SAVING_THROWS 5 #define TAR_IGNORE (1 << 0) #define TAR_CHAR_ROOM (1 << 1) diff --git a/src/structs.h b/src/structs.h index 5190386..992fa57 100644 --- a/src/structs.h +++ b/src/structs.h @@ -427,6 +427,9 @@ /** Total number of applies */ #define NUM_APPLIES 25 +/* Equals the total number of SAVING_* defines in spells.h */ +#define NUM_OF_SAVING_THROWS 5 + /* Container flags - value[1] */ #define CONT_CLOSEABLE (1 << 0) /**< Container can be closed */ #define CONT_PICKPROOF (1 << 1) /**< Container is pickproof */