blob: d17ade4a36db57f7e6657b050361b0aababa3723 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/** @file Quest.h
* @brief The quest handling system.
*
* This file contains Quest and QuestHandler, used to manage quests inside the
* game.
*/
#ifndef QUEST_H
#define QUEST_H
#include <cstring>
#include <common.h>
#include <inventory.h>
/**
* When defined, DEBUG allows extra messages to be printed to the terminal for
* debugging purposes.
*/
#define DEBUG
/**
* The Quest class.
*
* This contains information for a single quest, and should only really be interacted
* with through QuestHandler.
*/
class Quest {
public:
/**
* Contains the title of the quest.
*/
char *title;
/**
* Contains the description of the quest.
*/
char *desc;
/**
* Contains the single item that's given as a reward upon quest completion.
*/
struct item_t reward;
/**
* Populates the values contained in this class.
*/
Quest(const char *t,const char *d,struct item_t r);
/**
* Frees memory allocated for the title and description text.
*/
~Quest();
};
/**
* The Quest Handler class.
*
* This class handles quests, including the assigning, dropping, and completing
* of the quests.
*/
class QuestHandler {
public:
/**
* A vector containing all quests currently being taken by the handler.
*/
std::vector<const Quest *>current;
/**
* Adds a quest to the current quest vector by its title.
*/
int assign(const char *t);
/**
* Drops a quest through its title.
*/
int drop(const char *t);
/**
* Finishes a quest through it's title, also giving a pointer to the Entity
* that gave the quest originally.
*/
int finish(const char *t,void *completer);
/**
* Returns true if this handler is currently taking the quest.
*/
bool hasQuest(const char *t);
};
#include <entities.h>
#endif // QUEST_H
|