aboutsummaryrefslogtreecommitdiffstats
path: root/src/Quest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Quest.cpp')
-rw-r--r--src/Quest.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Quest.cpp b/src/Quest.cpp
index 8f3c33b..781b164 100644
--- a/src/Quest.cpp
+++ b/src/Quest.cpp
@@ -1,14 +1,14 @@
#include <algorithm>
-#include <Quest.h>
-#include <entities.h>
+#include <Quest.hpp>
+#include <entities.hpp>
extern Player *player;
int QuestHandler::assign(std::string title,std::string desc,std::string req){
Quest tmp;
char *tok;
-
+
tmp.title = title;
tmp.desc = desc;
@@ -17,17 +17,17 @@ int QuestHandler::assign(std::string title,std::string desc,std::string req){
strcpy(buf.get(),req.c_str());
tok = strtok(buf.get(),"\n\r\t,");
tmp.need.push_back({"\0",0});
-
+
while(tok){
if(tmp.need.back().name != "\0"){
tmp.need.back().n = atoi(tok);
tmp.need.push_back({"\0",0});
}else
tmp.need.back().name = tok;
-
+
tok = strtok(NULL,"\n\r\t,");
}
-
+
tmp.need.pop_back();
current.push_back(tmp);
@@ -39,7 +39,7 @@ int QuestHandler::drop(std::string title){
current.end(),
[&](Quest q){ return q.title == title; }),
current.end() );
-
+
return 0;
}
@@ -50,15 +50,15 @@ int QuestHandler::finish(std::string t){
if ( player->inv->hasItem( n.name ) < n.n )
return 0;
}
-
+
for ( auto &n : (*c).need )
player->inv->takeItem( n.name, n.n );
-
+
current.erase( c );
return 1;
}
}
-
+
return 0;
}
@@ -67,6 +67,6 @@ bool QuestHandler::hasQuest(std::string t){
if ( c.title == t )
return true;
}
-
+
return false;
}