aboutsummaryrefslogtreecommitdiffstats
path: root/doc/Quest.htm
blob: 0f2f8229c4c5ec8a275b2b4c0b06c627c882cc83 (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
<!DOCTYPE html>
<html>
<head>
	<title>Quest</title>
	<style>
	.code{
		background:#555;
		color:white;
		font-family:Consolas;
		font-size:12px;
		margin:auto 20px;
		padding:20px;
	}
	</style>
</head>
<body>
	<h1>Quest</h1>
	<hr>
	<h2>Description</h2>
	<p>Quest.h provides quest functionality, including the master list of quests and methods for the player to access them.</p>
	<br>
	<h3>Macros</h3>
	<div class="code">#define QUEST_LIMIT 5<br>
	#define TOTAL_QUESTS 1
	</div>
	<ul>
		<li><b>QUEST_LIMIT</b>: Total number of quests a QuestHandler can handle.</li>
		<li><b>TOTAL_QUESTS</b>: Total number of quests in the game.</li>
	</ul>
	<h3>class Quest</h3>
	<div class="code"><b>public:</b><br>
	char *title,*desc;<br>
	unsigned int xp;<br>
	Quest();<br>
	Quest(const char *t,const char *d,unsigned int x);<br>
	~Quest();
	</div>
	<ul>
		<li>char *<b>title</b>: Points to a string containing the quest's title.</li>
		<li>char *<b>desc</b>: Points to a string containing a description of the quest.</li>
		<li>unsigned int <b>xp</b>: Contains the amount of XP rewarded upon quest completion.</li>
		<li><b>Quest()</b>: Initializes a blank quest.</li>
		<li><b>Quest(const char *t,const char *d,unsigned int x)</b>: Creates a quest with title <i>t</i>, description <i>d</i>, and a reward of <i>x</i> XP.</li>
		<li><b>	~Quest()</b>: Frees memory previously used by the quest.</li>
	</ul>
	<h3>class QuestHandler</h3>
	<div class="code"><b>private:</b><br>
	unsigned char ccnt;<br>
	Quest *current[QUEST_LIMIT];<br>
<b>public:</b><br>
	QuestHandler();<br>
	int assign(const char *t);<br>
	int drop(const char *t);<br>
	int finish(const char *t);<br>
	</div>
	<ul>
		<li>unsigned char <b>ccnt</b>: Contains an index to the next free slot in current[].</li>
		<li>Quest *<b>current[]</b>: Contains all current quests.</li>
		<li><b>QuestHandler()</b>: Initializes a blank QuestHandler</li>
		<li>int <b>assign(const char *t)</b>: Adds a quest with the name <i>t</i> to current[]. Returns -1 on error.</li>
		<li>int <b>drop(const char *t)</b>: Drop a quest in current[] with the name <i>t</i>. Returns -1 on error.</li>
		<li>int <b>finish(const char *t)</b>: Removes quest with name <i>t</i> from current[]. Returns quest's reward.</li>
</body>
</html>