From 8deee144293102d4498424c38161d13c877250b2 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 30 Sep 2015 08:51:10 -0400 Subject: quest stuff --- src/Quest.cpp | 52 +++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) (limited to 'src/Quest.cpp') diff --git a/src/Quest.cpp b/src/Quest.cpp index a42e42c..c9175b1 100644 --- a/src/Quest.cpp +++ b/src/Quest.cpp @@ -4,58 +4,56 @@ const Quest QuestList[TOTAL_QUESTS]={ Quest("Test","A test quest",0) }; -Quest::Quest(const char *t,const char *d,unsigned int x){ +Quest::Quest(const char *t,const char *d,unsigned int r){ 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; + reward=r; } + Quest::~Quest(){ free(title); free(desc); - xp=0; + reward=0; } -QuestHandler::QuestHandler(){ - ccnt=0; -} int QuestHandler::assign(const char *t){ - unsigned int i=0; - if(ccnt==QUEST_LIMIT) - return -1; - for(;ititle,t)){ + return -2; + } + } + for(i=0;ititle,t)){ - for(i++;ititle,t)){ - j=current[i]->xp; - for(i++;ireward; + current.erase(current.begin()+i); + return r; } } return -1; -- cgit v1.2.3