Quest
Description
Quest.h provides quest functionality, including the master list of quests and methods for the player to access them.
Macros
#define QUEST_LIMIT 5
#define TOTAL_QUESTS 1
- QUEST_LIMIT: Total number of quests a QuestHandler can handle.
- TOTAL_QUESTS: Total number of quests in the game.
class Quest
public:
char *title,*desc;
unsigned int xp;
Quest();
Quest(const char *t,const char *d,unsigned int x);
~Quest();
- char *title: Points to a string containing the quest's title.
- char *desc: Points to a string containing a description of the quest.
- unsigned int xp: Contains the amount of XP rewarded upon quest completion.
- Quest(): Initializes a blank quest.
- Quest(const char *t,const char *d,unsigned int x): Creates a quest with title t, description d, and a reward of x XP.
- ~Quest(): Frees memory previously used by the quest.
class QuestHandler
private:
unsigned char ccnt;
Quest *current[QUEST_LIMIT];
public:
QuestHandler();
int assign(const char *t);
int drop(const char *t);
int finish(const char *t);
- unsigned char ccnt: Contains an index to the next free slot in current[].
- Quest *current[]: Contains all current quests.
- QuestHandler(): Initializes a blank QuestHandler
- int assign(const char *t): Adds a quest with the name t to current[]. Returns -1 on error.
- int drop(const char *t): Drop a quest in current[] with the name t. Returns -1 on error.
- int finish(const char *t): Removes quest with name t from current[]. Returns quest's reward.