From 6ec947a8fc5b4aeb6ee54948b9b1a9ced583f8ba Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Mon, 9 Apr 2012 16:24:03 +0200 Subject: Lua: Remove quest_type "type" field. --- src/bldg.c | 2 +- src/cmd4.c | 14 ++------------ src/loadsave.c | 5 ++++- src/plots.c | 5 ++++- src/quest.pkg | 6 ------ src/tables.c | 30 ------------------------------ src/types.h | 2 -- src/wizard2.c | 2 +- 8 files changed, 12 insertions(+), 54 deletions(-) diff --git a/src/bldg.c b/src/bldg.c index bf284a7a..e35cc023 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -869,7 +869,7 @@ static bool_ castle_quest(int y, int x) get_questinfo(plots[plot]); /* Add the hooks */ - if (quest[plots[plot]].type == HOOK_TYPE_C) quest[plots[plot]].init(plots[plot]); + quest[plots[plot]].init(plots[plot]); return (TRUE); } diff --git a/src/cmd4.c b/src/cmd4.c index af98b0ed..2bc7b7e8 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -4152,19 +4152,9 @@ static void do_cmd_knowledge_quests(void) /* Dynamic quests */ if (quest[i].dynamic_desc) { - /* C type quests */ - if (quest[i].type == HOOK_TYPE_C) + if (!quest[i].gen_desc(fff)) { - if (!quest[i].gen_desc(fff)) - { - continue; - } - } - /* MUST be a lua quest */ - else - { - hook_file = fff; - exec_lua(format("__quest_dynamic_desc[%d]()", i)); + continue; } } diff --git a/src/loadsave.c b/src/loadsave.c index 1787670b..eddac55b 100644 --- a/src/loadsave.c +++ b/src/loadsave.c @@ -2709,7 +2709,10 @@ static bool_ do_savefile_aux(int flag) } /* Init the hooks */ - if ((flag == LS_LOAD) && (quest[i].type == HOOK_TYPE_C)) quest[i].init(i); + if (flag == LS_LOAD) + { + quest[i].init(i); + } } /* Position in the wilderness */ diff --git a/src/plots.c b/src/plots.c index e16cbe2a..6015420a 100644 --- a/src/plots.c +++ b/src/plots.c @@ -42,7 +42,10 @@ void init_hooks() for (i = 0; i < MAX_Q_IDX; i++) { - if ((quest[i].type == HOOK_TYPE_C) && (quest[i].init != NULL)) quest[i].init(i); + if (quest[i].init != NULL) + { + quest[i].init(i); + } } } diff --git a/src/quest.pkg b/src/quest.pkg index f9b3fe7e..5021659e 100644 --- a/src/quest.pkg +++ b/src/quest.pkg @@ -106,12 +106,6 @@ struct quest_type * @note Dungeon level */ s16b level; - - /** @structvar type - * @brief Number - * @note Lua or C ? - */ - byte type; }; /** @var quest_aux; diff --git a/src/tables.c b/src/tables.c index 9b77d07b..a3470ede 100644 --- a/src/tables.c +++ b/src/tables.c @@ -3619,7 +3619,6 @@ quest_type quest[MAX_Q_IDX] = 0, NULL, - HOOK_TYPE_C, quest_null_hook, {0, 0}, NULL, @@ -3644,7 +3643,6 @@ quest_type quest[MAX_Q_IDX] = 70, &plots[PLOT_MAIN], - HOOK_TYPE_C, quest_necro_init_hook, {0, 0}, NULL, @@ -3669,7 +3667,6 @@ quest_type quest[MAX_Q_IDX] = 99, &plots[PLOT_MAIN], - HOOK_TYPE_C, quest_sauron_init_hook, {0, 0}, NULL, @@ -3694,7 +3691,6 @@ quest_type quest[MAX_Q_IDX] = 100, &plots[PLOT_MAIN], - HOOK_TYPE_C, quest_morgoth_init_hook, {0, 0}, NULL, @@ -3721,7 +3717,6 @@ quest_type quest[MAX_Q_IDX] = 5, &plots[PLOT_BREE], - HOOK_TYPE_C, quest_thieves_init_hook, {0, 0}, NULL, @@ -3747,7 +3742,6 @@ quest_type quest[MAX_Q_IDX] = 5, NULL, - HOOK_TYPE_C, quest_random_init_hook, {0, 0}, quest_random_describe, @@ -3773,7 +3767,6 @@ quest_type quest[MAX_Q_IDX] = 25, &plots[PLOT_OTHER], - HOOK_TYPE_C, quest_hobbit_init_hook, {0, 0}, NULL, @@ -3799,7 +3792,6 @@ quest_type quest[MAX_Q_IDX] = 40, &plots[PLOT_BREE], - HOOK_TYPE_C, quest_nazgul_init_hook, {0, 0}, NULL, @@ -3825,7 +3817,6 @@ quest_type quest[MAX_Q_IDX] = 30, &plots[PLOT_BREE], - HOOK_TYPE_C, quest_troll_init_hook, {FALSE, 0}, NULL, @@ -3851,7 +3842,6 @@ quest_type quest[MAX_Q_IDX] = 30, &plots[PLOT_BREE], - HOOK_TYPE_C, quest_wight_init_hook, {FALSE, 0}, NULL, @@ -3878,7 +3868,6 @@ quest_type quest[MAX_Q_IDX] = 25, &plots[PLOT_LORIEN], - HOOK_TYPE_C, quest_spider_init_hook, {0, 0}, NULL, @@ -3903,7 +3892,6 @@ quest_type quest[MAX_Q_IDX] = 30, &plots[PLOT_LORIEN], - HOOK_TYPE_C, quest_poison_init_hook, {0, 0}, NULL, @@ -3929,7 +3917,6 @@ quest_type quest[MAX_Q_IDX] = 20, &plots[PLOT_OTHER], - HOOK_TYPE_C, quest_narsil_init_hook, {0, 0}, NULL, @@ -3955,7 +3942,6 @@ quest_type quest[MAX_Q_IDX] = 30, &plots[PLOT_GONDOLIN], - HOOK_TYPE_C, quest_eol_init_hook, {0, 0}, NULL, @@ -3980,7 +3966,6 @@ quest_type quest[MAX_Q_IDX] = 37, &plots[PLOT_GONDOLIN], - HOOK_TYPE_C, quest_nirnaeth_init_hook, {0, 0}, NULL, @@ -4005,7 +3990,6 @@ quest_type quest[MAX_Q_IDX] = 80, &plots[PLOT_GONDOLIN], - HOOK_TYPE_C, quest_invasion_init_hook, {0, 0}, NULL, @@ -4031,7 +4015,6 @@ quest_type quest[MAX_Q_IDX] = 80, &plots[PLOT_MINAS], - HOOK_TYPE_C, quest_between_init_hook, {0, 0}, NULL, @@ -4056,7 +4039,6 @@ quest_type quest[MAX_Q_IDX] = 99, &plots[PLOT_MAIN], - HOOK_TYPE_C, quest_one_init_hook, {0, 0}, NULL, @@ -4082,7 +4064,6 @@ quest_type quest[MAX_Q_IDX] = 3, &plots[PLOT_OTHER], - HOOK_TYPE_C, quest_shroom_init_hook, {0, 0}, NULL, @@ -4108,7 +4089,6 @@ quest_type quest[MAX_Q_IDX] = 60, &plots[PLOT_OTHER], - HOOK_TYPE_C, quest_thrain_init_hook, {0, 0}, NULL, @@ -4135,7 +4115,6 @@ quest_type quest[MAX_Q_IDX] = 150, &plots[PLOT_MAIN], - HOOK_TYPE_C, quest_ultra_good_init_hook, {0, 0}, NULL, @@ -4160,7 +4139,6 @@ quest_type quest[MAX_Q_IDX] = 150, &plots[PLOT_MAIN], - HOOK_TYPE_C, quest_ultra_evil_init_hook, {0, 0}, NULL, @@ -4186,7 +4164,6 @@ quest_type quest[MAX_Q_IDX] = 15, &plots[PLOT_LORIEN], - HOOK_TYPE_C, quest_wolves_init_hook, {0, 0}, NULL, @@ -4212,7 +4189,6 @@ quest_type quest[MAX_Q_IDX] = 25, &plots[PLOT_GONDOLIN], - HOOK_TYPE_C, quest_dragons_init_hook, {0, 0}, NULL, @@ -4238,7 +4214,6 @@ quest_type quest[MAX_Q_IDX] = 45, &plots[PLOT_MINAS], - HOOK_TYPE_C, quest_haunted_init_hook, {0, 0}, NULL, @@ -4264,7 +4239,6 @@ quest_type quest[MAX_Q_IDX] = 60, &plots[PLOT_KHAZAD], - HOOK_TYPE_C, quest_evil_init_hook, {0, 0}, NULL, @@ -4280,7 +4254,6 @@ quest_type quest[MAX_Q_IDX] = QUEST_STATUS_UNTAKEN, -1, NULL, - HOOK_TYPE_C, quest_bounty_init_hook, {0, 0, 0, 0}, quest_bounty_describe, @@ -4296,7 +4269,6 @@ quest_type quest[MAX_Q_IDX] = QUEST_STATUS_UNTAKEN, 20, NULL, - HOOK_TYPE_C, quest_fireproof_init_hook, {0, 0, 0, 0}, quest_fireproof_describe, @@ -4312,7 +4284,6 @@ quest_type quest[MAX_Q_IDX] = QUEST_STATUS_UNTAKEN, 35, NULL, - HOOK_TYPE_C, quest_library_init_hook, { -1, -1, -1, -1 }, quest_library_describe, @@ -4328,7 +4299,6 @@ quest_type quest[MAX_Q_IDX] = QUEST_STATUS_UNTAKEN, -1, NULL, - HOOK_TYPE_C, quest_god_init_hook, { 0 /* quests_given */, 0 /* relics_found */, diff --git a/src/types.h b/src/types.h index 027ce678..c594f79b 100644 --- a/src/types.h +++ b/src/types.h @@ -2250,8 +2250,6 @@ struct quest_type s16b *plot; /* Which plot does it belongs to? */ - byte type; /* Lua or C ? */ - bool_ (*init)(int q); /* Function that takes care of generating hardcoded quests */ s32b data[9]; /* Various datas used by the quests */ diff --git a/src/wizard2.c b/src/wizard2.c index 6f691171..36efa148 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1799,7 +1799,7 @@ void do_cmd_debug(void) { quest[command_arg].status = QUEST_STATUS_TAKEN; *(quest[command_arg].plot) = command_arg; - if (quest[command_arg].type == HOOK_TYPE_C) quest[command_arg].init(command_arg); + quest[command_arg].init(command_arg); break; } break; -- cgit v1.2.3