aboutsummaryrefslogtreecommitdiffstats
path: root/src/Quest.cpp
blob: ac1802171a6c58e687fbf88ae82575138c387bad (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
#include <Quest.h>

#include <entities.h>

extern Player *player;

int QuestHandler::assign(const char *t){
	return strcmp(t,"h");
}

int QuestHandler::drop(const char *t){
	return strcmp(t,"h");
}

int QuestHandler::finish(std::string t){
	for(unsigned int i=0;i<current.size();i++){
		if(current[i].title == t){
			if(!player->inv->takeItem(current[i].need.back(),1)){
				current.erase(current.begin()+i);
				return 1;
			}else return 0;
		}
	}
	return 0;
}

bool QuestHandler::hasQuest(std::string t){
	for(unsigned int i=0;i<current.size();i++){
		if(current[i].title == t)
			return true;
	}
	return false;
}