From 60c7924097814686a2fb826b87fd7a3e1ff684de Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 8 Sep 2015 17:01:40 -0400 Subject: Added quests --- src/Quest.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/Quest.cpp (limited to 'src/Quest.cpp') diff --git a/src/Quest.cpp b/src/Quest.cpp new file mode 100644 index 0000000..52ab3a8 --- /dev/null +++ b/src/Quest.cpp @@ -0,0 +1,64 @@ +#include + +Quest QuestList[TOTAL_QUESTS]={ + Quest("Test","A test quest",0) +}; + +Quest::Quest(){ +} +Quest::Quest(const char *t,const char *d,unsigned int x){ + size_t len; + title=(char *)malloc((len=strlen(t))); + strncpy(title,t,len); + desc=(char *)malloc((len=strlen(d))); + strncpy(desc,d,len); + xp=x; +} +Quest::~Quest(){ + free(title); + free(desc); + xp=0; +} + +QuestHandler::QuestHandler(){ + ccnt=0; +} +int QuestHandler::assign(const char *t){ + unsigned int i=0; + if(ccnt==QUEST_LIMIT) + return -1; + for(;ititle,t)){ + for(i++;ititle,t)){ + j=current[i]->xp; + for(i++;i