Crossfire Server  1.75.0
quest.h
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2021 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #ifndef QUEST_H
14 #define QUEST_H
15 
16 #include "global.h"
17 #include <vector>
18 
21  sstring quest_code = nullptr;
22  int minstep = 0;
24  int maxstep = 0;
26 };
27 
30  int step = 0;
31  sstring step_description = nullptr;
33  std::vector<quest_condition *> conditions;
34 };
35 
38  sstring quest_code = nullptr;
39  sstring quest_title = nullptr;
40  sstring quest_description = nullptr;
41  sstring quest_comment = nullptr;
42  int quest_restart = 0;
43  const Face *face = nullptr;
44  uint32_t client_code = 0;
45  bool quest_is_system = false;
46  std::vector<quest_step_definition *> steps;
47  struct quest_definition *parent = nullptr;
48 };
49 
50 typedef void(*quest_op)(const quest_definition *, void *);
51 
52 void quest_for_each(quest_op op, void *user);
53 
59 
65 
66 quest_definition *quest_create(const char *name);
69 void quest_clear(quest_definition *quest);
70 void quest_destroy(quest_definition *quest);
71 
84 int quest_condition_from_string(quest_condition *condition, const char *buffer);
85 
92 void quest_write_condition(char *buf, size_t len, const quest_condition *condition);
93 
94 #endif /* QUEST_H */
int maxstep
The latest step that triggers the condition, to match, the stages must be between minstep and maxstep...
Definition: quest.h:24
Definition of an in-game quest.
Definition: quest.h:37
sstring quest_code
The quest that triggers the condition.
Definition: quest.h:21
std::vector< quest_step_definition * > steps
Quest steps.
Definition: quest.h:46
New face structure - this enforces the notion that data is face by face only - you can not change the...
Definition: face.h:14
One step of a quest.
Definition: quest.h:29
int quest_condition_from_string(quest_condition *condition, const char *buffer)
Parse a single step condition.
Definition: Quests.cpp:100
quest_step_definition * quest_create_step(void)
Allocate a quest_step_definition, will call fatal() if out of memory.
Definition: Quests.cpp:49
Global type definitions and header inclusions.
void quest_destroy_condition(quest_condition *condition)
Definition: Quests.cpp:69
One condition to automatically move to a quest step.
Definition: quest.h:20
void(* quest_op)(const quest_definition *, void *)
Definition: quest.h:50
void quest_clear(quest_definition *quest)
Definition: Quests.cpp:83
quest_condition * quest_create_condition(void)
Allocate a quest_condition, will call fatal() if out of memory.
Definition: Quests.cpp:56
std::vector< quest_condition * > conditions
The conditions that must be satisfied to trigger the step.
Definition: quest.h:33
void quest_write_condition(char *buf, size_t len, const quest_condition *condition)
Write a step condition to a buffer.
Definition: Quests.cpp:130
struct quest_definition * parent
Parent for this quest, NULL if it is a &#39;top-level&#39; quest.
Definition: quest.h:47
void quest_destroy_step(quest_step_definition *step)
Definition: Quests.cpp:74
quest_definition * quest_create(const char *name)
Definition: Quests.cpp:63
int minstep
The earliest step in the quest that triggers the condition, -1 means finished, 0 means not started...
Definition: quest.h:22
int is_completion_step
Whether this step completes the quest (1) or not (0)
Definition: quest.h:32
void quest_for_each(quest_op op, void *user)
Iterate over all quests.
Definition: assets.cpp:543
void quest_destroy(quest_definition *quest)
Definition: Quests.cpp:95
StringBuffer * buf
Definition: readable.cpp:1563
const char * sstring
Definition: sstring.h:2