From 1024fe8305e5b0a7bb1f660a1cee077172d84534 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 30 Nov 2016 17:54:13 -0500 Subject: quest system --- include/quest.hpp | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 include/quest.hpp (limited to 'include') diff --git a/include/quest.hpp b/include/quest.hpp new file mode 100644 index 0000000..cb43eca --- /dev/null +++ b/include/quest.hpp @@ -0,0 +1,72 @@ +/** + * @file quest.hpp + * Quest handling. + */ + +#ifndef QUEST_HPP_ +#define QUEST_HPP_ + +#include + +#include +#include + +/** + * The Quest structure. + * Contains information necessary for a quest. + */ +struct Quest +{ + Quest(std::string n = "", std::string d = "") + : name(n), desc(d) {} + + std::string name; /**< the quest's title */ + std::string desc; /**< the quest's description */ +}; + +/** + * @class QuestSystem + * The quest system, handles active quests. + */ +class QuestSystem : public entityx::System { +private: + /** + * A list of all quests that are currently active. + */ + std::vector current; + +public: + void update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt) override; + + /** + * Adds a quest to the current quest vector by its title. + * @param title the quest's title + * @param desc the quest's description + * @param req retrieved from XML, list of what the quest wants + * @return a possible error code + */ + int assign(std::string title, std::string desc, std::string req); + + /** + * Drops a quest through its title. + * @param title the quest's title + * @return a possible error code + */ + int drop(std::string title); + + /** + * Finishes a quest through it's title. + * @param title the quest's title + * @return a possible error code + */ + int finish(std::string title); + + /** + * Returns true if the system is currently taking the quest. + * @param title the quest's title + * @return if the quest is active. + */ + bool hasQuest(std::string title); +}; + +#endif // QUEST_HPP_ -- cgit v1.2.3