Skip to content

Commit

Permalink
Made prereq quests persist over boot
Browse files Browse the repository at this point in the history
  • Loading branch information
luciensadi committed Dec 6, 2023
1 parent df9ac0d commit 3d8caa8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2362,9 +2362,9 @@ void parse_quest(File &fl, long virtual_nr)
quest_table[quest_nr].vnum = virtual_nr;

fl.GetLine(line, 256, FALSE);
if (sscanf(line, "%ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld",
if (sscanf(line, "%ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld",
t, t + 1, t + 2, t + 3, t + 4, t + 5,
t + 6, t + 7, t + 8, t + 9, t + 10, t + 11, t+12, t+13, t+14, t+15, t+16) < 12) {
t + 6, t + 7, t + 8, t + 9, t + 10, t + 11, t+12, t+13, t+14, t+15, t+16, t+17) < 12) {
fprintf(stderr, "FATAL ERROR: Format error in quest #%ld, expecting 12-15 numbers like '# # # # # # # # # # # #'. Got '%s' instead.\n",
virtual_nr, line);
exit(ERROR_WORLD_BOOT_FORMAT_ERROR);
Expand All @@ -2387,6 +2387,8 @@ void parse_quest(File &fl, long virtual_nr)
int num_quit_emote = t[14];
int num_finish_emote = t[15];
int num_info_emotes = t[16];

quest_table[quest_nr].prerequisite_quest = t[17];

if (quest_table[quest_nr].num_objs > 0) {
quest_table[quest_nr].obj = new quest_om_data[quest_table[quest_nr].num_objs];
Expand Down
7 changes: 5 additions & 2 deletions src/quest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,7 @@ void boot_one_quest(struct quest_data *quest)
quest_table[quest_nr].nuyen = quest->nuyen;
quest_table[quest_nr].karma = quest->karma;
quest_table[quest_nr].reward = quest->reward;
quest_table[quest_nr].prerequisite_quest = quest->prerequisite_quest;

quest_table[quest_nr].num_objs = quest->num_objs;
if (quest_table[quest_nr].num_objs > 0)
Expand Down Expand Up @@ -2063,6 +2064,7 @@ void reboot_quest(int rnum, struct quest_data *quest)
quest_table[rnum].nuyen = quest->nuyen;
quest_table[rnum].karma = quest->karma;
quest_table[rnum].reward = quest->reward;
quest_table[rnum].prerequisite_quest = quest->prerequisite_quest;

if (quest_table[rnum].obj)
delete [] quest_table[rnum].obj;
Expand Down Expand Up @@ -2186,7 +2188,7 @@ int write_quests_to_disk(int zone) {
if ((i = real_quest(counter)) > -1) {
wrote_something = TRUE;
fprintf(fp, "#%ld\n", quest_table[i].vnum);
fprintf(fp, "%ld %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %ld\n", quest_table[i].johnson,
fprintf(fp, "%ld %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %ld %ld\n", quest_table[i].johnson,
quest_table[i].time, quest_table[i].min_rep,
quest_table[i].max_rep, quest_table[i].nuyen,
quest_table[i].karma, quest_table[i].reward,
Expand All @@ -2197,7 +2199,8 @@ int write_quests_to_disk(int zone) {
quest_table[i].decline_emote ? 1 : 0,
quest_table[i].quit_emote ? 1 : 0,
quest_table[i].finish_emote ? 1 : 0,
quest_table[i].info_emotes ? quest_table[i].info_emotes->size() : 0
quest_table[i].info_emotes ? quest_table[i].info_emotes->size() : 0,
quest_table[i].prerequisite_quest
);

for (j = 0; j < quest_table[i].num_objs; j++)
Expand Down

0 comments on commit 3d8caa8

Please sign in to comment.